Page MenuHomePhabricator

D10270.id34602.diff
No OneTemporary

D10270.id34602.diff

diff --git a/lib/shared/updates/delete-account-spec.js b/lib/shared/updates/delete-account-spec.js
--- a/lib/shared/updates/delete-account-spec.js
+++ b/lib/shared/updates/delete-account-spec.js
@@ -3,7 +3,7 @@
import t from 'tcomb';
import type { UpdateSpec } from './update-spec.js';
-import type { LegacyRawThreadInfos } from '../../types/thread-types.js';
+import type { RawThreadInfos } from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type {
AccountDeletionRawUpdateInfo,
@@ -19,27 +19,47 @@
AccountDeletionUpdateData,
> = Object.freeze({
generateOpsForThreadUpdates(
- storeThreadInfos: LegacyRawThreadInfos,
+ storeThreadInfos: RawThreadInfos,
update: AccountDeletionUpdateInfo,
) {
const operations = [];
for (const threadID in storeThreadInfos) {
const threadInfo = storeThreadInfos[threadID];
- const newMembers = threadInfo.members.filter(
- member => member.id !== update.deletedUserID,
- );
- if (newMembers.length < threadInfo.members.length) {
- const updatedThread = {
- ...threadInfo,
- members: newMembers,
- };
- operations.push({
- type: 'replace',
- payload: {
- id: threadID,
- threadInfo: updatedThread,
- },
- });
+ // TODO (atul): Try to get rid of this ridiculous branching.
+ if (threadInfo.minimallyEncoded) {
+ const newMembers = threadInfo.members.filter(
+ member => member.id !== update.deletedUserID,
+ );
+ if (newMembers.length < threadInfo.members.length) {
+ const updatedThread = {
+ ...threadInfo,
+ members: newMembers,
+ };
+ operations.push({
+ type: 'replace',
+ payload: {
+ id: threadID,
+ threadInfo: updatedThread,
+ },
+ });
+ }
+ } else {
+ const newMembers = threadInfo.members.filter(
+ member => member.id !== update.deletedUserID,
+ );
+ if (newMembers.length < threadInfo.members.length) {
+ const updatedThread = {
+ ...threadInfo,
+ members: newMembers,
+ };
+ operations.push({
+ type: 'replace',
+ payload: {
+ id: threadID,
+ threadInfo: updatedThread,
+ },
+ });
+ }
}
}
return operations;

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 9:56 PM (21 h, 51 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431820
Default Alt Text
D10270.id34602.diff (2 KB)

Event Timeline