Skip to content

Commit eaf9ebb

Browse files
committed
fix: show pro badge for Msg search results that have pro
1 parent 98b4a46 commit eaf9ebb

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

ts/components/conversation/ContactName/ContactName.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function isBoldProfileNameCtx(ctx: ContactNameContext) {
3939
case 'quote-author':
4040
case 'conversation-list-item-search':
4141
case 'react-list-modal':
42-
case 'message-search-result':
42+
case 'message-search-result-conversation':
43+
case 'message-search-result-from':
4344
return false;
4445
default:
4546
assertUnreachable(ctx, 'isBoldProfileNameCtx');
@@ -70,7 +71,8 @@ function isShowPubkeyCtx(ctx: ContactNameContext, isBlinded: boolean) {
7071
case 'quoted-message-composition':
7172
case 'conversation-list-item-search':
7273
case 'react-list-modal':
73-
case 'message-search-result':
74+
case 'message-search-result-conversation':
75+
case 'message-search-result-from':
7476
return false;
7577
default:
7678
assertUnreachable(ctx, 'isShowPubkeyCtx');
@@ -89,12 +91,13 @@ function isShowNtsIsYouCtx(ctx: ContactNameContext) {
8991
case 'quote-author':
9092
case 'quoted-message-composition':
9193
case 'react-list-modal':
92-
case 'message-search-result':
9394
case 'member-list-item':
9495
case 'member-list-item-mention-row':
9596
case 'message-info-author':
97+
case 'message-search-result-from':
9698
return true;
9799
case 'contact-list-row':
100+
case 'message-search-result-conversation':
98101
case 'conversation-list-item':
99102
case 'conversation-list-item-search':
100103
return false;
@@ -120,7 +123,8 @@ function isForceSingleLineCtx(ctx: ContactNameContext) {
120123
case 'quote-author':
121124
case 'quoted-message-composition':
122125
case 'react-list-modal':
123-
case 'message-search-result':
126+
case 'message-search-result-conversation':
127+
case 'message-search-result-from':
124128
case 'conversation-list-item':
125129
case 'conversation-list-item-search':
126130
return false;
@@ -146,7 +150,8 @@ function isShowUPMOnClickCtx(ctx: ContactNameContext) {
146150
case 'quote-author':
147151
case 'quoted-message-composition':
148152
case 'react-list-modal':
149-
case 'message-search-result':
153+
case 'message-search-result-conversation':
154+
case 'message-search-result-from':
150155
case 'conversation-list-item':
151156
case 'conversation-list-item-search':
152157
return false;

ts/components/conversation/ContactName/ContactNameContext.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type ContactNameContext =
1212
| 'quote-author' // the author of the quoted message, shown in the message list
1313
| 'react-list-modal'
1414
| 'message-info-author' // the author of the message as shown in the message info (right panel)
15-
| 'message-search-result'
15+
| 'message-search-result-conversation' // the conversation name in the message search results
16+
| 'message-search-result-from' // the name of the sender in the message search results
1617
| 'contact-list-row' // the name in the list of contacts (after clicking the + from the left pane)
1718
| `member-list-item${ContactNameSuffixInMemberList}`;

ts/components/menuAndSettingsHooks/useProBadgeOnClickCb.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ const showNoCb: ShowTagNoCb = { show: true, cb: null };
7777
function isContactNameNoShowContext(context: ContactNameContext) {
7878
switch (context) {
7979
case 'react-list-modal':
80-
case 'message-search-result':
80+
case 'message-search-result-from': // no pro badge when showing the sender of a message in the search results
8181
case 'member-list-item-mention-row': // we don't want the pro badge when mentioning someone (from the composition box)
8282
return true;
8383
case 'contact-list-row':
84+
case 'message-search-result-conversation': // show the pro badge when showing the conversation name in the search results
8485
case 'quoted-message-composition':
8586
case 'message-info-author':
8687
case 'member-list-item':

ts/components/search/MessageSearchResults.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const FromName = (props: { source: string; conversationId: string }) => {
9292
<ContactName
9393
pubkey={conversationId}
9494
module="module-message-search-result__header__name"
95-
contactNameContext="message-search-result"
95+
contactNameContext="message-search-result-from"
9696
conversationId={conversationId}
9797
/>
9898
);
@@ -109,7 +109,7 @@ const ConversationHeader = (props: { source: string; conversationId: string }) =
109109
<StyledMessageResultsHeaderName>
110110
<ContactName
111111
pubkey={conversationId}
112-
contactNameContext="message-search-result"
112+
contactNameContext="message-search-result-conversation"
113113
conversationId={conversationId}
114114
/>
115115
</StyledMessageResultsHeaderName>

0 commit comments

Comments
 (0)