diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js --- a/lib/shared/avatar-utils.js +++ b/lib/shared/avatar-utils.js @@ -22,7 +22,6 @@ } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { UserInfos } from '../types/user-types.js'; -import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js'; import { useSelector } from '../utils/redux-utils.js'; const defaultAnonymousUserEmojiAvatar: ClientEmojiAvatar = { @@ -248,8 +247,10 @@ function getDefaultAvatar(hashKey: string, color?: string): ClientEmojiAvatar { let key = hashKey; - if (key.startsWith(`${authoritativeKeyserverID()}|`)) { - key = key.slice(`${authoritativeKeyserverID()}|`.length); + + const barPosition = key.indexOf('|'); + if (barPosition !== -1) { + key = key.slice(barPosition + 1); } const avatarIndex = stringHash(key) % defaultEmojiAvatars.length; diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -27,6 +27,7 @@ import ashoat from '../facts/ashoat.js'; import genesis from '../facts/genesis.js'; import { useLoggedInUserInfo } from '../hooks/account-hooks.js'; +import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; import { hasPermission, permissionsToBitmaskHex, @@ -237,14 +238,16 @@ ); } -function threadMembersWithoutAddedAshoat< +function threadMembersWithoutAddedAdmin< T: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, >(threadInfo: T): $PropertyType { if (threadInfo.community !== genesis().id) { return threadInfo.members; } + const adminID = extractKeyserverIDFromID(threadInfo.id); + return threadInfo.members.filter( - member => member.id !== ashoat.id || member.role, + member => member.id !== adminID || member.role, ); } @@ -255,7 +258,7 @@ function threadOrParentThreadIsGroupChat( threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ) { - return threadMembersWithoutAddedAshoat(threadInfo).length > 2; + return threadMembersWithoutAddedAdmin(threadInfo).length > 2; } function threadIsPending(threadID: ?string): boolean { @@ -1111,7 +1114,7 @@ threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ) { return ( - threadMembersWithoutAddedAshoat(threadInfo).filter(member => + threadMembersWithoutAddedAdmin(threadInfo).filter(member => memberHasAdminPowers(member), ).length > 0 ); @@ -1875,7 +1878,7 @@ useThreadListSearch, removeMemberFromThread, getAvailableThreadMemberActions, - threadMembersWithoutAddedAshoat, + threadMembersWithoutAddedAdmin, patchThreadInfoToIncludeMentionedMembersOfParent, threadInfoInsideCommunity, useRoleMemberCountsForCommunity,