Page MenuHomePhabricator

D7333.id24756.diff
No OneTemporary

D7333.id24756.diff

diff --git a/keyserver/src/fetchers/thread-fetchers.js b/keyserver/src/fetchers/thread-fetchers.js
--- a/keyserver/src/fetchers/thread-fetchers.js
+++ b/keyserver/src/fetchers/thread-fetchers.js
@@ -38,7 +38,7 @@
const threadsQuery = SQL`
SELECT t.id, t.name, t.parent_thread_id, t.containing_thread_id,
t.community, t.depth, t.color, t.description, t.type, t.creation_time,
- t.source_message, t.replies_count, m.user, m.role, m.permissions,
+ t.source_message, t.replies_count, t.avatar, m.user, m.role, m.permissions,
m.subscription, m.last_read_message < m.last_message AS unread, m.sender
FROM threads t
LEFT JOIN memberships m ON m.thread = t.id AND m.role >= 0
@@ -75,6 +75,12 @@
roles: {},
repliesCount: threadsRow.replies_count,
};
+ if (threadsRow.avatar) {
+ threadInfos[threadID] = {
+ ...threadInfos[threadID],
+ avatar: JSON.parse(threadsRow.avatar),
+ };
+ }
}
const sourceMessageID = threadsRow.source_message?.toString();
if (sourceMessageID) {
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
@@ -803,6 +803,9 @@
if (sourceMessageID) {
rawThreadInfo = { ...rawThreadInfo, sourceMessageID };
}
+ if (serverThreadInfo.avatar) {
+ rawThreadInfo = { ...rawThreadInfo, avatar: serverThreadInfo.avatar };
+ }
if (includeVisibilityRules) {
return {
...rawThreadInfo,
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -2,7 +2,11 @@
import invariant from 'invariant';
-import type { ClientAvatar, UpdateUserAvatarRequest } from './avatar-types.js';
+import type {
+ AvatarDBContent,
+ ClientAvatar,
+ UpdateUserAvatarRequest,
+} from './avatar-types.js';
import type { Shape } from './core.js';
import type { CalendarQuery, RawEntryInfo } from './entry-types.js';
import type { Media } from './media-types.js';
@@ -264,6 +268,7 @@
+id: string,
+type: ThreadType,
+name: ?string,
+ +avatar?: AvatarDBContent,
+description: ?string,
+color: string, // hex, without "#" or "0x"
+creationTime: number, // millisecond timestamp

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 5:55 AM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610087
Default Alt Text
D7333.id24756.diff (2 KB)

Event Timeline