Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3516411
D13413.id44378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13413.id44378.diff
View Options
diff --git a/lib/shared/dm-ops/change-thread-settings-spec.js b/lib/shared/dm-ops/change-thread-settings-spec.js
--- a/lib/shared/dm-ops/change-thread-settings-spec.js
+++ b/lib/shared/dm-ops/change-thread-settings-spec.js
@@ -8,6 +8,7 @@
ProcessDMOperationUtilities,
} from './dm-op-spec.js';
import type {
+ DMBlobOperation,
DMChangeThreadSettingsOperation,
DMThreadSettingsChanges,
} from '../../types/dm-ops.js';
@@ -20,6 +21,7 @@
} from '../../types/minimally-encoded-thread-permissions-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type { ClientUpdateInfo } from '../../types/update-types.js';
+import { blobHashFromBlobServiceURI } from '../../utils/blob-service.js';
import { values } from '../../utils/objects.js';
import { rawMessageInfoFromMessageData } from '../message-utils.js';
@@ -92,6 +94,32 @@
return { fieldNameToMessageData, threadInfoUpdate };
}
+function getBlobOpsFromOperation(
+ dmOperation: DMChangeThreadSettingsOperation,
+ threadInfo: ?RawThreadInfo,
+): Array<DMBlobOperation> {
+ const ops: Array<DMBlobOperation> = [];
+
+ const prevAvatar = threadInfo?.avatar;
+ if (prevAvatar && prevAvatar.type === 'encrypted_image') {
+ ops.push({
+ type: 'remove_holder',
+ blobHash: blobHashFromBlobServiceURI(prevAvatar.blobURI),
+ dmOpType: 'inbound_and_outbound',
+ });
+ }
+
+ const { avatar } = dmOperation.changes;
+ if (avatar && avatar?.type === 'encrypted_image') {
+ ops.push({
+ type: 'establish_holder',
+ blobHash: blobHashFromBlobServiceURI(avatar.blobURI),
+ dmOpType: 'inbound_only',
+ });
+ }
+ return ops;
+}
+
const changeThreadSettingsSpec: DMOperationSpec<DMChangeThreadSettingsOperation> =
Object.freeze({
notificationsCreationData: async (
@@ -119,6 +147,8 @@
const { fieldNameToMessageData, threadInfoUpdate } =
createChangeSettingsMessageDatasAndUpdate(dmOperation);
+ const blobOps = getBlobOpsFromOperation(dmOperation, threadInfo);
+
const fieldNameToMessageDataPairs = Object.entries(
fieldNameToMessageData,
);
@@ -159,7 +189,7 @@
return {
rawMessageInfos,
updateInfos,
- blobOps: [],
+ blobOps,
};
},
canBeProcessed: async (
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 2:23 PM (18 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2694870
Default Alt Text
D13413.id44378.diff (2 KB)
Attached To
Mode
D13413: [lib] Create holder ops for thick thread avatars
Attached
Detach File
Event Timeline
Log In to Comment