fix: fill missing userId when open tip modal, close #2248
This commit is contained in:
@@ -117,7 +117,9 @@ export const useEntryActions = ({ entryId, view }: { entryId: string; view?: Fee
|
||||
},
|
||||
{
|
||||
id: COMMAND_ID.entry.tip,
|
||||
onClick: runCmdFn(COMMAND_ID.entry.tip, [{ entryId, feedId: feed?.id }]),
|
||||
onClick: runCmdFn(COMMAND_ID.entry.tip, [
|
||||
{ entryId, feedId: feed?.id, userId: feed?.ownerUserId },
|
||||
]),
|
||||
hide: isInbox || feed?.ownerUserId === whoami()?.id,
|
||||
shortcut: shortcuts.entry.tip.key,
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { COMMAND_ID } from "./id"
|
||||
|
||||
export type TipCommand = Command<{
|
||||
id: typeof COMMAND_ID.entry.tip
|
||||
fn: (data: { userId?: string; feedId?: string; entryId?: string }) => void
|
||||
fn: (data: { userId?: string | null; feedId?: string; entryId?: string }) => void
|
||||
}>
|
||||
|
||||
export type StarCommand = Command<{
|
||||
|
||||
@@ -10,7 +10,15 @@ export const useTipModal = () => {
|
||||
const { present } = useModalStack()
|
||||
const { t } = useTranslation()
|
||||
return useCallback(
|
||||
({ userId, feedId, entryId }: { userId?: string; feedId?: string; entryId?: string }) => {
|
||||
({
|
||||
userId,
|
||||
feedId,
|
||||
entryId,
|
||||
}: {
|
||||
userId?: string | null
|
||||
feedId?: string
|
||||
entryId?: string
|
||||
}) => {
|
||||
if (!feedId || !entryId) {
|
||||
// this should not happen unless there is a bug in the code
|
||||
toast.error("Invalid feed id or entry id")
|
||||
|
||||
@@ -31,7 +31,7 @@ const Loading = () => (
|
||||
)
|
||||
|
||||
export const TipModalContent: FC<{
|
||||
userId?: string
|
||||
userId?: string | null
|
||||
feedId: string
|
||||
entryId: string
|
||||
}> = (props) => {
|
||||
@@ -43,7 +43,7 @@ export const TipModalContent: FC<{
|
||||
return <TipModalContent_ {...props} />
|
||||
}
|
||||
const TipModalContent_: FC<{
|
||||
userId?: string
|
||||
userId?: string | null
|
||||
feedId: string
|
||||
entryId: string
|
||||
}> = ({ userId, feedId, entryId }) => {
|
||||
|
||||
Reference in New Issue
Block a user