fix duplicate mentions and spurious "user is not mentioned" warnings when replying to a DM thread including a user with a capitalized username

This commit is contained in:
Hazelnoot 2025-05-04 10:21:16 -04:00
parent a4c7f3affd
commit df0d8045d5

View file

@ -412,7 +412,7 @@ function checkMissingMention() {
const ast = mfm.parse(text.value);
for (const x of extractMentions(ast)) {
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
if (!visibleUsers.value.some(u => (u.username.toLowerCase() === x.username.toLowerCase()) && (u.host === x.host))) {
hasNotSpecifiedMentions.value = true;
return;
}
@ -425,7 +425,7 @@ function addMissingMention() {
const ast = mfm.parse(text.value);
for (const x of extractMentions(ast)) {
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
if (!visibleUsers.value.some(u => (u.username.toLowerCase() === x.username.toLowerCase()) && (u.host === x.host))) {
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
pushVisibleUser(user);
});
@ -641,7 +641,7 @@ function showOtherSettings() {
//#endregion
function pushVisibleUser(user: Misskey.entities.UserDetailed) {
if (!visibleUsers.value.some(u => u.username === user.username && u.host === user.host)) {
if (!visibleUsers.value.some(u => u.username.toLowerCase() === user.username.toLowerCase() && u.host === user.host)) {
visibleUsers.value.push(user);
}
}