Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/meteor/app/mentions/server/Mentions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MentionsServer extends MentionsParser {
const userMentions = [];

for await (const m of mentions) {
const mention = m.trim().substr(1);
const mention = m.includes(':') ? m.trim() : m.trim().substring(1);
if (mention !== 'all' && mention !== 'here') {
userMentions.push(mention);
continue;
Expand All @@ -79,7 +79,7 @@ export class MentionsServer extends MentionsParser {
isE2EEMessage(message) && e2eMentions?.e2eChannelMentions && e2eMentions?.e2eChannelMentions.length > 0
? e2eMentions?.e2eChannelMentions
: this.getChannelMentions(msg);
return this.getChannels(channels.map((c) => c.trim().substr(1)));
return this.getChannels(channels.map((c) => c.trim().substring(1)));
}

async execute(message: IMessage) {
Expand Down
7 changes: 6 additions & 1 deletion apps/meteor/client/components/GazzodownText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ const GazzodownText = ({ mentions, channels, searchText, children }: GazzodownTe
return undefined;
}

const filterUser = ({ username, type }: UserMention) => (!type || type === 'user') && username === mention;
const normalizedMention = mention.startsWith('@') ? mention.substring(1) : mention;
const filterUser = ({ username, type }: UserMention) => {
if (!username || type === 'team') return false;
const normalizedUsername = username.startsWith('@') ? username.substring(1) : username;
return normalizedUsername === normalizedMention;
};
const filterTeam = ({ name, type }: UserMention) => type === 'team' && name === mention;

return mentions?.find((mention) => filterUser(mention) || filterTeam(mention));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const ComposerPopupProvider = ({ children, room }: ComposerPopupProviderProps) =
};
});
},
getValue: (item) => item.username,
getValue: (item) => (item.username.startsWith('@') ? item.username.substring(1) : item.username),
renderItem: ({ item }) => <ComposerBoxPopupUser {...item} />,
}),
createMessageBoxPopupConfig<ComposerBoxPopupRoomProps>({
Expand Down
Loading