author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
129,184
09.08.2021 13:46:39
14,400
b520e6b24712c953d51bd1ef6c9c093de7aff4ab
[lib] Fix `LocallyComposedMessageInfo` type Summary: fixes flow error in D1872 Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "@@ -265,11 +265,19 @@ export type RawMessageInfo =\n| RawRobotextMessageInfo\n| RawSidebarSourceMessageInfo;\n-export type LocallyComposedMessageInfo = {\n+export type LocallyComposedMessageInfo =\n+ | ({\n+ ...RawImagesMessageInfo,\n+localID: string,\n- +threadID: string,\n- ...\n-};\n+ } & RawImagesMessageInfo)\n+ | ({\n+ ...RawMediaMessageInfo,\n+ +localID: string,\n+ } & RawMediaMessageInfo)\n+ | ({\n+ ...RawTextMessageInfo,\n+ +localID: string,\n+ } & RawTextMessageInfo);\nexport type MultimediaMessageInfo = ImagesMessageInfo | MediaMessageInfo;\nexport type ComposableMessageInfo = TextMessageInfo | MultimediaMessageInfo;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Fix `LocallyComposedMessageInfo` type Summary: fixes flow error in D1872 Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1871
129,184
09.08.2021 13:50:56
14,400
de166b3b3e04501e0c0bae3829083b833450d630
[lib] Introduce `messageStoreOperations` for `createLocalMessageActionType` action in `reduceMessageStore` Summary: na Test Plan: invariant Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -69,8 +69,6 @@ import {\ntype MessageStoreOperation,\ntype MessageTruncationStatus,\ntype ThreadMessageInfo,\n- type LocallyComposedMessageInfo,\n- type RawMultimediaMessageInfo,\ntype MessageTruncationStatuses,\nmessageTruncationStatus,\nmessageTypes,\n@@ -78,7 +76,6 @@ import {\n} from '../types/message-types';\nimport type { RawImagesMessageInfo } from '../types/messages/images';\nimport type { RawMediaMessageInfo } from '../types/messages/media';\n-import type { RawTextMessageInfo } from '../types/messages/text';\nimport { type BaseAction, rehydrateActionType } from '../types/redux-types';\nimport { processServerRequestsActionType } from '../types/request-types';\nimport {\n@@ -614,9 +611,10 @@ function filterByNewThreadInfos(\n};\n}\n-function ensureRealizedThreadIDIsUsedWhenPossible<\n- T: RawTextMessageInfo | RawMultimediaMessageInfo | LocallyComposedMessageInfo,\n->(payload: T, threadInfos: { +[id: string]: RawThreadInfo }): T {\n+function ensureRealizedThreadIDIsUsedWhenPossible<T: RawMessageInfo>(\n+ payload: T,\n+ threadInfos: { +[id: string]: RawThreadInfo },\n+): T {\nconst pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(\nthreadInfos,\n);\n@@ -1190,7 +1188,8 @@ function reduceMessageStore(\nlastNavigatedTo: now,\nlastPruned: now,\n};\n- return {\n+\n+ const updatedMessageStore = {\n...messageStore,\nmessages: {\n...messageStore.messages,\n@@ -1201,6 +1200,26 @@ function reduceMessageStore(\n[threadID]: threadState,\n},\n};\n+ const messageStoreOperations = [\n+ {\n+ type: 'replace',\n+ payload: { id: localID, messageInfo },\n+ },\n+ ];\n+\n+ const processedMessageStore = processMessageStoreOperations(\n+ messageStore,\n+ messageStoreOperations,\n+ );\n+\n+ invariant(\n+ !isDev ||\n+ _isEqual(updatedMessageStore.messages)(processedMessageStore.messages),\n+ 'processedMessageStore.messages should be equal to' +\n+ ' updatedMessageStore.messages',\n+ );\n+\n+ return updatedMessageStore;\n} else if (action.type === rehydrateActionType) {\n// When starting the app on native, we filter out any local-only multimedia\n// messages because the relevant context is no longer available\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `messageStoreOperations` for `createLocalMessageActionType` action in `reduceMessageStore` Summary: na Test Plan: invariant Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1872
129,184
09.08.2021 15:53:01
14,400
e28f04091b9135f5cc458f1e5de38ea5eae31e18
[lib] Introduce `messageStoreOperation` for `updateMultimediaMessageMediaActionType` in `reduceMessageStore` Summary: last action type to be handled in `reduceMessageStore` Test Plan: invariant Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -61,6 +61,7 @@ import {\n} from '../shared/thread-utils';\nimport threadWatcher from '../shared/thread-watcher';\nimport { unshimMessageInfos } from '../shared/unshim-utils';\n+import type { Media, Image } from '../types/media-types';\nimport {\ntype RawMessageInfo,\ntype LocalMessageInfo,\n@@ -1133,40 +1134,81 @@ function reduceMessageStore(\n`message with ID ${id} is not multimedia`,\n);\n+ let updatedMessage;\nlet replaced = false;\n- const media = [];\n+ if (message.type === messageTypes.IMAGES) {\n+ const media: Image[] = [];\nfor (const singleMedia of message.media) {\nif (singleMedia.id !== currentMediaID) {\nmedia.push(singleMedia);\n- } else if (singleMedia.type === 'photo') {\n+ } else {\n+ invariant(\n+ mediaUpdate.type === 'photo',\n+ 'mediaUpdate should be of type photo',\n+ );\n+ media.push({ ...singleMedia, ...mediaUpdate });\nreplaced = true;\n- media.push({\n- ...singleMedia,\n- ...mediaUpdate,\n- });\n- } else if (singleMedia.type === 'video') {\n+ }\n+ }\n+ updatedMessage = { ...message, media };\n+ } else {\n+ const media: Media[] = [];\n+ for (const singleMedia of message.media) {\n+ if (singleMedia.id !== currentMediaID) {\n+ media.push(singleMedia);\n+ } else if (\n+ singleMedia.type === 'photo' &&\n+ mediaUpdate.type === 'photo'\n+ ) {\n+ media.push({ ...singleMedia, ...mediaUpdate });\nreplaced = true;\n- media.push({\n- ...singleMedia,\n- ...mediaUpdate,\n- });\n+ } else if (\n+ singleMedia.type === 'video' &&\n+ mediaUpdate.type === 'video'\n+ ) {\n+ media.push({ ...singleMedia, ...mediaUpdate });\n+ replaced = true;\n+ }\n}\n+ updatedMessage = { ...message, media };\n}\n+\ninvariant(\nreplaced,\n`message ${id} did not contain media with ID ${currentMediaID}`,\n);\n- return {\n+ const updatedMessageStore = {\n...messageStore,\nmessages: {\n...messageStore.messages,\n- [id]: {\n- ...message,\n- media,\n- },\n+ [id]: updatedMessage,\n},\n};\n+\n+ const messageStoreOperations = [\n+ {\n+ type: 'replace',\n+ payload: {\n+ id,\n+ messageInfo: updatedMessage,\n+ },\n+ },\n+ ];\n+\n+ const processedMessageStore = processMessageStoreOperations(\n+ messageStore,\n+ messageStoreOperations,\n+ );\n+\n+ invariant(\n+ !isDev ||\n+ _isEqual(processedMessageStore.messages)(updatedMessageStore.messages),\n+ 'processedMessageStore.messages should be equal to' +\n+ ' updatedMessageStore.messages',\n+ );\n+\n+ return updatedMessageStore;\n} else if (action.type === createLocalMessageActionType) {\nconst messageInfo = ensureRealizedThreadIDIsUsedWhenPossible(\naction.payload,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `messageStoreOperation` for `updateMultimediaMessageMediaActionType` in `reduceMessageStore` Summary: last action type to be handled in `reduceMessageStore` Test Plan: invariant Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1874
129,184
09.08.2021 18:06:30
14,400
d0bec2f16beac5d627ad179be0b82c8dc821c0ff
[lib] Modify `reduceMessageStore` return type to include `messageStoreOperations` Summary: have reduceMessageStore return list of messageStoreOperations Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/master-reducer.js", "new_path": "lib/reducers/master-reducer.js", "diff": "@@ -45,7 +45,7 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\n];\n// Only allow checkpoints to increase if we are connected\n// or if the action is a STATE_SYNC\n- let messageStore = reduceMessageStore(\n+ let { messageStore } = reduceMessageStore(\nstate.messageStore,\naction,\nthreadInfos,\n" }, { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -646,11 +646,15 @@ function processMessageStoreOperations(\nreturn { ...messageStore, messages: processedMessages };\n}\n+type ReduceMessageStoreResult = {\n+ +messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,\n+ +messageStore: MessageStore,\n+};\nfunction reduceMessageStore(\nmessageStore: MessageStore,\naction: BaseAction,\nnewThreadInfos: { +[id: string]: RawThreadInfo },\n-): MessageStore {\n+): ReduceMessageStoreResult {\nif (action.type === logInActionTypes.success) {\nconst messagesResult = action.payload.messagesResult;\nconst {\n@@ -673,13 +677,13 @@ function reduceMessageStore(\n'messageStore.messages should be equal to processedMessageStore.messages',\n);\n- return freshStore;\n+ return { messageStoreOperations, messageStore: freshStore };\n} else if (action.type === incrementalStateSyncActionType) {\nif (\naction.payload.messagesResult.rawMessageInfos.length === 0 &&\naction.payload.updatesResult.newUpdates.length === 0\n) {\n- return messageStore;\n+ return { messageStoreOperations: [], messageStore };\n}\nconst messagesResult = mergeUpdatesWithMessageInfos(\n@@ -688,17 +692,20 @@ function reduceMessageStore(\naction.payload.messagesResult.truncationStatuses,\n);\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\nmessagesResult.rawMessageInfos,\nmessagesResult.truncationStatuses,\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (action.type === processUpdatesActionType) {\nif (action.payload.updatesResult.newUpdates.length === 0) {\n- return messageStore;\n+ return { messageStoreOperations: [], messageStore };\n}\nconst messagesResult = mergeUpdatesWithMessageInfos(\n@@ -706,7 +713,10 @@ function reduceMessageStore(\naction.payload.updatesResult.newUpdates,\n);\n- const { messageStore: newMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: newMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\nmessagesResult.rawMessageInfos,\nmessagesResult.truncationStatuses,\n@@ -714,36 +724,45 @@ function reduceMessageStore(\naction.type,\n);\nreturn {\n+ messageStoreOperations,\n+ messageStore: {\nmessages: newMessageStore.messages,\nthreads: newMessageStore.threads,\nlocal: newMessageStore.local,\ncurrentAsOf: messageStore.currentAsOf,\n+ },\n};\n} else if (\naction.type === fullStateSyncActionType ||\naction.type === processMessagesActionType\n) {\nconst { messagesResult } = action.payload;\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\nmessagesResult.rawMessageInfos,\nmessagesResult.truncationStatuses,\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (\naction.type === fetchMessagesBeforeCursorActionTypes.success ||\naction.type === fetchMostRecentMessagesActionTypes.success\n) {\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.rawMessageInfos,\n{ [action.payload.threadID]: action.payload.truncationStatus },\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (\naction.type === logOutActionTypes.success ||\naction.type === deleteAccountActionTypes.success ||\n@@ -768,94 +787,115 @@ function reduceMessageStore(\n'to filteredMessageStore.messages',\n);\n- return filteredMessageStore;\n+ return { messageStoreOperations, messageStore: filteredMessageStore };\n} else if (action.type === newThreadActionTypes.success) {\nconst messagesResult = mergeUpdatesWithMessageInfos(\naction.payload.newMessageInfos,\naction.payload.updatesResult.newUpdates,\n);\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\nmessagesResult.rawMessageInfos,\nmessagesResult.truncationStatuses,\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (action.type === registerActionTypes.success) {\nconst truncationStatuses = {};\nfor (const messageInfo of action.payload.rawMessageInfos) {\ntruncationStatuses[messageInfo.threadID] =\nmessageTruncationStatus.EXHAUSTIVE;\n}\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.rawMessageInfos,\ntruncationStatuses,\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (\naction.type === changeThreadSettingsActionTypes.success ||\naction.type === removeUsersFromThreadActionTypes.success ||\naction.type === changeThreadMemberRolesActionTypes.success\n) {\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.newMessageInfos,\n{ [action.payload.threadID]: messageTruncationStatus.UNCHANGED },\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (\naction.type === createEntryActionTypes.success ||\naction.type === saveEntryActionTypes.success\n) {\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.newMessageInfos,\n{ [action.payload.threadID]: messageTruncationStatus.UNCHANGED },\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (action.type === deleteEntryActionTypes.success) {\nconst payload = action.payload;\nif (payload) {\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\npayload.newMessageInfos,\n{ [payload.threadID]: messageTruncationStatus.UNCHANGED },\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n}\n} else if (action.type === restoreEntryActionTypes.success) {\nconst { threadID } = action.payload;\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.newMessageInfos,\n{ [threadID]: messageTruncationStatus.UNCHANGED },\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (action.type === joinThreadActionTypes.success) {\nconst messagesResult = mergeUpdatesWithMessageInfos(\naction.payload.rawMessageInfos,\naction.payload.updatesResult.newUpdates,\n);\n- const { messageStore: mergedMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: mergedMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\nmessagesResult.rawMessageInfos,\nmessagesResult.truncationStatuses,\nnewThreadInfos,\naction.type,\n);\n- return mergedMessageStore;\n+ return { messageStoreOperations, messageStore: mergedMessageStore };\n} else if (\naction.type === sendTextMessageActionTypes.started ||\naction.type === sendMultimediaMessageActionTypes.started\n@@ -903,13 +943,13 @@ function reduceMessageStore(\n'processedMessageStore.messages should be equal' +\n' to newMessageStore.messages',\n);\n- return newMessageStore;\n+ return { messageStoreOperations, messageStore: newMessageStore };\n}\nfor (const existingMessageID of messageIDs) {\nconst existingMessageInfo = messageStore.messages[existingMessageID];\nif (existingMessageInfo && existingMessageInfo.localID === localID) {\n- return messageStore;\n+ return { messageStoreOperations: [], messageStore };\n}\n}\n@@ -945,13 +985,15 @@ function reduceMessageStore(\n' to newMessageStore.messages',\n);\n- return newMessageStore;\n+ return { messageStoreOperations, messageStore: newMessageStore };\n} else if (\naction.type === sendTextMessageActionTypes.failed ||\naction.type === sendMultimediaMessageActionTypes.failed\n) {\nconst { localID } = action.payload;\nreturn {\n+ messageStoreOperations: [],\n+ messageStore: {\nmessages: messageStore.messages,\nthreads: messageStore.threads,\nlocal: {\n@@ -959,6 +1001,7 @@ function reduceMessageStore(\n[localID]: { sendFailed: true },\n},\ncurrentAsOf: messageStore.currentAsOf,\n+ },\n};\n} else if (\naction.type === sendTextMessageActionTypes.success ||\n@@ -996,7 +1039,7 @@ function reduceMessageStore(\n} else {\n// Well this is weird, we probably got deauthorized between when the\n// action was dispatched and when we ran this reducer...\n- return messageStore;\n+ return { messageStoreOperations, messageStore };\n}\nconst newMessage = {\n@@ -1047,14 +1090,17 @@ function reduceMessageStore(\n' updatedMessageStore.messages',\n);\n- return updatedMessageStore;\n+ return { messageStoreOperations, messageStore: updatedMessageStore };\n} else if (action.type === saveMessagesActionType) {\nconst truncationStatuses = {};\nfor (const messageInfo of action.payload.rawMessageInfos) {\ntruncationStatuses[messageInfo.threadID] =\nmessageTruncationStatus.UNCHANGED;\n}\n- const { messageStore: newMessageStore } = mergeNewMessages(\n+ const {\n+ messageStoreOperations,\n+ messageStore: newMessageStore,\n+ } = mergeNewMessages(\nmessageStore,\naction.payload.rawMessageInfos,\ntruncationStatuses,\n@@ -1062,12 +1108,15 @@ function reduceMessageStore(\naction.type,\n);\nreturn {\n+ messageStoreOperations,\n+ messageStore: {\nmessages: newMessageStore.messages,\nthreads: newMessageStore.threads,\nlocal: newMessageStore.local,\n// We avoid bumping currentAsOf because notifs may include a contracted\n// RawMessageInfo, so we want to make sure we still fetch it\ncurrentAsOf: messageStore.currentAsOf,\n+ },\n};\n} else if (action.type === messageStorePruneActionType) {\nconst now = Date.now();\n@@ -1104,7 +1153,7 @@ function reduceMessageStore(\ncurrentAsOf: messageStore.currentAsOf,\n};\n- const messageStoreOperation = [\n+ const messageStoreOperations = [\n{\ntype: 'remove',\npayload: { ids: messageIDsToPrune },\n@@ -1113,7 +1162,7 @@ function reduceMessageStore(\nconst processedMessageStore = processMessageStoreOperations(\nmessageStore,\n- messageStoreOperation,\n+ messageStoreOperations,\n);\ninvariant(\n@@ -1123,7 +1172,7 @@ function reduceMessageStore(\n' prunedMessageStore.messages',\n);\n- return prunedMessageStore;\n+ return { messageStoreOperations, messageStore: prunedMessageStore };\n} else if (action.type === updateMultimediaMessageMediaActionType) {\nconst { messageID: id, currentMediaID, mediaUpdate } = action.payload;\nconst message = messageStore.messages[id];\n@@ -1208,7 +1257,7 @@ function reduceMessageStore(\n' updatedMessageStore.messages',\n);\n- return updatedMessageStore;\n+ return { messageStoreOperations, messageStore: updatedMessageStore };\n} else if (action.type === createLocalMessageActionType) {\nconst messageInfo = ensureRealizedThreadIDIsUsedWhenPossible(\naction.payload,\n@@ -1261,7 +1310,7 @@ function reduceMessageStore(\n' updatedMessageStore.messages',\n);\n- return updatedMessageStore;\n+ return { messageStoreOperations, messageStore: updatedMessageStore };\n} else if (action.type === rehydrateActionType) {\n// When starting the app on native, we filter out any local-only multimedia\n// messages because the relevant context is no longer available\n@@ -1298,7 +1347,7 @@ function reduceMessageStore(\n}\nif (newThreads === threads) {\n- return messageStore;\n+ return { messageStoreOperations: [], messageStore };\n}\nconst newMessageStore = {\n...messageStore,\n@@ -1307,7 +1356,7 @@ function reduceMessageStore(\nlocal: newLocal,\n};\n- const messageStoreOperation: MessageStoreOperation[] = [\n+ const messageStoreOperations: MessageStoreOperation[] = [\n{\ntype: 'remove',\npayload: { ids: messageIDsToBeRemoved },\n@@ -1315,7 +1364,7 @@ function reduceMessageStore(\n];\nconst processedMessageStore = processMessageStoreOperations(\nmessageStore,\n- messageStoreOperation,\n+ messageStoreOperations,\n);\ninvariant(\n!isDev ||\n@@ -1324,16 +1373,16 @@ function reduceMessageStore(\n' newMessageStore.messages',\n);\n- return newMessageStore;\n+ return { messageStoreOperations, messageStore: newMessageStore };\n} else if (action.type === processServerRequestsActionType) {\nconst {\n- messageStoreOperations: reassignMessagesOps,\n+ messageStoreOperations,\nmessageStore: messageStoreAfterReassignment,\n} = reassignMessagesToRealizedThreads(messageStore, newThreadInfos);\nconst processedMessageStore = processMessageStoreOperations(\nmessageStore,\n- reassignMessagesOps,\n+ messageStoreOperations,\n);\ninvariant(\n@@ -1345,9 +1394,12 @@ function reduceMessageStore(\n' messageStoreAfterReassignment.messages',\n);\n- return messageStoreAfterReassignment;\n+ return {\n+ messageStoreOperations,\n+ messageStore: messageStoreAfterReassignment,\n+ };\n}\n- return messageStore;\n+ return { messageStoreOperations: [], messageStore };\n}\ntype MergedUpdatesWithMessages = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Modify `reduceMessageStore` return type to include `messageStoreOperations` Summary: have reduceMessageStore return list of messageStoreOperations Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1875
129,184
11.08.2021 10:27:09
14,400
ebce09d934a3ba361f4776994b12f2e6e15f8b8e
[native] Remove "coming soon" apps from `APP_DIRECTORY_DATA` Summary: Remove apps that aren't yet available from `APP_DIRECTORY_DATA` Test Plan: The apps no longer appear in the apps directory Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/apps/apps-directory.react.js", "new_path": "native/apps/apps-directory.react.js", "diff": "@@ -17,27 +17,6 @@ const APP_DIRECTORY_DATA = [\nappIcon: 'calendar',\nappCopy: 'Shared calendar for your community',\n},\n- {\n- id: 'wiki',\n- available: false,\n- appName: 'Wiki',\n- appIcon: 'document-filled',\n- appCopy: 'Shared wiki for your community',\n- },\n- {\n- id: 'tasks',\n- available: false,\n- appName: 'Tasks',\n- appIcon: 'check-round',\n- appCopy: 'Shared tasks for your community',\n- },\n- {\n- id: 'files',\n- available: false,\n- appName: 'Files',\n- appIcon: 'package',\n- appCopy: 'Shared files for your community',\n- },\n];\n// eslint-disable-next-line no-unused-vars\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Remove "coming soon" apps from `APP_DIRECTORY_DATA` Summary: Remove apps that aren't yet available from `APP_DIRECTORY_DATA` Test Plan: The apps no longer appear in the apps directory Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1879
129,184
11.08.2021 11:06:46
14,400
af5469239c9c8bfc499c37ce64aa1fbff693e19c
[native] Add 'chat' to `apps-directory` Summary: We spoke about adding "Chat" to the `apps-directory` as a non-toggleable app (w/ alwaysEnabled prop) so the directory isn't so sparse once we remove "coming soon" apps Test Plan: Looks as expected: Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/apps/app-listing.react.js", "new_path": "native/apps/app-listing.react.js", "diff": "@@ -11,19 +11,29 @@ import {\nimport type { SupportedApps } from 'lib/types/enabled-apps';\nimport SWMansionIcon from '../components/swmansion-icon.react';\n-import { useStyles } from '../themes/colors';\n+import { useColors, useStyles } from '../themes/colors';\ntype Props = {\n- +id: SupportedApps,\n+ +id: SupportedApps | 'chat',\n+available: boolean,\n+ +alwaysEnabled: boolean,\n+enabled: boolean,\n+appName: string,\n- +appIcon: 'calendar' | 'document-filled' | 'check-round' | 'package',\n+ +appIcon: 'message-square' | 'calendar',\n+appCopy: string,\n};\nfunction AppListing(props: Props): React.Node {\n- const { id, available, enabled, appName, appIcon, appCopy } = props;\n+ const {\n+ id,\n+ available,\n+ enabled,\n+ alwaysEnabled,\n+ appName,\n+ appIcon,\n+ appCopy,\n+ } = props;\nconst styles = useStyles(unboundStyles);\n+ const colors = useColors();\nconst dispatch = useDispatch();\nconst textColor = available ? 'white' : 'gray';\n@@ -38,19 +48,37 @@ function AppListing(props: Props): React.Node {\n[dispatch, id],\n);\n- let callToAction;\n- if (available) {\n- callToAction = (\n+ const callToAction = React.useMemo(() => {\n+ if (alwaysEnabled) {\n+ return (\n+ <SWMansionIcon\n+ color={colors.modalForegroundTertiaryLabel}\n+ name=\"check-circle\"\n+ style={styles.plusIcon}\n+ />\n+ );\n+ }\n+ return (\n<TouchableOpacity onPress={enabled ? disableApp : enableApp}>\n<SWMansionIcon\nname={enabled ? 'check-circle' : 'plus-circle'}\n+ color={\n+ enabled ? colors.vibrantGreenButton : colors.listForegroundLabel\n+ }\nstyle={styles.plusIcon}\n/>\n</TouchableOpacity>\n);\n- } else {\n- callToAction = <Text style={styles.comingSoon}>{`coming\\nsoon!`}</Text>;\n- }\n+ }, [\n+ alwaysEnabled,\n+ colors.listForegroundLabel,\n+ colors.modalForegroundTertiaryLabel,\n+ colors.vibrantGreenButton,\n+ disableApp,\n+ enableApp,\n+ enabled,\n+ styles.plusIcon,\n+ ]);\nreturn (\n<View style={styles.cell}>\n@@ -86,7 +114,6 @@ const unboundStyles = {\n},\nplusIcon: {\nfontSize: 24,\n- color: 'white',\n},\nappName: {\nfontSize: 20,\n" }, { "change_type": "MODIFY", "old_path": "native/apps/apps-directory.react.js", "new_path": "native/apps/apps-directory.react.js", "diff": "@@ -10,9 +10,18 @@ import AppListing from './app-listing.react';\nconst safeAreaEdges = ['top', 'bottom'];\nconst APP_DIRECTORY_DATA = [\n+ {\n+ id: 'chat',\n+ available: true,\n+ alwaysEnabled: true,\n+ appName: 'Chat',\n+ appIcon: 'message-square',\n+ appCopy: 'Keep in touch with your community',\n+ },\n{\nid: 'calendar',\navailable: true,\n+ alwaysEnabled: false,\nappName: 'Calendar',\nappIcon: 'calendar',\nappCopy: 'Shared calendar for your community',\n@@ -30,6 +39,7 @@ function AppsDirectory(props: { ... }): React.Node {\nid={item.id}\navailable={item.available}\nenabled={enabledApps[item.id]}\n+ alwaysEnabled={item.alwaysEnabled}\nappName={item.appName}\nappIcon={item.appIcon}\nappCopy={item.appCopy}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add 'chat' to `apps-directory` Summary: We spoke about adding "Chat" to the `apps-directory` as a non-toggleable app (w/ alwaysEnabled prop) so the directory isn't so sparse once we remove "coming soon" apps Test Plan: Looks as expected: https://blob.sh/atul/e7da.png Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1881
129,184
11.08.2021 11:13:47
14,400
23d1e0db3ec015d416f715565e9acc259f4333bb
[native] Get rid of `available` prop in `AppListing` Summary: For the time being we won't be listing unavailable apps in the apps directory, so I cut the `available` prop Test Plan: Things continue looking as expected, flow Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/apps/app-listing.react.js", "new_path": "native/apps/app-listing.react.js", "diff": "@@ -15,7 +15,6 @@ import { useColors, useStyles } from '../themes/colors';\ntype Props = {\n+id: SupportedApps | 'chat',\n- +available: boolean,\n+alwaysEnabled: boolean,\n+enabled: boolean,\n+appName: string,\n@@ -23,21 +22,11 @@ type Props = {\n+appCopy: string,\n};\nfunction AppListing(props: Props): React.Node {\n- const {\n- id,\n- available,\n- enabled,\n- alwaysEnabled,\n- appName,\n- appIcon,\n- appCopy,\n- } = props;\n+ const { id, enabled, alwaysEnabled, appName, appIcon, appCopy } = props;\nconst styles = useStyles(unboundStyles);\nconst colors = useColors();\nconst dispatch = useDispatch();\n- const textColor = available ? 'white' : 'gray';\n-\nconst enableApp = React.useCallback(\n() => dispatch({ type: enableAppActionType, payload: id }),\n[dispatch, id],\n@@ -63,7 +52,9 @@ function AppListing(props: Props): React.Node {\n<SWMansionIcon\nname={enabled ? 'check-circle' : 'plus-circle'}\ncolor={\n- enabled ? colors.vibrantGreenButton : colors.listForegroundLabel\n+ enabled\n+ ? colors.vibrantGreenButton\n+ : colors.modalForegroundSecondaryLabel\n}\nstyle={styles.plusIcon}\n/>\n@@ -71,7 +62,7 @@ function AppListing(props: Props): React.Node {\n);\n}, [\nalwaysEnabled,\n- colors.listForegroundLabel,\n+ colors.modalForegroundSecondaryLabel,\ncolors.modalForegroundTertiaryLabel,\ncolors.vibrantGreenButton,\ndisableApp,\n@@ -83,13 +74,10 @@ function AppListing(props: Props): React.Node {\nreturn (\n<View style={styles.cell}>\n<View style={styles.appContent}>\n- <SWMansionIcon\n- name={appIcon}\n- style={[styles.appIcon, { color: textColor }]}\n- />\n+ <SWMansionIcon name={appIcon} style={styles.appIcon} />\n<View>\n- <Text style={[styles.appName, { color: textColor }]}>{appName}</Text>\n- <Text style={[styles.appCopy, { color: textColor }]}>{appCopy}</Text>\n+ <Text style={styles.appName}>{appName}</Text>\n+ <Text style={styles.appCopy}>{appCopy}</Text>\n</View>\n</View>\n{callToAction}\n@@ -109,6 +97,7 @@ const unboundStyles = {\nalignItems: 'center',\n},\nappIcon: {\n+ color: 'modalForegroundLabel',\nfontSize: 36,\npaddingRight: 18,\n},\n@@ -116,9 +105,11 @@ const unboundStyles = {\nfontSize: 24,\n},\nappName: {\n+ color: 'modalForegroundLabel',\nfontSize: 20,\n},\nappCopy: {\n+ color: 'modalForegroundLabel',\nfontSize: 12,\n},\ncomingSoon: {\n" }, { "change_type": "MODIFY", "old_path": "native/apps/apps-directory.react.js", "new_path": "native/apps/apps-directory.react.js", "diff": "@@ -12,7 +12,6 @@ const safeAreaEdges = ['top', 'bottom'];\nconst APP_DIRECTORY_DATA = [\n{\nid: 'chat',\n- available: true,\nalwaysEnabled: true,\nappName: 'Chat',\nappIcon: 'message-square',\n@@ -20,7 +19,6 @@ const APP_DIRECTORY_DATA = [\n},\n{\nid: 'calendar',\n- available: true,\nalwaysEnabled: false,\nappName: 'Calendar',\nappIcon: 'calendar',\n@@ -37,7 +35,6 @@ function AppsDirectory(props: { ... }): React.Node {\n({ item }) => (\n<AppListing\nid={item.id}\n- available={item.available}\nenabled={enabledApps[item.id]}\nalwaysEnabled={item.alwaysEnabled}\nappName={item.appName}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Get rid of `available` prop in `AppListing` Summary: For the time being we won't be listing unavailable apps in the apps directory, so I cut the `available` prop Test Plan: Things continue looking as expected, flow Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1882
129,184
11.08.2021 11:28:04
14,400
ab4f5e5c2b43229fda71bba7f15fd2f5027aa18e
[native] Stop calling app "beta" in `BuildInfo` Summary: Addresses one of the points mentioned: Test Plan: Looks as expected: Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/profile/build-info.react.js", "new_path": "native/profile/build-info.react.js", "diff": "@@ -15,10 +15,6 @@ function BuildInfo(props: { ... }): React.Node {\nstyle={styles.scrollView}\n>\n<View style={styles.section}>\n- <View style={styles.row}>\n- <Text style={styles.label}>Release</Text>\n- <Text style={styles.releaseText}>BETA</Text>\n- </View>\n<View style={styles.row}>\n<Text style={styles.label}>Code version</Text>\n<Text style={styles.text}>{codeVersion}</Text>\n@@ -30,9 +26,7 @@ function BuildInfo(props: { ... }): React.Node {\n</View>\n<View style={styles.section}>\n<View style={styles.row}>\n- <Text style={styles.thanksText}>\n- Thank you for helping to test the alpha!\n- </Text>\n+ <Text style={styles.thanksText}>Thank you for using Comm!</Text>\n</View>\n</View>\n</ScrollView>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Stop calling app "beta" in `BuildInfo` Summary: Addresses one of the points mentioned: https://www.notion.so/commapp/Satisfy-Apple-reviewers-3154595eb8b54991832edc578d9a3140 Test Plan: Looks as expected: https://blob.sh/atul/5450.png Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1887
129,184
11.08.2021 13:41:33
14,400
b604565d2ea45c34e95178e3c5b442f292dd9997
[native] Add "report" button to `text-message-tooltip` Summary: Here's what it looks like: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/text-message-tooltip-modal.react.js", "new_path": "native/chat/text-message-tooltip-modal.react.js", "diff": "@@ -25,6 +25,7 @@ export type TextMessageTooltipModalParams = TooltipParams<{\n}>;\nconst confirmCopy = () => displayActionResultModal('copied!');\n+const confirmReport = () => displayActionResultModal('reported to admin');\nfunction onPressCopy(route: TooltipRoute<'TextMessageTooltipModal'>) {\nClipboard.setString(route.params.item.messageInfo.text);\n@@ -48,6 +49,11 @@ const spec = {\nentries: [\n{ id: 'copy', text: 'Copy', onPress: onPressCopy },\n{ id: 'reply', text: 'Reply', onPress: onPressReply },\n+ {\n+ id: 'report',\n+ text: 'Report',\n+ onPress: confirmReport,\n+ },\n{\nid: 'create_sidebar',\ntext: 'Create sidebar',\n" }, { "change_type": "MODIFY", "old_path": "native/chat/text-message.react.js", "new_path": "native/chat/text-message.react.js", "diff": "@@ -155,7 +155,7 @@ class TextMessage extends React.PureComponent<Props> {\n}\nvisibleEntryIDs() {\n- const result = ['copy'];\n+ const result = ['copy', 'report'];\nif (this.canReply()) {\nresult.push('reply');\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add "report" button to `text-message-tooltip` Summary: Here's what it looks like: https://blob.sh/atul/report-text.mp4 Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1890
129,184
11.08.2021 13:42:05
14,400
b0ca7ef43c6da797ccec2bb74e520aa346e37a32
[native] Add "report" button to `multimedia-message-tooltip` Summary: Here's what it looks like: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/multimedia-message-tooltip-modal.react.js", "new_path": "native/chat/multimedia-message-tooltip-modal.react.js", "diff": "import * as React from 'react';\n+import { displayActionResultModal } from '../navigation/action-result-modal';\nimport {\ncreateTooltip,\ntooltipHeight,\n@@ -18,6 +19,7 @@ export type MultimediaMessageTooltipModalParams = TooltipParams<{\n+verticalBounds: VerticalBounds,\n}>;\n+const confirmReport = () => displayActionResultModal('reported to admin');\nconst spec = {\nentries: [\n{\n@@ -30,6 +32,11 @@ const spec = {\ntext: 'Go to sidebar',\nonPress: navigateToSidebar,\n},\n+ {\n+ id: 'report',\n+ text: 'Report',\n+ onPress: confirmReport,\n+ },\n],\n};\n" }, { "change_type": "MODIFY", "old_path": "native/chat/multimedia-message.react.js", "new_path": "native/chat/multimedia-message.react.js", "diff": "@@ -80,7 +80,7 @@ class MultimediaMessage extends React.PureComponent<Props, State> {\n};\nvisibleEntryIDs() {\n- const result = [];\n+ const result = ['report'];\nif (this.props.item.threadCreatedFromMessage) {\nresult.push('open_sidebar');\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add "report" button to `multimedia-message-tooltip` Summary: Here's what it looks like: https://blob.sh/atul/report-media.mp4 Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1891
129,184
11.08.2021 14:22:43
14,400
da69b5e8efc7a169c85c031f7205a177e58280c7
[lib] Introduce `PROCESSED_MSG_STORE_INVARIANTS_DISABLED` Summary: Pull `isDev` out from each invariant and use `PROCESSED_MSG_STORE_INVARIANTS_DISABLED` instead. (for example, when we want to create the staff build with invariants enabled, we couls just set `PROCESSED_MSG_STORE_INVARIANTS_DISABLED = false`) Test Plan: simple refactor Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -92,6 +92,7 @@ import {\nimport { setNewSessionActionType } from '../utils/action-utils';\nimport { isDev } from '../utils/dev-utils';\n+const PROCESSED_MSG_STORE_INVARIANTS_DISABLED = !isDev;\nconst _mapValuesWithKeys = _mapValues.convert({ cap: false });\n// Input must already be ordered!\n@@ -276,7 +277,7 @@ function mergeNewMessages(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(messageStoreAfterOperations.messages)(\nmessageStoreAfterReassignment.messages,\n),\n@@ -564,7 +565,7 @@ function mergeNewMessages(\nnewMessageOps,\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(mergedMessageStore.messages),\n`${actionType}: processed.messages should be equal to mergedMessageStore.messages`,\n);\n@@ -673,7 +674,8 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev || _isEqual(processedMessageStore.messages)(freshStore.messages),\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n+ _isEqual(processedMessageStore.messages)(freshStore.messages),\n'messageStore.messages should be equal to processedMessageStore.messages',\n);\n@@ -781,7 +783,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(filteredMessageStore.messages),\n'processedMessageStore.messages should be equal ' +\n'to filteredMessageStore.messages',\n@@ -938,7 +940,7 @@ function reduceMessageStore(\nconst newMessageStore = { ...messageStore, messages, threads, local };\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(newMessageStore.messages),\n'processedMessageStore.messages should be equal' +\n' to newMessageStore.messages',\n@@ -979,7 +981,7 @@ function reduceMessageStore(\n};\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(newMessageStore.messages),\n'processedMessageStore.messages should be equal' +\n' to newMessageStore.messages',\n@@ -1084,7 +1086,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(updatedMessageStore.messages),\n'processedMessageStore.messages should be equal to' +\n' updatedMessageStore.messages',\n@@ -1166,7 +1168,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(prunedMessageStore.messages),\n'messageStore.messages should be equal to' +\n' prunedMessageStore.messages',\n@@ -1251,7 +1253,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(updatedMessageStore.messages),\n'processedMessageStore.messages should be equal to' +\n' updatedMessageStore.messages',\n@@ -1304,7 +1306,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(updatedMessageStore.messages)(processedMessageStore.messages),\n'processedMessageStore.messages should be equal to' +\n' updatedMessageStore.messages',\n@@ -1367,7 +1369,7 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(processedMessageStore.messages)(newMessageStore.messages),\n'processedMessageStore.messages should be equal to' +\n' newMessageStore.messages',\n@@ -1386,7 +1388,7 @@ function reduceMessageStore(\n);\ninvariant(\n- !isDev ||\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n_isEqual(messageStoreAfterReassignment.messages)(\nprocessedMessageStore.messages,\n),\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `PROCESSED_MSG_STORE_INVARIANTS_DISABLED` Summary: Pull `isDev` out from each invariant and use `PROCESSED_MSG_STORE_INVARIANTS_DISABLED` instead. (for example, when we want to create the staff build with invariants enabled, we couls just set `PROCESSED_MSG_STORE_INVARIANTS_DISABLED = false`) Test Plan: simple refactor Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1892
129,187
11.08.2021 14:44:28
14,400
5d2f42bb5af9863153fa09af3af75f739b44b55d
[lib] Fix deduping of initialMembers in createPendingSidebar Summary: Addresses part 1 of [this Notion task](https://www.notion.so/commapp/Specifying-userID-twice-in-initialMemberIDs-to-createThread-leads-to-crash-062791c5d498470b987b4592187d8548). Test Plan: Test creating a sidebar in a `PERSONAL` thread from a message sent by the other user Reviewers: atul Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -375,7 +375,7 @@ function createPendingSidebar(\n);\nconst threadName = trimText(messageTitle, 30);\n- const initialMembers = new Set();\n+ const initialMembers = new Map();\nif (userIsMember(parentThreadInfo, sourceMessageInfo.creator.id)) {\nconst {\nid: sourceAuthorID,\n@@ -389,7 +389,7 @@ function createPendingSidebar(\nid: sourceAuthorID,\nusername: sourceAuthorUsername,\n};\n- initialMembers.add(initialMemberUserInfo);\n+ initialMembers.set(sourceAuthorID, initialMemberUserInfo);\n}\nconst singleOtherUser = getSingleOtherUser(parentThreadInfo, viewerID);\nif (parentThreadType === threadTypes.PERSONAL && singleOtherUser) {\n@@ -404,13 +404,13 @@ function createPendingSidebar(\nid: singleOtherUser,\nusername: singleOtherUsername,\n};\n- initialMembers.add(singleOtherUserInfo);\n+ initialMembers.set(singleOtherUser, singleOtherUserInfo);\n}\nreturn createPendingThread({\nviewerID,\nthreadType: threadTypes.SIDEBAR,\n- members: [...initialMembers],\n+ members: [...initialMembers.values()],\nparentThreadID,\nthreadColor: color,\nname: threadName,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Fix deduping of initialMembers in createPendingSidebar Summary: Addresses part 1 of [this Notion task](https://www.notion.so/commapp/Specifying-userID-twice-in-initialMemberIDs-to-createThread-leads-to-crash-062791c5d498470b987b4592187d8548). Test Plan: Test creating a sidebar in a `PERSONAL` thread from a message sent by the other user Reviewers: atul Reviewed By: atul Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1893
129,190
03.08.2021 12:15:39
-7,200
fd3f0d49ca922af795017cd42d7fbfd9c6a00dbe
[native] Generate Keys - add Olm tools Summary: Adding olm tools to the comm repo. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "ADD", "old_path": null, "new_path": "native/cpp/CommonCpp/CryptoTools/Tools.cpp", "diff": "+#include \"Tools.h\"\n+\n+#include <random>\n+#include <string>\n+\n+namespace comm {\n+namespace crypto {\n+\n+Tools::Tools() {\n+ std::random_device rd;\n+ mt = std::mt19937(rd());\n+}\n+\n+std::string Tools::generateRandomString(size_t size) {\n+ static std::string availableSigns =\n+ \" 01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n+ static std::uniform_int_distribution<int> randomStringUid(\n+ 0, availableSigns.size() - 1);\n+ std::string result;\n+ for (size_t i = 0; i < size; ++i) {\n+ result.push_back(availableSigns[randomStringUid(this->mt)]);\n+ }\n+ return result;\n+}\n+\n+unsigned char Tools::generateRandomByte() {\n+ static std::uniform_int_distribution<int> randomByteUid(0, 255);\n+ return (unsigned char)randomByteUid(this->mt);\n+}\n+\n+void Tools::generateRandomBytes(OlmBuffer &buffer, size_t size) {\n+ buffer.resize(size);\n+\n+ for (size_t i = 0; i < size; ++i) {\n+ buffer[i] = generateRandomByte();\n+ }\n+}\n+\n+} // namespace crypto\n+} // namespace comm\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/cpp/CommonCpp/CryptoTools/Tools.h", "diff": "+#pragma once\n+\n+#include <random>\n+#include <vector>\n+\n+#include \"olm/olm.h\"\n+\n+#define KEYSIZE 43\n+#define ID_KEYS_PREFIX_OFFSET 15\n+#define ONE_TIME_KEYS_PREFIX_OFFSET 25\n+#define ONE_TIME_KEYS_MIDDLE_OFFSET 12\n+\n+namespace comm {\n+namespace crypto {\n+\n+typedef std::vector<std::uint8_t> OlmBuffer;\n+\n+struct Keys {\n+ OlmBuffer identityKeys; // size = 116\n+ OlmBuffer oneTimeKeys; // size = 43 each\n+};\n+\n+struct EncryptedData {\n+ OlmBuffer message;\n+ size_t messageType;\n+};\n+\n+class Tools {\n+ std::mt19937 mt;\n+\n+ Tools();\n+\n+public:\n+ static Tools &getInstance() {\n+ static Tools instance;\n+ return instance;\n+ }\n+ Tools(Tools const &) = delete;\n+ void operator=(Tools const &) = delete;\n+\n+ std::string generateRandomString(size_t size);\n+\n+ unsigned char generateRandomByte();\n+ void generateRandomBytes(OlmBuffer &buffer, size_t size);\n+};\n+\n+} // namespace crypto\n+} // namespace comm\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Generate Keys - add Olm tools Summary: Adding olm tools to the comm repo. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1840
129,190
03.08.2021 12:16:20
-7,200
97d632b53a3d2d35880d8cbe31d1bba882fda8f2
[native] Generate Keys - add Olm session wrapper Summary: Adding olm session wrapper to the comm repo. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "ADD", "old_path": null, "new_path": "native/cpp/CommonCpp/CryptoTools/Session.cpp", "diff": "+#include \"Session.h\"\n+\n+#include \"Tools.h\"\n+\n+namespace comm {\n+namespace crypto {\n+\n+std::unique_ptr<Session> Session::createSessionAsInitializer(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const OlmBuffer &idKeys,\n+ const OlmBuffer &oneTimeKeys,\n+ size_t keyIndex) {\n+ std::unique_ptr<Session> session(new Session(account, ownerIdentityKeys));\n+\n+ session->olmSessionBuffer.resize(::olm_session_size());\n+ session->olmSession = ::olm_session(session->olmSessionBuffer.data());\n+\n+ OlmBuffer randomBuffer;\n+ Tools::getInstance().generateRandomBytes(\n+ randomBuffer,\n+ ::olm_create_outbound_session_random_length(session->olmSession));\n+\n+ if (-1 == ::olm_create_outbound_session(\n+ session->olmSession,\n+ session->ownerUserAccount,\n+ idKeys.data() + ID_KEYS_PREFIX_OFFSET,\n+ KEYSIZE,\n+ oneTimeKeys.data() + ONE_TIME_KEYS_PREFIX_OFFSET +\n+ (KEYSIZE + ONE_TIME_KEYS_MIDDLE_OFFSET) * keyIndex,\n+ KEYSIZE,\n+ randomBuffer.data(),\n+ randomBuffer.size())) {\n+ throw std::runtime_error(\n+ \"error createOutbound => ::olm_create_outbound_session\");\n+ }\n+ return std::move(session);\n+}\n+\n+std::unique_ptr<Session> Session::createSessionAsResponder(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const OlmBuffer &encryptedMessage,\n+ const OlmBuffer &idKeys) {\n+ std::unique_ptr<Session> session(new Session(account, ownerIdentityKeys));\n+\n+ OlmBuffer tmpEncryptedMessage(encryptedMessage);\n+ session->olmSessionBuffer.resize(::olm_session_size());\n+ session->olmSession = ::olm_session(session->olmSessionBuffer.data());\n+ if (-1 == ::olm_create_inbound_session(\n+ session->olmSession,\n+ session->ownerUserAccount,\n+ tmpEncryptedMessage.data(),\n+ encryptedMessage.size())) {\n+ throw std::runtime_error(\n+ \"error createInbound => ::olm_create_inbound_session\");\n+ }\n+ return std::move(session);\n+}\n+\n+OlmBuffer Session::storeAsB64(const std::string &secretKey) {\n+ size_t pickleLength = ::olm_pickle_session_length(this->olmSession);\n+ OlmBuffer pickle(pickleLength);\n+ size_t res = ::olm_pickle_session(\n+ this->olmSession,\n+ secretKey.data(),\n+ secretKey.size(),\n+ pickle.data(),\n+ pickleLength);\n+ if (pickleLength != res) {\n+ throw std::runtime_error(\"error pickleSession => ::olm_pickle_session\");\n+ }\n+ return pickle;\n+}\n+\n+std::unique_ptr<Session> Session::restoreFromB64(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const std::string &secretKey,\n+ OlmBuffer &b64) {\n+ std::unique_ptr<Session> session(new Session(account, ownerIdentityKeys));\n+\n+ session->olmSessionBuffer.resize(::olm_session_size());\n+ session->olmSession = ::olm_session(session->olmSessionBuffer.data());\n+ if (-1 == ::olm_unpickle_session(\n+ session->olmSession,\n+ secretKey.data(),\n+ secretKey.size(),\n+ b64.data(),\n+ b64.size())) {\n+ throw std::runtime_error(\"error pickleSession => ::olm_unpickle_session\");\n+ }\n+ if (b64.size() != ::olm_pickle_session_length(session->olmSession)) {\n+ throw std::runtime_error(\n+ \"error pickleSession => ::olm_pickle_session_length\");\n+ }\n+ return session;\n+}\n+\n+OlmSession *Session::getOlmSession() {\n+ if (this->olmSession == nullptr) {\n+ throw std::runtime_error(\n+ \"trying to obtain a session pointer of uninitialized session\");\n+ }\n+ return this->olmSession;\n+}\n+\n+} // namespace crypto\n+} // namespace comm\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/cpp/CommonCpp/CryptoTools/Session.h", "diff": "+#pragma once\n+\n+#include <memory>\n+#include <string>\n+\n+#include \"Tools.h\"\n+\n+namespace comm {\n+namespace crypto {\n+\n+class Session {\n+ OlmAccount *ownerUserAccount;\n+ std::uint8_t *ownerIdentityKeys;\n+\n+ OlmSession *olmSession = nullptr;\n+ OlmBuffer olmSessionBuffer;\n+\n+ Session(OlmAccount *account, std::uint8_t *ownerIdentityKeys)\n+ : ownerUserAccount(account), ownerIdentityKeys(ownerIdentityKeys) {\n+ }\n+\n+public:\n+ static std::unique_ptr<Session> createSessionAsInitializer(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const OlmBuffer &idKeys,\n+ const OlmBuffer &oneTimeKeys,\n+ size_t keyIndex = 0);\n+ static std::unique_ptr<Session> createSessionAsResponder(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const OlmBuffer &encryptedMessage,\n+ const OlmBuffer &idKeys);\n+ OlmBuffer storeAsB64(const std::string &secretKey);\n+ static std::unique_ptr<Session> restoreFromB64(\n+ OlmAccount *account,\n+ std::uint8_t *ownerIdentityKeys,\n+ const std::string &secretKey,\n+ OlmBuffer &b64);\n+ OlmSession *getOlmSession();\n+};\n+\n+} // namespace crypto\n+} // namespace comm\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Generate Keys - add Olm session wrapper Summary: Adding olm session wrapper to the comm repo. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1841
129,190
03.08.2021 12:17:14
-7,200
ceceed0b5fae7639788126116234e5a5562f8542
[native] Generate Keys - add Persist structure Summary: Adding persist structure to the comm repo. This is used to pickling an account and its sessions. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "ADD", "old_path": null, "new_path": "native/cpp/CommonCpp/CryptoTools/Persist.h", "diff": "+#pragma once\n+\n+#include <string>\n+#include <unordered_map>\n+\n+#include \"Tools.h\"\n+\n+namespace comm {\n+namespace crypto {\n+\n+struct Persist {\n+ OlmBuffer account;\n+ std::unordered_map<std::string, OlmBuffer> sessions;\n+\n+ bool isEmpty() const {\n+ return (this->account.size() == 0);\n+ }\n+};\n+\n+} // namespace crypto\n+} // namespace comm\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Generate Keys - add Persist structure Summary: Adding persist structure to the comm repo. This is used to pickling an account and its sessions. The original code can be found [here](https://github.com/karol-bisztyga/olm_tests/tree/main/karol_tests) Test Plan: none Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1842
129,190
03.08.2021 12:22:46
-7,200
e662cdd9204d0bc9a9b1388e473305bf448766ef
[native] Generate Keys - add untracked files to iOS Summary: Syncing files newly added in the previous diffs with the iOS. Test Plan: build iOS Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/ios/Comm.xcodeproj/project.pbxproj", "new_path": "native/ios/Comm.xcodeproj/project.pbxproj", "diff": "71BE84492636A944002849D2 /* NativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BE843B2636A944002849D2 /* NativeModules.cpp */; };\n71BE844A2636A944002849D2 /* CommCoreModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BE843C2636A944002849D2 /* CommCoreModule.cpp */; };\n71BE844B2636A944002849D2 /* SQLiteQueryExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BE84412636A944002849D2 /* SQLiteQueryExecutor.cpp */; };\n- 71BF5B6426AEC56500EDE27D /* CommSecureStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71BF5B6326AEC56500EDE27D /* CommSecureStore.mm */; };\n+ 71BF5B7126B3FF0900EDE27D /* Session.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BF5B6F26B3FF0900EDE27D /* Session.cpp */; };\n+ 71BF5B7526B401D300EDE27D /* Tools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BF5B7326B401D300EDE27D /* Tools.cpp */; };\n+ 71BF5B7F26BBDD7400EDE27D /* CryptoModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BF5B7B26BBDA6100EDE27D /* CryptoModule.cpp */; };\n71CA4A64262DA8E500835C89 /* Logger.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4A63262DA8E500835C89 /* Logger.mm */; };\n71CA4AEC262F236100835C89 /* Tools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4AEB262F236100835C89 /* Tools.mm */; };\n+ 71D4D7CC26C50B1000FCDBCD /* CommSecureStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71D4D7CB26C50B1000FCDBCD /* CommSecureStore.mm */; };\n7F761E602201141E001B6FB7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F761E292201141E001B6FB7 /* JavaScriptCore.framework */; };\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F788C2B248AA2130098F071 /* SplashScreen.storyboard */; };\n7F8D602126535E060053CB29 /* OpenSans-Semibold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */; };\n71BE84432636A944002849D2 /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseManager.h; sourceTree = \"<group>\"; };\n71BE84452636A944002849D2 /* Draft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Draft.h; sourceTree = \"<group>\"; };\n71BE84482636A944002849D2 /* sqlite_orm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqlite_orm.h; sourceTree = \"<group>\"; };\n- 71BF5B6326AEC56500EDE27D /* CommSecureStore.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CommSecureStore.mm; path = Comm/CommSecureStore.mm; sourceTree = \"<group>\"; };\n+ 71BF5B6F26B3FF0900EDE27D /* Session.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Session.cpp; sourceTree = \"<group>\"; };\n+ 71BF5B7026B3FF0900EDE27D /* Session.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Session.h; sourceTree = \"<group>\"; };\n+ 71BF5B7226B3FFBC00EDE27D /* Persist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Persist.h; sourceTree = \"<group>\"; };\n+ 71BF5B7326B401D300EDE27D /* Tools.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Tools.cpp; sourceTree = \"<group>\"; };\n+ 71BF5B7426B401D300EDE27D /* Tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Tools.h; sourceTree = \"<group>\"; };\n+ 71BF5B7A26BBDA6000EDE27D /* CryptoModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoModule.h; sourceTree = \"<group>\"; };\n+ 71BF5B7B26BBDA6100EDE27D /* CryptoModule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoModule.cpp; sourceTree = \"<group>\"; };\n71CA4A63262DA8E500835C89 /* Logger.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Logger.mm; path = Comm/Logger.mm; sourceTree = \"<group>\"; };\n71CA4AEA262F230A00835C89 /* Tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = Comm/Tools.h; sourceTree = \"<group>\"; };\n71CA4AEB262F236100835C89 /* Tools.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = Tools.mm; path = Comm/Tools.mm; sourceTree = \"<group>\"; };\n+ 71D4D7CB26C50B1000FCDBCD /* CommSecureStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CommSecureStore.mm; path = Comm/CommSecureStore.mm; sourceTree = \"<group>\"; };\n7F26E81B24440D87004049C6 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = \"<group>\"; };\n7F554F822332D58B007CB9F7 /* Info.debug.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.debug.plist; path = Comm/Info.debug.plist; sourceTree = \"<group>\"; };\n7F761E292201141E001B6FB7 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };\n71B8CCB626BD30EC0040C0A2 /* CommCoreImplementations */ = {\nisa = PBXGroup;\nchildren = (\n+ 71D4D7CB26C50B1000FCDBCD /* CommSecureStore.mm */,\n71142A7526C2650A0039DCBD /* CommSecureStoreIOSWrapper.h */,\n71142A7626C2650A0039DCBD /* CommSecureStoreIOSWrapper.mm */,\n71CA4AEA262F230A00835C89 /* Tools.h */,\n71CA4AEB262F236100835C89 /* Tools.mm */,\n- 71BF5B6326AEC56500EDE27D /* CommSecureStore.mm */,\n71CA4A63262DA8E500835C89 /* Logger.mm */,\n);\nname = CommCoreImplementations;\n71BE84372636A944002849D2 /* CommonCpp */ = {\nisa = PBXGroup;\nchildren = (\n+ 71BF5B6A26B3FCFF00EDE27D /* CryptoTools */,\n71BE84382636A944002849D2 /* Tools */,\n71BE843A2636A944002849D2 /* NativeModules */,\n71BE843F2636A944002849D2 /* DatabaseManagers */,\npath = sqlite_orm;\nsourceTree = \"<group>\";\n};\n+ 71BF5B6A26B3FCFF00EDE27D /* CryptoTools */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 71BF5B7B26BBDA6100EDE27D /* CryptoModule.cpp */,\n+ 71BF5B7A26BBDA6000EDE27D /* CryptoModule.h */,\n+ 71BF5B6F26B3FF0900EDE27D /* Session.cpp */,\n+ 71BF5B7026B3FF0900EDE27D /* Session.h */,\n+ 71BF5B7226B3FFBC00EDE27D /* Persist.h */,\n+ 71BF5B7326B401D300EDE27D /* Tools.cpp */,\n+ 71BF5B7426B401D300EDE27D /* Tools.h */,\n+ );\n+ path = CryptoTools;\n+ sourceTree = \"<group>\";\n+ };\n7FF0870B1E833C3F000A1ACF /* Frameworks */ = {\nisa = PBXGroup;\nchildren = (\nfiles = (\n718DE99E2653D41C00365824 /* WorkerThread.cpp in Sources */,\n71CA4AEC262F236100835C89 /* Tools.mm in Sources */,\n+ 71BF5B7126B3FF0900EDE27D /* Session.cpp in Sources */,\n+ 71BF5B7526B401D300EDE27D /* Tools.cpp in Sources */,\n13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,\n71142A7726C2650B0039DCBD /* CommSecureStoreIOSWrapper.mm in Sources */,\n71BE84492636A944002849D2 /* NativeModules.cpp in Sources */,\n71CA4A64262DA8E500835C89 /* Logger.mm in Sources */,\n+ 71BF5B7F26BBDD7400EDE27D /* CryptoModule.cpp in Sources */,\n71BE844A2636A944002849D2 /* CommCoreModule.cpp in Sources */,\n- 71BF5B6426AEC56500EDE27D /* CommSecureStore.mm in Sources */,\n+ 71D4D7CC26C50B1000FCDBCD /* CommSecureStore.mm in Sources */,\n711B408425DA97F9005F8F06 /* dummy.swift in Sources */,\n13B07FC11A68108700A75B9A /* main.m in Sources */,\n71BE844B2636A944002849D2 /* SQLiteQueryExecutor.cpp in Sources */,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Generate Keys - add untracked files to iOS Summary: Syncing files newly added in the previous diffs with the iOS. Test Plan: build iOS Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1845
129,191
11.08.2021 11:18:02
-7,200
3f4e5571eb53e760c0d403f26702781e60aae1c1
[native] Move message height functions to utils Summary: We do this to avoid import cycles Test Plan: Flow Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/message.react.js", "new_path": "native/chat/message.react.js", "diff": "@@ -20,29 +20,10 @@ import type { ChatMessageInfoItemWithHeight } from '../types/chat-types';\nimport { type VerticalBounds } from '../types/layout-types';\nimport type { LayoutEvent } from '../types/react-native';\nimport type { ChatNavigationProp } from './chat.react';\n-import { multimediaMessageItemHeight } from './multimedia-message-utils';\nimport MultimediaMessage from './multimedia-message.react';\n-import {\n- RobotextMessage,\n- robotextMessageItemHeight,\n-} from './robotext-message.react';\n-import { TextMessage, textMessageItemHeight } from './text-message.react';\n-import { timestampHeight } from './timestamp.react';\n-\n-function messageItemHeight(item: ChatMessageInfoItemWithHeight): number {\n- let height = 0;\n- if (item.messageShapeType === 'text') {\n- height += textMessageItemHeight(item);\n- } else if (item.messageShapeType === 'multimedia') {\n- height += multimediaMessageItemHeight(item);\n- } else {\n- height += robotextMessageItemHeight(item);\n- }\n- if (item.startsConversation) {\n- height += timestampHeight;\n- }\n- return height;\n-}\n+import { RobotextMessage } from './robotext-message.react';\n+import { TextMessage } from './text-message.react';\n+import { messageItemHeight } from './utils';\ntype BaseProps = {\n+item: ChatMessageInfoItemWithHeight,\n@@ -160,4 +141,4 @@ const ConnectedMessage: React.ComponentType<BaseProps> = React.memo<BaseProps>(\n},\n);\n-export { ConnectedMessage as Message, messageItemHeight };\n+export { ConnectedMessage as Message };\n" }, { "change_type": "MODIFY", "old_path": "native/chat/robotext-message.react.js", "new_path": "native/chat/robotext-message.react.js", "diff": "@@ -15,20 +15,11 @@ import { useStyles } from '../themes/colors';\nimport type { ChatRobotextMessageInfoItemWithHeight } from '../types/chat-types';\nimport type { VerticalBounds } from '../types/layout-types';\nimport type { ChatNavigationProp } from './chat.react';\n-import { InlineSidebar, inlineSidebarHeight } from './inline-sidebar.react';\n+import { InlineSidebar } from './inline-sidebar.react';\nimport { InnerRobotextMessage } from './inner-robotext-message.react';\nimport { robotextMessageTooltipHeight } from './robotext-message-tooltip-modal.react';\nimport { Timestamp } from './timestamp.react';\n-function robotextMessageItemHeight(\n- item: ChatRobotextMessageInfoItemWithHeight,\n-): number {\n- if (item.threadCreatedFromMessage) {\n- return item.contentHeight + inlineSidebarHeight;\n- }\n- return item.contentHeight;\n-}\n-\ntype Props = {\n...React.ElementConfig<typeof View>,\n+item: ChatRobotextMessageInfoItemWithHeight,\n@@ -196,4 +187,4 @@ const unboundStyles = {\n},\n};\n-export { robotextMessageItemHeight, RobotextMessage };\n+export { RobotextMessage };\n" }, { "change_type": "MODIFY", "old_path": "native/chat/text-message.react.js", "new_path": "native/chat/text-message.react.js", "diff": "@@ -21,40 +21,11 @@ import { TextMessageTooltipModalRouteName } from '../navigation/route-names';\nimport type { ChatTextMessageInfoItemWithHeight } from '../types/chat-types';\nimport type { VerticalBounds } from '../types/layout-types';\nimport type { ChatNavigationProp } from './chat.react';\n-import { ComposedMessage, clusterEndHeight } from './composed-message.react';\n-import { failedSendHeight } from './failed-send.react';\n-import {\n- inlineSidebarHeight,\n- inlineSidebarMarginBottom,\n- inlineSidebarMarginTop,\n-} from './inline-sidebar.react';\n+import { ComposedMessage } from './composed-message.react';\nimport { InnerTextMessage } from './inner-text-message.react';\n-import { authorNameHeight } from './message-header.react';\nimport textMessageSendFailed from './text-message-send-failed';\nimport { textMessageTooltipHeight } from './text-message-tooltip-modal.react';\n-function textMessageItemHeight(\n- item: ChatTextMessageInfoItemWithHeight,\n-): number {\n- const { messageInfo, contentHeight, startsCluster, endsCluster } = item;\n- const { isViewer } = messageInfo.creator;\n- let height = 5 + contentHeight; // 5 from marginBottom in ComposedMessage\n- if (!isViewer && startsCluster) {\n- height += authorNameHeight;\n- }\n- if (endsCluster) {\n- height += clusterEndHeight;\n- }\n- if (textMessageSendFailed(item)) {\n- height += failedSendHeight;\n- }\n- if (item.threadCreatedFromMessage) {\n- height +=\n- inlineSidebarHeight + inlineSidebarMarginTop + inlineSidebarMarginBottom;\n- }\n- return height;\n-}\n-\ntype BaseProps = {\n...React.ElementConfig<typeof View>,\n+item: ChatTextMessageInfoItemWithHeight,\n@@ -252,4 +223,4 @@ const ConnectedTextMessage: React.ComponentType<BaseProps> = React.memo<BaseProp\n},\n);\n-export { ConnectedTextMessage as TextMessage, textMessageItemHeight };\n+export { ConnectedTextMessage as TextMessage };\n" }, { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -11,13 +11,23 @@ import { useSelector } from '../redux/redux-utils';\nimport type {\nChatMessageInfoItemWithHeight,\nChatMessageItemWithHeight,\n+ ChatRobotextMessageInfoItemWithHeight,\n+ ChatTextMessageInfoItemWithHeight,\n} from '../types/chat-types';\nimport type { LayoutCoordinates, VerticalBounds } from '../types/layout-types';\nimport type { AnimatedViewStyle } from '../types/styles';\nimport { ChatContext, useHeightMeasurer } from './chat-context';\n+import { clusterEndHeight } from './composed-message.react';\n+import { failedSendHeight } from './failed-send.react';\n+import {\n+ inlineSidebarHeight,\n+ inlineSidebarMarginBottom,\n+ inlineSidebarMarginTop,\n+} from './inline-sidebar.react';\nimport { authorNameHeight } from './message-header.react';\n-import { messageItemHeight } from './message.react';\n+import { multimediaMessageItemHeight } from './multimedia-message-utils';\nimport { getSidebarThreadInfo } from './sidebar-navigation';\n+import textMessageSendFailed from './text-message-send-failed';\nimport { timestampHeight } from './timestamp.react';\n/* eslint-disable import/no-named-as-default-member */\n@@ -33,6 +43,52 @@ const {\n} = Animated;\n/* eslint-enable import/no-named-as-default-member */\n+function textMessageItemHeight(\n+ item: ChatTextMessageInfoItemWithHeight,\n+): number {\n+ const { messageInfo, contentHeight, startsCluster, endsCluster } = item;\n+ const { isViewer } = messageInfo.creator;\n+ let height = 5 + contentHeight; // 5 from marginBottom in ComposedMessage\n+ if (!isViewer && startsCluster) {\n+ height += authorNameHeight;\n+ }\n+ if (endsCluster) {\n+ height += clusterEndHeight;\n+ }\n+ if (textMessageSendFailed(item)) {\n+ height += failedSendHeight;\n+ }\n+ if (item.threadCreatedFromMessage) {\n+ height +=\n+ inlineSidebarHeight + inlineSidebarMarginTop + inlineSidebarMarginBottom;\n+ }\n+ return height;\n+}\n+\n+function robotextMessageItemHeight(\n+ item: ChatRobotextMessageInfoItemWithHeight,\n+): number {\n+ if (item.threadCreatedFromMessage) {\n+ return item.contentHeight + inlineSidebarHeight;\n+ }\n+ return item.contentHeight;\n+}\n+\n+function messageItemHeight(item: ChatMessageInfoItemWithHeight): number {\n+ let height = 0;\n+ if (item.messageShapeType === 'text') {\n+ height += textMessageItemHeight(item);\n+ } else if (item.messageShapeType === 'multimedia') {\n+ height += multimediaMessageItemHeight(item);\n+ } else {\n+ height += robotextMessageItemHeight(item);\n+ }\n+ if (item.startsConversation) {\n+ height += timestampHeight;\n+ }\n+ return height;\n+}\n+\nfunction chatMessageItemHeight(item: ChatMessageItemWithHeight): number {\nif (item.itemType === 'loader') {\nreturn 56;\n@@ -213,4 +269,5 @@ export {\ngetSidebarThreadInfo,\nchatMessageItemHeight,\nuseAnimatedMessageTooltipButton,\n+ messageItemHeight,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Move message height functions to utils Summary: We do this to avoid import cycles Test Plan: Flow Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1883
129,191
11.08.2021 12:34:32
-7,200
9dc01821415743336d8e617b8a7ad7713bdb4b14
[native] Remove message hiding logic Summary: We're going to use a new mechanism and it's easier to remove the old one first Test Plan: Check if the navigating to sidebar works Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/message-list.react.js", "new_path": "native/chat/message-list.react.js", "diff": "@@ -46,7 +46,6 @@ import type {\n} from '../types/chat-types';\nimport type { VerticalBounds } from '../types/layout-types';\nimport type { ViewableItemsChange } from '../types/react-native';\n-import { ChatContext } from './chat-context';\nimport { ChatList } from './chat-list.react';\nimport type { ChatNavigationProp } from './chat.react';\nimport { Message } from './message.react';\n@@ -64,7 +63,6 @@ type Props = {\n+startReached: boolean,\n+styles: typeof unboundStyles,\n+indicatorStyle: IndicatorStyle,\n- +currentTransitionSidebarSourceID: ?string,\n// Redux dispatch functions\n+dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -94,7 +92,6 @@ type FlatListExtraData = {\nfocusedMessageKey: ?string,\nnavigation: ChatNavigationProp<'MessageList'>,\nroute: NavigationRoute<'MessageList'>,\n- currentTransitionSidebarSourceID: ?string,\n};\nclass MessageList extends React.PureComponent<Props, State> {\nstate: State = {\n@@ -109,20 +106,16 @@ class MessageList extends React.PureComponent<Props, State> {\n(propsAndState: PropsAndState) => propsAndState.focusedMessageKey,\n(propsAndState: PropsAndState) => propsAndState.navigation,\n(propsAndState: PropsAndState) => propsAndState.route,\n- (propsAndState: PropsAndState) =>\n- propsAndState.currentTransitionSidebarSourceID,\n(\nmessageListVerticalBounds: ?VerticalBounds,\nfocusedMessageKey: ?string,\nnavigation: ChatNavigationProp<'MessageList'>,\nroute: NavigationRoute<'MessageList'>,\n- currentTransitionSidebarSourceID: ?string,\n) => ({\nmessageListVerticalBounds,\nfocusedMessageKey,\nnavigation,\nroute,\n- currentTransitionSidebarSourceID,\n}),\n);\n@@ -194,12 +187,9 @@ class MessageList extends React.PureComponent<Props, State> {\nfocusedMessageKey,\nnavigation,\nroute,\n- currentTransitionSidebarSourceID,\n} = this.flatListExtraData;\nconst focused =\nmessageKey(messageInfoItem.messageInfo) === focusedMessageKey;\n- const isVisible =\n- messageInfoItem.messageInfo.id !== currentTransitionSidebarSourceID;\nreturn (\n<Message\nitem={messageInfoItem}\n@@ -208,7 +198,6 @@ class MessageList extends React.PureComponent<Props, State> {\nroute={route}\ntoggleFocus={this.toggleMessageFocus}\nverticalBounds={messageListVerticalBounds}\n- visible={isVisible}\n/>\n);\n};\n@@ -371,17 +360,12 @@ const ConnectedMessageList: React.ComponentType<BaseProps> = React.memo<BaseProp\nuseWatchThread(props.threadInfo);\n- const chatContext = React.useContext(ChatContext);\n- invariant(chatContext, 'chatContext should be set');\n- const { currentTransitionSidebarSourceID } = chatContext;\n-\nreturn (\n<MessageList\n{...props}\nstartReached={startReached}\nstyles={styles}\nindicatorStyle={indicatorStyle}\n- currentTransitionSidebarSourceID={currentTransitionSidebarSourceID}\ndispatchActionPromise={dispatchActionPromise}\nfetchMessagesBeforeCursor={callFetchMessagesBeforeCursor}\nfetchMostRecentMessages={callFetchMostRecentMessages}\n" }, { "change_type": "MODIFY", "old_path": "native/chat/message.react.js", "new_path": "native/chat/message.react.js", "diff": "@@ -5,8 +5,6 @@ import {\nLayoutAnimation,\nTouchableWithoutFeedback,\nPixelRatio,\n- StyleSheet,\n- View,\n} from 'react-native';\nimport { messageKey } from 'lib/shared/message-utils';\n@@ -32,7 +30,6 @@ type BaseProps = {\n+route: NavigationRoute<'MessageList'>,\n+toggleFocus: (messageKey: string) => void,\n+verticalBounds: ?VerticalBounds,\n- +visible?: boolean,\n};\ntype Props = {\n...BaseProps,\n@@ -85,13 +82,12 @@ class Message extends React.PureComponent<Props> {\n}\nconst onLayout = __DEV__ ? this.onLayout : undefined;\n- const messageStyle = this.props.visible === false ? styles.hidden : null;\nreturn (\n<TouchableWithoutFeedback\nonPress={this.dismissKeyboard}\nonLayout={onLayout}\n>\n- <View style={messageStyle}>{message}</View>\n+ {message}\n</TouchableWithoutFeedback>\n);\n}\n@@ -128,12 +124,6 @@ class Message extends React.PureComponent<Props> {\n};\n}\n-const styles = StyleSheet.create({\n- hidden: {\n- opacity: 0,\n- },\n-});\n-\nconst ConnectedMessage: React.ComponentType<BaseProps> = React.memo<BaseProps>(\nfunction ConnectedMessage(props: BaseProps) {\nconst keyboardState = React.useContext(KeyboardContext);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Remove message hiding logic Summary: We're going to use a new mechanism and it's easier to remove the old one first Test Plan: Check if the navigating to sidebar works Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1885
129,191
11.08.2021 17:10:10
-7,200
fc8bcd03848caf6f56f9e9dc21aad35effd6510e
[native] Determine optimal animation parameters Summary: I spent some time tweaking the values so that the animation looks correct and feels right Test Plan: Open tooltip, close it, open again and navigate to a sidebar. Check if animation is correct. Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/message.react.js", "new_path": "native/chat/message.react.js", "diff": "@@ -89,7 +89,7 @@ class Message extends React.PureComponent<Props, State> {\nreturn sub(\n1,\ninterpolateNode(overlayPosition, {\n- inputRange: [0.1, 0.11],\n+ inputRange: [0.05, 0.06],\noutputRange: [0, 1],\nextrapolate: Extrapolate.CLAMP,\n}),\n" }, { "change_type": "MODIFY", "old_path": "native/chat/multimedia-message-tooltip-button.react.js", "new_path": "native/chat/multimedia-message-tooltip-button.react.js", "diff": "@@ -36,7 +36,7 @@ function MultimediaMessageTooltipButton(props: Props): React.Node {\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\nconst opacity = interpolateNode(progress, {\n- inputRange: [0, 0.1],\n+ inputRange: [0, 0.05],\noutputRange: [0, 1],\nextrapolate: Extrapolate.CLAMP,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/robotext-message-tooltip-button.react.js", "new_path": "native/chat/robotext-message-tooltip-button.react.js", "diff": "@@ -34,7 +34,7 @@ function RobotextMessageTooltipButton(props: Props): React.Node {\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\nconst opacity = interpolateNode(progress, {\n- inputRange: [0, 0.1],\n+ inputRange: [0, 0.05],\noutputRange: [0, 1],\nextrapolate: Extrapolate.CLAMP,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/text-message-tooltip-button.react.js", "new_path": "native/chat/text-message-tooltip-button.react.js", "diff": "@@ -39,7 +39,7 @@ function TextMessageTooltipButton(props: Props): React.Node {\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\nconst opacity = interpolateNode(progress, {\n- inputRange: [0, 0.1],\n+ inputRange: [0, 0.05],\noutputRange: [0, 1],\nextrapolate: Extrapolate.CLAMP,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -207,7 +207,7 @@ function useAnimatedMessageTooltipButton(\nconst bottom = React.useMemo(\n() =>\ninterpolateNode(progress, {\n- inputRange: [0, 1],\n+ inputRange: [0.3, 1],\noutputRange: [targetPosition, 0],\nextrapolate: Extrapolate.CLAMP,\n}),\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/overlay-navigator.react.js", "new_path": "native/navigation/overlay-navigator.react.js", "diff": "@@ -335,7 +335,7 @@ const OverlayNavigator = React.memo<Props>(\nconst duration =\n(navigationTransitionSpec.animation === 'timing' &&\nnavigationTransitionSpec.config.duration) ||\n- 250;\n+ 400;\ninvariant(position, `should have position for animating key ${key}`);\ntiming(position, {\nduration,\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/tooltip.react.js", "new_path": "native/navigation/tooltip.react.js", "diff": "@@ -141,6 +141,7 @@ function createTooltip<\ntooltipVerticalBelow: Node;\ntooltipHorizontalOffset: Value = new Value(0);\ntooltipHorizontal: Node;\n+ tooltipScale: Node;\nconstructor(props: TooltipProps<BaseTooltipPropsType>) {\nsuper(props);\n@@ -176,6 +177,12 @@ function createTooltip<\nadd(1, multiply(-1, position)),\nthis.tooltipHorizontalOffset,\n);\n+\n+ this.tooltipScale = interpolateNode(position, {\n+ inputRange: [0, 0.2, 0.8, 1],\n+ outputRange: [0, 0, 1, 1],\n+ extrapolate: Extrapolate.CLAMP,\n+ });\n}\ncomponentDidMount() {\n@@ -295,10 +302,7 @@ function createTooltip<\nstyle.transform.push({ translateY: this.tooltipVerticalBelow });\n}\n- const { overlayContext } = this.props;\n- invariant(overlayContext, 'Tooltip should have OverlayContext');\n- const { position } = overlayContext;\n- style.transform.push({ scale: position });\n+ style.transform.push({ scale: this.tooltipScale });\nreturn style;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Determine optimal animation parameters Summary: I spent some time tweaking the values so that the animation looks correct and feels right Test Plan: Open tooltip, close it, open again and navigate to a sidebar. Check if animation is correct. Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1889
129,187
12.08.2021 13:41:04
14,400
519c7b86ca1db5ce1e9e2956ccb047b7f5b3f225
[server] Introduce createNewVersionResponder Test Plan: 1. Try doing it with correct input 2. Try doing it with malformed input 3. Try doing it twice with the same version Reviewers: atul Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "ADD", "old_path": null, "new_path": "lib/types/version-types.js", "diff": "+// @flow\n+\n+import type { DeviceType } from './device-types';\n+\n+export type CreateNewVersionsRequest = {\n+ +codeVersion: number,\n+ +deviceType: DeviceType,\n+};\n" }, { "change_type": "MODIFY", "old_path": "server/src/responders/handlers.js", "new_path": "server/src/responders/handlers.js", "diff": "@@ -22,6 +22,7 @@ export type DownloadResponder = (\nres: $Response,\n) => Promise<void>;\nexport type HTMLResponder = DownloadResponder;\n+export type HTTPGetResponder = DownloadResponder;\nexport type UploadResponder = (viewer: Viewer, req: $Request) => Promise<*>;\nfunction jsonHandler(\n@@ -49,6 +50,20 @@ function jsonHandler(\n};\n}\n+function httpGetHandler(\n+ responder: HTTPGetResponder,\n+): (req: $Request, res: $Response) => Promise<void> {\n+ return async (req: $Request, res: $Response) => {\n+ let viewer;\n+ try {\n+ viewer = await fetchViewerForJSONRequest(req);\n+ await responder(viewer, req, res);\n+ } catch (e) {\n+ await handleException(e, res, viewer);\n+ }\n+ };\n+}\n+\nfunction downloadHandler(\nresponder: DownloadResponder,\n): (req: $Request, res: $Response) => Promise<void> {\n@@ -152,6 +167,7 @@ async function handleAsyncPromise(promise: Promise<any>) {\nexport {\njsonHandler,\n+ httpGetHandler,\ndownloadHandler,\nhtmlHandler,\nuploadHandler,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "server/src/responders/version-responders.js", "diff": "+// @flow\n+\n+import type { $Response, $Request } from 'express';\n+import t from 'tcomb';\n+\n+import { isStaff } from 'lib/shared/user-utils';\n+import type { CreateNewVersionsRequest } from 'lib/types/version-types';\n+import { ServerError } from 'lib/utils/errors';\n+\n+import createIDs from '../creators/id-creator';\n+import { dbQuery, SQL } from '../database/database';\n+import type { Viewer } from '../session/viewer';\n+import { validateInput, tShape, tDeviceType } from '../utils/validation-utils';\n+\n+const createNewVersionInputValidator = tShape({\n+ codeVersion: t.Number,\n+ deviceType: tDeviceType,\n+});\n+\n+async function createNewVersionResponder(\n+ viewer: Viewer,\n+ req: $Request,\n+ res: $Response,\n+): Promise<void> {\n+ if (!viewer.loggedIn || !isStaff(viewer.userID)) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\n+ const request: CreateNewVersionsRequest = ({\n+ codeVersion: parseInt(req.params.codeVersion),\n+ deviceType: req.params.deviceType,\n+ }: any);\n+ await validateInput(viewer, createNewVersionInputValidator, request);\n+\n+ const [id] = await createIDs('versions', 1);\n+ const row = [id, request.codeVersion, request.deviceType, Date.now()];\n+ const insertQuery = SQL`\n+ INSERT INTO versions (id, code_version, platform, creation_time)\n+ VALUES ${[row]}\n+ `;\n+ try {\n+ await dbQuery(insertQuery);\n+ res.json({ success: true });\n+ } catch {\n+ await dbQuery(SQL`DELETE FROM ids WHERE id = ${id}`);\n+ res.json({ success: false });\n+ }\n+}\n+\n+export { createNewVersionResponder };\n" }, { "change_type": "MODIFY", "old_path": "server/src/server.js", "new_path": "server/src/server.js", "diff": "@@ -11,12 +11,14 @@ import { jsonEndpoints } from './endpoints';\nimport { emailSubscriptionResponder } from './responders/comm-landing-responders';\nimport {\njsonHandler,\n+ httpGetHandler,\ndownloadHandler,\nhtmlHandler,\nuploadHandler,\n} from './responders/handlers';\nimport landingHandler from './responders/landing-handler';\nimport { errorReportDownloadResponder } from './responders/report-responders';\n+import { createNewVersionResponder } from './responders/version-responders';\nimport { websiteResponder } from './responders/website-responders';\nimport { onConnection } from './socket/socket';\nimport {\n@@ -86,6 +88,11 @@ if (cluster.isMaster) {\nrouter.post('/commlanding/subscribe_email', emailSubscriptionResponder);\n+ router.get(\n+ '/create_version/:deviceType/:codeVersion',\n+ httpGetHandler(createNewVersionResponder),\n+ );\n+\nrouter.get(\n'/download_error_report/:reportID',\ndownloadHandler(errorReportDownloadResponder),\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Introduce createNewVersionResponder Test Plan: 1. Try doing it with correct input 2. Try doing it with malformed input 3. Try doing it twice with the same version Reviewers: atul Reviewed By: atul Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1896
129,187
12.08.2021 13:52:33
14,400
0c43d498385eac7cffb26171be7edca330f8fb63
[server] Introduce markVersionDeployedResponder Test Plan: 1. Try it with a version that exists 2. Try it with a version that doesn't exist Reviewers: atul Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "server/src/responders/version-responders.js", "new_path": "server/src/responders/version-responders.js", "diff": "@@ -47,4 +47,31 @@ async function createNewVersionResponder(\n}\n}\n-export { createNewVersionResponder };\n+async function markVersionDeployedResponder(\n+ viewer: Viewer,\n+ req: $Request,\n+ res: $Response,\n+): Promise<void> {\n+ if (!viewer.loggedIn || !isStaff(viewer.userID)) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\n+ const request: CreateNewVersionsRequest = ({\n+ codeVersion: parseInt(req.params.codeVersion),\n+ deviceType: req.params.deviceType,\n+ }: any);\n+ await validateInput(viewer, createNewVersionInputValidator, request);\n+\n+ const updateQuery = SQL`\n+ UPDATE versions\n+ SET deploy_time = ${Date.now()}\n+ WHERE code_version = ${request.codeVersion}\n+ AND platform = ${request.deviceType}\n+ `;\n+ const [results] = await dbQuery(updateQuery);\n+\n+ const success = !!(results.affectedRows && results.affectedRows > 0);\n+ res.json({ success });\n+}\n+\n+export { createNewVersionResponder, markVersionDeployedResponder };\n" }, { "change_type": "MODIFY", "old_path": "server/src/server.js", "new_path": "server/src/server.js", "diff": "@@ -18,7 +18,10 @@ import {\n} from './responders/handlers';\nimport landingHandler from './responders/landing-handler';\nimport { errorReportDownloadResponder } from './responders/report-responders';\n-import { createNewVersionResponder } from './responders/version-responders';\n+import {\n+ createNewVersionResponder,\n+ markVersionDeployedResponder,\n+} from './responders/version-responders';\nimport { websiteResponder } from './responders/website-responders';\nimport { onConnection } from './socket/socket';\nimport {\n@@ -92,6 +95,10 @@ if (cluster.isMaster) {\n'/create_version/:deviceType/:codeVersion',\nhttpGetHandler(createNewVersionResponder),\n);\n+ router.get(\n+ '/mark_version_deployed/:deviceType/:codeVersion',\n+ httpGetHandler(markVersionDeployedResponder),\n+ );\nrouter.get(\n'/download_error_report/:reportID',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Introduce markVersionDeployedResponder Test Plan: 1. Try it with a version that exists 2. Try it with a version that doesn't exist Reviewers: atul Reviewed By: atul Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1897
129,184
12.08.2021 11:49:23
14,400
ef93c3332067a9eeeb8007713c22e1a193cd9f45
[native] codeVersion -> 95
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 94\n- versionName '0.0.94'\n+ versionCode 95\n+ versionName '0.0.95'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.94</string>\n+ <string>0.0.95</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>94</string>\n+ <string>95</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.94</string>\n+ <string>0.0.95</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>94</string>\n+ <string>95</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 94;\n+const codeVersion = 95;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 95
129,184
13.08.2021 10:11:28
14,400
c753eb962961a2d1bf59e742dc37fde2c51f522d
[native] codeVersion -> 96
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 95\n- versionName '0.0.95'\n+ versionCode 96\n+ versionName '0.0.96'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.95</string>\n+ <string>0.0.96</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>95</string>\n+ <string>96</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.95</string>\n+ <string>0.0.96</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>95</string>\n+ <string>96</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 95;\n+const codeVersion = 96;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 96
129,184
16.08.2021 13:37:42
14,400
d3e23d4da1fb9b265645388079aba14202821074
[iOS] Better explain use of camera and photos in the "purpose string" Summary: Changed "purpose string" to appease apps store reviewers Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>NSLocationWhenInUseUsageDescription</key>\n<string>Allow $(PRODUCT_NAME) to access your location</string>\n<key>NSPhotoLibraryUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to access your photos</string>\n+ <string>Allow $(PRODUCT_NAME) to access your photo library so you can send images.</string>\n<key>NSPhotoLibraryAddUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to save photos to your camera roll</string>\n+ <string>Allow $(PRODUCT_NAME) to save images to your photo library.</string>\n<key>NSCameraUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to access the camera</string>\n+ <string>Allow $(PRODUCT_NAME) to access the camera so you can capture and send photos.</string>\n<key>UIAppFonts</key>\n<array>\n<string>OpenSans-Semibold.ttf</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>NSLocationWhenInUseUsageDescription</key>\n<string>Allow $(PRODUCT_NAME) to access your location</string>\n<key>NSPhotoLibraryUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to access your photos</string>\n+ <string>Allow $(PRODUCT_NAME) to access your photo library so you can send images.</string>\n<key>NSPhotoLibraryAddUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to save photos to your camera roll</string>\n+ <string>Allow $(PRODUCT_NAME) to save images to your photo library.</string>\n<key>NSCameraUsageDescription</key>\n- <string>Give $(PRODUCT_NAME) permission to access the camera</string>\n+ <string>Allow $(PRODUCT_NAME) to access the camera so you can capture and send photos.</string>\n<key>UIAppFonts</key>\n<array>\n<string>OpenSans-Semibold.ttf</string>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[iOS] Better explain use of camera and photos in the "purpose string" Summary: Changed "purpose string" to appease apps store reviewers Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1901
129,184
16.08.2021 18:59:10
14,400
a4e636ed8cdf613d46fa278ede0653a706ea3c08
[lib] Make sure to properly rekey local->server message IDs in `mergeNewMessages` Summary: Fixes issue that caused invariant to be triggered for Alicja (https://www.notion.so/commapp/Investigate-message-op-invariants-getting-triggered-ecf7783806f641719db1b9742d71d5c0) Test Plan: No longer able to reproduce issue Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -547,6 +547,11 @@ function mergeNewMessages(\n});\n}\n+ newMessageOps.push({\n+ type: 'remove',\n+ payload: { ids: [...localIDsToServerIDs.keys()] },\n+ });\n+\nfor (const threadID of mustResortThreadMessageIDs) {\nthreads[threadID].messageIDs = sortMessageIDs(messages)(\nthreads[threadID].messageIDs,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Make sure to properly rekey local->server message IDs in `mergeNewMessages` Summary: Fixes issue that caused invariant to be triggered for Alicja (https://www.notion.so/commapp/Investigate-message-op-invariants-getting-triggered-ecf7783806f641719db1b9742d71d5c0) Test Plan: No longer able to reproduce issue Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1905
129,184
16.08.2021 19:18:31
14,400
08e68514d2b88cb87b76f103820bacc4e3f2852a
[lib] remove handling of `fetchMessagesBeforeCursorActionTypes.success` from `mergeNewMessages` Summary: We concluded that this was not necessary Test Plan: none Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -414,16 +414,6 @@ function mergeNewMessages(\nconst oldThread = messageStoreAfterReassignment.threads[threadID];\nconst truncate = truncationStatus[threadID];\nif (!oldThread) {\n- if (actionType === fetchMessagesBeforeCursorActionTypes.success) {\n- // Well, this is weird. Somehow fetchMessagesBeforeCursor got called\n- // for a thread that doesn't exist in the messageStore. How did this\n- // happen? How do we even know what cursor to use if we didn't have\n- // any messages? Anyways, the messageStore is predicated on the\n- // principle that it is current. We can't create a ThreadMessageInfo\n- // for a thread if we can't guarantee this, as the client has no UX\n- // for endReached, only for startReached. We'll have to bail out here.\n- return null;\n- }\nreturn {\nmessageIDs,\nstartReached: truncate === messageTruncationStatus.EXHAUSTIVE,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] remove handling of `fetchMessagesBeforeCursorActionTypes.success` from `mergeNewMessages` Summary: We concluded that this was not necessary Test Plan: none Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1906
129,184
17.08.2021 09:51:33
14,400
9976387b659d319fc96440af0906757e058c4225
[lib] Introduce `RemoveMessagesForThreadOperation` Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "@@ -341,6 +341,11 @@ export type RemoveMessageOperation = {\n+payload: { +ids: $ReadOnlyArray<string> },\n};\n+export type RemoveMessagesForThreadOperation = {\n+ +type: 'remove_messages_for_thread',\n+ +payload: { +threadID: string },\n+};\n+\nexport type ReplaceMessageOperation = {\n+type: 'replace',\n+payload: { +id: string, +messageInfo: RawMessageInfo },\n@@ -354,7 +359,8 @@ export type RekeyMessageOperation = {\nexport type MessageStoreOperation =\n| RemoveMessageOperation\n| ReplaceMessageOperation\n- | RekeyMessageOperation;\n+ | RekeyMessageOperation\n+ | RemoveMessagesForThreadOperation;\nexport const messageTruncationStatus = Object.freeze({\n// EXHAUSTIVE means we've reached the start of the thread. Either the result\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `RemoveMessagesForThreadOperation` Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1907
129,184
17.08.2021 10:02:43
14,400
113bc3cab03e98d1b79c75b892a3f791640523b7
[lib] Handle `RemoveMessagesForThreadOperation` in `processMessageStoreOperations` Summary: Handle `RemoveMessagesForThreadOperation` on the JS side Test Plan: copied example `messageStore.messages` from redux dev tools and tested functionality in repl Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -633,6 +633,12 @@ function processMessageStoreOperations(\nfor (const id of operation.payload.ids) {\ndelete processedMessages[id];\n}\n+ } else if (operation.type === 'remove_messages_for_thread') {\n+ for (const msgID in processedMessages) {\n+ if (processedMessages[msgID].threadID === operation.payload.threadID) {\n+ delete processedMessages[msgID];\n+ }\n+ }\n} else if (operation.type === 'rekey') {\nprocessedMessages[operation.payload.to] =\nprocessedMessages[operation.payload.from];\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Handle `RemoveMessagesForThreadOperation` in `processMessageStoreOperations` Summary: Handle `RemoveMessagesForThreadOperation` on the JS side Test Plan: copied example `messageStore.messages` from redux dev tools and tested functionality in repl Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1908
129,184
17.08.2021 14:00:12
14,400
7e9d02a80d891a7614164ef603b1e245c85bfe29
[lib] Remove `mediaType` invariant from `message-reducer` for `updateMultimediaMessageMediaActionType Summary: na Test Plan: flow, and was able to upload/send image on web (https://blob.sh/atul/ecd4.png) Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -1194,11 +1194,8 @@ function reduceMessageStore(\nif (singleMedia.id !== currentMediaID) {\nmedia.push(singleMedia);\n} else {\n- invariant(\n- mediaUpdate.type === 'photo',\n- 'mediaUpdate should be of type photo',\n- );\n- media.push({ ...singleMedia, ...mediaUpdate });\n+ const updatedMedia: Image = ({ ...singleMedia, ...mediaUpdate }: any);\n+ media.push(updatedMedia);\nreplaced = true;\n}\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Remove `mediaType` invariant from `message-reducer` for `updateMultimediaMessageMediaActionType Summary: na Test Plan: flow, and was able to upload/send image on web (https://blob.sh/atul/ecd4.png) Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1912
129,184
17.08.2021 14:27:03
14,400
fa98febf83a50fa72dbd2e12abdb9e312c4e571f
[native] codeVersion -> 97
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 96\n- versionName '0.0.96'\n+ versionCode 97\n+ versionName '0.0.97'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.96</string>\n+ <string>0.0.97</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>96</string>\n+ <string>97</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.96</string>\n+ <string>0.0.97</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>96</string>\n+ <string>97</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 96;\n+const codeVersion = 97;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 97
129,191
17.08.2021 11:43:16
-7,200
58f9b735ee935abadb351e42bdc93f49c40a0438
[native] Wrap useAnimatedMessageTooltipButton arguments in an object Summary: We're going to add new arguments and introducing an object args will make the code more readable Test Plan: Flow. Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/multimedia-message-tooltip-button.react.js", "new_path": "native/chat/multimedia-message-tooltip-button.react.js", "diff": "@@ -26,12 +26,12 @@ function MultimediaMessageTooltipButton(props: Props): React.Node {\nconst { progress } = props;\nconst { item, verticalBounds, initialCoordinates } = props.route.params;\n- const { style: messageContainerStyle } = useAnimatedMessageTooltipButton(\n- item,\n+ const { style: messageContainerStyle } = useAnimatedMessageTooltipButton({\n+ sourceMessage: item,\ninitialCoordinates,\n- verticalBounds,\n+ messageListVerticalBounds: verticalBounds,\nprogress,\n- );\n+ });\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\n" }, { "change_type": "MODIFY", "old_path": "native/chat/robotext-message-tooltip-button.react.js", "new_path": "native/chat/robotext-message-tooltip-button.react.js", "diff": "@@ -24,12 +24,12 @@ function RobotextMessageTooltipButton(props: Props): React.Node {\nconst windowWidth = useSelector(state => state.dimensions.width);\nconst { item, verticalBounds, initialCoordinates } = props.route.params;\n- const { style: messageContainerStyle } = useAnimatedMessageTooltipButton(\n- item,\n+ const { style: messageContainerStyle } = useAnimatedMessageTooltipButton({\n+ sourceMessage: item,\ninitialCoordinates,\n- verticalBounds,\n+ messageListVerticalBounds: verticalBounds,\nprogress,\n- );\n+ });\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\n" }, { "change_type": "MODIFY", "old_path": "native/chat/text-message-tooltip-button.react.js", "new_path": "native/chat/text-message-tooltip-button.react.js", "diff": "@@ -29,12 +29,12 @@ function TextMessageTooltipButton(props: Props): React.Node {\nstyle: messageContainerStyle,\nthreadColorOverride,\nisThreadColorDarkOverride,\n- } = useAnimatedMessageTooltipButton(\n- item,\n+ } = useAnimatedMessageTooltipButton({\n+ sourceMessage: item,\ninitialCoordinates,\n- verticalBounds,\n+ messageListVerticalBounds: verticalBounds,\nprogress,\n- );\n+ });\nconst headerStyle = React.useMemo(() => {\nconst bottom = initialCoordinates.height;\n" }, { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -176,12 +176,19 @@ function useMessageTargetParameters(\n};\n}\n-function useAnimatedMessageTooltipButton(\n- sourceMessage: ChatMessageInfoItemWithHeight,\n- initialCoordinates: LayoutCoordinates,\n- messageListVerticalBounds: VerticalBounds,\n- progress: Node,\n-): {\n+type AnimatedMessageArgs = {\n+ +sourceMessage: ChatMessageInfoItemWithHeight,\n+ +initialCoordinates: LayoutCoordinates,\n+ +messageListVerticalBounds: VerticalBounds,\n+ +progress: Node,\n+};\n+\n+function useAnimatedMessageTooltipButton({\n+ sourceMessage,\n+ initialCoordinates,\n+ messageListVerticalBounds,\n+ progress,\n+}: AnimatedMessageArgs): {\n+style: AnimatedViewStyle,\n+threadColorOverride: ?Node,\n+isThreadColorDarkOverride: ?boolean,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Wrap useAnimatedMessageTooltipButton arguments in an object Summary: We're going to add new arguments and introducing an object args will make the code more readable Test Plan: Flow. Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1909
129,184
18.08.2021 15:01:40
14,400
71f835ac4c9d7d50253ac7714532dee72d2221fd
[lib] Skip adding new messages from unwatched threads Summary: We want to filter out new messages that don't belong to watched threads Test Plan: in progress Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -284,9 +284,13 @@ function mergeNewMessages(\n'messageStoreAfterOperations.messages should be equal to' +\n'messageStoreAfterReassignment.messages',\n);\n+ const localIDsToServerIDs: Map<string, string> = new Map();\n+ const watchedIDs = [...threadWatcher.getWatchedIDs(), ...reassignedThreadIDs];\nconst unshimmed = unshimMessageInfos(newMessageInfos);\n- const localIDsToServerIDs: Map<string, string> = new Map();\n+ const unshimmedMessagesOfWatchedThreads = unshimmed.filter(msg =>\n+ threadIsWatched(msg.threadID, threadInfos[msg.threadID], watchedIDs),\n+ );\nconst orderedNewMessageInfos = _flow(\n_map((messageInfo: RawMessageInfo) => {\nconst { id: inputID } = messageInfo;\n@@ -396,7 +400,7 @@ function mergeNewMessages(\n: messageInfo;\n}),\nsortMessageInfoList,\n- )(unshimmed);\n+ )(unshimmedMessagesOfWatchedThreads);\nconst threadsToMessageIDs = threadsToMessageIDsFromMessageInfos(\norderedNewMessageInfos,\n@@ -404,7 +408,6 @@ function mergeNewMessages(\nconst oldMessageInfosToCombine = [];\nconst mustResortThreadMessageIDs = [];\nconst lastPruned = Date.now();\n- const watchedIDs = [...threadWatcher.getWatchedIDs(), ...reassignedThreadIDs];\nconst local = {};\nconst threads = _flow(\n_pickBy((messageIDs: string[], threadID: string) =>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Skip adding new messages from unwatched threads Summary: We want to filter out new messages that don't belong to watched threads Test Plan: in progress Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1914
129,184
17.08.2021 16:20:31
14,400
2f9dd656296bb45cdcec570938c17c2366048ff5
[lib] Introduce `assertMessageStoreMessagesAreEqual` and use in `mergeNewMessages` Summary: Factor out invariant into separate function and use in `mergeNewMessages` Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -124,6 +124,33 @@ function threadIsWatched(\n);\n}\n+function assertMessageStoreMessagesAreEqual(\n+ processedMessageStore: MessageStore,\n+ expectedMessageStore: MessageStore,\n+ location: string,\n+) {\n+ const processedMessageStoreKeys = Object.keys(processedMessageStore.messages);\n+ const expectedMessageStoreKeys = Object.keys(expectedMessageStore.messages);\n+\n+ const inProcessedButNotExpected = _difference(processedMessageStoreKeys)(\n+ expectedMessageStoreKeys,\n+ );\n+ const inExpectedButNotProcessed = _difference(expectedMessageStoreKeys)(\n+ processedMessageStoreKeys,\n+ );\n+\n+ invariant(\n+ PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n+ _isEqual(processedMessageStore.messages)(expectedMessageStore.messages),\n+ `${location}: processedMessageStore.messages should be equal` +\n+ ` to expectedMessageStore.messages.` +\n+ ` ${inProcessedButNotExpected.toString()}` +\n+ ` are message IDs in processed but not expected.` +\n+ ` ${inExpectedButNotProcessed.toString()}` +\n+ ` are message IDs in expected but not processed.`,\n+ );\n+}\n+\ntype FreshMessageStoreResult = {\n+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,\n+messageStore: MessageStore,\n@@ -275,15 +302,12 @@ function mergeNewMessages(\noldMessageStore,\nreassignMessagesOps,\n);\n-\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(messageStoreAfterOperations.messages)(\n- messageStoreAfterReassignment.messages,\n- ),\n- 'messageStoreAfterOperations.messages should be equal to' +\n- 'messageStoreAfterReassignment.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ messageStoreAfterOperations,\n+ messageStoreAfterReassignment,\n+ `${actionType}|reassignment`,\n);\n+\nconst localIDsToServerIDs: Map<string, string> = new Map();\nconst watchedIDs = [...threadWatcher.getWatchedIDs(), ...reassignedThreadIDs];\n@@ -566,10 +590,11 @@ function mergeNewMessages(\nmessageStoreAfterReassignment,\nnewMessageOps,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(mergedMessageStore.messages),\n- `${actionType}: processed.messages should be equal to mergedMessageStore.messages`,\n+\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ mergedMessageStore,\n+ `${actionType}|processed`,\n);\nreturn {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `assertMessageStoreMessagesAreEqual` and use in `mergeNewMessages` Summary: Factor out invariant into separate function and use in `mergeNewMessages` Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1916
129,184
18.08.2021 16:54:03
14,400
828bf044af228d5ae9577f1629a2d0a35ff4c3ec
[lib] Use `assertMessageStoreMessagesAreEqual` everywhere else in `message-reducer` Summary: Replace invariants with `assertMessageStoreMessagesAreEqual` everywhere else in file Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -710,10 +710,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(freshStore.messages),\n- 'messageStore.messages should be equal to processedMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ freshStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: freshStore };\n@@ -819,11 +819,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(filteredMessageStore.messages),\n- 'processedMessageStore.messages should be equal ' +\n- 'to filteredMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ filteredMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: filteredMessageStore };\n@@ -976,11 +975,10 @@ function reduceMessageStore(\n};\nconst newMessageStore = { ...messageStore, messages, threads, local };\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(newMessageStore.messages),\n- 'processedMessageStore.messages should be equal' +\n- ' to newMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ newMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: newMessageStore };\n}\n@@ -1017,11 +1015,10 @@ function reduceMessageStore(\ncurrentAsOf: messageStore.currentAsOf,\n};\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(newMessageStore.messages),\n- 'processedMessageStore.messages should be equal' +\n- ' to newMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ newMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: newMessageStore };\n@@ -1122,11 +1119,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(updatedMessageStore.messages),\n- 'processedMessageStore.messages should be equal to' +\n- ' updatedMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ updatedMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: updatedMessageStore };\n@@ -1204,11 +1200,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(prunedMessageStore.messages),\n- 'messageStore.messages should be equal to' +\n- ' prunedMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ prunedMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: prunedMessageStore };\n@@ -1286,11 +1281,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(updatedMessageStore.messages),\n- 'processedMessageStore.messages should be equal to' +\n- ' updatedMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ updatedMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: updatedMessageStore };\n@@ -1339,11 +1333,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(updatedMessageStore.messages)(processedMessageStore.messages),\n- 'processedMessageStore.messages should be equal to' +\n- ' updatedMessageStore.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ updatedMessageStore,\n+ processedMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: updatedMessageStore };\n@@ -1402,11 +1395,11 @@ function reduceMessageStore(\nmessageStore,\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(processedMessageStore.messages)(newMessageStore.messages),\n- 'processedMessageStore.messages should be equal to' +\n- ' newMessageStore.messages',\n+\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ newMessageStore,\n+ action.type,\n);\nreturn { messageStoreOperations, messageStore: newMessageStore };\n@@ -1421,13 +1414,10 @@ function reduceMessageStore(\nmessageStoreOperations,\n);\n- invariant(\n- PROCESSED_MSG_STORE_INVARIANTS_DISABLED ||\n- _isEqual(messageStoreAfterReassignment.messages)(\n- processedMessageStore.messages,\n- ),\n- 'processedMessageStore.messages should be equal to' +\n- ' messageStoreAfterReassignment.messages',\n+ assertMessageStoreMessagesAreEqual(\n+ processedMessageStore,\n+ messageStoreAfterReassignment,\n+ action.type,\n);\nreturn {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Use `assertMessageStoreMessagesAreEqual` everywhere else in `message-reducer` Summary: Replace invariants with `assertMessageStoreMessagesAreEqual` everywhere else in file Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1917
129,184
18.08.2021 18:02:28
14,400
fc456d5c4586e73f17d90074c9fe1589ecf73079
[native] codeVersion -> 98
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 97\n- versionName '0.0.97'\n+ versionCode 98\n+ versionName '0.0.98'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.97</string>\n+ <string>0.0.98</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>97</string>\n+ <string>98</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.97</string>\n+ <string>0.0.98</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>97</string>\n+ <string>98</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 97;\n+const codeVersion = 98;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 98
129,184
18.08.2021 18:16:07
14,400
1cb3f4c3ebd4b84e16e8fcb63b7cf8c886cdea1d
[native] codeVersion -> 99
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 98\n- versionName '0.0.98'\n+ versionCode 99\n+ versionName '0.0.99'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.98</string>\n+ <string>0.0.99</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>98</string>\n+ <string>99</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.98</string>\n+ <string>0.0.99</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>98</string>\n+ <string>99</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 98;\n+const codeVersion = 99;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 99
129,185
20.08.2021 09:43:14
-7,200
9239da312a2440fe339412cc46cda0371c05dbec
[web] move links style to markdown.css Summary: I moved links css from chat-message-list.css to markdown.css. Test Plan: Open web chat and send link. It should be still styled. Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-message-list.css", "new_path": "web/chat/chat-message-list.css", "diff": "@@ -255,14 +255,6 @@ div.darkTextMessage {\ndiv.lightTextMessage {\ncolor: black;\n}\n-div.darkTextMessage a {\n- color: white;\n- text-decoration: underline;\n-}\n-div.lightTextMessage a {\n- color: #2a5db0;\n- text-decoration: underline;\n-}\ndiv.content {\ndisplay: flex;\n" }, { "change_type": "MODIFY", "old_path": "web/markdown/markdown.css", "new_path": "web/markdown/markdown.css", "diff": "@@ -68,3 +68,13 @@ div.markdown ul {\npadding-left: 1em;\nmargin-left: 0.5em;\n}\n+\n+div.markdown a {\n+ text-decoration: underline;\n+}\n+div.lightBackground a {\n+ color: #2a5db0;\n+}\n+div.darkBackground a {\n+ color: white;\n+}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] move links style to markdown.css Summary: I moved links css from chat-message-list.css to markdown.css. Test Plan: Open web chat and send link. It should be still styled. Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1922
129,184
20.08.2021 13:45:40
14,400
bd2e3fabeacf95271e69cffd3d5f5d9369b6e7e2
[lib] Bump up `minCodeVersion` for video playback content Summary: We were getting close to this placeholder value (we're currently on build 99), so bumped it up to arbitrary large number. Test Plan: na, straightforward change Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/shared/messages/multimedia-message-spec.js", "new_path": "lib/shared/messages/multimedia-message-spec.js", "diff": "@@ -173,7 +173,7 @@ export const multimediaMessageSpec: MessageSpec<\nplatformDetails,\n);\n// TODO figure out first native codeVersion supporting video playback\n- if (hasMinCodeVersion(platformDetails, 100)) {\n+ if (hasMinCodeVersion(platformDetails, 99999)) {\nreturn shimmedRawMessageInfo;\n}\nconst { id } = shimmedRawMessageInfo;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Bump up `minCodeVersion` for video playback content Summary: We were getting close to this placeholder value (we're currently on build 99), so bumped it up to arbitrary large number. Test Plan: na, straightforward change Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1925
129,184
21.08.2021 21:01:59
14,400
9523a6a52efad0f60c26785b534d4fcd731251dc
[iOS] Remove `TestCrypto.h` from xcodeproj Summary: I think this was probably just left in xcodeproj on accident? Test Plan: na Reviewers: karol-bisztyga, ashoat Subscribers: palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/ios/Comm.xcodeproj/project.pbxproj", "new_path": "native/ios/Comm.xcodeproj/project.pbxproj", "diff": "713EE40626C6676B003D7C48 /* CommTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CommTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n713EE40A26C6676B003D7C48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n713EE41026C66B80003D7C48 /* CryptoTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CryptoTest.mm; sourceTree = \"<group>\"; };\n- 713EE41826C66CAC003D7C48 /* TestCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestCrypto.h; sourceTree = \"<group>\"; };\n718DE99C2653D41C00365824 /* WorkerThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerThread.cpp; sourceTree = \"<group>\"; };\n718DE99D2653D41C00365824 /* WorkerThread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerThread.h; sourceTree = \"<group>\"; };\n71B8CCBD26BD4DEB0040C0A2 /* CommSecureStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommSecureStore.h; sourceTree = \"<group>\"; };\npath = CommTests;\nsourceTree = \"<group>\";\n};\n- 713EE41726C66C96003D7C48 /* Tests */ = {\n- isa = PBXGroup;\n- children = (\n- 713EE41826C66CAC003D7C48 /* TestCrypto.h */,\n- );\n- path = Tests;\n- sourceTree = \"<group>\";\n- };\n71B8CCB626BD30EC0040C0A2 /* CommCoreImplementations */ = {\nisa = PBXGroup;\nchildren = (\n71BE84372636A944002849D2 /* CommonCpp */ = {\nisa = PBXGroup;\nchildren = (\n- 713EE41726C66C96003D7C48 /* Tests */,\n71BF5B6A26B3FCFF00EDE27D /* CryptoTools */,\n71BE84382636A944002849D2 /* Tools */,\n71BE843A2636A944002849D2 /* NativeModules */,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[iOS] Remove `TestCrypto.h` from xcodeproj Summary: I think this was probably just left in xcodeproj on accident? Test Plan: na Reviewers: karol-bisztyga, ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1934
129,184
22.08.2021 00:00:19
14,400
ad3ec1c9ee89a02e58bc2ffac2def373bd9e84c6
[CommCoreModule] Modify remove message operation to handle list of indices Summary: Change `processMessageStoreOperations` on C++ side to correctly handle new "remove" API Test Plan: Haven't tested yet, will test the C++ changes together before landing Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -243,7 +243,8 @@ std::vector<Message> SQLiteQueryExecutor::getAllMessages() const {\n}\nvoid SQLiteQueryExecutor::removeMessages(std::vector<int> ids) const {\n- SQLiteQueryExecutor::getStorage().remove<Message>(ids);\n+ SQLiteQueryExecutor::getStorage().remove_all<Message>(\n+ where(in(&Message::id, ids)));\n}\nvoid SQLiteQueryExecutor::replaceMessage(Message message) const {\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "diff": "@@ -233,9 +233,12 @@ jsi::Value CommCoreModule::processMessageStoreOperations(\nif (op_type == REMOVE_OPERATION) {\nauto payload_obj = op.getProperty(rt, \"payload\").asObject(rt);\n- auto msg_idx =\n- std::stoi(payload_obj.getProperty(rt, \"id\").asString(rt).utf8(rt));\n- removed_msg_ids.push_back(msg_idx);\n+ auto msg_ids =\n+ payload_obj.getProperty(rt, \"ids\").asObject(rt).asArray(rt);\n+ for (auto msg_idx = 0; msg_idx < msg_ids.size(rt); msg_idx++) {\n+ removed_msg_ids.push_back(std::stoi(\n+ msg_ids.getValueAtIndex(rt, msg_idx).asString(rt).utf8(rt)));\n+ }\n} else if (op_type == REPLACE_OPERATION) {\nauto msg_obj = op.getProperty(rt, \"payload\").asObject(rt);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Modify remove message operation to handle list of indices Summary: Change `processMessageStoreOperations` on C++ side to correctly handle new "remove" API Test Plan: Haven't tested yet, will test the C++ changes together before landing Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1877
129,184
22.08.2021 00:03:05
14,400
58922075cfb0e362d9dbfadb2d8e97e040917534
[CommCoreModule] Remove `creation` from `SQLiteMessageInfo` type and snake case future_type Summary: Already removed creation column on C++ side Snake case `future_type` so it matches up with C++ side/db column name Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/schema/CommCoreModuleSchema.js", "new_path": "native/schema/CommCoreModuleSchema.js", "diff": "@@ -10,10 +10,9 @@ type SQLiteMessageInfo = {\n+thread: string,\n+user: string,\n+type: string,\n- +futureType: string,\n+ +future_type: string,\n+content: string,\n+time: string,\n- +creation: string,\n};\ntype SQLiteDraftInfo = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Remove `creation` from `SQLiteMessageInfo` type and snake case future_type Summary: Already removed creation column on C++ side Snake case `future_type` so it matches up with C++ side/db column name Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1935
129,184
20.08.2021 15:33:34
14,400
23bc05fa8d9ef990daeec7f97d72c4fbf3384609
[lib] Call `filterByNewThreadInfos` at top of `mergeNewMessages` Summary: Refactor `mergeNewMessages` to include call to `filterByNewThreadInfos` as discussed Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -298,13 +298,18 @@ function mergeNewMessages(\nreassignedThreadIDs,\n} = reassignMessagesToRealizedThreads(oldMessageStore, threadInfos);\n+ const {\n+ messageStoreOperations: filterUnwatchedThreadOps,\n+ messageStore: filteredMessageStore,\n+ } = filterByNewThreadInfos(messageStoreAfterReassignment, threadInfos);\n+\nconst messageStoreAfterOperations = processMessageStoreOperations(\noldMessageStore,\n- reassignMessagesOps,\n+ [...reassignMessagesOps, ...filterUnwatchedThreadOps],\n);\nassertMessageStoreMessagesAreEqual(\nmessageStoreAfterOperations,\n- messageStoreAfterReassignment,\n+ filteredMessageStore,\n`${actionType}|reassignment`,\n);\n@@ -323,8 +328,7 @@ function mergeNewMessages(\n!threadIsPending(messageInfo.threadID),\n'new messageInfos should have realized thread id',\n);\n- const currentMessageInfo =\n- messageStoreAfterReassignment.messages[inputID];\n+ const currentMessageInfo = filteredMessageStore.messages[inputID];\nif (\nmessageInfo.type === messageTypes.TEXT ||\nmessageInfo.type === messageTypes.IMAGES ||\n@@ -332,7 +336,7 @@ function mergeNewMessages(\n) {\nconst { localID: inputLocalID } = messageInfo;\nconst currentLocalMessageInfo = inputLocalID\n- ? messageStoreAfterReassignment.messages[inputLocalID]\n+ ? filteredMessageStore.messages[inputLocalID]\n: null;\nif (currentMessageInfo && currentMessageInfo.localID) {\n// If the client already has a RawMessageInfo with this serverID, keep\n@@ -438,7 +442,7 @@ function mergeNewMessages(\nthreadIsWatched(threadID, threadInfos[threadID], watchedIDs),\n),\n_mapValuesWithKeys((messageIDs: string[], threadID: string) => {\n- const oldThread = messageStoreAfterReassignment.threads[threadID];\n+ const oldThread = filteredMessageStore.threads[threadID];\nconst truncate = truncationStatus[threadID];\nif (!oldThread) {\nreturn {\n@@ -471,10 +475,10 @@ function mergeNewMessages(\n}\nconst oldNotInNew = _difference(oldMessageIDs)(messageIDs);\nfor (const id of oldNotInNew) {\n- const oldMessageInfo = messageStoreAfterReassignment.messages[id];\n+ const oldMessageInfo = filteredMessageStore.messages[id];\ninvariant(oldMessageInfo, `could not find ${id} in messageStore`);\noldMessageInfosToCombine.push(oldMessageInfo);\n- const localInfo = messageStoreAfterReassignment.local[id];\n+ const localInfo = filteredMessageStore.local[id];\nif (localInfo) {\nlocal[id] = localInfo;\n}\n@@ -506,7 +510,7 @@ function mergeNewMessages(\n)(threadsToMessageIDs);\nconst removeMessagesFromUnwatchedThreadOps: MessageStoreOperation[] = [];\n- for (const threadID in messageStoreAfterReassignment.threads) {\n+ for (const threadID in filteredMessageStore.threads) {\nif (threads[threadID]) {\ncontinue;\n} else if (!threadIsWatched(threadID, threadInfos[threadID], watchedIDs)) {\n@@ -516,7 +520,7 @@ function mergeNewMessages(\n});\ncontinue;\n}\n- let thread = messageStoreAfterReassignment.threads[threadID];\n+ let thread = filteredMessageStore.threads[threadID];\nconst truncate = truncationStatus[threadID];\nif (truncate === messageTruncationStatus.EXHAUSTIVE) {\nthread = {\n@@ -526,11 +530,11 @@ function mergeNewMessages(\n}\nthreads[threadID] = thread;\nfor (const id of thread.messageIDs) {\n- const messageInfo = messageStoreAfterReassignment.messages[id];\n+ const messageInfo = filteredMessageStore.messages[id];\nif (messageInfo) {\noldMessageInfosToCombine.push(messageInfo);\n}\n- const localInfo = messageStoreAfterReassignment.local[id];\n+ const localInfo = filteredMessageStore.local[id];\nif (localInfo) {\nlocal[id] = localInfo;\n}\n@@ -581,13 +585,13 @@ function mergeNewMessages(\nconst currentAsOf = Math.max(\norderedNewMessageInfos.length > 0 ? orderedNewMessageInfos[0].time : 0,\n- messageStoreAfterReassignment.currentAsOf,\n+ filteredMessageStore.currentAsOf,\n);\nconst mergedMessageStore = { messages, threads, local, currentAsOf };\nconst processedMessageStore = processMessageStoreOperations(\n- messageStoreAfterReassignment,\n+ filteredMessageStore,\nnewMessageOps,\n);\n@@ -600,6 +604,7 @@ function mergeNewMessages(\nreturn {\nmessageStoreOperations: [\n...reassignMessagesOps,\n+ ...filterUnwatchedThreadOps,\n...removeMessagesFromUnwatchedThreadOps,\n...newMessageOps,\n],\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Call `filterByNewThreadInfos` at top of `mergeNewMessages` Summary: Refactor `mergeNewMessages` to include call to `filterByNewThreadInfos` as discussed Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1926
129,184
20.08.2021 15:40:09
14,400
ecbb4bb0ce39c8651d0daa13f3d6121553351149
[lib] Remove `removeMessagesFromUnwatchedThreadOps` from `mergeNewMessages` Summary: We no longer need these ops because we're calling `filterByNewThreadInfos` which creates them for us. Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -509,16 +509,9 @@ function mergeNewMessages(\n_pickBy(thread => !!thread),\n)(threadsToMessageIDs);\n- const removeMessagesFromUnwatchedThreadOps: MessageStoreOperation[] = [];\nfor (const threadID in filteredMessageStore.threads) {\nif (threads[threadID]) {\ncontinue;\n- } else if (!threadIsWatched(threadID, threadInfos[threadID], watchedIDs)) {\n- removeMessagesFromUnwatchedThreadOps.push({\n- type: 'remove_messages_for_thread',\n- payload: { threadID },\n- });\n- continue;\n}\nlet thread = filteredMessageStore.threads[threadID];\nconst truncate = truncationStatus[threadID];\n@@ -605,7 +598,6 @@ function mergeNewMessages(\nmessageStoreOperations: [\n...reassignMessagesOps,\n...filterUnwatchedThreadOps,\n- ...removeMessagesFromUnwatchedThreadOps,\n...newMessageOps,\n],\nmessageStore: mergedMessageStore,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Remove `removeMessagesFromUnwatchedThreadOps` from `mergeNewMessages` Summary: We no longer need these ops because we're calling `filterByNewThreadInfos` which creates them for us. Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1928
129,184
20.08.2021 17:16:14
14,400
30cfb145e2a9f63384e400843c632a24ea0fe1f1
[lib] Call `reassignMessagesToRealizedThreads` from `filterByNewThreadInfos` and remove `reassignMessagesToRealizedThreads` from `mergeNewMessages` Summary: Refactor as discussed Test Plan: set breakpoints and observed correct behavior Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -292,20 +292,15 @@ function mergeNewMessages(\nthreadInfos: { +[threadID: string]: RawThreadInfo },\nactionType: *,\n): MergeNewMessagesResult {\n- const {\n- messageStoreOperations: reassignMessagesOps,\n- messageStore: messageStoreAfterReassignment,\n- reassignedThreadIDs,\n- } = reassignMessagesToRealizedThreads(oldMessageStore, threadInfos);\n-\nconst {\nmessageStoreOperations: filterUnwatchedThreadOps,\nmessageStore: filteredMessageStore,\n- } = filterByNewThreadInfos(messageStoreAfterReassignment, threadInfos);\n+ reassignedThreadIDs,\n+ } = filterByNewThreadInfos(oldMessageStore, threadInfos);\nconst messageStoreAfterOperations = processMessageStoreOperations(\noldMessageStore,\n- [...reassignMessagesOps, ...filterUnwatchedThreadOps],\n+ filterUnwatchedThreadOps,\n);\nassertMessageStoreMessagesAreEqual(\nmessageStoreAfterOperations,\n@@ -595,11 +590,7 @@ function mergeNewMessages(\n);\nreturn {\n- messageStoreOperations: [\n- ...reassignMessagesOps,\n- ...filterUnwatchedThreadOps,\n- ...newMessageOps,\n- ],\n+ messageStoreOperations: [...filterUnwatchedThreadOps, ...newMessageOps],\nmessageStore: mergedMessageStore,\n};\n}\n@@ -607,22 +598,29 @@ function mergeNewMessages(\ntype FilterByNewThreadInfosResult = {\n+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,\n+messageStore: MessageStore,\n+ +reassignedThreadIDs: $ReadOnlyArray<string>,\n};\nfunction filterByNewThreadInfos(\nmessageStore: MessageStore,\nthreadInfos: { +[id: string]: RawThreadInfo },\n): FilterByNewThreadInfosResult {\n- const watchedIDs = threadWatcher.getWatchedIDs();\n+ const messageStoreOperations: MessageStoreOperation[] = [];\n+ const {\n+ messageStore: reassignedMessageStore,\n+ messageStoreOperations: reassignMessagesOps,\n+ reassignedThreadIDs,\n+ } = reassignMessagesToRealizedThreads(messageStore, threadInfos);\n+ messageStoreOperations.push(...reassignMessagesOps);\n+ const watchedIDs = [...threadWatcher.getWatchedIDs(), ...reassignedThreadIDs];\nconst watchedThreadInfos = _pickBy((threadInfo: RawThreadInfo) =>\nthreadIsWatched(threadInfo.id, threadInfo, watchedIDs),\n)(threadInfos);\nconst messageIDsToRemove = [];\n- const messageStoreOperations: MessageStoreOperation[] = [];\n- for (const threadID in messageStore.threads) {\n+ for (const threadID in reassignedMessageStore.threads) {\nif (watchedThreadInfos[threadID]) {\ncontinue;\n}\n- for (const id of messageStore.threads[threadID].messageIDs) {\n+ for (const id of reassignedMessageStore.threads[threadID].messageIDs) {\nmessageIDsToRemove.push(id);\n}\nmessageStoreOperations.push({\n@@ -634,11 +632,14 @@ function filterByNewThreadInfos(\nreturn {\nmessageStoreOperations,\nmessageStore: {\n- messages: _omit(messageIDsToRemove)(messageStore.messages),\n- threads: _pick(Object.keys(watchedThreadInfos))(messageStore.threads),\n- local: _omit(messageIDsToRemove)(messageStore.local),\n- currentAsOf: messageStore.currentAsOf,\n+ messages: _omit(messageIDsToRemove)(reassignedMessageStore.messages),\n+ threads: _pick(Object.keys(watchedThreadInfos))(\n+ reassignedMessageStore.threads,\n+ ),\n+ local: _omit(messageIDsToRemove)(reassignedMessageStore.local),\n+ currentAsOf: reassignedMessageStore.currentAsOf,\n},\n+ reassignedThreadIDs,\n};\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Call `reassignMessagesToRealizedThreads` from `filterByNewThreadInfos` and remove `reassignMessagesToRealizedThreads` from `mergeNewMessages` Summary: Refactor as discussed Test Plan: set breakpoints and observed correct behavior Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1929
129,184
23.08.2021 17:28:22
14,400
7d6577a571cf10110597202b36fc4b5671f3dc06
[lib] Rename `filterByNewThreadInfos` to `reassignMessagesToRealizedAndWatchedThreads` Summary: I think the new name better explains the behavior of the function. I'm very open to changing it to something more clear. Test Plan: just a rename Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -296,7 +296,7 @@ function mergeNewMessages(\nmessageStoreOperations: filterUnwatchedThreadOps,\nmessageStore: filteredMessageStore,\nreassignedThreadIDs,\n- } = filterByNewThreadInfos(oldMessageStore, threadInfos);\n+ } = updateMessageStoreWithLatestThreadInfos(oldMessageStore, threadInfos);\nconst messageStoreAfterOperations = processMessageStoreOperations(\noldMessageStore,\n@@ -595,15 +595,15 @@ function mergeNewMessages(\n};\n}\n-type FilterByNewThreadInfosResult = {\n+type UpdateMessageStoreWithLatestThreadInfosResult = {\n+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,\n+messageStore: MessageStore,\n+reassignedThreadIDs: $ReadOnlyArray<string>,\n};\n-function filterByNewThreadInfos(\n+function updateMessageStoreWithLatestThreadInfos(\nmessageStore: MessageStore,\nthreadInfos: { +[id: string]: RawThreadInfo },\n-): FilterByNewThreadInfosResult {\n+): UpdateMessageStoreWithLatestThreadInfosResult {\nconst messageStoreOperations: MessageStoreOperation[] = [];\nconst {\nmessageStore: reassignedMessageStore,\n@@ -811,7 +811,7 @@ function reduceMessageStore(\nconst {\nmessageStoreOperations,\nmessageStore: filteredMessageStore,\n- } = filterByNewThreadInfos(messageStore, newThreadInfos);\n+ } = updateMessageStoreWithLatestThreadInfos(messageStore, newThreadInfos);\nconst processedMessageStore = processMessageStoreOperations(\nmessageStore,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Rename `filterByNewThreadInfos` to `reassignMessagesToRealizedAndWatchedThreads` Summary: I think the new name better explains the behavior of the function. I'm very open to changing it to something more clear. Test Plan: just a rename Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1930
129,184
23.08.2021 18:51:12
14,400
682b0f881daa007be04b6455ab61caf7cd02d648
[lib] Misc naming tweaks in `mergeNewMessages` Summary: Thought these changes made things a little more readable. No functional changes. Test Plan: should be straightforward refactor Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -293,27 +293,35 @@ function mergeNewMessages(\nactionType: *,\n): MergeNewMessagesResult {\nconst {\n- messageStoreOperations: filterUnwatchedThreadOps,\n- messageStore: filteredMessageStore,\n+ messageStoreOperations: updateWithLatestThreadInfosOps,\n+ messageStore: updatedMessageStore,\nreassignedThreadIDs,\n} = updateMessageStoreWithLatestThreadInfos(oldMessageStore, threadInfos);\n- const messageStoreAfterOperations = processMessageStoreOperations(\n+ const messageStoreAfterUpdateOps = processMessageStoreOperations(\noldMessageStore,\n- filterUnwatchedThreadOps,\n+ updateWithLatestThreadInfosOps,\n);\nassertMessageStoreMessagesAreEqual(\n- messageStoreAfterOperations,\n- filteredMessageStore,\n- `${actionType}|reassignment`,\n+ messageStoreAfterUpdateOps,\n+ updatedMessageStore,\n+ `${actionType}| reassignment and filtering`,\n);\nconst localIDsToServerIDs: Map<string, string> = new Map();\n- const watchedIDs = [...threadWatcher.getWatchedIDs(), ...reassignedThreadIDs];\n- const unshimmed = unshimMessageInfos(newMessageInfos);\n- const unshimmedMessagesOfWatchedThreads = unshimmed.filter(msg =>\n- threadIsWatched(msg.threadID, threadInfos[msg.threadID], watchedIDs),\n+ const watchedThreadIDs = [\n+ ...threadWatcher.getWatchedIDs(),\n+ ...reassignedThreadIDs,\n+ ];\n+ const unshimmedNewMessages = unshimMessageInfos(newMessageInfos);\n+ const unshimmedNewMessagesOfWatchedThreads = unshimmedNewMessages.filter(\n+ msg =>\n+ threadIsWatched(\n+ msg.threadID,\n+ threadInfos[msg.threadID],\n+ watchedThreadIDs,\n+ ),\n);\nconst orderedNewMessageInfos = _flow(\n_map((messageInfo: RawMessageInfo) => {\n@@ -323,7 +331,7 @@ function mergeNewMessages(\n!threadIsPending(messageInfo.threadID),\n'new messageInfos should have realized thread id',\n);\n- const currentMessageInfo = filteredMessageStore.messages[inputID];\n+ const currentMessageInfo = updatedMessageStore.messages[inputID];\nif (\nmessageInfo.type === messageTypes.TEXT ||\nmessageInfo.type === messageTypes.IMAGES ||\n@@ -331,7 +339,7 @@ function mergeNewMessages(\n) {\nconst { localID: inputLocalID } = messageInfo;\nconst currentLocalMessageInfo = inputLocalID\n- ? filteredMessageStore.messages[inputLocalID]\n+ ? updatedMessageStore.messages[inputLocalID]\n: null;\nif (currentMessageInfo && currentMessageInfo.localID) {\n// If the client already has a RawMessageInfo with this serverID, keep\n@@ -360,7 +368,7 @@ function mergeNewMessages(\n// success action never got processed. We set a key in\n// localIDsToServerIDs here to fix the messageIDs for the rest of the\n// MessageStore too. (The conditional below is for Flow)\n- invariant(inputLocalID, 'should be set');\n+ invariant(inputLocalID, 'inputLocalID should be set');\nlocalIDsToServerIDs.set(inputLocalID, inputID);\nif (messageInfo.type === messageTypes.TEXT) {\nmessageInfo = {\n@@ -423,18 +431,18 @@ function mergeNewMessages(\n: messageInfo;\n}),\nsortMessageInfoList,\n- )(unshimmedMessagesOfWatchedThreads);\n+ )(unshimmedNewMessagesOfWatchedThreads);\nconst threadsToMessageIDs = threadsToMessageIDsFromMessageInfos(\norderedNewMessageInfos,\n);\nconst oldMessageInfosToCombine = [];\n- const mustResortThreadMessageIDs = [];\n+ const threadsThatNeedMessageIDsResorted = [];\nconst lastPruned = Date.now();\nconst local = {};\nconst threads = _flow(\n_mapValuesWithKeys((messageIDs: string[], threadID: string) => {\n- const oldThread = filteredMessageStore.threads[threadID];\n+ const oldThread = updatedMessageStore.threads[threadID];\nconst truncate = truncationStatus[threadID];\nif (!oldThread) {\nreturn {\n@@ -467,10 +475,10 @@ function mergeNewMessages(\n}\nconst oldNotInNew = _difference(oldMessageIDs)(messageIDs);\nfor (const id of oldNotInNew) {\n- const oldMessageInfo = filteredMessageStore.messages[id];\n+ const oldMessageInfo = updatedMessageStore.messages[id];\ninvariant(oldMessageInfo, `could not find ${id} in messageStore`);\noldMessageInfosToCombine.push(oldMessageInfo);\n- const localInfo = filteredMessageStore.local[id];\n+ const localInfo = updatedMessageStore.local[id];\nif (localInfo) {\nlocal[id] = localInfo;\n}\n@@ -490,7 +498,7 @@ function mergeNewMessages(\n};\n}\nconst mergedMessageIDs = [...messageIDs, ...oldNotInNew];\n- mustResortThreadMessageIDs.push(threadID);\n+ threadsThatNeedMessageIDsResorted.push(threadID);\nreturn {\nmessageIDs: mergedMessageIDs,\nstartReached,\n@@ -501,11 +509,11 @@ function mergeNewMessages(\n_pickBy(thread => !!thread),\n)(threadsToMessageIDs);\n- for (const threadID in filteredMessageStore.threads) {\n+ for (const threadID in updatedMessageStore.threads) {\nif (threads[threadID]) {\ncontinue;\n}\n- let thread = filteredMessageStore.threads[threadID];\n+ let thread = updatedMessageStore.threads[threadID];\nconst truncate = truncationStatus[threadID];\nif (truncate === messageTruncationStatus.EXHAUSTIVE) {\nthread = {\n@@ -515,11 +523,11 @@ function mergeNewMessages(\n}\nthreads[threadID] = thread;\nfor (const id of thread.messageIDs) {\n- const messageInfo = filteredMessageStore.messages[id];\n+ const messageInfo = updatedMessageStore.messages[id];\nif (messageInfo) {\noldMessageInfosToCombine.push(messageInfo);\n}\n- const localInfo = filteredMessageStore.local[id];\n+ const localInfo = updatedMessageStore.local[id];\nif (localInfo) {\nlocal[id] = localInfo;\n}\n@@ -530,7 +538,7 @@ function mergeNewMessages(\nconst threadInfo = threadInfos[threadID];\nif (\nthreads[threadID] ||\n- !threadIsWatched(threadID, threadInfo, watchedIDs)\n+ !threadIsWatched(threadID, threadInfo, watchedThreadIDs)\n) {\ncontinue;\n}\n@@ -562,7 +570,7 @@ function mergeNewMessages(\npayload: { ids: [...localIDsToServerIDs.keys()] },\n});\n- for (const threadID of mustResortThreadMessageIDs) {\n+ for (const threadID of threadsThatNeedMessageIDsResorted) {\nthreads[threadID].messageIDs = sortMessageIDs(messages)(\nthreads[threadID].messageIDs,\n);\n@@ -570,13 +578,13 @@ function mergeNewMessages(\nconst currentAsOf = Math.max(\norderedNewMessageInfos.length > 0 ? orderedNewMessageInfos[0].time : 0,\n- filteredMessageStore.currentAsOf,\n+ updatedMessageStore.currentAsOf,\n);\nconst mergedMessageStore = { messages, threads, local, currentAsOf };\nconst processedMessageStore = processMessageStoreOperations(\n- filteredMessageStore,\n+ updatedMessageStore,\nnewMessageOps,\n);\n@@ -587,7 +595,10 @@ function mergeNewMessages(\n);\nreturn {\n- messageStoreOperations: [...filterUnwatchedThreadOps, ...newMessageOps],\n+ messageStoreOperations: [\n+ ...updateWithLatestThreadInfosOps,\n+ ...newMessageOps,\n+ ],\nmessageStore: mergedMessageStore,\n};\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Misc naming tweaks in `mergeNewMessages` Summary: Thought these changes made things a little more readable. No functional changes. Test Plan: should be straightforward refactor Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1933
129,185
19.08.2021 16:51:30
-7,200
f73f724bddf7c2be6e34789f88d6a24b45ee5de8
Update Reactotron code to use fetchDevServerHostname Summary: Now device connects automatically with Reactotron tool using fetchDevServerHostname function. Test Plan: Run app on android and ios emulators. Both connects with Reactotron server. Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/reactotron.js", "new_path": "native/reactotron.js", "diff": "import AsyncStorage from '@react-native-community/async-storage';\n+import { fetchDevServerHostnameSync } from './utils/url-utils';\n+\nlet reactotron: any = null;\n+\nif (__DEV__) {\nconst { default: Reactotron } = require('reactotron-react-native');\nconst { reactotronRedux } = require('reactotron-redux');\n- reactotron = Reactotron.configure()\n+ reactotron = Reactotron.configure({ host: fetchDevServerHostnameSync() })\n.setAsyncStorageHandler(AsyncStorage)\n.useReactNative()\n.use(reactotronRedux())\n" }, { "change_type": "MODIFY", "old_path": "native/utils/url-utils.js", "new_path": "native/utils/url-utils.js", "diff": "@@ -45,6 +45,12 @@ async function fetchDevServerHostname(): Promise<string> {\nreturn getDevServerHostname(isEmulator);\n}\n+function fetchDevServerHostnameSync(): string {\n+ invariant(__DEV__, 'fetchDevServerHostnameSync called from production');\n+ const isEmulator = DeviceInfo.isEmulatorSync();\n+ return getDevServerHostname(isEmulator);\n+}\n+\nconst nodeServerOptions = [productionNodeServerURL];\nif (Platform.OS === 'android') {\nnodeServerOptions.push(\n@@ -86,6 +92,7 @@ const setCustomServer = 'SET_CUSTOM_SERVER';\nexport {\ndefaultURLPrefix,\nfetchDevServerHostname,\n+ fetchDevServerHostnameSync,\nnodeServerOptions,\nnatNodeServer,\nsetCustomServer,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Update Reactotron code to use fetchDevServerHostname Summary: Now device connects automatically with Reactotron tool using fetchDevServerHostname function. Test Plan: Run app on android and ios emulators. Both connects with Reactotron server. Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1921
129,184
25.08.2021 12:24:58
14,400
3c6b856ac60fe50ad7feee6a528be1f71a0523a6
[CommCoreModule] Create index on `thread` and `time` columns of messages table Summary: Query plan before: Query plan after: Test Plan: Logged path of sqlite db and used `EXPLAIN QUERY PLAN` to make sure index was being used Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -118,6 +118,29 @@ bool recreate_messages_table(sqlite3 *db) {\nreturn create_table(db, query, \"messages\");\n}\n+bool create_messages_idx_thread_time(sqlite3 *db) {\n+ char *error;\n+ sqlite3_exec(\n+ db,\n+ \"CREATE INDEX messages_idx_thread_time \"\n+ \"ON messages (thread, time);\",\n+ nullptr,\n+ nullptr,\n+ &error);\n+\n+ if (!error) {\n+ return true;\n+ }\n+\n+ std::ostringstream stringStream;\n+ stringStream << \"Error creating (thread, time) index on messages table: \"\n+ << error;\n+ Logger::log(stringStream.str());\n+\n+ sqlite3_free(error);\n+ return false;\n+}\n+\ntypedef std::function<bool(sqlite3 *)> MigrationFunction;\nstd::vector<std::pair<uint, MigrationFunction>> migrations{{\n{1, create_drafts_table},\n@@ -126,6 +149,7 @@ std::vector<std::pair<uint, MigrationFunction>> migrations{{\n{5, create_persist_sessions_table},\n{6, drop_messages_table},\n{7, recreate_messages_table},\n+ {8, create_messages_idx_thread_time},\n}};\nvoid SQLiteQueryExecutor::migrate() {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Create index on `thread` and `time` columns of messages table Summary: Query plan before: https://blob.sh/atul/ffc6.png Query plan after: https://blob.sh/atul/fb1c.png Test Plan: Logged path of sqlite db and used `EXPLAIN QUERY PLAN` to make sure index was being used Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1941
129,184
25.08.2021 13:52:19
14,400
0b65b3bf6bbc5168d96de1519a193ae5be0bc091
[CommCoreModule] Introduce `removeMessagesForThreads` Summary: Very similar to existing `SQLiteQueryExecutor::removeMessages`, but uses thread id instead of message id Test Plan: will be tested with next diff Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h", "diff": "@@ -30,6 +30,7 @@ public:\nvirtual void removeAllMessages() const = 0;\nvirtual std::vector<Message> getAllMessages() const = 0;\nvirtual void removeMessages(std::vector<int> ids) const = 0;\n+ virtual void removeMessagesForThreads(std::vector<int> threadIDs) const = 0;\nvirtual void replaceMessage(Message message) const = 0;\nvirtual std::vector<OlmPersistSession> getOlmPersistSessionsData() const = 0;\nvirtual folly::Optional<std::string> getOlmPersistAccountData() const = 0;\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -271,6 +271,12 @@ void SQLiteQueryExecutor::removeMessages(std::vector<int> ids) const {\nwhere(in(&Message::id, ids)));\n}\n+void SQLiteQueryExecutor::removeMessagesForThreads(\n+ std::vector<int> threadIDs) const {\n+ SQLiteQueryExecutor::getStorage().remove_all<Message>(\n+ where(in(&Message::thread, threadIDs)));\n+}\n+\nvoid SQLiteQueryExecutor::replaceMessage(Message message) const {\nSQLiteQueryExecutor::getStorage().replace(message);\n}\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "diff": "@@ -24,6 +24,7 @@ public:\nvoid removeAllMessages() const override;\nstd::vector<Message> getAllMessages() const override;\nvoid removeMessages(std::vector<int> ids) const override;\n+ void removeMessagesForThreads(std::vector<int> threadIDs) const override;\nvoid replaceMessage(Message message) const override;\nstd::vector<OlmPersistSession> getOlmPersistSessionsData() const override;\nfolly::Optional<std::string> getOlmPersistAccountData() const override;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Introduce `removeMessagesForThreads` Summary: Very similar to existing `SQLiteQueryExecutor::removeMessages`, but uses thread id instead of message id Test Plan: will be tested with next diff Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1944
129,191
24.08.2021 14:31:29
-7,200
898794b5fbb1bb3c655cd97cf704a554a69ebaa5
[native] Remove currentDraftHeight parameter Summary: We're now using a value stored in the context Test Plan: Flow Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/multimedia-message-tooltip-button.react.js", "new_path": "native/chat/multimedia-message-tooltip-button.react.js", "diff": "@@ -31,7 +31,6 @@ function MultimediaMessageTooltipButton(props: Props): React.Node {\ninitialCoordinates,\nmessageListVerticalBounds: verticalBounds,\nprogress,\n- currentInputBarHeight: 0,\ntargetInputBarHeight: 0,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/robotext-message-tooltip-button.react.js", "new_path": "native/chat/robotext-message-tooltip-button.react.js", "diff": "@@ -29,7 +29,6 @@ function RobotextMessageTooltipButton(props: Props): React.Node {\ninitialCoordinates,\nmessageListVerticalBounds: verticalBounds,\nprogress,\n- currentInputBarHeight: 0,\ntargetInputBarHeight: 0,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/text-message-tooltip-button.react.js", "new_path": "native/chat/text-message-tooltip-button.react.js", "diff": "@@ -34,7 +34,6 @@ function TextMessageTooltipButton(props: Props): React.Node {\ninitialCoordinates,\nmessageListVerticalBounds: verticalBounds,\nprogress,\n- currentInputBarHeight: 0,\ntargetInputBarHeight: 0,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -199,7 +199,6 @@ type AnimatedMessageArgs = {\n+initialCoordinates: LayoutCoordinates,\n+messageListVerticalBounds: VerticalBounds,\n+progress: Node,\n- +currentInputBarHeight: number,\n+targetInputBarHeight: number,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Remove currentDraftHeight parameter Summary: We're now using a value stored in the context Test Plan: Flow Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1951
129,191
25.08.2021 16:22:33
-7,200
17083000270b5dbee8e50867b57ebfc2c40f3fd7
[native] Create dummy chat input bar Summary: This is a simplified version of chat input bar which do not require navigation props and requires a prop which will be called with measured height Test Plan: Tested with next diffs Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -799,34 +799,21 @@ const createThreadLoadingStatusSelector = createLoadingStatusSelector(\nnewThreadActionTypes,\n);\n-type ChatInputBarProps = {\n+type ConnectedChatInputBarBaseProps = {\n...BaseProps,\n- +navigation: ChatNavigationProp<'MessageList'>,\n- +route: NavigationRoute<'MessageList'>,\n+ +onInputBarLayout?: (event: LayoutEvent) => mixed,\n+ +openCamera: () => mixed,\n};\n-const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo<ChatInputBarProps>(\n- function ConnectedChatInputBar(props: ChatInputBarProps) {\n- const { navigation, route, ...restProps } = props;\n- const inputState = React.useContext(InputStateContext);\n- const keyboardState = React.useContext(KeyboardContext);\n+function ConnectedChatInputBarBase(props: ConnectedChatInputBarBaseProps) {\nconst navContext = React.useContext(NavContext);\n-\n- const styles = useStyles(unboundStyles);\n- const colors = useColors();\n-\n- const isActive = React.useMemo(\n- () => props.threadInfo.id === activeThreadSelector(navContext),\n- [props.threadInfo.id, navContext],\n- );\n-\n- const { draft, updateDraft, moveDraft } = useDrafts(props.threadInfo.id);\n+ const keyboardState = React.useContext(KeyboardContext);\n+ const inputState = React.useContext(InputStateContext);\nconst viewerID = useSelector(\nstate => state.currentUserInfo && state.currentUserInfo.id,\n);\n- const joinThreadLoadingStatus = useSelector(\n- joinThreadLoadingStatusSelector,\n- );\n+ const { draft, updateDraft, moveDraft } = useDrafts(props.threadInfo.id);\n+ const joinThreadLoadingStatus = useSelector(joinThreadLoadingStatusSelector);\nconst createThreadLoadingStatus = useSelector(\ncreateThreadLoadingStatusSelector,\n);\n@@ -840,10 +827,75 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\nconst nextLocalID = useSelector(state => state.nextLocalID);\nconst userInfos = useSelector(state => state.userStore.userInfos);\n+ const styles = useStyles(unboundStyles);\n+ const colors = useColors();\n+\n+ const isActive = React.useMemo(\n+ () => props.threadInfo.id === activeThreadSelector(navContext),\n+ [props.threadInfo.id, navContext],\n+ );\n+\nconst dispatch = useDispatch();\nconst dispatchActionPromise = useDispatchActionPromise();\nconst callJoinThread = useServerCall(joinThread);\n+ return (\n+ <ChatInputBar\n+ {...props}\n+ viewerID={viewerID}\n+ draft={draft}\n+ updateDraft={updateDraft}\n+ moveDraft={moveDraft}\n+ joinThreadLoadingStatus={joinThreadLoadingStatus}\n+ threadCreationInProgress={threadCreationInProgress}\n+ calendarQuery={calendarQuery}\n+ nextLocalID={nextLocalID}\n+ userInfos={userInfos}\n+ colors={colors}\n+ styles={styles}\n+ isActive={isActive}\n+ keyboardState={keyboardState}\n+ dispatch={dispatch}\n+ dispatchActionPromise={dispatchActionPromise}\n+ joinThread={callJoinThread}\n+ inputState={inputState}\n+ />\n+ );\n+}\n+\n+type DummyChatInputBarProps = {\n+ ...BaseProps,\n+ +onHeightMeasured: (height: number) => mixed,\n+};\n+const noop = () => {};\n+function DummyChatInputBar(props: DummyChatInputBarProps): React.Node {\n+ const { onHeightMeasured, ...restProps } = props;\n+ const onInputBarLayout = React.useCallback(\n+ (event: LayoutEvent) => {\n+ const { height } = event.nativeEvent.layout;\n+ onHeightMeasured(height);\n+ },\n+ [onHeightMeasured],\n+ );\n+ return (\n+ <ConnectedChatInputBarBase\n+ {...restProps}\n+ onInputBarLayout={onInputBarLayout}\n+ openCamera={noop}\n+ />\n+ );\n+}\n+\n+type ChatInputBarProps = {\n+ ...BaseProps,\n+ +navigation: ChatNavigationProp<'MessageList'>,\n+ +route: NavigationRoute<'MessageList'>,\n+};\n+const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo<ChatInputBarProps>(\n+ function ConnectedChatInputBar(props: ChatInputBarProps) {\n+ const { navigation, route, ...restProps } = props;\n+ const keyboardState = React.useContext(KeyboardContext);\n+\nconst imagePastedCallback = React.useCallback(\nimagePastedEvent => {\nif (props.threadInfo.id !== imagePastedEvent['threadID']) {\n@@ -909,25 +961,8 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\n}, [keyboardState]);\nreturn (\n- <ChatInputBar\n+ <ConnectedChatInputBarBase\n{...restProps}\n- viewerID={viewerID}\n- draft={draft}\n- updateDraft={updateDraft}\n- moveDraft={moveDraft}\n- joinThreadLoadingStatus={joinThreadLoadingStatus}\n- threadCreationInProgress={threadCreationInProgress}\n- calendarQuery={calendarQuery}\n- nextLocalID={nextLocalID}\n- userInfos={userInfos}\n- colors={colors}\n- styles={styles}\n- isActive={isActive}\n- keyboardState={keyboardState}\n- dispatch={dispatch}\n- dispatchActionPromise={dispatchActionPromise}\n- joinThread={callJoinThread}\n- inputState={inputState}\nonInputBarLayout={onInputBarLayout}\nopenCamera={openCamera}\n/>\n@@ -935,4 +970,4 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\n},\n);\n-export default ConnectedChatInputBar;\n+export { ConnectedChatInputBar as ChatInputBar, DummyChatInputBar };\n" }, { "change_type": "MODIFY", "old_path": "native/chat/message-list-container.react.js", "new_path": "native/chat/message-list-container.react.js", "diff": "@@ -33,7 +33,7 @@ import { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\nimport type { ChatMessageItemWithHeight } from '../types/chat-types';\nimport { type MessagesMeasurer, useHeightMeasurer } from './chat-context';\n-import ChatInputBar from './chat-input-bar.react';\n+import { ChatInputBar } from './chat-input-bar.react';\nimport type { ChatNavigationProp } from './chat.react';\nimport MessageListThreadSearch from './message-list-thread-search.react';\nimport { MessageListContextProvider } from './message-list-types';\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Create dummy chat input bar Summary: This is a simplified version of chat input bar which do not require navigation props and requires a prop which will be called with measured height Test Plan: Tested with next diffs Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1953
129,191
25.08.2021 16:35:34
-7,200
b6f689a7d5a35edf2eaac93a8edef02853b8b173
[native] Create input bar height measurer Summary: This component measures a chat input bar and returns a result using a callback prop Test Plan: Tested with next diffs Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "ADD", "old_path": null, "new_path": "native/chat/sidebar-input-bar-height-measurer.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { View, StyleSheet } from 'react-native';\n+\n+import { useSelector } from '../redux/redux-utils';\n+import type { ChatMessageInfoItemWithHeight } from '../types/chat-types';\n+import { DummyChatInputBar } from './chat-input-bar.react';\n+import { useMessageListScreenWidth } from './composed-message-width';\n+import { getSidebarThreadInfo } from './sidebar-navigation';\n+\n+type Props = {\n+ +sourceMessage: ChatMessageInfoItemWithHeight,\n+ +onInputBarMeasured: (height: number) => mixed,\n+};\n+\n+function SidebarInputBarHeightMeasurer(props: Props): React.Node {\n+ const { sourceMessage, onInputBarMeasured } = props;\n+\n+ const width = useMessageListScreenWidth();\n+\n+ const viewerID = useSelector(\n+ state => state.currentUserInfo && state.currentUserInfo.id,\n+ );\n+ const sidebarThreadInfo = React.useMemo(() => {\n+ return getSidebarThreadInfo(sourceMessage, viewerID);\n+ }, [sourceMessage, viewerID]);\n+ if (!sidebarThreadInfo) {\n+ return null;\n+ }\n+\n+ return (\n+ <View style={[styles.dummy, { width }]}>\n+ <DummyChatInputBar\n+ threadInfo={sidebarThreadInfo}\n+ onHeightMeasured={onInputBarMeasured}\n+ />\n+ </View>\n+ );\n+}\n+\n+const styles = StyleSheet.create({\n+ dummy: {\n+ opacity: 0,\n+ position: 'absolute',\n+ },\n+});\n+\n+export default SidebarInputBarHeightMeasurer;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Create input bar height measurer Summary: This component measures a chat input bar and returns a result using a callback prop Test Plan: Tested with next diffs Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1954
129,191
26.08.2021 14:28:28
-7,200
de1e6a938a7c48f9bc7213d82765a9ab00bcd607
[native] Delete unused utils Summary: We're not going to use them Test Plan: Flow Reviewers: ashoat Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -8,7 +8,6 @@ import { useMessageListData } from 'lib/selectors/chat-selectors';\nimport { messageKey } from 'lib/shared/message-utils';\nimport { colorIsDark } from 'lib/shared/thread-utils';\n-import { useDrafts } from '../data/core-data';\nimport { OverlayContext } from '../navigation/overlay-context';\nimport {\nMultimediaMessageTooltipModalRouteName,\n@@ -212,7 +211,6 @@ function useAnimatedMessageTooltipButton({\n+style: AnimatedViewStyle,\n+threadColorOverride: ?Node,\n+isThreadColorDarkOverride: ?boolean,\n- +isAnimatingToSidebar: boolean,\n} {\nconst chatContext = React.useContext(ChatContext);\ninvariant(chatContext, 'chatContext should be set');\n@@ -297,7 +295,6 @@ function useAnimatedMessageTooltipButton({\nstyle: messageContainerStyle,\nthreadColorOverride,\nisThreadColorDarkOverride,\n- isAnimatingToSidebar: !!currentTransitionSidebarSourceID,\n};\n}\n@@ -309,28 +306,6 @@ function isMessageTooltipKey(key: string): boolean {\nreturn key.startsWith('tooltip|');\n}\n-function useSidebarDrafts(\n- sourceMessage: ChatMessageInfoItemWithHeight,\n-): { parentDraft: string, sidebarDraft: string } {\n- const viewerID = useSelector(\n- state => state.currentUserInfo && state.currentUserInfo.id,\n- );\n- const sidebarThreadInfo = React.useMemo(() => {\n- return getSidebarThreadInfo(sourceMessage, viewerID);\n- }, [sourceMessage, viewerID]);\n-\n- const { draft: parentDraft } = useDrafts(sourceMessage.threadInfo.id);\n- const { draft: sidebarDraft } = useDrafts(sidebarThreadInfo?.id);\n-\n- return React.useMemo(\n- () => ({\n- parentDraft,\n- sidebarDraft,\n- }),\n- [parentDraft, sidebarDraft],\n- );\n-}\n-\nfunction useOverlayPosition(item: ChatMessageInfoItemWithHeight) {\nconst overlayContext = React.useContext(OverlayContext);\ninvariant(overlayContext, 'should be set');\n@@ -391,7 +366,6 @@ export {\nmessageItemHeight,\ngetMessageTooltipKey,\nisMessageTooltipKey,\n- useSidebarDrafts,\nuseContentAndHeaderOpacity,\nuseDeliveryIconOpacity,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Delete unused utils Summary: We're not going to use them Test Plan: Flow Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1957
129,184
26.08.2021 15:02:37
25,200
11c61e7cf69a370ddda1d2ae9f10b72219c1ed47
[web] Restyle "Join thread" button to include thread color Summary: Here's how it looks: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-input-bar.react.js", "new_path": "web/chat/chat-input-bar.react.js", "diff": "@@ -182,7 +182,12 @@ class ChatInputBar extends React.PureComponent<Props> {\n}\njoinButton = (\n<div className={css.joinButtonContainer}>\n- <a onClick={this.onClickJoin}>{buttonContent}</a>\n+ <a\n+ style={{ backgroundColor: `#${this.props.threadInfo.color}` }}\n+ onClick={this.onClickJoin}\n+ >\n+ {buttonContent}\n+ </a>\n</div>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-message-list.css", "new_path": "web/chat/chat-message-list.css", "diff": "@@ -76,8 +76,7 @@ div.joinButtonContainer > a {\nmargin: 3px 12px;\npadding: 3px 0 5px 0;\ndisplay: flex;\n- background-color: #44cc99;\n- border-radius: 5px;\n+ border-radius: 8px;\njustify-content: center;\ncursor: pointer;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Restyle "Join thread" button to include thread color Summary: Here's how it looks: https://blob.sh/atul/4d64.png Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1958
129,184
26.08.2021 16:27:36
25,200
6bd460182be40be4fce303d7cf58fe48e55112f3
[web] Add `faPlus` icon to "Join Thread" button Summary: Here's how it looks: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-input-bar.react.js", "new_path": "web/chat/chat-input-bar.react.js", "diff": "// @flow\nimport { faFileImage } from '@fortawesome/free-regular-svg-icons';\n-import { faChevronRight } from '@fortawesome/free-solid-svg-icons';\n+import { faChevronRight, faPlus } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport invariant from 'invariant';\nimport _difference from 'lodash/fp/difference';\n@@ -178,7 +178,12 @@ class ChatInputBar extends React.PureComponent<Props> {\n/>\n);\n} else {\n- buttonContent = <span className={css.joinButtonText}>Join Thread</span>;\n+ buttonContent = (\n+ <div>\n+ <FontAwesomeIcon color=\"white\" icon={faPlus} />\n+ <span className={css.joinButtonText}>Join Thread</span>\n+ </div>\n+ );\n}\njoinButton = (\n<div className={css.joinButtonContainer}>\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-message-list.css", "new_path": "web/chat/chat-message-list.css", "diff": "@@ -84,6 +84,7 @@ span.joinButtonText {\nfont-size: 18px;\ncolor: white;\ntext-align: center;\n+ margin-inline: 6px;\n}\nspan.explanation {\ncolor: #777777;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Add `faPlus` icon to "Join Thread" button Summary: Here's how it looks: https://blob.sh/atul/46f7.png Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1959
129,184
26.08.2021 16:35:29
25,200
5e56afeaf147e5e865d939883eeacdb2190701c5
[web] Remove explanatory text below "Join Thread" button Summary: Here's how it looks: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-input-bar.react.js", "new_path": "web/chat/chat-input-bar.react.js", "diff": "@@ -278,11 +278,7 @@ class ChatInputBar extends React.PureComponent<Props> {\n</span>\n);\n} else if (defaultMembersAreVoiced && canJoin) {\n- content = (\n- <span className={css.explanation}>\n- Join this thread to send messages.\n- </span>\n- );\n+ content = null;\n} else {\ncontent = (\n<span className={css.explanation}>\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-message-list.css", "new_path": "web/chat/chat-message-list.css", "diff": "@@ -73,7 +73,7 @@ svg.sendButton {\ncolor: #88bb88;\n}\ndiv.joinButtonContainer > a {\n- margin: 3px 12px;\n+ margin: 8px;\npadding: 3px 0 5px 0;\ndisplay: flex;\nborder-radius: 8px;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Remove explanatory text below "Join Thread" button Summary: Here's how it looks: https://blob.sh/atul/67cb.png Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1960
129,184
25.08.2021 11:32:42
14,400
017a5a459077f4de8bd7e80b6740757dd0b07e0c
[native] Restyle "Join thread" button to include thread color Summary: Here's what it looks like: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -421,15 +421,24 @@ class ChatInputBar extends React.PureComponent<Props, State> {\n);\n} else {\nbuttonContent = (\n+ <View style={this.props.styles.joinButtonContent}>\n+ <SWMansionIcon\n+ name=\"plus\"\n+ style={this.props.styles.joinButtonText}\n+ />\n<Text style={this.props.styles.joinButtonText}>Join Thread</Text>\n+ </View>\n);\n}\njoinButton = (\n<View style={this.props.styles.joinButtonContainer}>\n<Button\nonPress={this.onPressJoin}\n- iosActiveOpacity={0.5}\n- style={this.props.styles.joinButton}\n+ iosActiveOpacity={0.85}\n+ style={[\n+ this.props.styles.joinButton,\n+ { backgroundColor: `#${this.props.threadInfo.color}` },\n+ ]}\n>\n{buttonContent}\n</Button>\n@@ -746,23 +755,25 @@ const unboundStyles = {\nflexDirection: 'row',\n},\njoinButton: {\n- backgroundColor: 'mintButton',\n- borderRadius: 5,\n+ borderRadius: 8,\nflex: 1,\njustifyContent: 'center',\nmarginHorizontal: 12,\nmarginVertical: 3,\n- paddingBottom: 5,\n- paddingTop: 3,\n},\njoinButtonContainer: {\nflexDirection: 'row',\n- height: 36,\n+ height: 48,\n+ },\n+ joinButtonContent: {\n+ flexDirection: 'row',\n+ justifyContent: 'center',\n+ alignItems: 'center',\n},\njoinButtonText: {\n- color: 'listBackground',\n+ color: 'listForegroundLabel',\nfontSize: 20,\n- textAlign: 'center',\n+ marginHorizontal: 4,\n},\njoinThreadLoadingIndicator: {\npaddingVertical: 2,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Restyle "Join thread" button to include thread color Summary: Here's what it looks like: https://blob.sh/atul/join_thread_btn.mov Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1939
129,184
25.08.2021 11:39:45
14,400
0e2a1407ac1a8aaa8f36736a90fb57a852e34b0a
[native] Get rid of redundant text below "Join Thread" button Summary: Here's what it looks like: Test Plan: na Reviewers: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -472,11 +472,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\n</Text>\n);\n} else if (defaultMembersAreVoiced && canJoin) {\n- content = (\n- <Text style={this.props.styles.explanation}>\n- Join this thread to send messages.\n- </Text>\n- );\n+ content = null;\n} else {\ncontent = (\n<Text style={this.props.styles.explanation}>\n@@ -764,6 +760,7 @@ const unboundStyles = {\njoinButtonContainer: {\nflexDirection: 'row',\nheight: 48,\n+ marginBottom: 8,\n},\njoinButtonContent: {\nflexDirection: 'row',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Get rid of redundant text below "Join Thread" button Summary: Here's what it looks like: https://blob.sh/atul/c509.png Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1940
129,191
30.08.2021 15:43:45
-7,200
e6070aa0e506ead1573ac30cf4a321c8b05e4c07
[native] Set simplified animation flag Summary: We need to use a simpler animation when a measurement is not finished, a keyboard is open or viewer is not a member of a sidebar Test Plan: Tested with next diffs Reviewers: ashoat, atul Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/utils.js", "new_path": "native/chat/utils.js", "diff": "@@ -6,8 +6,10 @@ import Animated from 'react-native-reanimated';\nimport { useMessageListData } from 'lib/selectors/chat-selectors';\nimport { messageKey } from 'lib/shared/message-utils';\n-import { colorIsDark } from 'lib/shared/thread-utils';\n+import { colorIsDark, viewerIsMember } from 'lib/shared/thread-utils';\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+import { KeyboardContext } from '../keyboard/keyboard-state';\nimport { OverlayContext } from '../navigation/overlay-context';\nimport {\nMultimediaMessageTooltipModalRouteName,\n@@ -110,17 +112,11 @@ function useMessageTargetParameters(\nmessageListVerticalBounds: VerticalBounds,\ncurrentInputBarHeight: number,\ntargetInputBarHeight: number,\n+ sidebarThreadInfo: ?ThreadInfo,\n): {\n+position: number,\n+color: string,\n} {\n- const viewerID = useSelector(\n- state => state.currentUserInfo && state.currentUserInfo.id,\n- );\n- const sidebarThreadInfo = React.useMemo(() => {\n- return getSidebarThreadInfo(sourceMessage, viewerID);\n- }, [sourceMessage, viewerID]);\n-\nconst messageListData = useMessageListData({\nsearching: false,\nuserInfoInputArray: [],\n@@ -218,10 +214,38 @@ function useAnimatedMessageTooltipButton({\ncurrentTransitionSidebarSourceID,\nsetCurrentTransitionSidebarSourceID,\nchatInputBarHeights,\n+ setSidebarAnimationType,\n} = chatContext;\n+ const viewerID = useSelector(\n+ state => state.currentUserInfo && state.currentUserInfo.id,\n+ );\n+ const sidebarThreadInfo = React.useMemo(() => {\n+ return getSidebarThreadInfo(sourceMessage, viewerID);\n+ }, [sourceMessage, viewerID]);\n+\nconst currentInputBarHeight =\nchatInputBarHeights.get(sourceMessage.threadInfo.id) ?? 0;\n+ const keyboardState = React.useContext(KeyboardContext);\n+ const viewerIsSidebarMember = viewerIsMember(sidebarThreadInfo);\n+ React.useEffect(() => {\n+ const newSidebarAnimationType =\n+ !currentInputBarHeight ||\n+ !targetInputBarHeight ||\n+ keyboardState?.keyboardShowing ||\n+ !viewerIsSidebarMember\n+ ? 'fade_source_message'\n+ : 'move_source_message';\n+ setSidebarAnimationType(newSidebarAnimationType);\n+ }, [\n+ currentInputBarHeight,\n+ keyboardState?.keyboardShowing,\n+ setSidebarAnimationType,\n+ sidebarThreadInfo,\n+ targetInputBarHeight,\n+ viewerIsSidebarMember,\n+ ]);\n+\nconst {\nposition: targetPosition,\ncolor: targetColor,\n@@ -231,6 +255,7 @@ function useAnimatedMessageTooltipButton({\nmessageListVerticalBounds,\ncurrentInputBarHeight,\ntargetInputBarHeight ?? currentInputBarHeight,\n+ sidebarThreadInfo,\n);\nReact.useEffect(() => {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Set simplified animation flag Summary: We need to use a simpler animation when a measurement is not finished, a keyboard is open or viewer is not a member of a sidebar Test Plan: Tested with next diffs Reviewers: ashoat, atul Reviewed By: ashoat, atul Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1965
129,184
31.08.2021 13:54:52
25,200
4df03ade6028e8a458336ac5135f64aa07f86ef8
[lib] Avoid unnecessary `remove` op in `mergeNewMessages` when payload is empty Summary: One of the issues we noticed when debugging truncation issue (which should be resolved by D1968) Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -565,10 +565,12 @@ function mergeNewMessages(\n});\n}\n+ if (localIDsToServerIDs.size > 0) {\nnewMessageOps.push({\ntype: 'remove',\npayload: { ids: [...localIDsToServerIDs.keys()] },\n});\n+ }\nfor (const threadID of threadsThatNeedMessageIDsResorted) {\nthreads[threadID].messageIDs = sortMessageIDs(messages)(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Avoid unnecessary `remove` op in `mergeNewMessages` when payload is empty Summary: One of the issues we noticed when debugging truncation issue (which should be resolved by D1968) Test Plan: set breakpoint and observed expected behavior Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1969
129,190
01.09.2021 12:32:06
-7,200
bcef7410d1301dad7ffaf0b8be3a06992ed1eea2
[server] Add primary column to the cookies table Summary: Add primary column to the cookies table for the primary devices task. Test Plan: run the script on the existing database and recreate the database Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "ADD", "old_path": null, "new_path": "server/src/scripts/add-primary-column-for-cookies.js", "diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database/database';\n+import { main } from './utils';\n+\n+async function addPrimaryColumn() {\n+ await dbQuery(SQL`\n+ ALTER TABLE cookies\n+ ADD \\`primary\\` TINYINT(1) DEFAULT NULL;\n+ `);\n+}\n+\n+main([addPrimaryColumn]);\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "@@ -40,7 +40,8 @@ async function createTables() {\ncreation_time bigint(20) NOT NULL,\nlast_used bigint(20) NOT NULL,\ndevice_token varchar(255) DEFAULT NULL,\n- versions json DEFAULT NULL\n+ versions json DEFAULT NULL,\n+ \\`primary\\` TINYINT(1) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\nCREATE TABLE days (\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add primary column to the cookies table Summary: Add primary column to the cookies table for the primary devices task. Test Plan: run the script on the existing database and recreate the database Reviewers: palys-swm, ashoat Reviewed By: ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1895
129,184
31.08.2021 13:33:35
25,200
c018088710bf4b156d423018b2e982b858bb9980
[lib] Handle truncation case in `mergeNewMessages` Summary: Should fix this issue: If result set isn't contiguous with what we already have, dump existing messages for thread Test Plan: haven't yet tested Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -433,6 +433,7 @@ function mergeNewMessages(\nsortMessageInfoList,\n)(unshimmedNewMessagesOfWatchedThreads);\n+ const newMessageOps: MessageStoreOperation[] = [];\nconst threadsToMessageIDs = threadsToMessageIDsFromMessageInfos(\norderedNewMessageInfos,\n);\n@@ -466,6 +467,10 @@ function mergeNewMessages(\n// now, that means we need to dump what we have in the state and replace\n// it with the result set. We do this to achieve our two goals for the\n// messageStore: currentness and contiguousness.\n+ newMessageOps.push({\n+ type: 'remove_messages_for_threads',\n+ payload: { threadIDs: [threadID] },\n+ });\nreturn {\nmessageIDs,\nstartReached: false,\n@@ -557,7 +562,6 @@ function mergeNewMessages(\n)([...orderedNewMessageInfos, ...oldMessageInfosToCombine]);\nconst newMessages = _keyBy(messageID)(orderedNewMessageInfos);\n- const newMessageOps: MessageStoreOperation[] = [];\nfor (const id in newMessages) {\nnewMessageOps.push({\ntype: 'replace',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Handle truncation case in `mergeNewMessages` Summary: Should fix this issue: https://www.notion.so/commapp/Message-op-invariants-triggering-with-build-99-df5f0587879e4d08acb93f5f6e807de9 If result set isn't contiguous with what we already have, dump existing messages for thread Test Plan: haven't yet tested Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1968
129,184
03.09.2021 18:26:03
25,200
a9594500e1917607901fd981a2d2eda311c7bdb8
[native] codeVersion -> 100
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 99\n- versionName '0.0.99'\n+ versionCode 100\n+ versionName '1.0.100'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.99</string>\n+ <string>1.0.100</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>99</string>\n+ <string>100</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.99</string>\n+ <string>1.0.100</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>99</string>\n+ <string>100</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 99;\n+const codeVersion = 100;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 100
129,184
04.09.2021 09:52:39
25,200
7f1ddc3849312892e22b658fb3a9ddf2e67a2fa8
[native] codeVersion -> 101
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 100\n- versionName '1.0.100'\n+ versionCode 101\n+ versionName '1.0.101'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.100</string>\n+ <string>1.0.101</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>100</string>\n+ <string>101</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.100</string>\n+ <string>1.0.101</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>100</string>\n+ <string>101</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -280,7 +280,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 100;\n+const codeVersion = 101;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] codeVersion -> 101
129,184
07.09.2021 11:06:44
25,200
4cad0c2c91b98b107727ee29bc6e33a2b749a28f
[native] Replace "Testflight" with "App Store" in `client_version_unsupported` copy Summary: na Test Plan: na Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/account/log-in-panel.react.js", "new_path": "native/account/log-in-panel.react.js", "diff": "@@ -276,7 +276,7 @@ class LogInPanel extends React.PureComponent<Props> {\n);\n} else if (e.message === 'client_version_unsupported') {\nconst app = Platform.select({\n- ios: 'Testflight',\n+ ios: 'App Store',\nandroid: 'Play Store',\n});\nAlert.alert(\n" }, { "change_type": "MODIFY", "old_path": "native/account/register-panel.react.js", "new_path": "native/account/register-panel.react.js", "diff": "@@ -351,7 +351,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n);\n} else if (e.message === 'client_version_unsupported') {\nconst app = Platform.select({\n- ios: 'Testflight',\n+ ios: 'App Store',\nandroid: 'Play Store',\n});\nAlert.alert(\n" }, { "change_type": "MODIFY", "old_path": "native/redux/redux-setup.js", "new_path": "native/redux/redux-setup.js", "diff": "@@ -304,7 +304,7 @@ function sessionInvalidationAlert(payload: SetSessionPayload) {\n}\nif (payload.error === 'client_version_unsupported') {\nconst app = Platform.select({\n- ios: 'Testflight',\n+ ios: 'App Store',\nandroid: 'Play Store',\n});\nAlert.alert(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Replace "Testflight" with "App Store" in `client_version_unsupported` copy Summary: na Test Plan: na Reviewers: palys-swm, ashoat Reviewed By: palys-swm Subscribers: ashoat, palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1987
129,187
07.09.2021 17:49:37
25,200
a165956f30ecd42a36b99b8df053e0b6843277f7
[native] Fix CameraModal crash Summary: See the [Notion issue](https://www.notion.so/commapp/CameraModal-crash-cannot-read-property-navigation-c2a3b96491864ae4b57d08e38a14a1bb) for more details. Test Plan: Confirm I can open the `CameraModal` again on a simulator Reviewers: palys-swm, atul Subscribers: Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -904,9 +904,10 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\nconst { navigation, route, ...restProps } = props;\nconst keyboardState = React.useContext(KeyboardContext);\n+ const { threadInfo } = props;\nconst imagePastedCallback = React.useCallback(\nimagePastedEvent => {\n- if (props.threadInfo.id !== imagePastedEvent['threadID']) {\n+ if (threadInfo.id !== imagePastedEvent.threadID) {\nreturn;\n}\nconst pastedImage: PhotoPaste = {\n@@ -921,15 +922,15 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\nsendTime: 0,\nretries: 0,\n};\n- props.navigation.navigate({\n+ navigation.navigate({\nname: ImagePasteModalRouteName,\nparams: {\nimagePasteStagingInfo: pastedImage,\n- thread: props.threadInfo,\n+ thread: threadInfo,\n},\n});\n},\n- [props.navigation, props.threadInfo],\n+ [navigation, threadInfo],\n);\nReact.useEffect(() => {\n@@ -946,27 +947,27 @@ const ConnectedChatInputBar: React.ComponentType<ChatInputBarProps> = React.memo\nconst onInputBarLayout = React.useCallback(\n(event: LayoutEvent) => {\nconst { height } = event.nativeEvent.layout;\n- setChatInputBarHeight(props.threadInfo.id, height);\n+ setChatInputBarHeight(threadInfo.id, height);\n},\n- [props.threadInfo.id, setChatInputBarHeight],\n+ [threadInfo.id, setChatInputBarHeight],\n);\nReact.useEffect(() => {\nreturn () => {\n- deleteChatInputBarHeight(props.threadInfo.id);\n+ deleteChatInputBarHeight(threadInfo.id);\n};\n- }, [deleteChatInputBarHeight, props.threadInfo.id]);\n+ }, [deleteChatInputBarHeight, threadInfo.id]);\nconst openCamera = React.useCallback(() => {\nkeyboardState?.dismissKeyboard();\n- this.props.navigation.navigate({\n+ navigation.navigate({\nname: CameraModalRouteName,\nparams: {\n- presentedFrom: this.props.route.key,\n- thread: this.props.threadInfo,\n+ presentedFrom: route.key,\n+ thread: threadInfo,\n},\n});\n- }, [keyboardState]);\n+ }, [keyboardState, navigation, route.key, threadInfo]);\nreturn (\n<ConnectedChatInputBarBase\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Fix CameraModal crash Summary: See the [Notion issue](https://www.notion.so/commapp/CameraModal-crash-cannot-read-property-navigation-c2a3b96491864ae4b57d08e38a14a1bb) for more details. Test Plan: Confirm I can open the `CameraModal` again on a simulator Reviewers: palys-swm, atul Reviewed By: palys-swm Subscribers: Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1991
129,187
07.09.2021 22:42:27
25,200
b6f0373a8a3080fb35b197ae21dfba3a09bb26c5
[lib] Make ThreadInfo and RawThreadInfo types $ReadOnly Test Plan: Flow Reviewers: palys-swm Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -560,7 +560,7 @@ function rawThreadInfoFromServerThreadInfo(\ntype = shimThreadTypes[type];\n}\n- const rawThreadInfo: RawThreadInfo = {\n+ let rawThreadInfo: RawThreadInfo = {\nid: serverThreadInfo.id,\ntype,\nname: serverThreadInfo.name,\n@@ -575,7 +575,7 @@ function rawThreadInfoFromServerThreadInfo(\n};\nconst sourceMessageID = serverThreadInfo.sourceMessageID;\nif (sourceMessageID) {\n- rawThreadInfo.sourceMessageID = sourceMessageID;\n+ rawThreadInfo = { ...rawThreadInfo, sourceMessageID };\n}\nif (!includeVisibilityRules) {\nreturn rawThreadInfo;\n@@ -616,7 +616,7 @@ function threadInfoFromRawThreadInfo(\nviewerID: ?string,\nuserInfos: UserInfos,\n): ThreadInfo {\n- const threadInfo: ThreadInfo = {\n+ let threadInfo: ThreadInfo = {\nid: rawThreadInfo.id,\ntype: rawThreadInfo.type,\nname: rawThreadInfo.name,\n@@ -632,7 +632,7 @@ function threadInfoFromRawThreadInfo(\n};\nconst { sourceMessageID } = rawThreadInfo;\nif (sourceMessageID) {\n- threadInfo.sourceMessageID = sourceMessageID;\n+ threadInfo = { ...threadInfo, sourceMessageID };\n}\nreturn threadInfo;\n}\n@@ -705,7 +705,7 @@ function threadFrozenDueToViewerBlock(\n}\nfunction rawThreadInfoFromThreadInfo(threadInfo: ThreadInfo): RawThreadInfo {\n- const rawThreadInfo: RawThreadInfo = {\n+ let rawThreadInfo: RawThreadInfo = {\nid: threadInfo.id,\ntype: threadInfo.type,\nname: threadInfo.name,\n@@ -725,7 +725,7 @@ function rawThreadInfoFromThreadInfo(threadInfo: ThreadInfo): RawThreadInfo {\n};\nconst { sourceMessageID } = threadInfo;\nif (sourceMessageID) {\n- rawThreadInfo.sourceMessageID = sourceMessageID;\n+ rawThreadInfo = { ...rawThreadInfo, sourceMessageID };\n}\nreturn rawThreadInfo;\n}\n" }, { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -175,34 +175,34 @@ export type ThreadCurrentUserInfo = {\n};\nexport type RawThreadInfo = {\n- id: string,\n- type: ThreadType,\n- name: ?string,\n- description: ?string,\n- color: string, // hex, without \"#\" or \"0x\"\n- creationTime: number, // millisecond timestamp\n- parentThreadID: ?string,\n- members: $ReadOnlyArray<MemberInfo>,\n- roles: { [id: string]: RoleInfo },\n- currentUser: ThreadCurrentUserInfo,\n- sourceMessageID?: string,\n- repliesCount: number,\n+ +id: string,\n+ +type: ThreadType,\n+ +name: ?string,\n+ +description: ?string,\n+ +color: string, // hex, without \"#\" or \"0x\"\n+ +creationTime: number, // millisecond timestamp\n+ +parentThreadID: ?string,\n+ +members: $ReadOnlyArray<MemberInfo>,\n+ +roles: { [id: string]: RoleInfo },\n+ +currentUser: ThreadCurrentUserInfo,\n+ +sourceMessageID?: string,\n+ +repliesCount: number,\n};\nexport type ThreadInfo = {\n- id: string,\n- type: ThreadType,\n- name: ?string,\n- uiName: string,\n- description: ?string,\n- color: string, // hex, without \"#\" or \"0x\"\n- creationTime: number, // millisecond timestamp\n- parentThreadID: ?string,\n- members: $ReadOnlyArray<RelativeMemberInfo>,\n- roles: { [id: string]: RoleInfo },\n- currentUser: ThreadCurrentUserInfo,\n- sourceMessageID?: string,\n- repliesCount: number,\n+ +id: string,\n+ +type: ThreadType,\n+ +name: ?string,\n+ +uiName: string,\n+ +description: ?string,\n+ +color: string, // hex, without \"#\" or \"0x\"\n+ +creationTime: number, // millisecond timestamp\n+ +parentThreadID: ?string,\n+ +members: $ReadOnlyArray<RelativeMemberInfo>,\n+ +roles: { [id: string]: RoleInfo },\n+ +currentUser: ThreadCurrentUserInfo,\n+ +sourceMessageID?: string,\n+ +repliesCount: number,\n};\nexport type ServerMemberInfo = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Make ThreadInfo and RawThreadInfo types $ReadOnly Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1993
129,187
07.09.2021 22:55:54
25,200
289179fdbed290af9033d890eb2b542e6d47032b
[lib] Move thread ancestry functions to lib Summary: This will be necessary in a following diff. Test Plan: Flow Reviewers: palys-swm Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -49,6 +49,7 @@ import {\ntype NewThreadResult,\nthreadTypes,\nthreadPermissions,\n+ threadTypeIsCommunityRoot,\n} from '../types/thread-types';\nimport { type ClientUpdateInfo, updateTypes } from '../types/update-types';\nimport type {\n@@ -1083,6 +1084,36 @@ function threadTypeCanBePending(threadType: ThreadType): boolean {\n);\n}\n+function getContainingThreadID(\n+ parentThreadInfo: ?ServerThreadInfo,\n+ threadType: ThreadType,\n+): ?string {\n+ if (!parentThreadInfo) {\n+ return null;\n+ }\n+ if (threadType === threadTypes.SIDEBAR) {\n+ return parentThreadInfo.id;\n+ }\n+ if (!parentThreadInfo.containingThreadID) {\n+ return parentThreadInfo.id;\n+ }\n+ return parentThreadInfo.containingThreadID;\n+}\n+\n+function getCommunity(parentThreadInfo: ?ServerThreadInfo): ?string {\n+ if (!parentThreadInfo) {\n+ return null;\n+ }\n+ const { id, community, type } = parentThreadInfo;\n+ if (community !== null && community !== undefined) {\n+ return community;\n+ }\n+ if (threadTypeIsCommunityRoot(type)) {\n+ return id;\n+ }\n+ return null;\n+}\n+\nexport {\ncolorIsDark,\ngenerateRandomColor,\n@@ -1134,4 +1165,6 @@ export {\ncheckIfDefaultMembersAreVoiced,\ndraftKeyFromThreadID,\nthreadTypeCanBePending,\n+ getContainingThreadID,\n+ getCommunity,\n};\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "// @flow\nimport { getAllThreadPermissions } from 'lib/permissions/thread-permissions';\n-import { rawThreadInfoFromServerThreadInfo } from 'lib/shared/thread-utils';\n+import {\n+ rawThreadInfoFromServerThreadInfo,\n+ getContainingThreadID,\n+ getCommunity,\n+} from 'lib/shared/thread-utils';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\nimport {\nthreadTypes,\ntype ThreadType,\ntype RawThreadInfo,\ntype ServerThreadInfo,\n- threadTypeIsCommunityRoot,\n} from 'lib/types/thread-types';\nimport { ServerError } from 'lib/utils/errors';\n@@ -198,36 +201,6 @@ async function determineThreadAncestry(\nreturn { containingThreadID, community, depth };\n}\n-function getContainingThreadID(\n- parentThreadInfo: ?ServerThreadInfo,\n- threadType: ThreadType,\n-): ?string {\n- if (!parentThreadInfo) {\n- return null;\n- }\n- if (threadType === threadTypes.SIDEBAR) {\n- return parentThreadInfo.id;\n- }\n- if (!parentThreadInfo.containingThreadID) {\n- return parentThreadInfo.id;\n- }\n- return parentThreadInfo.containingThreadID;\n-}\n-\n-function getCommunity(parentThreadInfo: ?ServerThreadInfo): ?string {\n- if (!parentThreadInfo) {\n- return null;\n- }\n- const { id, community, type } = parentThreadInfo;\n- if (community !== null && community !== undefined) {\n- return community;\n- }\n- if (threadTypeIsCommunityRoot(type)) {\n- return id;\n- }\n- return null;\n-}\n-\nexport {\nfetchServerThreadInfos,\nfetchThreadInfos,\n@@ -235,6 +208,4 @@ export {\nverifyThreadIDs,\nverifyThreadID,\ndetermineThreadAncestry,\n- getCommunity,\n- getContainingThreadID,\n};\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/add-thread-ancestry.js", "new_path": "server/src/scripts/add-thread-ancestry.js", "diff": "// @flow\n+import { getContainingThreadID, getCommunity } from 'lib/shared/thread-utils';\nimport type { ServerThreadInfo } from 'lib/types/thread-types';\nimport { dbQuery, SQL } from '../database/database';\n-import {\n- fetchServerThreadInfos,\n- getContainingThreadID,\n- getCommunity,\n-} from '../fetchers/thread-fetchers';\n+import { fetchServerThreadInfos } from '../fetchers/thread-fetchers';\nimport { main } from './utils';\nasync function addColumnAndIndexes() {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Move thread ancestry functions to lib Summary: This will be necessary in a following diff. Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1994
129,187
07.09.2021 23:06:19
25,200
2a9a112c78df5f5a535e95b151988ee14b25ffe6
[lib] Pass whole parentThreadInfo to CreatePendingThreadArgs Summary: This will be necessary in a following diff. Test Plan: Flow Reviewers: palys-swm Subscribers: Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -247,7 +247,7 @@ type CreatePendingThreadArgs = {\n+viewerID: string,\n+threadType: ThreadType,\n+members?: $ReadOnlyArray<GlobalAccountUserInfo | UserInfo>,\n- +parentThreadID?: ?string,\n+ +parentThreadInfo?: ?ThreadInfo,\n+threadColor?: ?string,\n+name?: ?string,\n+sourceMessageID?: string,\n@@ -257,7 +257,7 @@ function createPendingThread({\nviewerID,\nthreadType,\nmembers,\n- parentThreadID,\n+ parentThreadInfo,\nthreadColor,\nname,\nsourceMessageID,\n@@ -294,7 +294,7 @@ function createPendingThread({\ndescription: null,\ncolor: threadColor ?? generatePendingThreadColor(memberIDs),\ncreationTime: now,\n- parentThreadID: parentThreadID ?? null,\n+ parentThreadID: parentThreadInfo?.id ?? null,\nmembers: [\n{\nid: viewerID,\n@@ -362,11 +362,7 @@ function createPendingSidebar(\nviewerID: string,\nmarkdownRules: ParserRules,\n): ThreadInfo {\n- const {\n- id: parentThreadID,\n- color,\n- type: parentThreadType,\n- } = parentThreadInfo;\n+ const { color, type: parentThreadType } = parentThreadInfo;\nconst messageTitle = getMessageTitle(\nsourceMessageInfo,\n@@ -412,7 +408,7 @@ function createPendingSidebar(\nviewerID,\nthreadType: threadTypes.SIDEBAR,\nmembers: [...initialMembers.values()],\n- parentThreadID,\n+ parentThreadInfo,\nthreadColor: color,\nname: threadName,\nsourceMessageID: sourceMessageInfo.id,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Pass whole parentThreadInfo to CreatePendingThreadArgs Summary: This will be necessary in a following diff. Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1995
129,184
07.09.2021 09:59:57
25,200
909bb571a8b2c0df8665bb473fdb74da0a25de23
[CommCoreModule] Introduce `RekeyMessageOperation` to `MessageStoreOperations.h` Summary: Introduce `RekeyMessageOperation` and use in `CommCoreModule:processMessageStoreOperations` Test Plan: Same as D1984 Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "diff": "@@ -218,6 +218,7 @@ jsi::Value CommCoreModule::getAllMessages(jsi::Runtime &rt) {\n});\n}\n+#define REKEY_OPERATION \"rekey\"\n#define REMOVE_OPERATION \"remove\"\n#define REPLACE_OPERATION \"replace\"\n#define REMOVE_MSGS_FOR_THREADS_OPERATION \"remove_messages_for_threads\"\n@@ -274,6 +275,12 @@ jsi::Value CommCoreModule::processMessageStoreOperations(\nMessage message = {id, thread, user, type, future_type, content, time};\nmessageStoreOps.push_back(\nstd::make_shared<ReplaceMessageOperation>(std::move(message)));\n+ } else if (op_type == REKEY_OPERATION) {\n+ auto rekey_payload = op.getProperty(rt, \"payload\").asObject(rt);\n+ auto from = rekey_payload.getProperty(rt, \"from\").asString(rt).utf8(rt);\n+ auto to = rekey_payload.getProperty(rt, \"to\").asString(rt).utf8(rt);\n+ messageStoreOps.push_back(std::make_shared<RekeyMessageOperation>(\n+ std::move(from), std::move(to)));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h", "new_path": "native/cpp/CommonCpp/NativeModules/MessageStoreOperations.h", "diff": "@@ -53,4 +53,20 @@ private:\nMessage msg_;\n};\n+class RekeyMessageOperation : public MessageStoreOperationBase {\n+public:\n+ RekeyMessageOperation(std::string from, std::string to)\n+ : from_{from}, to_{to} {\n+ }\n+ virtual ~RekeyMessageOperation() = default;\n+\n+ void virtual execute() override {\n+ DatabaseManager::getQueryExecutor().rekeyMessage(from_, to_);\n+ }\n+\n+private:\n+ std::string from_;\n+ std::string to_;\n+};\n+\n} // namespace comm\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Introduce `RekeyMessageOperation` to `MessageStoreOperations.h` Summary: Introduce `RekeyMessageOperation` and use in `CommCoreModule:processMessageStoreOperations` Test Plan: Same as D1984 Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1985
129,184
07.09.2021 10:43:43
25,200
2dc1ad6fe95a77112bec84e53cc8f180f774961c
[CommCoreModule] Handle unsupported `op_type` in `processMessageStoreOperations` Summary: Reject promise (and don't process any ops) if unsupported operation is passed in to `processMessageStoreOperations` Test Plan: 1. Passed in nonsense op_type 2. Observed expected behavior: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "diff": "@@ -281,6 +281,16 @@ jsi::Value CommCoreModule::processMessageStoreOperations(\nauto to = rekey_payload.getProperty(rt, \"to\").asString(rt).utf8(rt);\nmessageStoreOps.push_back(std::make_shared<RekeyMessageOperation>(\nstd::move(from), std::move(to)));\n+ } else {\n+ return createPromiseAsJSIValue(\n+ rt,\n+ [this,\n+ op_type](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {\n+ this->jsInvoker_->invokeAsync([promise, &innerRt, op_type]() {\n+ promise->reject(\n+ std::string{\"unsupported operation: \"}.append(op_type));\n+ });\n+ });\n}\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Handle unsupported `op_type` in `processMessageStoreOperations` Summary: Reject promise (and don't process any ops) if unsupported operation is passed in to `processMessageStoreOperations` Test Plan: 1. Passed in nonsense op_type 2. Observed expected behavior: https://blob.sh/atul/a0be.png Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1986
129,184
09.09.2021 16:44:27
25,200
103c1ac33151d537a757bc56d9589cab58cb1e11
[lib] Fix for "should have media" crash Summary: The fix discussed during mid-week sync today. Test Plan: Can now view chat that would previously crash: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/selectors/chat-selectors.js", "new_path": "lib/selectors/chat-selectors.js", "diff": "@@ -302,6 +302,15 @@ function createChatMessageItems(\nmessageInfo.type === messageTypes.SIDEBAR_SOURCE\n? messageInfo.sourceMessage\n: messageInfo;\n+\n+ if (\n+ (originalMessageInfo.type === messageTypes.IMAGES ||\n+ originalMessageInfo.type === messageTypes.MULTIMEDIA) &&\n+ originalMessageInfo.media.length === 0\n+ ) {\n+ continue;\n+ }\n+\nlet startsConversation = true;\nlet startsCluster = true;\nif (\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Fix for "should have media" crash Summary: The fix discussed during mid-week sync today. Test Plan: Can now view chat that would previously crash: https://blob.sh/atul/c132.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2003
129,184
10.09.2021 23:02:03
25,200
6bd464cc24fcb3374f16059ce676b79a07b00ee1
[lib] Handle empty media array case in `contentStringForMediaArray` Summary: Showing "no media" seems better than crashing the app Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/media/media-utils.js", "new_path": "lib/media/media-utils.js", "diff": "@@ -21,8 +21,9 @@ function shimUploadURI(uri: string, platformDetails: ?PlatformDetails): string {\n}\nfunction contentStringForMediaArray(media: $ReadOnlyArray<Media>): string {\n- invariant(media.length > 0, 'there should be some media');\n- if (media.length === 1) {\n+ if (media.length === 0) {\n+ return 'corrupted media';\n+ } else if (media.length === 1) {\nreturn `a ${media[0].type}`;\n}\nlet firstType;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Handle empty media array case in `contentStringForMediaArray` Summary: Showing "no media" seems better than crashing the app Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2005
129,184
12.09.2021 17:10:31
25,200
8662cc9a2024fc18d439222a0bb3ec9f0b120bac
[native] `codeVersion` -> 102
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 101\n- versionName '1.0.101'\n+ versionCode 102\n+ versionName '1.0.102'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.101</string>\n+ <string>1.0.102</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>101</string>\n+ <string>102</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.101</string>\n+ <string>1.0.102</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>101</string>\n+ <string>102</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -320,12 +320,12 @@ const persistConfig = {\n'frozen',\n],\ndebug: __DEV__,\n- version: 27,\n+ version: 28,\nmigrate: (createMigrate(migrations, { debug: __DEV__ }): any),\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 101;\n+const codeVersion = 102;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] `codeVersion` -> 102
129,184
12.09.2021 19:03:07
25,200
4b917f6ee57ed74033724ebf66a7905e16fbb82c
[native] `codeVersion` -> 103
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -284,8 +284,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 102\n- versionName '1.0.102'\n+ versionCode 103\n+ versionName '1.0.103'\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.102</string>\n+ <string>1.0.103</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>102</string>\n+ <string>103</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.102</string>\n+ <string>1.0.103</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>102</string>\n+ <string>103</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -325,7 +325,7 @@ const persistConfig = {\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n};\n-const codeVersion = 102;\n+const codeVersion = 103;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] `codeVersion` -> 103
129,185
10.09.2021 09:52:15
-7,200
52b8a3fab4b18ddfa11116013fbf823e46710ee8
[lib] Add EDIT_THREAD_DESCRIPTION and EDIT_THREAD_COLOR permission Summary: I added EDIT_THREAD_DESCRIPTION and EDIT_THREAD_COLOR permissions to thread-types. Test Plan: My change doesn't modify any behavior and the server still works. Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -77,6 +77,8 @@ export const threadPermissions = Object.freeze({\nVOICED: 'voiced',\nEDIT_ENTRIES: 'edit_entries',\nEDIT_THREAD_NAME: 'edit_thread',\n+ EDIT_THREAD_DESCRIPTION: 'edit_thread_description',\n+ EDIT_THREAD_COLOR: 'edit_thread_color',\nDELETE_THREAD: 'delete_thread',\nCREATE_SUBTHREADS: 'create_subthreads',\nCREATE_SIDEBARS: 'create_sidebars',\n@@ -98,6 +100,8 @@ export function assertThreadPermissions(\nourThreadPermissions === 'voiced' ||\nourThreadPermissions === 'edit_entries' ||\nourThreadPermissions === 'edit_thread' ||\n+ ourThreadPermissions === 'edit_thread_description' ||\n+ ourThreadPermissions === 'edit_thread_color' ||\nourThreadPermissions === 'delete_thread' ||\nourThreadPermissions === 'create_subthreads' ||\nourThreadPermissions === 'create_sidebars' ||\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Add EDIT_THREAD_DESCRIPTION and EDIT_THREAD_COLOR permission Summary: I added EDIT_THREAD_DESCRIPTION and EDIT_THREAD_COLOR permissions to thread-types. Test Plan: My change doesn't modify any behavior and the server still works. Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D1974
129,184
13.09.2021 15:32:33
25,200
11fc71c7d6d943c59e17ca9a20829b52e5ce0736
[lib] Change `future_type` and `content` type in `SQLiteMessageInfo` to maybe string Summary: want these to be nullable Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "@@ -356,8 +356,8 @@ export type SQLiteMessageInfo = {\n+thread: string,\n+user: string,\n+type: string,\n- +future_type: string,\n- +content: string,\n+ +future_type: ?string,\n+ +content: ?string,\n+time: string,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Change `future_type` and `content` type in `SQLiteMessageInfo` to maybe string Summary: want these to be nullable Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2008
129,184
15.09.2021 17:00:18
14,400
e1847fac50ae4d43873f97e834dd95d7fe256b0a
[CommCoreModule] Bump MPMCQueue capacity from 20 -> 100 Summary: na Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/Tools/WorkerThread.cpp", "new_path": "native/cpp/CommonCpp/Tools/WorkerThread.cpp", "diff": "namespace comm {\nWorkerThread::WorkerThread(const std::string name)\n- : tasks(folly::MPMCQueue<std::unique_ptr<taskType>>(20)), name(name) {\n+ : tasks(folly::MPMCQueue<std::unique_ptr<taskType>>(100)), name(name) {\nauto job = [this]() {\nwhile (true) {\nstd::unique_ptr<taskType> lastTask;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Bump MPMCQueue capacity from 20 -> 100 Summary: na Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2015
129,184
17.09.2021 10:43:58
14,400
cb1a21a6c58e3e1053feb2b9a68619953df9486a
[CommCoreModule] Log sqlite db path Summary: I've been constantly stashing/unstashing this to get the sqlite db path and thought it might be helpful to others/worth logging Test Plan: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -156,6 +156,11 @@ void SQLiteQueryExecutor::migrate() {\nsqlite3 *db;\nsqlite3_open(SQLiteQueryExecutor::sqliteFilePath.c_str(), &db);\n+ std::stringstream db_path;\n+ db_path << \"db path: \" << SQLiteQueryExecutor::sqliteFilePath.c_str()\n+ << std::endl;\n+ Logger::log(db_path.str());\n+\nsqlite3_stmt *user_version_stmt;\nsqlite3_prepare_v2(\ndb, \"PRAGMA user_version;\", -1, &user_version_stmt, nullptr);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Log sqlite db path Summary: I've been constantly stashing/unstashing this to get the sqlite db path and thought it might be helpful to others/worth logging Test Plan: https://blob.sh/atul/cdd2.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2028
129,191
15.09.2021 17:55:45
-7,200
a915e77f7805285007e2db8b9ae40a10a700ad52
[CommCoreModule] Remove unused parameters from core module functions Summary: We don't use them, so they can be removed Test Plan: Compile the app and run it Reviewers: ashoat, karol-bisztyga Subscribers: Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp", "diff": "@@ -396,9 +396,7 @@ jsi::Value CommCoreModule::initializeCryptoAccount(\n});\n}\n-jsi::Value\n-CommCoreModule::getUserPublicKey(jsi::Runtime &rt, const jsi::String &userId) {\n- std::string userIdStr = userId.utf8(rt);\n+jsi::Value CommCoreModule::getUserPublicKey(jsi::Runtime &rt) {\nreturn createPromiseAsJSIValue(\nrt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {\ntaskType job = [=, &innerRt]() {\n@@ -421,10 +419,7 @@ CommCoreModule::getUserPublicKey(jsi::Runtime &rt, const jsi::String &userId) {\n});\n}\n-jsi::Value CommCoreModule::getUserOneTimeKeys(\n- jsi::Runtime &rt,\n- const jsi::String &userId) {\n- std::string userIdStr = userId.utf8(rt);\n+jsi::Value CommCoreModule::getUserOneTimeKeys(jsi::Runtime &rt) {\nreturn createPromiseAsJSIValue(\nrt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {\ntaskType job = [=, &innerRt]() {\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h", "new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h", "diff": "@@ -35,10 +35,8 @@ class CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\njsi::Value\ninitializeCryptoAccount(jsi::Runtime &rt, const jsi::String &userId) override;\n- jsi::Value\n- getUserPublicKey(jsi::Runtime &rt, const jsi::String &userId) override;\n- jsi::Value\n- getUserOneTimeKeys(jsi::Runtime &rt, const jsi::String &userId) override;\n+ jsi::Value getUserPublicKey(jsi::Runtime &rt) override;\n+ jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) override;\nvoid scheduleOrRun(\nconst std::unique_ptr<WorkerThread> &thread,\nconst taskType &task);\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/NativeModules.cpp", "new_path": "native/cpp/CommonCpp/NativeModules/NativeModules.cpp", "diff": "@@ -94,7 +94,7 @@ __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey(\nconst jsi::Value *args,\nsize_t count) {\nreturn static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)\n- ->getUserPublicKey(rt, args[0].getString(rt));\n+ ->getUserPublicKey(rt);\n}\nstatic jsi::Value\n__hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys(\n@@ -103,7 +103,7 @@ __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys(\nconst jsi::Value *args,\nsize_t count) {\nreturn static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)\n- ->getUserOneTimeKeys(rt, args[0].getString(rt));\n+ ->getUserOneTimeKeys(rt);\n}\nCommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(\n@@ -129,9 +129,9 @@ CommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(\nmethodMap_[\"initializeCryptoAccount\"] = MethodMetadata{\n1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeCryptoAccount};\nmethodMap_[\"getUserPublicKey\"] = MethodMetadata{\n- 1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};\n+ 0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};\nmethodMap_[\"getUserOneTimeKeys\"] = MethodMetadata{\n- 1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys};\n+ 0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys};\n}\n} // namespace react\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/NativeModules/NativeModules.h", "new_path": "native/cpp/CommonCpp/NativeModules/NativeModules.h", "diff": "@@ -34,10 +34,8 @@ public:\nconst jsi::Array &operations) = 0;\nvirtual jsi::Value\ninitializeCryptoAccount(jsi::Runtime &rt, const jsi::String &userId) = 0;\n- virtual jsi::Value\n- getUserPublicKey(jsi::Runtime &rt, const jsi::String &userId) = 0;\n- virtual jsi::Value\n- getUserOneTimeKeys(jsi::Runtime &rt, const jsi::String &userId) = 0;\n+ virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) = 0;\n+ virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) = 0;\n};\n} // namespace react\n" }, { "change_type": "MODIFY", "old_path": "native/schema/CommCoreModuleSchema.js", "new_path": "native/schema/CommCoreModuleSchema.js", "diff": "@@ -27,8 +27,8 @@ export interface Spec extends TurboModule {\noperations: $ReadOnlyArray<SQLiteMessageStoreOperation>,\n) => Promise<void>;\n+initializeCryptoAccount: (userId: string) => Promise<string>;\n- +getUserPublicKey: (userId: string) => Promise<string>;\n- +getUserOneTimeKeys: (userId: string) => Promise<string>;\n+ +getUserPublicKey: () => Promise<string>;\n+ +getUserOneTimeKeys: () => Promise<string>;\n}\nexport default (TurboModuleRegistry.getEnforcing<Spec>(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Remove unused parameters from core module functions Summary: We don't use them, so they can be removed Test Plan: Compile the app and run it Reviewers: ashoat, karol-bisztyga Reviewed By: ashoat, karol-bisztyga Subscribers: Adrian, atul Differential Revision: https://phabricator.ashoat.com/D2014
129,187
20.09.2021 21:57:20
14,400
b493901f7624e8cf648b0dd9345d4b31480f7aa8
[server] Script to reset passwords Summary: See context in [Notion task](https://www.notion.so/commapp/Temporary-script-to-reset-password-via-CLI-d3638d415cbf4ba695478f005fad51a4). Test Plan: Ran the script on a test user in my local environment and then made sure I could log in with the new password on the web client Reviewers: palys-swm, atul Subscribers: Adrian, karol-bisztyga
[ { "change_type": "ADD", "old_path": null, "new_path": "server/src/scripts/reset-password.js", "diff": "+// @flow\n+\n+import bcrypt from 'twin-bcrypt';\n+\n+import { dbQuery, SQL } from '../database/database';\n+import { main } from './utils';\n+\n+const userID = '-1';\n+const password = 'password';\n+\n+async function updatePassword() {\n+ const hash = bcrypt.hashSync(password);\n+ await dbQuery(SQL`UPDATE users SET hash = ${hash} WHERE id = ${userID}`);\n+}\n+\n+main([updatePassword]);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Script to reset passwords Summary: See context in [Notion task](https://www.notion.so/commapp/Temporary-script-to-reset-password-via-CLI-d3638d415cbf4ba695478f005fad51a4). Test Plan: Ran the script on a test user in my local environment and then made sure I could log in with the new password on the web client Reviewers: palys-swm, atul Reviewed By: atul Subscribers: Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2031
129,184
21.09.2021 02:04:26
14,400
a196b1ed44f8d859c4b5061573a13658809b9104
[lib] Rename `SQLite*` -> `ClientDB*` Summary: part of generally moving names away from being DB-specific Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "@@ -351,7 +351,7 @@ export type ReplaceMessageOperation = {\n+payload: { +id: string, +messageInfo: RawMessageInfo },\n};\n-export type SQLiteMessageInfo = {\n+export type ClientDBMessageInfo = {\n+id: string,\n+thread: string,\n+user: string,\n@@ -361,9 +361,9 @@ export type SQLiteMessageInfo = {\n+time: string,\n};\n-export type SQLiteReplaceMessageOperation = {\n+export type ClientDBReplaceMessageOperation = {\n+type: 'replace',\n- +payload: SQLiteMessageInfo,\n+ +payload: ClientDBMessageInfo,\n};\nexport type RekeyMessageOperation = {\n@@ -377,9 +377,9 @@ export type MessageStoreOperation =\n| RekeyMessageOperation\n| RemoveMessagesForThreadsOperation;\n-export type SQLiteMessageStoreOperation =\n+export type ClientDBMessageStoreOperation =\n| RemoveMessageOperation\n- | SQLiteReplaceMessageOperation\n+ | ClientDBReplaceMessageOperation\n| RekeyMessageOperation\n| RemoveMessagesForThreadsOperation;\n" }, { "change_type": "MODIFY", "old_path": "native/schema/CommCoreModuleSchema.js", "new_path": "native/schema/CommCoreModuleSchema.js", "diff": "@@ -6,25 +6,25 @@ import { TurboModuleRegistry } from 'react-native';\nimport type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';\nimport type {\n- SQLiteMessageInfo,\n- SQLiteMessageStoreOperation,\n+ ClientDBMessageInfo,\n+ ClientDBMessageStoreOperation,\n} from 'lib/types/message-types';\n-type SQLiteDraftInfo = {\n+type ClientDBDraftInfo = {\n+key: string,\n+text: string,\n};\nexport interface Spec extends TurboModule {\n+getDraft: (key: string) => Promise<string>;\n- +updateDraft: (draft: SQLiteDraftInfo) => Promise<boolean>;\n+ +updateDraft: (draft: ClientDBDraftInfo) => Promise<boolean>;\n+moveDraft: (oldKey: string, newKey: string) => Promise<boolean>;\n- +getAllDrafts: () => Promise<$ReadOnlyArray<SQLiteDraftInfo>>;\n+ +getAllDrafts: () => Promise<$ReadOnlyArray<ClientDBDraftInfo>>;\n+removeAllDrafts: () => Promise<void>;\n+removeAllMessages: () => Promise<void>;\n- +getAllMessages: () => Promise<$ReadOnlyArray<SQLiteMessageInfo>>;\n+ +getAllMessages: () => Promise<$ReadOnlyArray<ClientDBMessageInfo>>;\n+processMessageStoreOperations: (\n- operations: $ReadOnlyArray<SQLiteMessageStoreOperation>,\n+ operations: $ReadOnlyArray<ClientDBMessageStoreOperation>,\n) => Promise<void>;\n+initializeCryptoAccount: (userId: string) => Promise<string>;\n+getUserPublicKey: () => Promise<string>;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Rename `SQLite*` -> `ClientDB*` Summary: part of generally moving names away from being DB-specific Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2027
129,179
21.09.2021 19:02:21
14,400
f2045c4c709114ed2db86471acf8ae4274d09396
fix: Dont require customizing of network_security_config for on device debug Summary: Check out Notion Issue: Test Plan: Run Anroid build on physical device Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/android/app/src/debug/res/xml/network_security_config.xml", "new_path": "native/android/app/src/debug/res/xml/network_security_config.xml", "diff": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<network-security-config>\n<!-- allow cleartext traffic for React Native packager ips in debug -->\n- <domain-config cleartextTrafficPermitted=\"true\">\n- <domain includeSubdomains=\"false\">localhost</domain>\n- <domain includeSubdomains=\"false\">10.0.2.2</domain>\n- <domain includeSubdomains=\"false\">10.0.3.2</domain>\n- </domain-config>\n+ <base-config cleartextTrafficPermitted=\"true\" />\n</network-security-config>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
fix: Dont require customizing of network_security_config for on device debug Summary: Check out Notion Issue: https://www.notion.so/commapp/Don-t-require-customizing-network_security_config-xml-for-on-device-debugging-c6e18ae2e9b443bf8efcfc01a70cf6f5 Test Plan: Run Anroid build on physical device Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2047
129,184
17.09.2021 13:14:51
14,400
df00cf8d623353981356cc5d6bfb062b07330992
[lib] Include `$ReadOnlyArray<ClientDBMediaInfo>` in `ClientDBMessageInfo` Summary: Each `ClientDBMediaInfo` corresponds to a row in the `media` table Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "import invariant from 'invariant';\nimport type { FetchResultInfoInterface } from '../utils/fetch-json';\n+import { type ClientDBMediaInfo } from './media-types';\nimport type {\nAddMembersMessageData,\nAddMembersMessageInfo,\n@@ -360,6 +361,7 @@ export type ClientDBMessageInfo = {\n+future_type: ?string,\n+content: ?string,\n+time: string,\n+ +media_infos: ?$ReadOnlyArray<ClientDBMediaInfo>,\n};\nexport type ClientDBReplaceMessageOperation = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Include `$ReadOnlyArray<ClientDBMediaInfo>` in `ClientDBMessageInfo` Summary: Each `ClientDBMediaInfo` corresponds to a row in the `media` table Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2029
129,184
17.09.2021 00:18:42
14,400
8add779fa5ed8bb78b64aea12b844e3b0d638b29
[CommCoreModule] Create SQLite `media` table Summary: DB migration to create `media` table in SQLite, add `container` and `thread` columns to `Media.h` Test Plan: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "#include \"Logger.h\"\n#include \"sqlite_orm.h\"\n+#include \"entities/Media.h\"\n#include <sqlite3.h>\n#include <memory>\n#include <sstream>\n@@ -142,6 +143,18 @@ bool create_messages_idx_thread_time(sqlite3 *db) {\nreturn false;\n}\n+bool create_media_table(sqlite3 *db) {\n+ std::string query =\n+ \"CREATE TABLE IF NOT EXISTS media ( \"\n+ \"id TEXT UNIQUE PRIMARY KEY NOT NULL, \"\n+ \"container TEXT NOT NULL, \"\n+ \"thread TEXT NOT NULL, \"\n+ \"uri TEXT NOT NULL, \"\n+ \"type TEXT NOT NULL, \"\n+ \"extras TEXT NOT NULL);\";\n+ return create_table(db, query, \"media\");\n+}\n+\ntypedef std::function<bool(sqlite3 *)> MigrationFunction;\nstd::vector<std::pair<uint, MigrationFunction>> migrations{{\n{1, create_drafts_table},\n@@ -151,6 +164,7 @@ std::vector<std::pair<uint, MigrationFunction>> migrations{{\n{12, drop_messages_table},\n{13, recreate_messages_table},\n{14, create_messages_idx_thread_time},\n+ {15, create_media_table},\n}};\nvoid SQLiteQueryExecutor::migrate() {\n@@ -225,7 +239,15 @@ auto SQLiteQueryExecutor::getStorage() {\nmake_table(\n\"olm_persist_sessions\",\nmake_column(\"target_user_id\", &OlmPersistSession::target_user_id),\n- make_column(\"session_data\", &OlmPersistSession::session_data)));\n+ make_column(\"session_data\", &OlmPersistSession::session_data)),\n+ make_table(\n+ \"media\",\n+ make_column(\"id\", &Media::id, unique(), primary_key()),\n+ make_column(\"container\", &Media::container),\n+ make_column(\"thread\", &Media::thread),\n+ make_column(\"uri\", &Media::uri),\n+ make_column(\"type\", &Media::type),\n+ make_column(\"extras\", &Media::extras)));\nreturn storage;\n}\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/entities/Media.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/entities/Media.h", "diff": "@@ -6,6 +6,8 @@ namespace comm {\nstruct Media {\nstd::string id;\n+ std::string container;\n+ std::string thread;\nstd::string uri;\nstd::string type;\nstd::string extras;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Create SQLite `media` table Summary: DB migration to create `media` table in SQLite, add `container` and `thread` columns to `Media.h` Test Plan: https://blob.sh/atul/e68a.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2026
129,184
17.09.2021 15:18:05
14,400
f33c8864639da5b45aafe21617fd541c8e1b9141
[lib] Introduce `translateRawMessageInfoToClientDBMessageInfo` Summary: translates `rawMessageInfo` (from redux) => `ClientDBMessageInfo` (which gets passed to C++ side) Test Plan: will be tested once C++ side is modified to handle new `ClientDBMessageInfo` payload Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/utils/message-ops.utils.js", "new_path": "lib/utils/message-ops.utils.js", "diff": "// @flow\n+import { messageID } from '../shared/message-utils';\n+import { messageSpecs } from '../shared/messages/message-specs';\nimport type { Media, ClientDBMediaInfo } from '../types/media-types';\n+import {\n+ type ClientDBMessageInfo,\n+ type RawMessageInfo,\n+ messageTypes,\n+} from '../types/message-types';\nfunction translateMediaToClientDBMediaInfo(media: Media): ClientDBMediaInfo {\nreturn {\n@@ -15,4 +22,32 @@ function translateMediaToClientDBMediaInfo(media: Media): ClientDBMediaInfo {\n};\n}\n-export { translateMediaToClientDBMediaInfo };\n+function translateRawMessageInfoToClientDBMessageInfo(\n+ rawMessageInfo: RawMessageInfo,\n+): ClientDBMessageInfo {\n+ return {\n+ id: messageID(rawMessageInfo),\n+ local_id: rawMessageInfo.localID ? rawMessageInfo.localID : null,\n+ thread: rawMessageInfo.threadID,\n+ user: rawMessageInfo.creatorID,\n+ type: rawMessageInfo.type.toString(),\n+ future_type:\n+ rawMessageInfo.type === messageTypes.UNSUPPORTED\n+ ? rawMessageInfo.unsupportedMessageInfo.type.toString()\n+ : null,\n+ time: rawMessageInfo.time.toString(),\n+ content: messageSpecs[rawMessageInfo.type].messageContentForServerDB?.(\n+ rawMessageInfo,\n+ ),\n+ media_infos:\n+ rawMessageInfo.type === messageTypes.IMAGES ||\n+ rawMessageInfo.type === messageTypes.MULTIMEDIA\n+ ? rawMessageInfo.media.map(translateMediaToClientDBMediaInfo)\n+ : null,\n+ };\n+}\n+\n+export {\n+ translateMediaToClientDBMediaInfo,\n+ translateRawMessageInfoToClientDBMessageInfo,\n+};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `translateRawMessageInfoToClientDBMessageInfo` Summary: translates `rawMessageInfo` (from redux) => `ClientDBMessageInfo` (which gets passed to C++ side) Test Plan: will be tested once C++ side is modified to handle new `ClientDBMessageInfo` payload Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2030
129,185
23.09.2021 13:10:51
-7,200
71789755d3506cb5f6a01d1429814ddd98e703a2
[lib] Add thread store operation types Summary: I added thread operation types - `remove` and `replace`. Test Plan: The change doesn't modify any behavior. Reviewers: palys-swm, atul, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -243,6 +243,20 @@ export type ThreadStore = {\n+threadInfos: { +[id: string]: RawThreadInfo },\n};\n+export type RemoveThreadOperation = {\n+ +type: 'remove',\n+ +payload: { +ids: $ReadOnlyArray<string> },\n+};\n+\n+export type ReplaceThreadOperation = {\n+ +type: 'replace',\n+ +payload: { +id: string, +threadInfo: RawThreadInfo },\n+};\n+\n+export type ThreadStoreOperation =\n+ | RemoveThreadOperation\n+ | ReplaceThreadOperation;\n+\nexport type ThreadDeletionRequest = {\n+threadID: string,\n+accountPassword: string,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Add thread store operation types Summary: I added thread operation types - `remove` and `replace`. Test Plan: The change doesn't modify any behavior. Reviewers: palys-swm, atul, ashoat Reviewed By: palys-swm, atul, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2037
129,184
22.09.2021 18:41:25
14,400
e9b60ded31f37105d793ef89487afc2725b3d8e0
[2/5] [CommCoreModule] Introduce `replaceMedia` in `SQLiteQueryExecutor` Summary: Inserts or updates a row in SQLite `media` table. Test Plan: Will be tested implicitly in next diff. Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h", "diff": "#include \"../CryptoTools/Persist.h\"\n#include \"entities/Draft.h\"\n+#include \"entities/Media.h\"\n#include \"entities/Message.h\"\n#include \"entities/OlmPersistAccount.h\"\n#include \"entities/OlmPersistSession.h\"\n@@ -34,6 +35,7 @@ public:\nremoveMessagesForThreads(std::vector<std::string> threadIDs) const = 0;\nvirtual void replaceMessage(Message &message) const = 0;\nvirtual void rekeyMessage(std::string from, std::string to) const = 0;\n+ virtual void replaceMedia(Media &media) const = 0;\nvirtual std::vector<OlmPersistSession> getOlmPersistSessionsData() const = 0;\nvirtual folly::Optional<std::string> getOlmPersistAccountData() const = 0;\nvirtual void storeOlmPersistData(crypto::Persist persist) const = 0;\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -317,6 +317,10 @@ void SQLiteQueryExecutor::rekeyMessage(std::string from, std::string to) const {\nSQLiteQueryExecutor::getStorage().remove<Message>(from);\n}\n+void SQLiteQueryExecutor::replaceMedia(Media &media) const {\n+ SQLiteQueryExecutor::getStorage().replace(media);\n+}\n+\nstd::vector<OlmPersistSession>\nSQLiteQueryExecutor::getOlmPersistSessionsData() const {\nreturn SQLiteQueryExecutor::getStorage().get_all<OlmPersistSession>();\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "diff": "@@ -28,6 +28,7 @@ public:\nremoveMessagesForThreads(std::vector<std::string> threadIDs) const override;\nvoid replaceMessage(Message &message) const override;\nvoid rekeyMessage(std::string from, std::string to) const override;\n+ void replaceMedia(Media &media) const override;\nstd::vector<OlmPersistSession> getOlmPersistSessionsData() const override;\nfolly::Optional<std::string> getOlmPersistAccountData() const override;\nvoid storeOlmPersistData(crypto::Persist persist) const override;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[2/5] [CommCoreModule] Introduce `replaceMedia` in `SQLiteQueryExecutor` Summary: Inserts or updates a row in SQLite `media` table. Test Plan: Will be tested implicitly in next diff. Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2055
129,185
23.09.2021 14:44:10
-7,200
ae47a96f0ee9a5b911e24060cc8be1d8976d93ab
[lib] Introduce `RemoveAllThreadsOperation` Summary: Introduce `RemoveAllThreadsOperation` to increase SQLite database performance. Test Plan: I tested if new operation works in the same way like an old solution with `RemoveThreadOperation` on virtual iOS device. No error messages appeared. Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "lib/reducers/thread-reducer.js", "new_path": "lib/reducers/thread-reducer.js", "diff": "@@ -192,10 +192,7 @@ export default function reduceThreadInfos(\n};\nconst threadStoreOperations = [\n{\n- type: 'remove',\n- payload: {\n- ids: Object.keys(state.threadInfos),\n- },\n+ type: 'remove_all',\n},\n...Object.keys(newThreadInfos).map((id: string) => ({\ntype: 'replace',\n@@ -222,10 +219,7 @@ export default function reduceThreadInfos(\n};\nconst threadStoreOperations = [\n{\n- type: 'remove',\n- payload: {\n- ids: Object.keys(state.threadInfos),\n- },\n+ type: 'remove_all',\n},\n];\nconst processedStore = processThreadStoreOperations(\n@@ -504,7 +498,7 @@ function processThreadStoreOperations(\nif (threadStoreOperations.length === 0) {\nreturn threadStore;\n}\n- const processedThreads = { ...threadStore.threadInfos };\n+ let processedThreads = { ...threadStore.threadInfos };\nfor (const operation of threadStoreOperations) {\nif (operation.type === 'replace') {\nprocessedThreads[operation.payload.id] = operation.payload.threadInfo;\n@@ -512,6 +506,8 @@ function processThreadStoreOperations(\nfor (const id of operation.payload.ids) {\ndelete processedThreads[id];\n}\n+ } else if (operation.type === 'remove_all') {\n+ processedThreads = {};\n}\n}\nreturn { ...threadStore, threadInfos: processedThreads };\n" }, { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -248,6 +248,10 @@ export type RemoveThreadOperation = {\n+payload: { +ids: $ReadOnlyArray<string> },\n};\n+export type RemoveAllThreadsOperation = {\n+ +type: 'remove_all',\n+};\n+\nexport type ReplaceThreadOperation = {\n+type: 'replace',\n+payload: { +id: string, +threadInfo: RawThreadInfo },\n@@ -255,6 +259,7 @@ export type ReplaceThreadOperation = {\nexport type ThreadStoreOperation =\n| RemoveThreadOperation\n+ | RemoveAllThreadsOperation\n| ReplaceThreadOperation;\nexport type ThreadDeletionRequest = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce `RemoveAllThreadsOperation` Summary: Introduce `RemoveAllThreadsOperation` to increase SQLite database performance. Test Plan: I tested if new operation works in the same way like an old solution with `RemoveThreadOperation` on virtual iOS device. No error messages appeared. Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2061
129,184
27.09.2021 13:09:43
14,400
28ece287e120c3424c6e7a68b8a859ecce1eac45
[CommCoreModule] Change `getStorage()` return type to `auto&` Summary: Resolves issue with SQLite transactions detailed at: Test Plan: No more OOM error from sqlite Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp", "diff": "@@ -237,7 +237,7 @@ void SQLiteQueryExecutor::migrate() {\nsqlite3_close(db);\n}\n-auto SQLiteQueryExecutor::getStorage() {\n+auto &SQLiteQueryExecutor::getStorage() {\nstatic auto storage = make_storage(\nSQLiteQueryExecutor::sqliteFilePath,\nmake_table(\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h", "diff": "@@ -10,7 +10,7 @@ namespace comm {\nclass SQLiteQueryExecutor : public DatabaseQueryExecutor {\nvoid migrate();\n- static auto getStorage();\n+ static auto &getStorage();\npublic:\nstatic std::string sqliteFilePath;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[CommCoreModule] Change `getStorage()` return type to `auto&` Summary: Resolves issue with SQLite transactions detailed at: https://www.notion.so/commapp/Client-DB-transactions-with-sqlite_orm-d97e6ff6f2484fffad0af7385330824b Test Plan: No more OOM error from sqlite Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2067
129,184
27.09.2021 17:25:18
14,400
76e35f8b2eb2c2c3aa2a1917c5a7a8586a393d37
[landing] Rename `Home` component to `Keyservers` Summary: Renaming existing `Home` component to `Keyservers`. We will create a new `App` component which will become the new "homepage". Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "RENAME", "old_path": "landing/home.react.js", "new_path": "landing/keyservers.react.js", "diff": "@@ -10,7 +10,7 @@ import StarBackground from './star-background.react';\nconst useIsomorphicLayoutEffect =\ntypeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n-function Home(): React.Node {\n+function Keyservers(): React.Node {\nReact.useEffect(() => {\nimport('@lottiefiles/lottie-player');\n}, []);\n@@ -144,4 +144,4 @@ function Home(): React.Node {\n);\n}\n-export default Home;\n+export default Keyservers;\n" }, { "change_type": "MODIFY", "old_path": "landing/landing.react.js", "new_path": "landing/landing.react.js", "diff": "import * as React from 'react';\nimport { Link, useLocation, useRouteMatch } from 'react-router-dom';\n-import Home from './home.react';\n+import Keyservers from './keyservers.react';\nimport css from './landing.css';\nimport Privacy from './privacy.react';\nimport SubscriptionForm from './subscription-form.react';\n@@ -35,7 +35,7 @@ function Landing(): React.Node {\n} else if (onSupport) {\nreturn <Support />;\n}\n- return <Home />;\n+ return <Keyservers />;\n}, [onPrivacy, onSupport, onTerms]);\nreturn (\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Rename `Home` component to `Keyservers` Summary: Renaming existing `Home` component to `Keyservers`. We will create a new `App` component which will become the new "homepage". Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2069
129,184
27.09.2021 19:55:52
14,400
a12b897b42f38079ad9350daf3652cceb1df817c
[landing] Pull out `Header` component Summary: Pull out `Header` from `Landing` to its own component. Test Plan: na Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "ADD", "old_path": null, "new_path": "landing/header.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { Link } from 'react-router-dom';\n+\n+import css from './landing.css';\n+\n+export type HeaderProps = {\n+ +isLegalPage: boolean,\n+};\n+function Header(props: HeaderProps): React.Node {\n+ const { isLegalPage } = props;\n+\n+ const headerStyle = isLegalPage\n+ ? `${css.header_grid} ${css.header_legal}`\n+ : css.header_grid;\n+ return (\n+ <div className={headerStyle}>\n+ <Link to=\"/\">\n+ <h1 className={css.logo}>Comm</h1>\n+ </Link>\n+ </div>\n+ );\n+}\n+\n+export default Header;\n" }, { "change_type": "MODIFY", "old_path": "landing/landing.react.js", "new_path": "landing/landing.react.js", "diff": "// @flow\nimport * as React from 'react';\n-import { Link, useLocation, useRouteMatch } from 'react-router-dom';\n+import { useLocation, useRouteMatch } from 'react-router-dom';\nimport AppLanding from './app-landing.react';\nimport Footer from './footer.react';\n+import Header from './header.react';\nimport Keyservers from './keyservers.react';\n-import css from './landing.css';\nimport Privacy from './privacy.react';\nimport Support from './support.react';\nimport Terms from './terms.react';\n@@ -21,11 +21,8 @@ function Landing(): React.Node {\nconst onTerms = useRouteMatch({ path: '/terms' });\nconst onSupport = useRouteMatch({ path: '/support' });\nconst onKeyservers = useRouteMatch({ path: '/keyservers' });\n- const headerStyle = React.useMemo(\n- () =>\n- onPrivacy || onTerms || onSupport\n- ? `${css.header_grid} ${css.header_legal}`\n- : css.header_grid,\n+ const isLegalPage: boolean = React.useMemo(\n+ () => !!(onPrivacy || onTerms || onSupport),\n[onPrivacy, onSupport, onTerms],\n);\n@@ -44,11 +41,7 @@ function Landing(): React.Node {\nreturn (\n<>\n- <div className={headerStyle}>\n- <Link to=\"/\">\n- <h1 className={css.logo}>Comm</h1>\n- </Link>\n- </div>\n+ <Header isLegalPage={isLegalPage} />\n{activeNode}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Pull out `Header` component Summary: Pull out `Header` from `Landing` to its own component. Test Plan: na Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2072
129,184
28.09.2021 13:37:54
14,400
71b4209883d458b43978b91644c4ce30def9c906
[landing] Include app screenshot placeholder Summary: For now it's just a prod screenshot of thread list. Test Plan: Image shows up on page: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/app-landing.react.js", "new_path": "landing/app-landing.react.js", "diff": "@@ -10,6 +10,7 @@ function AppLanding(): React.Node {\n<StarBackground />\n<center>\n<h1>App Landing Page</h1>\n+ <img height={300} src=\"images/comm-screenshot.png\" />\n</center>\n</div>\n);\n" }, { "change_type": "ADD", "old_path": "server/images/comm-screenshot.png", "new_path": "server/images/comm-screenshot.png", "diff": "Binary files /dev/null and b/server/images/comm-screenshot.png differ\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Include app screenshot placeholder Summary: For now it's just a prod screenshot of thread list. Test Plan: Image shows up on page: https://blob.sh/atul/fca3.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2080
129,184
28.09.2021 13:46:38
14,400
b70d224e33b89831b6968f2d5a104e6d93d2f7aa
[landing] Create `app_landing_grid` grid Summary: CSS grid for `AppLanding` component Test Plan: Here's what it looks like: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/app-landing.react.js", "new_path": "landing/app-landing.react.js", "diff": "import * as React from 'react';\n-import StarBackground from './star-background.react';\n+import css from './landing.css';\nfunction AppLanding(): React.Node {\nreturn (\n- <div>\n- <StarBackground />\n- <center>\n- <h1>App Landing Page</h1>\n- <img height={300} src=\"images/comm-screenshot.png\" />\n- </center>\n+ <div className={css.app_landing_grid}>\n+ <div className={css.app_preview}>\n+ <img height={600} src=\"images/comm-screenshot.png\" />\n+ </div>\n+ <div className={css.app_copy}>\n+ <h1>Comm Messenger</h1>\n+ <p className={css.mono}>Web3 Messenger. E2E encrypted. Blah..</p>\n+ </div>\n</div>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -52,7 +52,8 @@ span.purple_accent {\n/* ===== COMMON CSS GRID LAYOUT ===== */\ndiv.header_grid,\ndiv.body_grid,\n-div.footer_grid {\n+div.footer_grid,\n+div.app_landing_grid {\nmax-width: 1920px;\nmargin-left: auto;\nmargin-right: auto;\n@@ -157,6 +158,25 @@ div.subscribe_updates {\nalign-self: center;\n}\n+/* ===== APP LANDING GRID ===== */\n+div.app_landing_grid {\n+ grid-template-areas: 'app_preview app_copy';\n+ padding-top: 200px;\n+ padding-bottom: 260px;\n+}\n+\n+div.app_preview {\n+ grid-area: app_preview;\n+ align-self: center;\n+ justify-self: right;\n+}\n+\n+div.app_copy {\n+ grid-area: app_copy;\n+ align-self: center;\n+ justify-self: left;\n+}\n+\n/* ===== LEGAL PAGE STYLING ===== */\ndiv.legal_container {\nmax-width: 1080px;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Create `app_landing_grid` grid Summary: CSS grid for `AppLanding` component Test Plan: Here's what it looks like: https://blob.sh/atul/6aad.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2081
129,184
28.09.2021 14:21:44
14,400
fc95c84ed0e4d6a7f70dc96d8b5988cab7423d12
[landing] Create `tile_grid` grid Summary: CSS grid for `AppLanding` component Test Plan: Here's what it looks like: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/app-landing.react.js", "new_path": "landing/app-landing.react.js", "diff": "@@ -13,6 +13,20 @@ function AppLanding(): React.Node {\n<div className={css.app_copy}>\n<h1>Comm Messenger</h1>\n<p className={css.mono}>Web3 Messenger. E2E encrypted. Blah..</p>\n+ <div className={css.tile_grid}>\n+ <div className={css.tile_tl}>\n+ <p>E2E Encryption</p>\n+ </div>\n+ <div className={css.tile_tr}>\n+ <p>Self-hosted</p>\n+ </div>\n+ <div className={css.tile_bl}>\n+ <p>Federated</p>\n+ </div>\n+ <div className={css.tile_br}>\n+ <p>Sovereign Identity</p>\n+ </div>\n+ </div>\n</div>\n</div>\n);\n" }, { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -177,6 +177,54 @@ div.app_copy {\njustify-self: left;\n}\n+/* ===== TILE GRID STYLING ===== */\n+div.tile_grid {\n+ display: grid;\n+ grid-template-columns: 1fr 1fr;\n+ grid-template-rows: 1fr 1fr;\n+ max-width: 17vw;\n+ row-gap: 1vw;\n+ column-gap: 1vw;\n+ padding-top: 40px;\n+ padding-bottom: 40px;\n+ grid-template-areas:\n+ 'tile_tl tile_tr'\n+ 'tile_bl tile_br';\n+}\n+\n+div.tile_tl,\n+div.tile_tr,\n+div.tile_bl,\n+div.tile_br {\n+ width: 8vw;\n+ height: 8vw;\n+ border-radius: 36px;\n+ background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);\n+}\n+\n+div.tile_tl p,\n+div.tile_tr p,\n+div.tile_bl p,\n+div.tile_br p {\n+ font-weight: bold;\n+ font-size: 14px;\n+ color: #485563;\n+ text-align: center;\n+}\n+\n+div.tile_tl {\n+ grid-area: tile_tl;\n+}\n+div.tile_tr {\n+ grid-area: tile_tr;\n+}\n+div.tile_bl {\n+ grid-area: tile_bl;\n+}\n+div.tile_br {\n+ grid-area: tile_br;\n+}\n+\n/* ===== LEGAL PAGE STYLING ===== */\ndiv.legal_container {\nmax-width: 1080px;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Create `tile_grid` grid Summary: CSS grid for `AppLanding` component Test Plan: Here's what it looks like: https://blob.sh/atul/3a88.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2082
129,184
28.09.2021 14:35:41
14,400
3653bacb3b4060d263a71f590d0bbdf4f69bd587
[landing] Make tile `div`s `display:flex` Summary: So we can align text vertically in each tile (which will shortly become their own components) Test Plan: Here's what it looks like: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -196,10 +196,14 @@ div.tile_tl,\ndiv.tile_tr,\ndiv.tile_bl,\ndiv.tile_br {\n+ display: flex;\nwidth: 8vw;\nheight: 8vw;\nborder-radius: 36px;\nbackground-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);\n+ justify-content: center;\n+ align-content: center;\n+ flex-direction: column;\n}\ndiv.tile_tl p,\n@@ -207,7 +211,7 @@ div.tile_tr p,\ndiv.tile_bl p,\ndiv.tile_br p {\nfont-weight: bold;\n- font-size: 14px;\n+ font-size: 12px;\ncolor: #485563;\ntext-align: center;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Make tile `div`s `display:flex` Summary: So we can align text vertically in each tile (which will shortly become their own components) Test Plan: Here's what it looks like: https://blob.sh/atul/4bdf.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2083
129,184
28.09.2021 14:54:32
14,400
18628c4cb206ff82c7e9f90f3d6f6eed3c7a9e39
[landing] Make `app_landing_grid` "responsive" Summary: Re-arrange CSS grid at smallest breakpoint. Test Plan: Before: After: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -315,7 +315,8 @@ div.body_grid > div + .starting_section {\n/* ===== COMMON CSS GRID LAYOUT ===== */\ndiv.body_grid,\ndiv.footer_grid,\n- div.header_grid {\n+ div.header_grid,\n+ div.app_landing_grid {\npadding-left: 3%;\npadding-right: 3%;\ngrid-template-columns: minmax(auto, 540px);\n@@ -368,6 +369,30 @@ div.body_grid > div + .starting_section {\ngrid-area: sitemap;\n}\n+ /* ===== APP LANDING GRID LAYOUT ===== */\n+ div.app_landing_grid {\n+ grid-template-areas:\n+ 'app_preview'\n+ 'app_copy';\n+ }\n+\n+ div.app_preview {\n+ grid-area: app_preview;\n+ align-self: center;\n+ justify-self: center;\n+ }\n+\n+ div.app_copy {\n+ grid-area: app_copy;\n+ align-self: center;\n+ justify-self: center;\n+ }\n+\n+ div.app_copy h1,\n+ div.app_copy p {\n+ text-align: center;\n+ }\n+\n/* ===== LAYOUT HACKS ===== */\n.section {\npadding-top: 20px;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Make `app_landing_grid` "responsive" Summary: Re-arrange CSS grid at smallest breakpoint. Test Plan: Before: https://blob.sh/atul/before_smallest_break.png After: https://blob.sh/atul/after_smallest_break.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2084
129,184
28.09.2021 15:32:47
14,400
23bff70bbbc2fcc03347222ba16dd9635078e444
[landing] Add icons to info tiles Summary: Include `FontAwesomeIcon` in `landing/package.json` and use in `AppLanding` Test Plan: Here's what it looks like: Reviewers: ashoat, palys-swm Subscribers: palys-swm, Adrian, karol-bisztyga
[ { "change_type": "MODIFY", "old_path": "landing/app-landing.react.js", "new_path": "landing/app-landing.react.js", "diff": "// @flow\n+import {\n+ faLock,\n+ faUserShield,\n+ faUsers,\n+ faServer,\n+} from '@fortawesome/free-solid-svg-icons';\n+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport * as React from 'react';\nimport css from './landing.css';\n@@ -15,15 +22,19 @@ function AppLanding(): React.Node {\n<p className={css.mono}>Web3 Messenger. E2E encrypted. Blah..</p>\n<div className={css.tile_grid}>\n<div className={css.tile_tl}>\n+ <FontAwesomeIcon color=\"#7e57c2\" icon={faLock} />\n<p>E2E Encryption</p>\n</div>\n<div className={css.tile_tr}>\n+ <FontAwesomeIcon color=\"#7e57c2\" icon={faServer} />\n<p>Self-hosted</p>\n</div>\n<div className={css.tile_bl}>\n+ <FontAwesomeIcon color=\"#7e57c2\" icon={faUsers} />\n<p>Federated</p>\n</div>\n<div className={css.tile_br}>\n+ <FontAwesomeIcon color=\"#7e57c2\" icon={faUserShield} />\n<p>Sovereign Identity</p>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -202,7 +202,7 @@ div.tile_br {\nborder-radius: 36px;\nbackground-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);\njustify-content: center;\n- align-content: center;\n+ align-items: center;\nflex-direction: column;\n}\n" }, { "change_type": "MODIFY", "old_path": "landing/package.json", "new_path": "landing/package.json", "diff": "},\n\"dependencies\": {\n\"@babel/runtime\": \"^7.13.10\",\n+ \"@fortawesome/fontawesome-svg-core\": \"^1.2.25\",\n+ \"@fortawesome/free-regular-svg-icons\": \"^5.11.2\",\n+ \"@fortawesome/free-solid-svg-icons\": \"^5.11.2\",\n+ \"@fortawesome/react-fontawesome\": \"^0.1.5\",\n\"@lottiefiles/lottie-interactivity\": \"^0.1.4\",\n\"@lottiefiles/lottie-player\": \"^1.0.3\",\n\"core-js\": \"^3.6.5\",\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Add icons to info tiles Summary: Include `FontAwesomeIcon` in `landing/package.json` and use in `AppLanding` Test Plan: Here's what it looks like: https://blob.sh/atul/b26f.png Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: palys-swm, Adrian, karol-bisztyga Differential Revision: https://phabricator.ashoat.com/D2085
129,190
30.09.2021 11:36:25
-7,200
3f8300708cd405358e6d69dbc6aa31988d24988c
[services] Add scripts for the grpc server Summary: Adds scripts for the grpc server that generate grpc files from protos, build and start the server Test Plan: `./services/tunnelbroker/server/run.sh` Reviewers: palys-swm, geekbrother, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "ADD", "old_path": null, "new_path": "services/package.json", "diff": "+{\n+ \"name\": \"services\",\n+ \"version\": \"1.0.0\",\n+ \"private\": true,\n+ \"license\": \"BSD-3-Clause\",\n+ \"scripts\": {\n+ \"run-grpc-server\": \"cd .. && ./services/tunnelbroker/run.sh && ./services/tunnelbroker/grpc-server/run.sh --overwrite\"\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "services/tunnelbroker/grpc-server/transferred/build_and_run_server.sh", "diff": "+#!/bin/bash\n+\n+set -e\n+\n+cd transferred/server\n+\n+rm -rf lib\n+mkdir lib\n+pushd lib\n+ln -s /usr/lib/folly\n+ln -s /usr/lib/glog\n+ln -s /usr/lib/double-conversion\n+popd # lib\n+\n+rm -rf _generated\n+mkdir _generated\n+\n+rm -rf cmake/build\n+mkdir -p cmake/build\n+\n+./generate.sh\n+./build.sh\n+./cmake/build/bin/tunnelbroker\n" }, { "change_type": "ADD", "old_path": null, "new_path": "services/tunnelbroker/grpc-server/transferred/server/build.sh", "diff": "+#!/bin/bash\n+\n+set -e\n+\n+echo \"building the server...\"\n+\n+pushd cmake/build\n+cmake ../..\n+make -j\n+\n+popd\n+\n+echo \"success - server built\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "services/tunnelbroker/grpc-server/transferred/server/generate.sh", "diff": "+#!/bin/bash\n+\n+set -e\n+\n+echo \"generating files from protos...\"\n+\n+protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/tunnelbroker.proto\n+\n+echo \"success - code generated from protos\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[services] Add scripts for the grpc server Summary: Adds scripts for the grpc server that generate grpc files from protos, build and start the server Test Plan: `./services/tunnelbroker/server/run.sh` Reviewers: palys-swm, geekbrother, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D2034
129,190
30.09.2021 13:35:09
-7,200
bb2795175938395091190623e0d57c83763200cb
[native] Fix grpc for building Summary: I missed adding `SortIncludes: false` in D2012 which results in build errors. Sorry that I broke master but this fix works Test Plan: build Reviewers: ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/grpc/_generated/.clang-format", "new_path": "native/cpp/CommonCpp/grpc/_generated/.clang-format", "diff": "---\nDisableFormat: true\n+SortIncludes: false\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "native/cpp/CommonCpp/grpc/_generated/tunnelbroker.pb.h", "new_path": "native/cpp/CommonCpp/grpc/_generated/tunnelbroker.pb.h", "diff": "#error regenerate this file with a newer version of protoc.\n#endif\n+#include <google/protobuf/port_undef.inc>\n+#include <google/protobuf/io/coded_stream.h>\n#include <google/protobuf/arena.h>\n#include <google/protobuf/arenastring.h>\n-#include <google/protobuf/extension_set.h> // IWYU pragma: export\n-#include <google/protobuf/generated_enum_reflection.h>\n-#include <google/protobuf/generated_message_reflection.h>\n#include <google/protobuf/generated_message_table_driven.h>\n#include <google/protobuf/generated_message_util.h>\n-#include <google/protobuf/io/coded_stream.h>\n-#include <google/protobuf/message.h>\n#include <google/protobuf/metadata_lite.h>\n-#include <google/protobuf/port_undef.inc>\n+#include <google/protobuf/generated_message_reflection.h>\n+#include <google/protobuf/message.h>\n#include <google/protobuf/repeated_field.h> // IWYU pragma: export\n+#include <google/protobuf/extension_set.h> // IWYU pragma: export\n+#include <google/protobuf/generated_enum_reflection.h>\n#include <google/protobuf/unknown_field_set.h>\n// @@protoc_insertion_point(includes)\n#include <google/protobuf/port_def.inc>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Fix grpc for building Summary: I missed adding `SortIncludes: false` in D2012 which results in build errors. Sorry that I broke master but this fix works Test Plan: build Reviewers: ashoat Reviewed By: ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D2101