Skip to content

Commit

Permalink
[lib] Allow reacting and creating sidebars from failed messages in th…
Browse files Browse the repository at this point in the history
…ick threads

Summary: https://linear.app/comm/issue/ENG-9313/consider-allowing-creating-sidebars-from-messages-that-failed#comment-dc22d82f

Test Plan: Checked on native and web if the actions are present for failed messages in thick threads and aren't present for failed messages in thin threads.

Reviewers: kamil, will

Reviewed By: will

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D13362
  • Loading branch information
palys-swm committed Sep 18, 2024
1 parent d052eab commit a80f96b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/shared/reaction-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
} from '../types/message-types.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { threadTypeIsThick } from '../types/thread-types-enum.js';
import { useSelector } from '../utils/redux-utils.js';

function useViewerAlreadySelectedMessageReactions(
Expand Down Expand Up @@ -92,8 +93,9 @@ function useCanCreateReactionFromMessage(
}

if (
!targetMessageInfo.id ||
threadInfo.sourceMessageID === targetMessageInfo.id
(!targetMessageInfo.id && !threadTypeIsThick(threadInfo.type)) ||
(threadInfo.sourceMessageID &&
threadInfo.sourceMessageID === targetMessageInfo.id)
) {
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/shared/sidebar-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ function useCanCreateSidebarFromMessage(
}

if (
!messageInfo.id ||
threadInfo.sourceMessageID === messageInfo.id ||
(!messageInfo.id && !threadTypeIsThick(threadInfo.type)) ||
(threadInfo.sourceMessageID &&
threadInfo.sourceMessageID === messageInfo.id) ||
isInvalidSidebarSource(messageInfo)
) {
return false;
Expand Down

0 comments on commit a80f96b

Please sign in to comment.