Page MenuHomePhabricator

D11146.id37502.diff
No OneTemporary

D11146.id37502.diff

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<T, 'members'> {
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,

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 2:04 AM (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2701350
Default Alt Text
D11146.id37502.diff (2 KB)

Event Timeline