Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3157150
D10270.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
D10270.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 7:27 PM (21 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431820
Default Alt Text
D10270.diff (2 KB)
Attached To
Mode
D10270: [lib] Add ridiculous branching to `delete-account-spec` to appease `flow`
Attached
Detach File
Event Timeline
Log In to Comment