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,191
11.05.2021 15:28:23
-7,200
84056cf9e5f7f482e21743ad64212e06cf3bcb70
[native] Delete OptimisticThreadInfo Summary: D1143, D1144 and D1145 removed all the usages of `OptimisticThreadInfo`, so we can safely delete it Test Plan: Flow, tested with other diffs Reviewers: ashoat Subscribers: KatPo, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -166,11 +166,6 @@ export type ThreadInfo = {|\nrepliesCount: number,\n|};\n-export type OptimisticThreadInfo = {|\n- +threadInfo: ThreadInfo,\n- +sourceMessageID?: string,\n-|};\n-\nexport type ServerMemberInfo = {|\n+id: string,\n+role: ?string,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Delete OptimisticThreadInfo Summary: D1143, D1144 and D1145 removed all the usages of `OptimisticThreadInfo`, so we can safely delete it Test Plan: Flow, tested with other diffs Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1146
129,191
12.05.2021 15:22:01
-7,200
1a67e2fb37670d6069abed0aa214a79cc805694a
[lib] Remove sourceMessageID parameter from useMessageListData hook Summary: Use `sourceMessageID` property of `threadInfo` Test Plan: The same as in D1149 Reviewers: ashoat Subscribers: KatPo, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "lib/selectors/chat-selectors.js", "new_path": "lib/selectors/chat-selectors.js", "diff": "@@ -400,19 +400,18 @@ const messageListData: (\n);\ntype UseMessageListDataArgs = {|\n- +sourceMessageID: ?string,\n+searching: boolean,\n+userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n+threadInfo: ?ThreadInfo,\n|};\nfunction useMessageListData({\n- sourceMessageID,\nsearching,\nuserInfoInputArray,\nthreadInfo,\n}: UseMessageListDataArgs) {\nconst pendingSidebarSourceMessageInfo = useSelector((state) => {\n+ const sourceMessageID = threadInfo?.sourceMessageID;\nif (threadInfo?.type !== threadTypes.SIDEBAR || !sourceMessageID) {\nreturn null;\n}\n" }, { "change_type": "MODIFY", "old_path": "native/chat/message-list-container.react.js", "new_path": "native/chat/message-list-container.react.js", "diff": "@@ -337,7 +337,7 @@ export default React.memo<BaseProps>(function ConnectedMessageListContainer(\nprops.route.params.threadInfo,\n);\n- const { searching, sourceMessageID } = props.route.params;\n+ const { searching } = props.route.params;\nconst threadInfo = useCurrentThreadInfo({\nbaseThreadInfo,\nsearching: !!searching,\n@@ -367,7 +367,6 @@ export default React.memo<BaseProps>(function ConnectedMessageListContainer(\nconst threadID = threadInfo.id;\nconst messageListData = useMessageListData({\n- sourceMessageID,\nsearching: !!searching,\nuserInfoInputArray,\nthreadInfo,\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-message-list.react.js", "new_path": "web/chat/chat-message-list.react.js", "diff": "@@ -394,7 +394,6 @@ export default React.memo<BaseProps>(function ConnectedChatMessageList(\n}\nreturn threadInfoSelector(state)[activeID] ?? state.navInfo.pendingThread;\n});\n- const sourceMessageID = useSelector((state) => state.navInfo.sourceMessageID);\nconst threadInfo = useCurrentThreadInfo({\nbaseThreadInfo,\nsearching: false,\n@@ -402,10 +401,9 @@ export default React.memo<BaseProps>(function ConnectedChatMessageList(\n});\nconst messageListData = useMessageListData({\n- sourceMessageID,\n+ threadInfo,\nsearching: false,\nuserInfoInputArray: [],\n- threadInfo,\n});\nconst startReached = useSelector((state) => {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Remove sourceMessageID parameter from useMessageListData hook Summary: Use `sourceMessageID` property of `threadInfo` Test Plan: The same as in D1149 Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1150
129,191
12.05.2021 15:25:16
-7,200
40af7b067a4ffa78558d8d27f62cc5bef24fee5d
[native] Delete sourceMessageID nav param from message list Summary: In D1149 and D1150 we removed the usages of this param so now it can be deleted Test Plan: Tested with other diffs Reviewers: ashoat Subscribers: KatPo, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/chat/message-list-types.js", "new_path": "native/chat/message-list-types.js", "diff": "@@ -10,7 +10,6 @@ import { useTextMessageRulesFunc } from '../markdown/rules.react';\nexport type MessageListParams = {|\n+threadInfo: ThreadInfo,\n- +sourceMessageID?: string,\n+pendingPersonalThreadUserInfo?: UserInfo,\n+searching?: boolean,\n|};\n" }, { "change_type": "MODIFY", "old_path": "native/chat/sidebar-navigation.js", "new_path": "native/chat/sidebar-navigation.js", "diff": "@@ -79,13 +79,11 @@ function onPressCreateSidebar(\nviewerID,\ngetDefaultTextMessageRules().simpleMarkdownRules,\n);\n- const sourceMessageID = messageInfo.id;\nnavigation.navigate({\nname: MessageListRouteName,\nparams: {\nthreadInfo: pendingSidebarInfo,\n- sourceMessageID,\n},\nkey: `${MessageListRouteName}${pendingSidebarInfo.id}`,\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Delete sourceMessageID nav param from message list Summary: In D1149 and D1150 we removed the usages of this param so now it can be deleted Test Plan: Tested with other diffs Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1151
129,191
12.05.2021 15:27:51
-7,200
542a74a629678152246e563a5e61cd60ceaf52f9
[web] Delete sourceMessageID from NavInfo Summary: In D1149 and D1150 all the usages were removed Test Plan: Tested with other diffs Reviewers: ashoat Subscribers: KatPo, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "web/selectors/nav-selectors.js", "new_path": "web/selectors/nav-selectors.js", "diff": "@@ -171,7 +171,6 @@ function useOnClickPendingSidebar(\npayload: {\nactiveChatThreadID: pendingSidebarInfo.id,\npendingThread: pendingSidebarInfo,\n- sourceMessageID: messageInfo.id,\n},\n});\n},\n" }, { "change_type": "MODIFY", "old_path": "web/types/nav-types.js", "new_path": "web/types/nav-types.js", "diff": "@@ -9,7 +9,6 @@ export type NavInfo = {|\n+verify: ?string,\n+activeChatThreadID: ?string,\n+pendingThread?: ThreadInfo,\n- +sourceMessageID?: string,\n|};\nexport const updateNavInfoActionType = 'UPDATE_NAV_INFO';\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Delete sourceMessageID from NavInfo Summary: In D1149 and D1150 all the usages were removed Test Plan: Tested with other diffs Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1152
129,184
13.05.2021 16:20:40
14,400
73b2dc0e743838fcd6a6d24f8cf5ae4e28147e79
[native] memoize some `reanimated` nodes in `video-playback-modal` Summary: memoized some of the `reanimated` nodes in `video-playback-modal` using `React.useMemo()` Test Plan: The zoom in/out animation continues to work as it did previously. Tested on iOS simulator. Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/video-playback-modal.react.js", "new_path": "native/media/video-playback-modal.react.js", "diff": "@@ -172,18 +172,38 @@ function VideoPlaybackModal(props: Props) {\nimageHeight,\n]);\n- const left = sub(centerX, divide(imageWidth, 2));\n- const top = sub(centerY, divide(imageHeight, 2));\n+ const left = React.useMemo(() => sub(centerX, divide(imageWidth, 2)), [\n+ centerX,\n+ imageWidth,\n+ ]);\n+ const top = React.useMemo(() => sub(centerY, divide(imageHeight, 2)), [\n+ centerY,\n+ imageHeight,\n+ ]);\nconst { initialCoordinates } = props.route.params;\n- const initialScale = divide(initialCoordinates.width, imageWidth);\n- const initialTranslateX = sub(\n+\n+ const initialScale = React.useMemo(\n+ () => divide(initialCoordinates.width, imageWidth),\n+ [initialCoordinates, imageWidth],\n+ );\n+\n+ const initialTranslateX = React.useMemo(\n+ () =>\n+ sub(\ninitialCoordinates.x + initialCoordinates.width / 2,\nadd(left, divide(imageWidth, 2)),\n+ ),\n+ [initialCoordinates, left, imageWidth],\n);\n- const initialTranslateY = sub(\n+\n+ const initialTranslateY = React.useMemo(\n+ () =>\n+ sub(\ninitialCoordinates.y + initialCoordinates.height / 2,\nadd(top, divide(imageHeight, 2)),\n+ ),\n+ [initialCoordinates, top, imageHeight],\n);\n// The all-important outputs\n@@ -192,44 +212,94 @@ function VideoPlaybackModal(props: Props) {\nconst curY = useValue(0);\nconst curBackdropOpacity = useValue(1);\n- const progressiveOpacity = max(\n+ const progressiveOpacity = React.useMemo(\n+ () =>\n+ max(\nmin(\nsub(1, abs(divide(curX, frameWidth))),\nsub(1, abs(divide(curY, frameHeight))),\n),\n0,\n+ ),\n+ [curX, curY, frameWidth, frameHeight],\n);\n- const updates = [set(curBackdropOpacity, progressiveOpacity)];\n- const updatedScale = [updates, curScale];\n- const updatedCurX = [updates, curX];\n- const updatedCurY = [updates, curY];\n- const updatedBackdropOpacity = [updates, curBackdropOpacity];\n+ const updates = React.useMemo(\n+ () => [set(curBackdropOpacity, progressiveOpacity)],\n+ [curBackdropOpacity, progressiveOpacity],\n+ );\n+ const updatedScale = React.useMemo(() => [updates, curScale], [\n+ updates,\n+ curScale,\n+ ]);\n+ const updatedCurX = React.useMemo(() => [updates, curX], [updates, curX]);\n+ const updatedCurY = React.useMemo(() => [updates, curY], [updates, curY]);\n+ const updatedBackdropOpacity = React.useMemo(\n+ () => [updates, curBackdropOpacity],\n+ [updates, curBackdropOpacity],\n+ );\nconst overlayContext = React.useContext(OverlayContext);\ninvariant(overlayContext, 'VideoPlaybackModal should have OverlayContext');\nconst navigationProgress = overlayContext.position;\n- const reverseNavigationProgress = sub(1, navigationProgress);\n- const scale = add(\n+ const reverseNavigationProgress = React.useMemo(\n+ () => sub(1, navigationProgress),\n+ [navigationProgress],\n+ );\n+\n+ const scale = React.useMemo(\n+ () =>\n+ add(\nmultiply(reverseNavigationProgress, initialScale),\nmultiply(navigationProgress, updatedScale),\n+ ),\n+ [reverseNavigationProgress, initialScale, navigationProgress, updatedScale],\n);\n- const x = add(\n+\n+ const x = React.useMemo(\n+ () =>\n+ add(\nmultiply(reverseNavigationProgress, initialTranslateX),\nmultiply(navigationProgress, updatedCurX),\n+ ),\n+ [\n+ reverseNavigationProgress,\n+ initialTranslateX,\n+ navigationProgress,\n+ updatedCurX,\n+ ],\n);\n- const y = add(\n+\n+ const y = React.useMemo(\n+ () =>\n+ add(\nmultiply(reverseNavigationProgress, initialTranslateY),\nmultiply(navigationProgress, updatedCurY),\n+ ),\n+ [\n+ reverseNavigationProgress,\n+ initialTranslateY,\n+ navigationProgress,\n+ updatedCurY,\n+ ],\n+ );\n+\n+ const backdropOpacity = React.useMemo(\n+ () => multiply(navigationProgress, updatedBackdropOpacity),\n+ [navigationProgress, updatedBackdropOpacity],\n);\n- const backdropOpacity = multiply(navigationProgress, updatedBackdropOpacity);\n- const imageContainerOpacity = interpolate(navigationProgress, {\n+ const imageContainerOpacity = React.useMemo(\n+ () =>\n+ interpolate(navigationProgress, {\ninputRange: [0, 0.1],\noutputRange: [0, 1],\nextrapolate: Extrapolate.CLAMP,\n- });\n+ }),\n+ [navigationProgress],\n+ );\n+\nconst { verticalBounds } = props.route.params;\nconst videoContainerStyle = React.useMemo(() => {\nconst { height, width } = mediaDisplayDimensions;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] memoize some `reanimated` nodes in `video-playback-modal` Summary: memoized some of the `reanimated` nodes in `video-playback-modal` using `React.useMemo()` Test Plan: The zoom in/out animation continues to work as it did previously. Tested on iOS simulator. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1153
129,183
12.05.2021 15:06:32
-7,200
cd8fb8c59d1aca4184c6d0678f96be0ca6675002
[native] Rename more.react to profile.react Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab works Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/navigation/app-navigator.react.js", "new_path": "native/navigation/app-navigator.react.js", "diff": "@@ -19,7 +19,7 @@ import KeyboardStateContainer from '../keyboard/keyboard-state-container.react';\nimport CameraModal from '../media/camera-modal.react';\nimport ImageModal from '../media/image-modal.react';\nimport VideoPlaybackModal from '../media/video-playback-modal.react';\n-import More from '../profile/more.react';\n+import More from '../profile/profile.react';\nimport RelationshipListItemTooltipModal from '../profile/relationship-list-item-tooltip-modal.react';\nimport PushHandler from '../push/push-handler.react';\nimport { getPersistor } from '../redux/persist';\n" }, { "change_type": "MODIFY", "old_path": "native/profile/dev-tools.react.js", "new_path": "native/profile/dev-tools.react.js", "diff": "@@ -16,7 +16,7 @@ import { useSelector } from '../redux/redux-utils';\nimport { useColors, useStyles, type Colors } from '../themes/colors';\nimport { wipeAndExit } from '../utils/crash-utils';\nimport { nodeServerOptions } from '../utils/url-utils';\n-import type { MoreNavigationProp } from './more.react';\n+import type { MoreNavigationProp } from './profile.react';\nconst ServerIcon = () => (\n<Icon\n" }, { "change_type": "MODIFY", "old_path": "native/profile/edit-email.react.js", "new_path": "native/profile/edit-email.react.js", "diff": "@@ -32,7 +32,7 @@ import type { NavigationRoute } from '../navigation/route-names';\nimport { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\nimport { type GlobalTheme } from '../types/themes';\n-import type { MoreNavigationProp } from './more.react';\n+import type { MoreNavigationProp } from './profile.react';\ntype BaseProps = {|\n+navigation: MoreNavigationProp<'EditEmail'>,\n" }, { "change_type": "MODIFY", "old_path": "native/profile/edit-password.react.js", "new_path": "native/profile/edit-password.react.js", "diff": "@@ -32,7 +32,7 @@ import type { NavigationRoute } from '../navigation/route-names';\nimport { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\nimport type { GlobalTheme } from '../types/themes';\n-import type { MoreNavigationProp } from './more.react';\n+import type { MoreNavigationProp } from './profile.react';\ntype BaseProps = {|\n+navigation: MoreNavigationProp<'EditPassword'>,\n" }, { "change_type": "MODIFY", "old_path": "native/profile/more-screen.react.js", "new_path": "native/profile/more-screen.react.js", "diff": "@@ -49,7 +49,7 @@ import {\n} from '../navigation/route-names';\nimport { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\n-import type { MoreNavigationProp } from './more.react';\n+import type { MoreNavigationProp } from './profile.react';\ntype BaseProps = {|\n+navigation: MoreNavigationProp<'MoreScreen'>,\n" }, { "change_type": "RENAME", "old_path": "native/profile/more.react.js", "new_path": "native/profile/profile.react.js", "diff": "" }, { "change_type": "MODIFY", "old_path": "native/profile/relationship-list.react.js", "new_path": "native/profile/relationship-list.react.js", "diff": "@@ -55,7 +55,7 @@ import {\nuseIndicatorStyle,\n} from '../themes/colors';\nimport type { VerticalBounds } from '../types/layout-types';\n-import type { MoreNavigationProp } from './more.react';\n+import type { MoreNavigationProp } from './profile.react';\nimport RelationshipListItem from './relationship-list-item.react';\nconst TagInput = createTagInput<GlobalAccountUserInfo>();\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Rename more.react to profile.react Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab works Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1156
129,183
12.05.2021 15:08:05
-7,200
fe650b8bab5acb57dcbca1a4c6bc71cc4b9281e2
[native] Rename more-screen.react to profile-screen Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab still works Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "RENAME", "old_path": "native/profile/more-screen.react.js", "new_path": "native/profile/profile-screen.react.js", "diff": "" }, { "change_type": "MODIFY", "old_path": "native/profile/profile.react.js", "new_path": "native/profile/profile.react.js", "diff": "@@ -31,7 +31,7 @@ import DevTools from './dev-tools.react';\nimport EditEmail from './edit-email.react';\nimport EditPassword from './edit-password.react';\nimport MoreHeader from './more-header.react';\n-import MoreScreen from './more-screen.react';\n+import MoreScreen from './profile-screen.react';\nimport RelationshipList from './relationship-list.react';\nconst header = (props: StackHeaderProps) => <MoreHeader {...props} />;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Rename more-screen.react to profile-screen Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab still works Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1157
129,183
12.05.2021 15:09:20
-7,200
37f42bb01992ecf4e089c87a67b894b3a4237830
[native] Rename more-header.react to profile-header.react Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab still works Reviewers: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul
[ { "change_type": "RENAME", "old_path": "native/profile/more-header.react.js", "new_path": "native/profile/profile-header.react.js", "diff": "" }, { "change_type": "MODIFY", "old_path": "native/profile/profile.react.js", "new_path": "native/profile/profile.react.js", "diff": "@@ -30,7 +30,7 @@ import DeleteAccount from './delete-account.react';\nimport DevTools from './dev-tools.react';\nimport EditEmail from './edit-email.react';\nimport EditPassword from './edit-password.react';\n-import MoreHeader from './more-header.react';\n+import MoreHeader from './profile-header.react';\nimport MoreScreen from './profile-screen.react';\nimport RelationshipList from './relationship-list.react';\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Rename more-header.react to profile-header.react Summary: Next step in renaming more tab to profile, rename file and update imports Test Plan: Flow, make sure more tab still works Reviewers: palys-swm, ashoat Reviewed By: palys-swm, ashoat Subscribers: ashoat, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1158
129,184
15.05.2021 19:16:58
14,400
8d851852ffb0f6c25ac0af5d397d1e5f1774a100
[native] Disable `video-playback-modal` controls when opacity is 0 Summary: Disable the `video-playback-modal` controls when the opacity is at 0. Test Plan: Behaves as expected when tested on iOS Simulator. Also logged state/Animated values to confirm they were as expected. Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/video-playback-modal.react.js", "new_path": "native/media/video-playback-modal.react.js", "diff": "@@ -32,7 +32,12 @@ import { formatDuration } from './video-utils';\n/* eslint-disable import/no-named-as-default-member */\nconst {\nExtrapolate,\n+ and,\n+ block,\ncond,\n+ eq,\n+ ceil,\n+ call,\nset,\nadd,\nsub,\n@@ -97,6 +102,41 @@ function VideoPlaybackModal(props: Props) {\n[singleTapState, controlsShowing],\n);\n+ const [controlsEnabled, setControlsEnabled] = React.useState(true);\n+ const enableControls = React.useCallback(() => setControlsEnabled(true), []);\n+ const disableControls = React.useCallback(\n+ () => setControlsEnabled(false),\n+ [],\n+ );\n+\n+ const previousOpacityCeiling = useValue(-1);\n+ const opacityCeiling = React.useMemo(() => ceil(controlsOpacity), [\n+ controlsOpacity,\n+ ]);\n+\n+ const opacityJustChanged = React.useMemo(\n+ () =>\n+ cond(eq(previousOpacityCeiling, opacityCeiling), 0, [\n+ set(previousOpacityCeiling, opacityCeiling),\n+ 1,\n+ ]),\n+ [previousOpacityCeiling, opacityCeiling],\n+ );\n+\n+ const toggleControls = React.useMemo(\n+ () => [\n+ cond(\n+ and(eq(opacityJustChanged, 1), eq(opacityCeiling, 0)),\n+ call([], disableControls),\n+ ),\n+ cond(\n+ and(eq(opacityJustChanged, 1), eq(opacityCeiling, 1)),\n+ call([], enableControls),\n+ ),\n+ ],\n+ [opacityJustChanged, opacityCeiling, disableControls, enableControls],\n+ );\n+\n/* ===== END FADE CONTROL ANIMATION ===== */\nconst mediaDimensions = mediaInfo.dimensions;\n@@ -225,8 +265,8 @@ function VideoPlaybackModal(props: Props) {\n);\nconst updates = React.useMemo(\n- () => [set(curBackdropOpacity, progressiveOpacity)],\n- [curBackdropOpacity, progressiveOpacity],\n+ () => [toggleControls, set(curBackdropOpacity, progressiveOpacity)],\n+ [curBackdropOpacity, progressiveOpacity, toggleControls],\n);\nconst updatedScale = React.useMemo(() => [updates, curScale], [\nupdates,\n@@ -239,6 +279,11 @@ function VideoPlaybackModal(props: Props) {\n[updates, curBackdropOpacity],\n);\n+ const updatedControlsOpacity = React.useMemo(\n+ () => block([updates, controlsOpacity]),\n+ [updates, controlsOpacity],\n+ );\n+\nconst overlayContext = React.useContext(OverlayContext);\ninvariant(overlayContext, 'VideoPlaybackModal should have OverlayContext');\nconst navigationProgress = overlayContext.position;\n@@ -399,8 +444,8 @@ function VideoPlaybackModal(props: Props) {\nconst controls = (\n<Animated.View\n- style={[styles.controls, { opacity: controlsOpacity }]}\n- pointerEvents=\"box-none\"\n+ style={[styles.controls, { opacity: updatedControlsOpacity }]}\n+ pointerEvents={controlsEnabled ? 'box-none' : 'none'}\n>\n<View style={styles.header}>\n<View style={styles.closeButton}>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Disable `video-playback-modal` controls when opacity is 0 Summary: Disable the `video-playback-modal` controls when the opacity is at 0. Test Plan: Behaves as expected when tested on iOS Simulator. Also logged state/Animated values to confirm they were as expected. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1162
129,187
17.05.2021 11:31:08
14,400
75765781f0525a54cbd8e2dff42a1d989558fb72
[native] Add displayName to Search Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/components/search.react.js", "new_path": "native/components/search.react.js", "diff": "@@ -23,7 +23,7 @@ type Props = {|\n+containerStyle?: ViewStyle,\n+active?: boolean,\n|};\n-const Search = React.forwardRef<Props, typeof TextInput>(\n+\nfunction ForwardedSearch(props: Props, ref: React.Ref<typeof TextInput>) {\nconst { onChangeText, searchText, containerStyle, active, ...rest } = props;\n@@ -96,8 +96,10 @@ const Search = React.forwardRef<Props, typeof TextInput>(\n{clearSearchInputIcon}\n</View>\n);\n- },\n-);\n+}\n+\n+const Search = React.forwardRef<Props, typeof TextInput>(ForwardedSearch);\n+Search.displayName = 'Search';\nconst unboundStyles = {\nsearch: {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add displayName to Search Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1166
129,187
17.05.2021 11:49:01
14,400
014383f649ff464cb488fb8f0fe6443c5a3ede43
[native] Make GestureTouchableOpacity forward its TapGestureHandler ref Test Plan: Will test in combo with diffs Reviewers: atul Subscribers: KatPo, palys-swm, atul, Adrian
[ { "change_type": "MODIFY", "old_path": "native/components/gesture-touchable-opacity.react.js", "new_path": "native/components/gesture-touchable-opacity.react.js", "diff": "@@ -55,7 +55,10 @@ type Props = {|\n+overlay?: React.Node,\n+disabled?: boolean,\n|};\n-function GestureTouchableOpacity(props: Props) {\n+function ForwardedGestureTouchableOpacity(\n+ props: Props,\n+ ref: React.Ref<typeof TapGestureHandler>,\n+) {\nconst { onPress: innerOnPress, onLongPress: innerOnLongPress } = props;\nconst onPress = React.useCallback(() => {\ninnerOnPress && innerOnPress();\n@@ -167,7 +170,11 @@ function GestureTouchableOpacity(props: Props) {\n]);\nconst tapHandler = (\n- <TapGestureHandler onHandlerStateChange={tapEvent} maxDurationMs={100000}>\n+ <TapGestureHandler\n+ onHandlerStateChange={tapEvent}\n+ maxDurationMs={100000}\n+ ref={ref}\n+ >\n<Animated.View style={styles.fill}>\n<Animated.View style={[transformStyle, props.style]}>\n{props.children}\n@@ -196,4 +203,9 @@ const styles = StyleSheet.create({\n},\n});\n+const GestureTouchableOpacity = React.forwardRef<Props, TapGestureHandler>(\n+ ForwardedGestureTouchableOpacity,\n+);\n+GestureTouchableOpacity.displayName = 'GestureTouchableOpacity';\n+\nexport default GestureTouchableOpacity;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Make GestureTouchableOpacity forward its TapGestureHandler ref Test Plan: Will test in combo with @atul's diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, atul, Adrian Differential Revision: https://phabricator.ashoat.com/D1167
129,184
17.05.2021 14:34:47
14,400
10dcf74924df66a05a74a2f0566b8d05fd9dbeda
[native] Avoid unnecessary Animated.Value instantiations in useReanimatedValueForBoolean Test Plan: na Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/utils/animation-utils.js", "new_path": "native/utils/animation-utils.js", "diff": "@@ -198,9 +198,12 @@ function ratchetAlongWithKeyboardHeight(\n}\nfunction useReanimatedValueForBoolean(booleanValue: boolean): Value {\n- const reanimatedValueRef = React.useRef(new Value(booleanValue ? 1 : 0));\n+ const reanimatedValueRef = React.useRef();\n+ if (!reanimatedValueRef.current) {\n+ reanimatedValueRef.current = new Value(booleanValue ? 1 : 0);\n+ }\nReact.useEffect(() => {\n- reanimatedValueRef.current.setValue(booleanValue ? 1 : 0);\n+ reanimatedValueRef.current?.setValue(booleanValue ? 1 : 0);\n}, [booleanValue]);\nreturn reanimatedValueRef.current;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Avoid unnecessary Animated.Value instantiations in useReanimatedValueForBoolean Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1170
129,184
17.05.2021 14:35:50
14,400
5d3ab0e8938d9c9059cdf78ba6a705dc451f4c38
[native] Add maxDist to GestureHandlers in GestureTouchableOpacity Test Plan: na Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/components/gesture-touchable-opacity.react.js", "new_path": "native/components/gesture-touchable-opacity.react.js", "diff": "@@ -210,6 +210,7 @@ function ForwardedGestureTouchableOpacity(\n<TapGestureHandler\nonHandlerStateChange={tapEvent}\nmaxDurationMs={100000}\n+ maxDist={50}\nref={ref}\n>\n<Animated.View style={fillStyle}>\n@@ -228,6 +229,7 @@ function ForwardedGestureTouchableOpacity(\n<LongPressGestureHandler\nonHandlerStateChange={longPressEvent}\nminDurationMs={370}\n+ maxDist={50}\n>\n<Animated.View style={fillStyle}>{tapHandler}</Animated.View>\n</LongPressGestureHandler>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add maxDist to GestureHandlers in GestureTouchableOpacity Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1171
129,184
17.05.2021 14:39:06
14,400
cecdc190b916780dcd3802d76ac153c4bd380e09
[native] Decrease VideoPlaybackModal controls opacity during dismissal Test Plan: na Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/video-playback-modal.react.js", "new_path": "native/media/video-playback-modal.react.js", "diff": "@@ -87,7 +87,7 @@ function VideoPlaybackModal(props: Props) {\n);\nconst controlsShowing = useValue(1);\n- const controlsOpacity = React.useMemo(\n+ const activeControlsOpacity = React.useMemo(\n() =>\nanimateTowards(\n[\n@@ -110,8 +110,8 @@ function VideoPlaybackModal(props: Props) {\n);\nconst previousOpacityCeiling = useValue(-1);\n- const opacityCeiling = React.useMemo(() => ceil(controlsOpacity), [\n- controlsOpacity,\n+ const opacityCeiling = React.useMemo(() => ceil(activeControlsOpacity), [\n+ activeControlsOpacity,\n]);\nconst opacityJustChanged = React.useMemo(\n@@ -279,9 +279,9 @@ function VideoPlaybackModal(props: Props) {\n[updates, curBackdropOpacity],\n);\n- const updatedControlsOpacity = React.useMemo(\n- () => block([updates, controlsOpacity]),\n- [updates, controlsOpacity],\n+ const updatedActiveControlsOpacity = React.useMemo(\n+ () => block([updates, activeControlsOpacity]),\n+ [updates, activeControlsOpacity],\n);\nconst overlayContext = React.useContext(OverlayContext);\n@@ -293,6 +293,17 @@ function VideoPlaybackModal(props: Props) {\n[navigationProgress],\n);\n+ const dismissalButtonOpacity = interpolate(updatedBackdropOpacity, {\n+ inputRange: [0.95, 1],\n+ outputRange: [0, 1],\n+ extrapolate: Extrapolate.CLAMP,\n+ });\n+ const controlsOpacity = multiply(\n+ navigationProgress,\n+ dismissalButtonOpacity,\n+ updatedActiveControlsOpacity,\n+ );\n+\nconst scale = React.useMemo(\n() =>\nadd(\n@@ -444,7 +455,7 @@ function VideoPlaybackModal(props: Props) {\nconst controls = (\n<Animated.View\n- style={[styles.controls, { opacity: updatedControlsOpacity }]}\n+ style={[styles.controls, { opacity: controlsOpacity }]}\npointerEvents={controlsEnabled ? 'box-none' : 'none'}\n>\n<View style={styles.header}>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Decrease VideoPlaybackModal controls opacity during dismissal Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1172
129,184
17.05.2021 14:46:15
14,400
6074904657a2ef46b05278a7cee894514552e4f7
[native] Refactor buttons/gestures in VideoPlaybackModal Test Plan: na Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/video-playback-modal.react.js", "new_path": "native/media/video-playback-modal.react.js", "diff": "import invariant from 'invariant';\nimport * as React from 'react';\nimport { useState } from 'react';\n-import { View, Text } from 'react-native';\n-import {\n- TapGestureHandler,\n- TouchableWithoutFeedback,\n-} from 'react-native-gesture-handler';\n+import { View, Text, TouchableOpacity } from 'react-native';\n+import { TapGestureHandler } from 'react-native-gesture-handler';\nimport * as Progress from 'react-native-progress';\nimport Animated from 'react-native-reanimated';\nimport Icon from 'react-native-vector-icons/MaterialCommunityIcons';\n@@ -17,7 +14,6 @@ import { useIsAppBackgroundedOrInactive } from 'lib/shared/lifecycle-utils';\nimport type { MediaInfo } from 'lib/types/media-types';\nimport type { ChatMultimediaMessageInfoItem } from '../chat/multimedia-message.react';\n-import Button from '../components/button.react';\nimport ConnectedStatusBar from '../connected-status-bar.react';\nimport type { AppNavigationProp } from '../navigation/app-navigator.react';\nimport { OverlayContext } from '../navigation/overlay-context';\n@@ -460,35 +456,35 @@ function VideoPlaybackModal(props: Props) {\n>\n<View style={styles.header}>\n<View style={styles.closeButton}>\n- <Button onPress={navigation.goBackOnce}>\n+ <TouchableOpacity onPress={navigation.goBackOnce}>\n<Icon name=\"close\" size={30} style={styles.iconButton} />\n- </Button>\n+ </TouchableOpacity>\n</View>\n</View>\n<View style={styles.footer}>\n- <View style={styles.playPauseButton}>\n- <TouchableWithoutFeedback onPress={togglePlayback}>\n+ <TouchableOpacity\n+ onPress={togglePlayback}\n+ style={styles.playPauseButton}\n+ >\n<Icon\nname={paused ? 'play' : 'pause'}\nsize={28}\nstyle={styles.iconButton}\n/>\n- </TouchableWithoutFeedback>\n-\n+ </TouchableOpacity>\n<View style={styles.progressBar}>\n<Progress.Bar\nprogress={percentElapsed / 100}\nheight={4}\n- width={260}\n+ width={null}\ncolor={styles.progressBar.color}\n+ style={styles.expand}\n/>\n</View>\n-\n<Text style={styles.durationText}>\n{timeElapsed} / {totalDuration}\n</Text>\n</View>\n- </View>\n</Animated.View>\n);\n@@ -505,15 +501,12 @@ function VideoPlaybackModal(props: Props) {\n}\nreturn (\n- <Animated.View style={styles.modal}>\n+ <TapGestureHandler onHandlerStateChange={singleTapEvent} minPointers={1}>\n+ <Animated.View style={styles.expand}>\n{statusBar}\n<Animated.View style={[styles.backdrop, backdropStyle]} />\n<View style={contentContainerStyle}>\n{spinner}\n- <TapGestureHandler\n- onHandlerStateChange={singleTapEvent}\n- minPointers={1}\n- >\n<Animated.View style={videoContainerStyle}>\n<Video\nsource={{ uri: videoUri }}\n@@ -525,15 +518,15 @@ function VideoPlaybackModal(props: Props) {\nonReadyForDisplay={readyForDisplayCallback}\n/>\n</Animated.View>\n- </TapGestureHandler>\n</View>\n{controls}\n</Animated.View>\n+ </TapGestureHandler>\n);\n}\nconst unboundStyles = {\n- modal: {\n+ expand: {\nflex: 1,\n},\nbackgroundVideo: {\n@@ -545,25 +538,27 @@ const unboundStyles = {\n},\nfooter: {\nposition: 'absolute',\n- justifyContent: 'flex-end',\nleft: 0,\nright: 0,\nbottom: 0,\n+ backgroundColor: 'rgba(52,52,52,0.6)',\n+ height: 76,\n+ display: 'flex',\n+ flexDirection: 'row',\n+ justifyContent: 'center',\n+ alignItems: 'center',\n+ paddingHorizontal: 8,\n},\nheader: {\nposition: 'absolute',\n- justifyContent: 'flex-start',\nleft: 0,\nright: 0,\ntop: 0,\n},\nplayPauseButton: {\n- backgroundColor: 'rgba(52,52,52,0.6)',\n+ display: 'flex',\njustifyContent: 'center',\nalignItems: 'center',\n- flexDirection: 'row',\n- flex: 0,\n- height: 76,\n},\ncloseButton: {\npaddingTop: 10,\n@@ -574,11 +569,14 @@ const unboundStyles = {\nheight: 100,\n},\nprogressBar: {\n+ flex: 1,\nposition: 'relative',\nalignItems: 'center',\njustifyContent: 'center',\ncolor: 'white',\npaddingRight: 10,\n+ display: 'flex',\n+ flexDirection: 'row',\n},\nprogressCircle: {\nposition: 'absolute',\n@@ -590,12 +588,13 @@ const unboundStyles = {\nright: 0,\n},\niconButton: {\n- paddingRight: 10,\n+ marginHorizontal: 10,\ncolor: 'white',\n},\ndurationText: {\ncolor: 'white',\nfontSize: 11,\n+ width: 70,\n},\nbackdrop: {\nbackgroundColor: 'black',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Refactor buttons/gestures in VideoPlaybackModal Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1173
129,184
17.05.2021 17:35:12
14,400
210f631067eca7b028b3d577c79f9721731e391b
[native] Introduce `outsideButtons` to `video-playback-modal` Test Plan: na Reviewers: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/video-playback-modal.react.js", "new_path": "native/media/video-playback-modal.react.js", "diff": "@@ -22,13 +22,20 @@ import { useSelector } from '../redux/redux-utils';\nimport { derivedDimensionsInfoSelector } from '../selectors/dimensions-selectors';\nimport { useStyles } from '../themes/colors';\nimport type { VerticalBounds, LayoutCoordinates } from '../types/layout-types';\n+import type { NativeMethods } from '../types/react-native';\nimport { gestureJustEnded, animateTowards } from '../utils/animation-utils';\nimport { formatDuration } from './video-utils';\n+type TouchableOpacityInstance = React.AbstractComponent<\n+ React.ElementConfig<typeof TouchableOpacity>,\n+ NativeMethods,\n+>;\n+\n/* eslint-disable import/no-named-as-default-member */\nconst {\nExtrapolate,\nand,\n+ or,\nblock,\ncond,\neq,\n@@ -42,6 +49,8 @@ const {\nnot,\nmax,\nmin,\n+ lessThan,\n+ greaterThan,\nabs,\ninterpolate,\nuseValue,\n@@ -63,6 +72,98 @@ type Props = {|\nfunction VideoPlaybackModal(props: Props) {\nconst { mediaInfo } = props.route.params;\n+ const closeButtonX = useValue(-1);\n+ const closeButtonY = useValue(-1);\n+ const closeButtonWidth = useValue(-1);\n+ const closeButtonHeight = useValue(-1);\n+ const closeButtonRef = React.useRef<?React.ElementRef<TouchableOpacityInstance>>();\n+ const closeButton = closeButtonRef.current;\n+ const onCloseButtonLayoutCalledRef = React.useRef(false);\n+ const onCloseButtonLayout = React.useCallback(() => {\n+ onCloseButtonLayoutCalledRef.current = true;\n+ }, []);\n+ const onCloseButtonLayoutCalled = onCloseButtonLayoutCalledRef.current;\n+ React.useEffect(() => {\n+ if (!closeButton || !onCloseButtonLayoutCalled) {\n+ return;\n+ }\n+ closeButton.measure((x, y, width, height, pageX, pageY) => {\n+ closeButtonX.setValue(pageX);\n+ closeButtonY.setValue(pageY);\n+ closeButtonWidth.setValue(width);\n+ closeButtonHeight.setValue(height);\n+ });\n+ }, [\n+ closeButton,\n+ onCloseButtonLayoutCalled,\n+ closeButtonX,\n+ closeButtonY,\n+ closeButtonWidth,\n+ closeButtonHeight,\n+ ]);\n+\n+ const footerX = useValue(-1);\n+ const footerY = useValue(-1);\n+ const footerWidth = useValue(-1);\n+ const footerHeight = useValue(-1);\n+ const footerRef = React.useRef();\n+ const footer = footerRef.current;\n+ const onFooterLayoutCalledRef = React.useRef(false);\n+ const onFooterLayout = React.useCallback(() => {\n+ onFooterLayoutCalledRef.current = true;\n+ }, []);\n+ const onFooterLayoutCalled = onFooterLayoutCalledRef.current;\n+ React.useEffect(() => {\n+ if (!footer || !onFooterLayoutCalled) {\n+ return;\n+ }\n+ footer.measure((x, y, width, height, pageX, pageY) => {\n+ footerX.setValue(pageX);\n+ footerY.setValue(pageY);\n+ footerWidth.setValue(width);\n+ footerHeight.setValue(height);\n+ });\n+ }, [\n+ footer,\n+ onFooterLayoutCalled,\n+ footerX,\n+ footerY,\n+ footerWidth,\n+ footerHeight,\n+ ]);\n+\n+ const controlsShowing = useValue(1);\n+ const outsideButtons = React.useCallback(\n+ (x, y) =>\n+ and(\n+ or(\n+ eq(controlsShowing, 0),\n+ lessThan(x, Animated.debug('closeButtonX', closeButtonX)),\n+ greaterThan(x, add(closeButtonX, closeButtonWidth)),\n+ lessThan(y, closeButtonY),\n+ greaterThan(y, add(closeButtonY, closeButtonHeight)),\n+ ),\n+ or(\n+ eq(controlsShowing, 0),\n+ lessThan(x, Animated.debug('footerX', footerX)),\n+ greaterThan(x, add(footerX, footerWidth)),\n+ lessThan(y, footerY),\n+ greaterThan(y, add(footerY, footerHeight)),\n+ ),\n+ ),\n+ [\n+ controlsShowing,\n+ closeButtonX,\n+ closeButtonY,\n+ closeButtonWidth,\n+ closeButtonHeight,\n+ footerX,\n+ footerY,\n+ footerWidth,\n+ footerHeight,\n+ ],\n+ );\n+\n/* ===== START FADE CONTROL ANIMATION ===== */\nconst singleTapState = useValue(-1);\n@@ -82,20 +183,35 @@ function VideoPlaybackModal(props: Props) {\n[],\n);\n- const controlsShowing = useValue(1);\n+ const lastTapX = useValue(-1);\n+ const lastTapY = useValue(-1);\n+\nconst activeControlsOpacity = React.useMemo(\n() =>\nanimateTowards(\n[\ncond(\n+ and(\ngestureJustEnded(singleTapState),\n+ outsideButtons(lastTapX, lastTapY),\n+ ),\nset(controlsShowing, not(controlsShowing)),\n),\n+ set(lastTapX, singleTapX),\n+ set(lastTapY, singleTapY),\ncontrolsShowing,\n],\n150,\n),\n- [singleTapState, controlsShowing],\n+ [\n+ singleTapState,\n+ controlsShowing,\n+ outsideButtons,\n+ lastTapX,\n+ lastTapY,\n+ singleTapX,\n+ singleTapY,\n+ ],\n);\nconst [controlsEnabled, setControlsEnabled] = React.useState(true);\n@@ -456,12 +572,16 @@ function VideoPlaybackModal(props: Props) {\n>\n<View style={styles.header}>\n<View style={styles.closeButton}>\n- <TouchableOpacity onPress={navigation.goBackOnce}>\n+ <TouchableOpacity\n+ onPress={navigation.goBackOnce}\n+ ref={(closeButtonRef: any)}\n+ onLayout={onCloseButtonLayout}\n+ >\n<Icon name=\"close\" size={30} style={styles.iconButton} />\n</TouchableOpacity>\n</View>\n</View>\n- <View style={styles.footer}>\n+ <View style={styles.footer} ref={footerRef} onLayout={onFooterLayout}>\n<TouchableOpacity\nonPress={togglePlayback}\nstyle={styles.playPauseButton}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Introduce `outsideButtons` to `video-playback-modal` Test Plan: na Reviewers: ashoat Reviewed By: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1174
129,187
17.05.2021 22:31:04
14,400
072f6c4dda49d46efaefc377477a9171a5eb12e9
[native] Move iOS fonts into Resources folder Test Plan: Compile and run iOS app Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "RENAME", "old_path": "native/ios/Anaheim-Regular.ttf", "new_path": "native/ios/Resources/Anaheim-Regular.ttf", "diff": "" }, { "change_type": "RENAME", "old_path": "native/ios/OpenSans-Regular.ttf", "new_path": "native/ios/Resources/OpenSans-Regular.ttf", "diff": "" }, { "change_type": "RENAME", "old_path": "native/ios/OpenSans-Semibold.ttf", "new_path": "native/ios/Resources/OpenSans-Semibold.ttf", "diff": "" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj", "new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj", "diff": "71CA4AEC262F236100835C89 /* Tools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4AEB262F236100835C89 /* Tools.mm */; };\n7F761E602201141E001B6FB7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F761E292201141E001B6FB7 /* JavaScriptCore.framework */; };\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F788C2B248AA2130098F071 /* SplashScreen.storyboard */; };\n- 7FB58ABE1E7F6BD500B4C1B1 /* Anaheim-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FB58ABB1E7F6BC600B4C1B1 /* Anaheim-Regular.ttf */; };\n- 7FB58AC01E7F6BD800B4C1B1 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FB58ABC1E7F6BC600B4C1B1 /* OpenSans-Regular.ttf */; };\n- 7FB58AC21E7F6BDB00B4C1B1 /* OpenSans-Semibold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FB58ABD1E7F6BC600B4C1B1 /* OpenSans-Semibold.ttf */; };\n+ 7F8D602126535E060053CB29 /* OpenSans-Semibold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */; };\n+ 7F8D602226535E060053CB29 /* Anaheim-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */; };\n+ 7F8D602326535E060053CB29 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */; };\n/* End PBXBuildFile section */\n/* Begin PBXFileReference section */\n7F554F822332D58B007CB9F7 /* Info.debug.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.debug.plist; path = SquadCal/Info.debug.plist; sourceTree = \"<group>\"; };\n7F761E292201141E001B6FB7 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };\n7F788C2B248AA2130098F071 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SplashScreen.storyboard; sourceTree = \"<group>\"; };\n- 7FB58ABB1E7F6BC600B4C1B1 /* Anaheim-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"Anaheim-Regular.ttf\"; sourceTree = \"<group>\"; };\n- 7FB58ABC1E7F6BC600B4C1B1 /* OpenSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"OpenSans-Regular.ttf\"; sourceTree = \"<group>\"; };\n- 7FB58ABD1E7F6BC600B4C1B1 /* OpenSans-Semibold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"OpenSans-Semibold.ttf\"; sourceTree = \"<group>\"; };\n+ 7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"OpenSans-Semibold.ttf\"; path = \"Resources/OpenSans-Semibold.ttf\"; sourceTree = \"<group>\"; };\n+ 7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"Anaheim-Regular.ttf\"; path = \"Resources/Anaheim-Regular.ttf\"; sourceTree = \"<group>\"; };\n+ 7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"OpenSans-Regular.ttf\"; path = \"Resources/OpenSans-Regular.ttf\"; sourceTree = \"<group>\"; };\n7FCEA2DC2444010B004017B1 /* SquadCal-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"SquadCal-Bridging-Header.h\"; sourceTree = \"<group>\"; };\n7FCFD8BD1E81B8DF00629B0E /* SquadCal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = SquadCal.entitlements; path = SquadCal/SquadCal.entitlements; sourceTree = \"<group>\"; };\nA75435FBAC0720E8BE857F55 /* libPods-SquadCal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-SquadCal.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n6534411766BE4CA4B0AB0A78 /* Resources */ = {\nisa = PBXGroup;\nchildren = (\n- 7FB58ABB1E7F6BC600B4C1B1 /* Anaheim-Regular.ttf */,\n- 7FB58ABC1E7F6BC600B4C1B1 /* OpenSans-Regular.ttf */,\n- 7FB58ABD1E7F6BC600B4C1B1 /* OpenSans-Semibold.ttf */,\n+ 7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */,\n+ 7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */,\n+ 7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */,\n);\nname = Resources;\nsourceTree = \"<group>\";\nisa = PBXResourcesBuildPhase;\nbuildActionMask = 2147483647;\nfiles = (\n- 7FB58ABE1E7F6BD500B4C1B1 /* Anaheim-Regular.ttf in Resources */,\n+ 7F8D602126535E060053CB29 /* OpenSans-Semibold.ttf in Resources */,\n13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,\n- 7FB58AC21E7F6BDB00B4C1B1 /* OpenSans-Semibold.ttf in Resources */,\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */,\n- 7FB58AC01E7F6BD800B4C1B1 /* OpenSans-Regular.ttf in Resources */,\n+ 7F8D602226535E060053CB29 /* Anaheim-Regular.ttf in Resources */,\n+ 7F8D602326535E060053CB29 /* OpenSans-Regular.ttf in Resources */,\n);\nrunOnlyForDeploymentPostprocessing = 0;\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Move iOS fonts into Resources folder Test Plan: Compile and run iOS app Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1175
129,187
17.05.2021 22:52:38
14,400
0ad72889e819e7961c952e8330a40be44958207b
[native] Add IBM Plex Sans font Test Plan: Tested in combination with following diff Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Bold.ttf", "new_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Bold.ttf", "diff": "Binary files /dev/null and b/native/android/app/src/main/assets/fonts/IBMPlexSans-Bold.ttf differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Regular.ttf", "new_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Regular.ttf", "diff": "Binary files /dev/null and b/native/android/app/src/main/assets/fonts/IBMPlexSans-Regular.ttf differ\n" }, { "change_type": "ADD", "old_path": "native/ios/Resources/IBMPlexSans-Bold.ttf", "new_path": "native/ios/Resources/IBMPlexSans-Bold.ttf", "diff": "Binary files /dev/null and b/native/ios/Resources/IBMPlexSans-Bold.ttf differ\n" }, { "change_type": "ADD", "old_path": "native/ios/Resources/IBMPlexSans-Regular.ttf", "new_path": "native/ios/Resources/IBMPlexSans-Regular.ttf", "diff": "Binary files /dev/null and b/native/ios/Resources/IBMPlexSans-Regular.ttf differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj", "new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj", "diff": "7F8D602126535E060053CB29 /* OpenSans-Semibold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */; };\n7F8D602226535E060053CB29 /* Anaheim-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */; };\n7F8D602326535E060053CB29 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */; };\n+ 7F8D602826535F240053CB29 /* IBMPlexSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */; };\n+ 7F8D602926535F2A0053CB29 /* IBMPlexSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */; };\n/* End PBXBuildFile section */\n/* Begin PBXFileReference section */\n7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"OpenSans-Semibold.ttf\"; path = \"Resources/OpenSans-Semibold.ttf\"; sourceTree = \"<group>\"; };\n7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"Anaheim-Regular.ttf\"; path = \"Resources/Anaheim-Regular.ttf\"; sourceTree = \"<group>\"; };\n7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"OpenSans-Regular.ttf\"; path = \"Resources/OpenSans-Regular.ttf\"; sourceTree = \"<group>\"; };\n+ 7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"IBMPlexSans-Regular.ttf\"; path = \"Resources/IBMPlexSans-Regular.ttf\"; sourceTree = \"<group>\"; };\n+ 7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"IBMPlexSans-Bold.ttf\"; path = \"Resources/IBMPlexSans-Bold.ttf\"; sourceTree = \"<group>\"; };\n7FCEA2DC2444010B004017B1 /* SquadCal-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"SquadCal-Bridging-Header.h\"; sourceTree = \"<group>\"; };\n7FCFD8BD1E81B8DF00629B0E /* SquadCal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = SquadCal.entitlements; path = SquadCal/SquadCal.entitlements; sourceTree = \"<group>\"; };\nA75435FBAC0720E8BE857F55 /* libPods-SquadCal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-SquadCal.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */,\n7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */,\n7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */,\n+ 7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */,\n+ 7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */,\n);\nname = Resources;\nsourceTree = \"<group>\";\nisa = PBXResourcesBuildPhase;\nbuildActionMask = 2147483647;\nfiles = (\n+ 7F8D602926535F2A0053CB29 /* IBMPlexSans-Regular.ttf in Resources */,\n+ 7F8D602826535F240053CB29 /* IBMPlexSans-Bold.ttf in Resources */,\n7F8D602126535E060053CB29 /* OpenSans-Semibold.ttf in Resources */,\n13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */,\n" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal/Info.debug.plist", "new_path": "native/ios/SquadCal/Info.debug.plist", "diff": "<string>Octicons.ttf</string>\n<string>SimpleLineIcons.ttf</string>\n<string>Zocial.ttf</string>\n+ <string>IBMPlexSans-Regular.ttf</string>\n+ <string>IBMPlexSans-Bold.ttf</string>\n</array>\n<key>UIBackgroundModes</key>\n<array>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal/Info.release.plist", "new_path": "native/ios/SquadCal/Info.release.plist", "diff": "<string>Octicons.ttf</string>\n<string>SimpleLineIcons.ttf</string>\n<string>Zocial.ttf</string>\n+ <string>IBMPlexSans-Regular.ttf</string>\n+ <string>IBMPlexSans-Bold.ttf</string>\n</array>\n<key>UIBackgroundModes</key>\n<array>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add IBM Plex Sans font Test Plan: Tested in combination with following diff Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1176
129,184
18.05.2021 13:26:18
14,400
556fa4f20418c52c49f33bab0944b7b7ca598619
[native] set default `activeTheme` and `preference` to `dark` Test Plan: Created some new accounts and the active theme/preference in profile tab were as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/types/themes.js", "new_path": "native/types/themes.js", "diff": "@@ -16,7 +16,9 @@ export const osCanTheme =\n(Platform.OS === 'android' && Platform.Version >= 29);\nexport const defaultGlobalThemeInfo = {\n- activeTheme: osCanTheme ? null : 'light',\n+ // revert to `activeTheme: osCanTheme ? null : 'light'` to re-enable theming\n+ activeTheme: 'dark',\nsystemTheme: null,\n- preference: osCanTheme ? 'system' : 'light',\n+ // revert to `preference: osCanTheme ? 'system' : 'light'` to re-enable theming\n+ preference: 'dark',\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] set default `activeTheme` and `preference` to `dark` Test Plan: Created some new accounts and the active theme/preference in profile tab were as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1178
129,184
18.05.2021 13:40:00
14,400
2f74e5a5b27cd5e7a4c508446e7f69ad7b11420d
[native] conditionally display appearance preferences in profile tab if `__DEV__` Test Plan: Preferences appear when built for dev, and don't appear when built for release Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/profile/profile-screen.react.js", "new_path": "native/profile/profile-screen.react.js", "diff": "@@ -153,6 +153,24 @@ class ProfileScreen extends React.PureComponent<Props> {\npanelIosHighlightUnderlay: underlay,\nlink: linkColor,\n} = this.props.colors;\n+\n+ const appearancePreferences = (\n+ <>\n+ <Text style={this.props.styles.header}>PREFERENCES</Text>\n+ <View style={this.props.styles.slightlyPaddedSection}>\n+ <Button\n+ onPress={this.onPressAppearance}\n+ style={this.props.styles.submenuButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={underlay}\n+ >\n+ <Text style={this.props.styles.submenuText}>Appearance</Text>\n+ <Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n+ </Button>\n+ </View>\n+ </>\n+ );\n+\nreturn (\n<View style={this.props.styles.container}>\n<ScrollView\n@@ -228,18 +246,10 @@ class ProfileScreen extends React.PureComponent<Props> {\n<Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n</Button>\n</View>\n- <Text style={this.props.styles.header}>PREFERENCES</Text>\n- <View style={this.props.styles.slightlyPaddedSection}>\n- <Button\n- onPress={this.onPressAppearance}\n- style={this.props.styles.submenuButton}\n- iosFormat=\"highlight\"\n- iosHighlightUnderlayColor={underlay}\n- >\n- <Text style={this.props.styles.submenuText}>Appearance</Text>\n- <Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n- </Button>\n- </View>\n+\n+ {/* revert the conditional rendering of `appearancePreferences` to re-enable theming */}\n+ {__DEV__ ? appearancePreferences : null}\n+\n<View style={this.props.styles.slightlyPaddedSection}>\n<Button\nonPress={this.onPressBuildInfo}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] conditionally display appearance preferences in profile tab if `__DEV__` Test Plan: Preferences appear when built for dev, and don't appear when built for release Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1179
129,184
18.05.2021 13:50:06
14,400
c6348764a0b02a4065b5b3b97b022050999416e1
[native] migrate light mode users to dark mode for soft launch Test Plan: created an account, set to light mode, was migrated to dark mode Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -209,6 +209,10 @@ const migrations = {\ndrafts: undefined,\n};\n},\n+ [23]: (state) => ({\n+ ...state,\n+ globalThemeInfo: defaultGlobalThemeInfo,\n+ }),\n};\nconst persistConfig = {\n@@ -223,7 +227,7 @@ const persistConfig = {\n'frozen',\n],\ndebug: __DEV__,\n- version: 22,\n+ version: 23,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\ntimeout: __DEV__ ? 0 : undefined,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] migrate light mode users to dark mode for soft launch Test Plan: created an account, set to light mode, was migrated to dark mode Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1180
129,187
18.05.2021 14:20:28
14,400
1041ccc9a92b0d7fbc8d2f93c2f27ba73db2b55c
[native] Summary: Noticed this package was pretty outdated while I was working on some related code and decided to update it. Test Plan: Make sure credentials still persist on iOS and Android Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/native-credentials.js", "new_path": "native/account/native-credentials.js", "diff": "@@ -7,9 +7,13 @@ import {\nsetInternetCredentials,\nsetSharedWebCredentials,\nresetInternetCredentials,\n- type UserCredentials,\n} from 'react-native-keychain';\n+type UserCredentials = {|\n+ +username: string,\n+ +password: string,\n+|};\n+\ntype StoredCredentials = {|\nstate: 'undetermined' | 'determined' | 'unsupported',\ncredentials: ?UserCredentials,\n@@ -28,8 +32,10 @@ async function fetchNativeKeychainCredentials(): Promise<?UserCredentials> {\nreturn storedNativeKeychainCredentials.credentials;\n}\ntry {\n- let credentials = await getInternetCredentials('squadcal.org');\n- credentials = credentials ? credentials : undefined;\n+ const result = await getInternetCredentials('squadcal.org');\n+ const credentials = result\n+ ? { username: result.username, password: result.password }\n+ : undefined;\nstoredNativeKeychainCredentials = { state: 'determined', credentials };\nreturn credentials;\n} catch (e) {\n@@ -174,7 +180,7 @@ async function deleteNativeSharedWebCredentialsFor(username: string) {\ntry {\n// This native call will display a modal iff credentials are non-null,\n// so we don't need to worry about checking our current state\n- await setSharedWebCredentials('squadcal.org', username, null);\n+ await setSharedWebCredentials('squadcal.org', username, undefined);\nstoredSharedWebCredentials = {\nstate: 'determined',\ncredentials: undefined,\n" }, { "change_type": "MODIFY", "old_path": "native/package.json", "new_path": "native/package.json", "diff": "\"react-native-gesture-handler\": \"^1.8.0\",\n\"react-native-in-app-message\": \"^1.0.2\",\n\"react-native-keyboard-input\": \"6.0.1\",\n- \"react-native-keychain\": \"^4.0.0\",\n+ \"react-native-keychain\": \"^7.0.0\",\n\"react-native-notifications\": \"git+https://git@github.com/ashoat/react-native-notifications.git\",\n\"react-native-orientation-locker\": \"^1.1.6\",\n\"react-native-progress\": \"^4.1.2\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -14844,10 +14844,10 @@ react-native-keyboard-tracking-view@^5.5.0:\nresolved \"https://registry.yarnpkg.com/react-native-keyboard-tracking-view/-/react-native-keyboard-tracking-view-5.7.0.tgz#264d0b7dfa1a7c362583953f81bc73d7598fea8a\"\nintegrity sha512-MDeEwAbn9LJDOfHq0QLCGaZirVLk2X/tHqkAqz3y6uxryTRdSl9PwleOVar5Jx2oAPEg4J9BXbUD1wwOOi+5Kg==\n-react-native-keychain@^4.0.0:\n- version \"4.0.1\"\n- resolved \"https://registry.yarnpkg.com/react-native-keychain/-/react-native-keychain-4.0.1.tgz#c332f5d9aaf597255ae6ea4ca7d5c84a24684a1d\"\n- integrity sha512-AqQp4Hib9y5DP5es5umEAhxKG7L0bA8cHNFhvlqs6oUcbUoKtXmhLDo3wzvnCF+bm8DXpGhvkU6P0LkfO0AgPQ==\n+react-native-keychain@^7.0.0:\n+ version \"7.0.0\"\n+ resolved \"https://registry.yarnpkg.com/react-native-keychain/-/react-native-keychain-7.0.0.tgz#11fd559fe86ae89f934b8c75ae228247deed5494\"\n+ integrity sha512-tH26sgW4OxB/llXmhO+DajFISEUoF1Ip2+WSDMIgCt8SP1xRE81m2qFzgIOc/7StYsUERxHhDPkxvq2H0/Goig==\n\"react-native-notifications@git+https://git@github.com/ashoat/react-native-notifications.git\":\nversion \"1.1.19\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] react-native-keychain@7.0.0 Summary: Noticed this package was pretty outdated while I was working on some related code and decided to update it. Test Plan: Make sure credentials still persist on iOS and Android Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1185
129,187
19.05.2021 12:11:28
14,400
05dc29abd3833a8d8089579fede15c19310e526a
[native] Avoid state.state in LogInPanel / RegisterPanel Summary: Addressing feedback from D1183. Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/account/log-in-panel-container.react.js", "new_path": "native/account/log-in-panel-container.react.js", "diff": "@@ -116,7 +116,7 @@ class BaseLogInPanelContainer extends React.PureComponent<Props, State> {\nsetActiveAlert={this.props.setActiveAlert}\nopacityValue={this.props.opacityValue}\ninnerRef={this.logInPanelRef}\n- state={this.props.logInState}\n+ logInState={this.props.logInState}\n/>\n</Animated.View>\n);\n" }, { "change_type": "MODIFY", "old_path": "native/account/log-in-panel.react.js", "new_path": "native/account/log-in-panel.react.js", "diff": "@@ -47,7 +47,7 @@ type BaseProps = {|\n+setActiveAlert: (activeAlert: boolean) => void,\n+opacityValue: Animated.Value,\n+innerRef: (logInPanel: ?LogInPanel) => void,\n- +state: StateContainer<LogInState>,\n+ +logInState: StateContainer<LogInState>,\n|};\ntype Props = {|\n...BaseProps,\n@@ -74,17 +74,17 @@ class LogInPanel extends React.PureComponent<Props> {\n}\nget usernameOrEmailInputText(): string {\n- return this.props.state.state.usernameOrEmailInputText || '';\n+ return this.props.logInState.state.usernameOrEmailInputText || '';\n}\nget passwordInputText(): string {\n- return this.props.state.state.passwordInputText || '';\n+ return this.props.logInState.state.passwordInputText || '';\n}\nasync attemptToFetchCredentials() {\nif (\n- this.props.state.state.usernameOrEmailInputText !== null &&\n- this.props.state.state.usernameOrEmailInputText !== undefined\n+ this.props.logInState.state.usernameOrEmailInputText !== null &&\n+ this.props.logInState.state.usernameOrEmailInputText !== undefined\n) {\nreturn;\n}\n@@ -93,12 +93,12 @@ class LogInPanel extends React.PureComponent<Props> {\nreturn;\n}\nif (\n- this.props.state.state.usernameOrEmailInputText !== null &&\n- this.props.state.state.usernameOrEmailInputText !== undefined\n+ this.props.logInState.state.usernameOrEmailInputText !== null &&\n+ this.props.logInState.state.usernameOrEmailInputText !== undefined\n) {\nreturn;\n}\n- this.props.state.setState({\n+ this.props.logInState.setState({\nusernameOrEmailInputText: credentials.username,\npasswordInputText: credentials.password,\n});\n@@ -176,7 +176,7 @@ class LogInPanel extends React.PureComponent<Props> {\n};\nonChangeUsernameOrEmailInputText = (text: string) => {\n- this.props.state.setState({ usernameOrEmailInputText: text });\n+ this.props.logInState.setState({ usernameOrEmailInputText: text });\n};\nonUsernameOrEmailKeyPress = (\n@@ -194,7 +194,7 @@ class LogInPanel extends React.PureComponent<Props> {\n};\nonChangePasswordInputText = (text: string) => {\n- this.props.state.setState({ passwordInputText: text });\n+ this.props.logInState.setState({ passwordInputText: text });\n};\nonSubmit = () => {\n@@ -232,7 +232,7 @@ class LogInPanel extends React.PureComponent<Props> {\nonUsernameOrEmailAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.logInState.setState(\n{\nusernameOrEmailInputText: '',\n},\n@@ -297,7 +297,7 @@ class LogInPanel extends React.PureComponent<Props> {\nonPasswordAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.logInState.setState(\n{\npasswordInputText: '',\n},\n@@ -310,7 +310,7 @@ class LogInPanel extends React.PureComponent<Props> {\nonUnknownErrorAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.logInState.setState(\n{\nusernameOrEmailInputText: '',\npasswordInputText: '',\n" }, { "change_type": "MODIFY", "old_path": "native/account/logged-out-modal.react.js", "new_path": "native/account/logged-out-modal.react.js", "diff": "@@ -588,7 +588,7 @@ class LoggedOutModal extends React.PureComponent<Props, State> {\n<RegisterPanel\nsetActiveAlert={this.setActiveAlert}\nopacityValue={this.panelOpacityValue}\n- state={this.state.registerState}\n+ registerState={this.state.registerState}\n/>\n);\n} else if (this.state.mode === 'prompt') {\n" }, { "change_type": "MODIFY", "old_path": "native/account/register-panel.react.js", "new_path": "native/account/register-panel.react.js", "diff": "@@ -39,7 +39,7 @@ export type RegisterState = {|\ntype BaseProps = {|\n+setActiveAlert: (activeAlert: boolean) => void,\n+opacityValue: Animated.Value,\n- +state: StateContainer<RegisterState>,\n+ +registerState: StateContainer<RegisterState>,\n|};\ntype Props = {|\n...BaseProps,\n@@ -69,7 +69,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nif (\nPlatform.OS !== 'ios' ||\nthis.state.confirmPasswordFocused ||\n- this.props.state.state.confirmPasswordInputText.length > 0\n+ this.props.registerState.state.confirmPasswordInputText.length > 0\n) {\nconfirmPasswordTextInputExtraProps = {\nsecureTextEntry: true,\n@@ -93,7 +93,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n/>\n<TextInput\nstyle={styles.input}\n- value={this.props.state.state.emailInputText}\n+ value={this.props.registerState.state.emailInputText}\nonChangeText={this.onChangeEmailInputText}\nplaceholder=\"Email address\"\nautoFocus={true}\n@@ -114,7 +114,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<Icon name=\"user\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={styles.input}\n- value={this.props.state.state.usernameInputText}\n+ value={this.props.registerState.state.usernameInputText}\nonChangeText={this.onChangeUsernameInputText}\nplaceholder=\"Username\"\nautoCorrect={false}\n@@ -133,7 +133,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<Icon name=\"lock\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={styles.input}\n- value={this.props.state.state.passwordInputText}\n+ value={this.props.registerState.state.passwordInputText}\nonChangeText={this.onChangePasswordInputText}\nonKeyPress={onPasswordKeyPress}\nplaceholder=\"Password\"\n@@ -150,7 +150,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<View>\n<TextInput\nstyle={styles.input}\n- value={this.props.state.state.confirmPasswordInputText}\n+ value={this.props.registerState.state.confirmPasswordInputText}\nonChangeText={this.onChangeConfirmPasswordInputText}\nplaceholder=\"Confirm password\"\nautoCompleteType=\"password\"\n@@ -204,20 +204,23 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n};\nonChangeUsernameInputText = (text: string) => {\n- this.props.state.setState({ usernameInputText: text });\n+ this.props.registerState.setState({ usernameInputText: text });\n};\nonChangeEmailInputText = (text: string) => {\n- this.props.state.setState({ emailInputText: text });\n- if (this.props.state.state.emailInputText.length === 0 && text.length > 1) {\n+ this.props.registerState.setState({ emailInputText: text });\n+ if (\n+ this.props.registerState.state.emailInputText.length === 0 &&\n+ text.length > 1\n+ ) {\nthis.focusUsernameInput();\n}\n};\nonEmailBlur = () => {\n- const trimmedEmail = this.props.state.state.emailInputText.trim();\n- if (trimmedEmail !== this.props.state.state.emailInputText) {\n- this.props.state.setState({ emailInputText: trimmedEmail });\n+ const trimmedEmail = this.props.registerState.state.emailInputText.trim();\n+ if (trimmedEmail !== this.props.registerState.state.emailInputText) {\n+ this.props.registerState.setState({ emailInputText: trimmedEmail });\n}\n};\n@@ -228,7 +231,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nthis.passwordBeingAutoFilled = false;\nstateUpdate.confirmPasswordInputText = text;\n}\n- this.props.state.setState(stateUpdate);\n+ this.props.registerState.setState(stateUpdate);\n};\nonPasswordKeyPress = (\n@@ -239,14 +242,14 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nkey.length > 1 &&\nkey !== 'Backspace' &&\nkey !== 'Enter' &&\n- this.props.state.state.confirmPasswordInputText.length === 0\n+ this.props.registerState.state.confirmPasswordInputText.length === 0\n) {\nthis.passwordBeingAutoFilled = true;\n}\n};\nonChangeConfirmPasswordInputText = (text: string) => {\n- this.props.state.setState({ confirmPasswordInputText: text });\n+ this.props.registerState.setState({ confirmPasswordInputText: text });\n};\nonConfirmPasswordFocus = () => {\n@@ -255,7 +258,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonSubmit = () => {\nthis.props.setActiveAlert(true);\n- if (this.props.state.state.passwordInputText === '') {\n+ if (this.props.registerState.state.passwordInputText === '') {\nAlert.alert(\n'Empty password',\n'Password cannot be empty',\n@@ -263,8 +266,8 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n{ cancelable: false },\n);\n} else if (\n- this.props.state.state.passwordInputText !==\n- this.props.state.state.confirmPasswordInputText\n+ this.props.registerState.state.passwordInputText !==\n+ this.props.registerState.state.confirmPasswordInputText\n) {\nAlert.alert(\n\"Passwords don't match\",\n@@ -273,7 +276,9 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n{ cancelable: false },\n);\n} else if (\n- this.props.state.state.usernameInputText.search(validUsernameRegex) === -1\n+ this.props.registerState.state.usernameInputText.search(\n+ validUsernameRegex,\n+ ) === -1\n) {\nAlert.alert(\n'Invalid username',\n@@ -284,7 +289,8 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n{ cancelable: false },\n);\n} else if (\n- this.props.state.state.emailInputText.search(validEmailRegex) === -1\n+ this.props.registerState.state.emailInputText.search(validEmailRegex) ===\n+ -1\n) {\nAlert.alert(\n'Invalid email address',\n@@ -306,7 +312,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonPasswordAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.registerState.setState(\n{\npasswordInputText: '',\nconfirmPasswordInputText: '',\n@@ -320,7 +326,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonUsernameAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.registerState.setState(\n{\nusernameInputText: '',\n},\n@@ -333,7 +339,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonEmailAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.registerState.setState(\n{\nemailInputText: '',\n},\n@@ -347,15 +353,15 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nasync registerAction(extraInfo: LogInExtraInfo) {\ntry {\nconst result = await this.props.register({\n- username: this.props.state.state.usernameInputText,\n- email: this.props.state.state.emailInputText,\n- password: this.props.state.state.passwordInputText,\n+ username: this.props.registerState.state.usernameInputText,\n+ email: this.props.registerState.state.emailInputText,\n+ password: this.props.registerState.state.passwordInputText,\n...extraInfo,\n});\nthis.props.setActiveAlert(false);\nawait setNativeCredentials({\nusername: result.currentUserInfo.username,\n- password: this.props.state.state.passwordInputText,\n+ password: this.props.registerState.state.passwordInputText,\n});\nreturn result;\n} catch (e) {\n@@ -399,7 +405,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonUnknownErrorAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.props.state.setState(\n+ this.props.registerState.setState(\n{\nusernameInputText: '',\nemailInputText: '',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Avoid state.state in LogInPanel / RegisterPanel Summary: Addressing @atul's feedback from D1183. Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1189
129,184
19.05.2021 11:32:41
14,400
ca9583412602e5a4e9277bb597c11c9e0566bb4b
[native] add `Apps` to tab bar and create `apps-directory` placeholder Test Plan: Apps tab appeared as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "native/apps/apps-directory.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { View, Text } from 'react-native';\n+\n+import { useStyles } from '../themes/colors';\n+\n+function AppsDirectory() {\n+ const styles = useStyles(unboundStyles);\n+ return (\n+ <View style={styles.view}>\n+ <Text style={styles.placeHolderText}>placeholder apps view</Text>\n+ </View>\n+ );\n+}\n+\n+const unboundStyles = {\n+ view: {\n+ flex: 1,\n+ backgroundColor: 'panelBackground',\n+ justifyContent: 'center',\n+ alignItems: 'center',\n+ },\n+ placeHolderText: {\n+ color: 'white',\n+ },\n+};\n+\n+export default AppsDirectory;\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/app-navigator.react.js", "new_path": "native/navigation/app-navigator.react.js", "diff": "@@ -9,6 +9,7 @@ import { PersistGate } from 'redux-persist/integration/react';\nimport { unreadCount } from 'lib/selectors/thread-selectors';\n+import AppsDirectory from '../apps/apps-directory.react';\nimport Calendar from '../calendar/calendar.react';\nimport Chat from '../chat/chat.react';\nimport { MultimediaTooltipModal } from '../chat/multimedia-tooltip-modal.react';\n@@ -44,6 +45,7 @@ import {\nRobotextMessageTooltipModalRouteName,\nCameraModalRouteName,\nVideoPlaybackModalRouteName,\n+ AppsRouteName,\ntype ScreenParamList,\ntype TabParamList,\ntype OverlayParamList,\n@@ -74,6 +76,13 @@ const profileTabOptions = {\n<Icon name=\"bars\" style={[styles.icon, { color }]} />\n),\n};\n+const appsTabOptions = {\n+ tabBarLabel: 'Apps',\n+ // eslint-disable-next-line react/display-name\n+ tabBarIcon: ({ color }) => (\n+ <Icon name=\"wrench\" style={[styles.icon, { color }]} />\n+ ),\n+};\nexport type TabNavigationProp<\nRouteName: $Keys<TabParamList> = $Keys<TabParamList>,\n@@ -110,6 +119,11 @@ function TabNavigator() {\ncomponent={Profile}\noptions={profileTabOptions}\n/>\n+ <Tab.Screen\n+ name={AppsRouteName}\n+ component={AppsDirectory}\n+ options={appsTabOptions}\n+ />\n</Tab.Navigator>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/route-names.js", "new_path": "native/navigation/route-names.js", "diff": "@@ -33,6 +33,7 @@ export const MessageListRouteName = 'MessageList';\nexport const VerificationModalRouteName = 'VerificationModal';\nexport const LoggedOutModalRouteName = 'LoggedOutModal';\nexport const ProfileRouteName = 'Profile';\n+export const AppsRouteName = 'Apps';\nexport const ProfileScreenRouteName = 'ProfileScreen';\nexport const RelationshipListItemTooltipModalRouteName =\n'RelationshipListItemTooltipModal';\n@@ -101,6 +102,7 @@ export type TabParamList = {|\n+Calendar: void,\n+Chat: void,\n+Profile: void,\n+ +Apps: void,\n|};\nexport type ChatParamList = {|\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] add `Apps` to tab bar and create `apps-directory` placeholder Test Plan: Apps tab appeared as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1191
129,184
19.05.2021 15:12:17
14,400
696e083fd17129145123df0554a873fe8668a225
[native] `app-directory` and `app-listing` layout Summary: Here's what it looks like: Test Plan: layout/views appeared as expected on iOS simulator Reviewers: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "native/apps/app-listing.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { View, Text, TouchableOpacity } from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome';\n+\n+import { useStyles } from '../themes/colors';\n+\n+type Props = {|\n+ +active: boolean,\n+ +appName: string,\n+ +appIcon: 'calendar' | 'book' | 'tasks' | 'folder',\n+ +appCopy: string,\n+|};\n+function AppListing(props: Props) {\n+ const { active, appName, appIcon, appCopy } = props;\n+ const styles = useStyles(unboundStyles);\n+ const textColor = active ? 'white' : 'gray';\n+ return (\n+ <View style={styles.cell}>\n+ <View style={styles.appContent}>\n+ <Icon name={appIcon} style={[styles.appIcon, { color: textColor }]} />\n+ <View>\n+ <Text style={[styles.appName, { color: textColor }]}>{appName}</Text>\n+ <Text style={[styles.appCopy, { color: textColor }]}>{appCopy}</Text>\n+ </View>\n+ </View>\n+\n+ <TouchableOpacity>\n+ <Icon name=\"plus\" style={[styles.plusIcon, { color: textColor }]} />\n+ </TouchableOpacity>\n+ </View>\n+ );\n+}\n+\n+const unboundStyles = {\n+ cell: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ alignItems: 'center',\n+ paddingVertical: 12,\n+ },\n+ appContent: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ },\n+ appIcon: {\n+ fontSize: 28,\n+ paddingRight: 18,\n+ },\n+ plusIcon: {\n+ fontSize: 20,\n+ },\n+ appName: {\n+ fontSize: 20,\n+ },\n+ appCopy: {\n+ fontSize: 12,\n+ },\n+};\n+\n+export default AppListing;\n" }, { "change_type": "MODIFY", "old_path": "native/apps/apps-directory.react.js", "new_path": "native/apps/apps-directory.react.js", "diff": "// @flow\nimport * as React from 'react';\n-import { View, Text } from 'react-native';\n+import { Text, FlatList } from 'react-native';\n+import { SafeAreaView } from 'react-native-safe-area-context';\nimport { useStyles } from '../themes/colors';\n+import AppListing from './app-listing.react';\n+\n+const safeAreaEdges = ['top', 'bottom'];\n+const APP_DIRECTORY_DATA = [\n+ {\n+ id: '0',\n+ active: true,\n+ appName: 'Calendar',\n+ appIcon: 'calendar',\n+ appCopy: 'Shared calendar for you and your community',\n+ },\n+ {\n+ id: '1',\n+ active: false,\n+ appName: 'Wiki',\n+ appIcon: 'book',\n+ appCopy: 'Connect your community mail account',\n+ },\n+ {\n+ id: '2',\n+ active: false,\n+ appName: 'Tasks',\n+ appIcon: 'tasks',\n+ appCopy: 'Shared tasks for you and your community',\n+ },\n+ {\n+ id: '3',\n+ active: false,\n+ appName: 'Files',\n+ appIcon: 'folder',\n+ appCopy: 'Shared files for you and your community',\n+ },\n+];\nfunction AppsDirectory() {\nconst styles = useStyles(unboundStyles);\n+\n+ const renderAppCell = React.useCallback(\n+ ({ item }) => (\n+ <AppListing\n+ active={item.active}\n+ appName={item.appName}\n+ appIcon={item.appIcon}\n+ appCopy={item.appCopy}\n+ />\n+ ),\n+ [],\n+ );\n+ const getItemID = React.useCallback((item) => item.id, []);\n+\nreturn (\n- <View style={styles.view}>\n- <Text style={styles.placeHolderText}>placeholder apps view</Text>\n- </View>\n+ <SafeAreaView style={styles.view} edges={safeAreaEdges}>\n+ <Text style={styles.title}>Choose Apps</Text>\n+ <FlatList\n+ data={APP_DIRECTORY_DATA}\n+ renderItem={renderAppCell}\n+ keyExtractor={getItemID}\n+ />\n+ </SafeAreaView>\n);\n}\n@@ -18,11 +71,12 @@ const unboundStyles = {\nview: {\nflex: 1,\nbackgroundColor: 'panelBackground',\n- justifyContent: 'center',\n- alignItems: 'center',\n+ padding: 18,\n},\n- placeHolderText: {\n+ title: {\ncolor: 'white',\n+ fontSize: 28,\n+ paddingVertical: 12,\n},\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] `app-directory` and `app-listing` layout Summary: Here's what it looks like: https://blob.sh/atul/app-directory.png Test Plan: layout/views appeared as expected on iOS simulator Reviewers: ashoat Reviewed By: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1192
129,187
19.05.2021 17:36:44
14,400
2eeb5bbe14a6f1d2aea41aea7f45dc0598024b6a
[native] Rename Android packages/folders from SquadCal to Comm Summary: This doesn't handle renaming the app, changing the app icon, changing the `rootProject.name` in Gradle, or changing the "applicationId" (`org.squadcal`). Test Plan: Make sure the app compiles Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/src/cpp/jsiInstaller.cpp", "new_path": "native/android/app/src/cpp/jsiInstaller.cpp", "diff": "@@ -11,7 +11,7 @@ namespace react = facebook::react;\nclass CommHybrid : public jni::HybridClass<CommHybrid> {\npublic:\n- static auto constexpr kJavaDescriptor = \"Lorg/squadcal/fbjni/CommHybrid;\";\n+ static auto constexpr kJavaDescriptor = \"Lapp/comm/fbjni/CommHybrid;\";\nstatic void initHybrid(\njni::alias_ref<jhybridobject> jThis,\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/debug/java/org/squadcal/ReactNativeFlipper.java", "new_path": "native/android/app/src/debug/java/app/comm/ReactNativeFlipper.java", "diff": "* <p>This source code is licensed under the MIT license found in the LICENSE file in the root\n* directory of this source tree.\n*/\n-package org.squadcal;\n+package app.comm;\nimport android.content.Context;\nimport com.facebook.flipper.android.AndroidFlipperClient;\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/AndroidManifest.xml", "new_path": "native/android/app/src/main/AndroidManifest.xml", "diff": "<manifest\nxmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\n- package=\"org.squadcal\"\n+ package=\"app.comm\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/AndroidLifecycleModule.java", "new_path": "native/android/app/src/main/java/app/comm/AndroidLifecycleModule.java", "diff": "-package org.squadcal;\n+package app.comm;\nimport com.facebook.react.bridge.ReactApplicationContext;\nimport com.facebook.react.bridge.ReactContextBaseJavaModule;\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/CommCoreJSIModulePackage.java", "new_path": "native/android/app/src/main/java/app/comm/CommCoreJSIModulePackage.java", "diff": "-package org.squadcal;\n+package app.comm;\nimport com.facebook.react.bridge.JSIModulePackage;\nimport com.facebook.react.bridge.JSIModuleSpec;\n@@ -6,7 +6,7 @@ import com.facebook.react.bridge.JavaScriptContextHolder;\nimport com.facebook.react.bridge.ReactApplicationContext;\nimport java.util.Collections;\nimport java.util.List;\n-import org.squadcal.fbjni.CommHybrid;\n+import app.comm.fbjni.CommHybrid;\npublic class CommCoreJSIModulePackage implements JSIModulePackage {\n@Override\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/SquadCalPackage.java", "new_path": "native/android/app/src/main/java/app/comm/CommPackage.java", "diff": "-package org.squadcal;\n-\n+package app.comm;\nimport com.facebook.react.ReactPackage;\nimport com.facebook.react.bridge.NativeModule;\n@@ -10,7 +9,7 @@ import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n-public class SquadCalPackage implements ReactPackage {\n+public class CommPackage implements ReactPackage {\n@Override\npublic List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/MainActivity.java", "new_path": "native/android/app/src/main/java/app/comm/MainActivity.java", "diff": "-package org.squadcal;\n+package app.comm;\nimport com.facebook.react.ReactFragmentActivity;\nimport android.os.Bundle;\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java", "new_path": "native/android/app/src/main/java/app/comm/MainApplication.java", "diff": "-package org.squadcal;\n+package app.comm;\n-import org.squadcal.generated.BasePackageList;\n+import app.comm.generated.BasePackageList;\nimport androidx.multidex.MultiDexApplication;\nimport android.content.Context;\n@@ -48,7 +48,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica\npackages.add(new RNFirebaseMessagingPackage());\npackages.add(new RNFirebaseNotificationsPackage());\npackages.add(new KeyboardInputPackage(this.getApplication()));\n- packages.add(new SquadCalPackage());\n+ packages.add(new CommPackage());\n// Add unimodules\nList<ReactPackage> unimodules = Arrays.<ReactPackage>asList(\n@@ -107,7 +107,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica\ntry {\n// We use reflection here to pick up the class that initializes Flipper,\n// since Flipper library is not available in release mode\n- Class<?> aClass = Class.forName(\"org.squadcal.ReactNativeFlipper\");\n+ Class<?> aClass = Class.forName(\"app.comm.ReactNativeFlipper\");\naClass\n.getMethod(\n\"initializeFlipper\",\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/SplashActivity.java", "new_path": "native/android/app/src/main/java/app/comm/SplashActivity.java", "diff": "-package org.squadcal;\n+package app.comm;\nimport android.content.Intent;\nimport android.os.Bundle;\n" }, { "change_type": "RENAME", "old_path": "native/android/app/src/main/java/org/squadcal/fbjni/CommHybrid.java", "new_path": "native/android/app/src/main/java/app/comm/fbjni/CommHybrid.java", "diff": "-package org.squadcal.fbjni;\n+package app.comm.fbjni;\nimport android.content.Context;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Rename Android packages/folders from SquadCal to Comm Summary: This doesn't handle renaming the app, changing the app icon, changing the `rootProject.name` in Gradle, or changing the "applicationId" (`org.squadcal`). Test Plan: Make sure the app compiles Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1194
129,187
19.05.2021 17:42:14
14,400
aeaf4a5dfcbbbec4d3e7e8e5305d3cf6b7a62f3c
[native] Change main component name from SquadCal to Comm Test Plan: Make sure the app compiles and runs on iOS and Android Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/src/main/java/app/comm/MainActivity.java", "new_path": "native/android/app/src/main/java/app/comm/MainActivity.java", "diff": "@@ -24,7 +24,7 @@ public class MainActivity extends ReactFragmentActivity {\n*/\n@Override\nprotected String getMainComponentName() {\n- return \"SquadCal\";\n+ return \"Comm\";\n}\n@Override\n" }, { "change_type": "MODIFY", "old_path": "native/app.json", "new_path": "native/app.json", "diff": "{\n- \"name\": \"SquadCal\",\n+ \"name\": \"Comm\",\n\"displayName\": \"SquadCal\"\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/AppDelegate.mm", "new_path": "native/ios/Comm/AppDelegate.mm", "diff": "@@ -57,7 +57,7 @@ static void InitializeFlipper(UIApplication *application) {\nself.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];\nRCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];\nRCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge\n- moduleName:@\"SquadCal\"\n+ moduleName:@\"Comm\"\ninitialProperties:nil];\nrootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Change main component name from SquadCal to Comm Test Plan: Make sure the app compiles and runs on iOS and Android Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1195
129,187
19.05.2021 18:56:26
14,400
7e35fcafca205539fe8f11c62db7a0c22ba3e2e6
[lib] Delete unused threadIsPersonalAndPending function Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -201,12 +201,6 @@ function threadIsPending(threadID: ?string) {\nreturn threadID?.startsWith('pending');\n}\n-function threadIsPersonalAndPending(threadInfo: ?(ThreadInfo | RawThreadInfo)) {\n- return (\n- threadInfo?.type === threadTypes.PERSONAL && threadIsPending(threadInfo?.id)\n- );\n-}\n-\nfunction getThreadOtherUsers(\nthreadInfo: ThreadInfo | RawThreadInfo,\nviewerID: ?string,\n@@ -1018,7 +1012,6 @@ export {\nthreadActualMembers,\nthreadIsGroupChat,\nthreadIsPending,\n- threadIsPersonalAndPending,\ngetSingleOtherUser,\ngetPendingThreadID,\ncreatePendingThread,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Delete unused threadIsPersonalAndPending function Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1198
129,187
19.05.2021 22:59:00
14,400
bd0c8e504d1e5ed03174cb2863a33299e02b0c18
[server] Deprecate botherMonthlyActivesToUpdateAppVersion Summary: We don't need to do this once we're on the app store. Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "DELETE", "old_path": "server/src/bots/app-version-update.js", "new_path": null, "diff": "-// @flow\n-\n-import invariant from 'invariant';\n-\n-import bots from 'lib/facts/bots';\n-import { messageTypes } from 'lib/types/message-types';\n-import { promiseAll } from 'lib/utils/promises';\n-\n-import createMessages from '../creators/message-creator';\n-import { dbQuery, SQL } from '../database/database';\n-import { createBotViewer } from '../session/bots';\n-import { createSquadbotThread } from './squadbot';\n-\n-const thirtyDays = 30 * 24 * 60 * 60 * 1000;\n-const { squadbot } = bots;\n-\n-async function tryCreateSquadbotThread(userID: string) {\n- try {\n- return await createSquadbotThread(userID);\n- } catch {\n- return null;\n- }\n-}\n-\n-async function botherMonthlyActivesToUpdateAppVersion(): Promise<void> {\n- const cutoff = Date.now() - thirtyDays;\n- const query = SQL`\n- SELECT x.user,\n- MIN(x.max_code_version) AS code_version,\n- MIN(t.id) AS squadbot_thread\n- FROM (\n- SELECT s.user, c.platform,\n- MAX(JSON_EXTRACT(c.versions, \"$.codeVersion\")) AS max_code_version\n- FROM sessions s\n- LEFT JOIN cookies c ON c.id = s.cookie\n- WHERE s.last_update > ${cutoff}\n- AND c.platform != \"web\"\n- AND JSON_EXTRACT(c.versions, \"$.codeVersion\") IS NOT NULL\n- GROUP BY s.user, c.platform\n- ) x\n- LEFT JOIN versions v ON v.platform = x.platform AND v.code_version = (\n- SELECT MAX(code_version)\n- FROM versions\n- WHERE platform = x.platform AND deploy_time IS NOT NULL\n- )\n- LEFT JOIN (\n- SELECT t.id, m1.user, COUNT(m3.user) AS user_count\n- FROM threads t\n- LEFT JOIN memberships m1 ON m1.thread = t.id\n- AND m1.user != ${squadbot.userID} AND m1.role >= 0\n- LEFT JOIN memberships m2 ON m2.thread = t.id\n- AND m2.user = ${squadbot.userID} AND m2.role >= 0\n- LEFT JOIN memberships m3 ON m3.thread = t.id\n- WHERE m1.user IS NOT NULL AND m2.user IS NOT NULL AND m3.role >= 0\n- GROUP BY t.id, m1.user\n- ) t ON t.user = x.user AND t.user_count = 2\n- WHERE v.id IS NOT NULL AND x.max_code_version < v.code_version\n- GROUP BY x.user\n- `;\n- const [result] = await dbQuery(query);\n-\n- const codeVersions = new Map();\n- const squadbotThreads = new Map();\n- const usersToSquadbotThreadPromises = {};\n- for (const row of result) {\n- const userID = row.user.toString();\n- const codeVersion = row.code_version;\n- codeVersions.set(userID, codeVersion);\n- if (row.squadbot_thread) {\n- const squadbotThread = row.squadbot_thread.toString();\n- squadbotThreads.set(userID, squadbotThread);\n- } else {\n- usersToSquadbotThreadPromises[userID] = tryCreateSquadbotThread(userID);\n- }\n- }\n-\n- const newSquadbotThreads = await promiseAll(usersToSquadbotThreadPromises);\n- for (const userID in newSquadbotThreads) {\n- const newSquadbotThreadID = newSquadbotThreads[userID];\n- if (newSquadbotThreadID) {\n- squadbotThreads.set(userID, newSquadbotThreadID);\n- }\n- }\n-\n- const time = Date.now();\n- const newMessageDatas = [];\n- for (const [userID, threadID] of squadbotThreads) {\n- const codeVersion = codeVersions.get(userID);\n- invariant(codeVersion, 'should be set');\n- newMessageDatas.push({\n- type: messageTypes.TEXT,\n- threadID,\n- creatorID: squadbot.userID,\n- time,\n- text:\n- `beep boop, I'm a bot! one or more of your devices is on an old ` +\n- `version (v${codeVersion}). any chance you could update it? on ` +\n- `Android you do this using the Play Store, same as any other app. on ` +\n- `iOS, you need to open up the Testflight app and update from there. ` +\n- `thanks for helping test!`,\n- });\n- }\n-\n- const squadbotViewer = createBotViewer(squadbot.userID);\n- await createMessages(squadbotViewer, newMessageDatas);\n-}\n-\n-export { botherMonthlyActivesToUpdateAppVersion };\n" }, { "change_type": "MODIFY", "old_path": "server/src/cron/cron.js", "new_path": "server/src/cron/cron.js", "diff": "import cluster from 'cluster';\nimport schedule from 'node-schedule';\n-import { botherMonthlyActivesToUpdateAppVersion } from '../bots/app-version-update';\nimport { deleteOrphanedActivity } from '../deleters/activity-deleters';\nimport { deleteExpiredCookies } from '../deleters/cookie-deleters';\nimport { deleteOrphanedDays } from '../deleters/day-deleters';\n@@ -61,19 +60,6 @@ if (cluster.isMaster) {\n}\n},\n);\n- schedule.scheduleJob(\n- '30 11 ? * 6', // every Saturday at 11:30 AM Pacific Time\n- async () => {\n- try {\n- await botherMonthlyActivesToUpdateAppVersion();\n- } catch (e) {\n- console.warn(\n- 'encountered error while trying to bother monthly actives to update',\n- e,\n- );\n- }\n- },\n- );\nschedule.scheduleJob(\n'0 3 ? * 0', // every Sunday at 3:00 AM Pacific Time\nasync () => {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Deprecate botherMonthlyActivesToUpdateAppVersion Summary: We don't need to do this once we're on the app store. Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1202
129,187
19.05.2021 23:30:02
14,400
ff1716ff2a7c721d636dc1bbab9962c5499d480a
[native] Remove threadPermissions.CREATE_SUBTHREADS from threadTypes.PERSONAL Summary: `PERSONAL` is going to be a "thick" thread long-term, and as such won't support subthreads. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -192,7 +192,6 @@ function getRolePermissionBlobsForChat(\n[threadPermissions.VOICED]: true,\n[threadPermissions.EDIT_ENTRIES]: true,\n[threadPermissions.EDIT_THREAD]: true,\n- [threadPermissions.CREATE_SUBTHREADS]: true,\n[threadPermissions.CREATE_SIDEBARS]: true,\n[openDescendantKnowOf]: true,\n[openDescendantVisible]: true,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Remove threadPermissions.CREATE_SUBTHREADS from threadTypes.PERSONAL Summary: `PERSONAL` is going to be a "thick" thread long-term, and as such won't support subthreads. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1204
129,184
20.05.2021 11:26:03
14,400
551e229b5eaf3986a5318cc2d16e48a53f7dbd90
[lib][web][native] add `enabledApps` to redux Test Plan: Verified with redux devtools Reviewers: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "lib/reducers/enabled-apps-reducer.js", "diff": "+// @flow\n+\n+import type { EnabledApps } from '../types/enabled-apps';\n+import type { BaseAction } from '../types/redux-types';\n+\n+export const enableAppActionType = 'ENABLE_APP';\n+export const disableAppActionType = 'DISABLE_APP';\n+\n+export default function reduceEnabledApps(\n+ state: EnabledApps,\n+ action: BaseAction,\n+): EnabledApps {\n+ if (action.type === enableAppActionType && action.payload === 'calendar') {\n+ return { ...state, calendar: true };\n+ } else if (\n+ action.type === disableAppActionType &&\n+ action.payload === 'calendar'\n+ ) {\n+ return { ...state, calendar: false };\n+ }\n+ return state;\n+}\n" }, { "change_type": "MODIFY", "old_path": "lib/reducers/master-reducer.js", "new_path": "lib/reducers/master-reducer.js", "diff": "@@ -14,6 +14,7 @@ import {\nimport reduceCalendarFilters from './calendar-filters-reducer';\nimport reduceConnectionInfo from './connection-reducer';\nimport reduceDataLoaded from './data-loaded-reducer';\n+import reduceEnabledApps from './enabled-apps-reducer';\nimport { reduceEntryInfos } from './entry-reducer';\nimport reduceLifecycleState from './lifecycle-state-reducer';\nimport { reduceLoadingStatuses } from './loading-reducer';\n@@ -78,6 +79,7 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\ncalendarFilters: reduceCalendarFilters(state.calendarFilters, action),\nconnection,\nlifecycleState: reduceLifecycleState(state.lifecycleState, action),\n+ enabledApps: reduceEnabledApps(state.enabledApps, action),\nnextLocalID: reduceNextLocalID(state.nextLocalID, action),\nqueuedReports: reduceQueuedReports(state.queuedReports, action),\ndataLoaded: reduceDataLoaded(state.dataLoaded, action),\n" }, { "change_type": "ADD", "old_path": null, "new_path": "lib/types/enabled-apps.js", "diff": "+// @flow\n+\n+export type EnabledApps = {|\n+ +calendar: boolean,\n+ +wiki: boolean,\n+ +tasks: boolean,\n+ +files: boolean,\n+|};\n+\n+export type SupportedApps = $Keys<EnabledApps>;\n+\n+export const defaultEnabledApps: EnabledApps = {\n+ calendar: false,\n+ wiki: false,\n+ tasks: false,\n+ files: false,\n+};\n+\n+export const defaultWebEnabledApps: EnabledApps = {\n+ calendar: true,\n+ wiki: false,\n+ tasks: false,\n+ files: false,\n+};\n" }, { "change_type": "MODIFY", "old_path": "lib/types/redux-types.js", "new_path": "lib/types/redux-types.js", "diff": "@@ -11,6 +11,7 @@ import type {\nQueueActivityUpdatesPayload,\nSetThreadUnreadStatusPayload,\n} from './activity-types';\n+import type { EnabledApps, SupportedApps } from './enabled-apps';\nimport type {\nRawEntryInfo,\nEntryStore,\n@@ -85,6 +86,7 @@ export type BaseAppState<NavInfo: BaseNavInfo> = {\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\n+ enabledApps: EnabledApps,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ndataLoaded: boolean,\n@@ -731,6 +733,14 @@ export type BaseAction =\n+type: 'UPDATE_LIFECYCLE_STATE',\n+payload: LifecycleState,\n|}\n+ | {|\n+ +type: 'ENABLE_APP',\n+ +payload: SupportedApps,\n+ |}\n+ | {|\n+ +type: 'DISABLE_APP',\n+ +payload: SupportedApps,\n+ |}\n| {|\n+type: 'PROCESS_UPDATES',\n+payload: UpdatesResultWithUserInfos,\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -17,6 +17,7 @@ import { defaultNotifPermissionAlertInfo } from '../push/alerts';\nimport { defaultDeviceCameraInfo } from '../types/camera';\nimport { defaultGlobalThemeInfo } from '../types/themes';\nimport type { AppState } from './redux-setup';\n+import { defaultEnabledApps } from 'lib/types/enabled-apps';\nconst migrations = {\n[1]: (state: AppState) => ({\n@@ -213,6 +214,10 @@ const migrations = {\n...state,\nglobalThemeInfo: defaultGlobalThemeInfo,\n}),\n+ [24]: (state) => ({\n+ ...state,\n+ enabledApps: defaultEnabledApps,\n+ }),\n};\nconst persistConfig = {\n@@ -227,7 +232,7 @@ const persistConfig = {\n'frozen',\n],\ndebug: __DEV__,\n- version: 23,\n+ version: 24,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\ntimeout: __DEV__ ? 0 : undefined,\n};\n" }, { "change_type": "MODIFY", "old_path": "native/redux/redux-setup.js", "new_path": "native/redux/redux-setup.js", "diff": "@@ -19,6 +19,7 @@ import {\ninvalidSessionDowngrade,\ninvalidSessionRecovery,\n} from 'lib/shared/account-utils';\n+import { type EnabledApps, defaultEnabledApps } from 'lib/types/enabled-apps';\nimport { type EntryStore } from 'lib/types/entry-types';\nimport {\ntype CalendarFilter,\n@@ -108,6 +109,7 @@ export type AppState = {|\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\n+ enabledApps: EnabledApps,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\n_persist: ?PersistState,\n@@ -156,6 +158,7 @@ const defaultState = ({\nconnection: defaultConnectionInfo(Platform.OS),\nwatchedThreadIDs: [],\nlifecycleState: 'active',\n+ enabledApps: defaultEnabledApps,\nnextLocalID: 0,\nqueuedReports: [],\n_persist: null,\n" }, { "change_type": "MODIFY", "old_path": "server/src/responders/website-responders.js", "new_path": "server/src/responders/website-responders.js", "diff": "@@ -16,6 +16,7 @@ import { freshMessageStore } from 'lib/reducers/message-reducer';\nimport { mostRecentReadThread } from 'lib/selectors/thread-selectors';\nimport { mostRecentMessageTimestamp } from 'lib/shared/message-utils';\nimport { threadHasPermission } from 'lib/shared/thread-utils';\n+import { defaultWebEnabledApps } from 'lib/types/enabled-apps';\nimport { defaultCalendarFilters } from 'lib/types/filter-types';\nimport { defaultNumberPerThread } from 'lib/types/message-types';\nimport { defaultConnectionInfo } from 'lib/types/socket-types';\n@@ -276,6 +277,7 @@ async function websiteResponder(\n},\nwatchedThreadIDs: [],\nlifecycleState: 'active',\n+ enabledApps: defaultWebEnabledApps,\nnextLocalID: 0,\nqueuedReports: [],\ntimeZone: viewer.timeZone,\n" }, { "change_type": "MODIFY", "old_path": "web/redux/redux-setup.js", "new_path": "web/redux/redux-setup.js", "diff": "@@ -10,6 +10,7 @@ import baseReducer from 'lib/reducers/master-reducer';\nimport { mostRecentReadThreadSelector } from 'lib/selectors/thread-selectors';\nimport { invalidSessionDowngrade } from 'lib/shared/account-utils';\nimport type { Shape } from 'lib/types/core';\n+import type { EnabledApps } from 'lib/types/enabled-apps';\nimport type { EntryStore } from 'lib/types/entry-types';\nimport type { CalendarFilter } from 'lib/types/filter-types';\nimport type { LifecycleState } from 'lib/types/lifecycle-state-types';\n@@ -50,6 +51,7 @@ export type AppState = {|\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\n+ enabledApps: EnabledApps,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ntimeZone: ?string,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib][web][native] add `enabledApps` to redux Test Plan: Verified with redux devtools Reviewers: ashoat Reviewed By: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1209
129,187
20.05.2021 17:14:33
14,400
b4a1ee565b01d9377331f4c5c93fb03b2c18aaa3
[server] Introduce validateCandidateMembers Summary: This function unifies member validation across `create_thread` and `update_thread`, and uses our new `MEMBERSHIP` permission to do the validation. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "import invariant from 'invariant';\nimport bots from 'lib/facts/bots';\n-import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils';\nimport {\ngeneratePendingThreadColor,\ngenerateRandomColor,\n@@ -12,7 +11,6 @@ import {\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\nimport type { Shape } from 'lib/types/core';\nimport { messageTypes } from 'lib/types/message-types';\n-import { userRelationshipStatus } from 'lib/types/relationship-types';\nimport {\ntype ServerNewThreadRequest,\ntype NewThreadResponse,\n@@ -25,9 +23,10 @@ import { firstLine } from 'lib/utils/string-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport { fetchMessageInfoByID } from '../fetchers/message-fetchers';\n-import { fetchThreadInfos } from '../fetchers/thread-fetchers';\n-import { checkThreadPermission } from '../fetchers/thread-permission-fetchers';\n-import { fetchKnownUserInfos } from '../fetchers/user-fetchers';\n+import {\n+ checkThreadPermission,\n+ validateCandidateMembers,\n+} from '../fetchers/thread-permission-fetchers';\nimport type { Viewer } from '../session/viewer';\nimport {\nchangeRole,\n@@ -38,7 +37,10 @@ import { joinThread } from '../updaters/thread-updaters';\nimport RelationshipChangeset from '../utils/relationship-changeset';\nimport createIDs from './id-creator';\nimport createMessages from './message-creator';\n-import { createInitialRolesForNewThread } from './role-creator';\n+import {\n+ createInitialRolesForNewThread,\n+ getRolePermissionBlobsForChat,\n+} from './role-creator';\nimport type { UpdatesForCurrentSession } from './update-creator';\nconst { squadbot } = bots;\n@@ -81,7 +83,7 @@ async function createThread(\nrequest.initialMemberIDs && request.initialMemberIDs.length > 0\n? request.initialMemberIDs\n: null;\n- const ghostMemberIDs =\n+ const ghostMemberIDsFromRequest =\nrequest.ghostMemberIDs && request.ghostMemberIDs.length > 0\n? request.ghostMemberIDs\n: null;\n@@ -109,111 +111,60 @@ async function createThread(\nthrow new ServerError('invalid_parameters');\n}\n- const checkPromises = {};\n- if (parentThreadID) {\n- checkPromises.parentThreadFetch = fetchThreadInfos(\n- viewer,\n- SQL`t.id = ${parentThreadID}`,\n- );\n- checkPromises.hasParentPermission = checkThreadPermission(\n+ const confirmParentPermissionPromise = (async () => {\n+ if (!parentThreadID) {\n+ return;\n+ }\n+ const hasParentPermission = await checkThreadPermission(\nviewer,\nparentThreadID,\nthreadType === threadTypes.SIDEBAR\n? threadPermissions.CREATE_SIDEBARS\n: threadPermissions.CREATE_SUBTHREADS,\n);\n- }\n-\n- const memberIDs = [];\n- if (initialMemberIDsFromRequest) {\n- memberIDs.push(...initialMemberIDsFromRequest);\n- }\n- if (ghostMemberIDs) {\n- memberIDs.push(...ghostMemberIDs);\n- }\n-\n- if (initialMemberIDsFromRequest || ghostMemberIDs) {\n- checkPromises.fetchMemberIDs = fetchKnownUserInfos(viewer, memberIDs);\n- }\n-\n- if (sourceMessageID) {\n- checkPromises.sourceMessage = fetchMessageInfoByID(viewer, sourceMessageID);\n- }\n-\n- const {\n- parentThreadFetch,\n- hasParentPermission,\n- fetchMemberIDs,\n- sourceMessage,\n- } = await promiseAll(checkPromises);\n-\n- let parentThreadMembers;\n- if (parentThreadID) {\n- invariant(parentThreadFetch, 'parentThreadFetch should be set');\n- const parentThreadInfo = parentThreadFetch.threadInfos[parentThreadID];\nif (!hasParentPermission) {\nthrow new ServerError('invalid_credentials');\n}\n- parentThreadMembers = parentThreadInfo.members.map(\n- (userInfo) => userInfo.id,\n- );\n- }\n+ })();\n- const relationshipChangeset = new RelationshipChangeset();\n- const silencedMemberIDs = new Set();\n- if (fetchMemberIDs) {\n- invariant(initialMemberIDsFromRequest || ghostMemberIDs, 'should be set');\n- for (const memberID of memberIDs) {\n- const member = fetchMemberIDs[memberID];\n- if (\n- !member &&\n- shouldCreateRelationships &&\n- (threadType !== threadTypes.SIDEBAR ||\n- parentThreadMembers?.includes(memberID))\n- ) {\n- continue;\n- } else if (!member && silentlyFailMembers) {\n- silencedMemberIDs.add(memberID);\n- continue;\n- } else if (!member) {\n- throw new ServerError('invalid_credentials');\n- }\n- relationshipChangeset.setRelationshipExists(viewer.id, memberID);\n-\n- const { relationshipStatus } = member;\n- const memberRelationshipHasBlock = !!(\n- relationshipStatus &&\n- relationshipBlockedInEitherDirection(relationshipStatus)\n+ const validateMembersPromise = (async () => {\n+ const defaultRolePermissions = getRolePermissionBlobsForChat(threadType)\n+ .Members;\n+ const { initialMemberIDs, ghostMemberIDs } = await validateCandidateMembers(\n+ viewer,\n+ {\n+ initialMemberIDs: initialMemberIDsFromRequest,\n+ ghostMemberIDs: ghostMemberIDsFromRequest,\n+ },\n+ {\n+ threadType,\n+ parentThreadID,\n+ defaultRolePermissions,\n+ },\n+ { requireRelationship: !shouldCreateRelationships },\n);\nif (\n- relationshipStatus === userRelationshipStatus.FRIEND &&\n- threadType !== threadTypes.SIDEBAR\n- ) {\n- continue;\n- } else if (memberRelationshipHasBlock && silentlyFailMembers) {\n- silencedMemberIDs.add(memberID);\n- } else if (memberRelationshipHasBlock) {\n- throw new ServerError('invalid_credentials');\n- } else if (\n- parentThreadMembers &&\n- parentThreadMembers.includes(memberID)\n+ !silentlyFailMembers &&\n+ (Number(initialMemberIDs?.length) <\n+ Number(initialMemberIDsFromRequest?.length) ||\n+ Number(ghostMemberIDs?.length) <\n+ Number(ghostMemberIDsFromRequest?.length))\n) {\n- continue;\n- } else if (!shouldCreateRelationships && silentlyFailMembers) {\n- silencedMemberIDs.add(memberID);\n- } else if (!shouldCreateRelationships) {\nthrow new ServerError('invalid_credentials');\n}\n- }\n- }\n+ return { initialMemberIDs, ghostMemberIDs };\n+ })();\n- const filteredInitialMemberIDs: ?$ReadOnlyArray<string> = initialMemberIDsFromRequest?.filter(\n- (id) => !silencedMemberIDs.has(id),\n- );\n- const initialMemberIDs =\n- filteredInitialMemberIDs && filteredInitialMemberIDs.length > 0\n- ? filteredInitialMemberIDs\n- : null;\n+ const checkPromises = {};\n+ checkPromises.confirmParentPermission = confirmParentPermissionPromise;\n+ checkPromises.validateMembers = validateMembersPromise;\n+ if (sourceMessageID) {\n+ checkPromises.sourceMessage = fetchMessageInfoByID(viewer, sourceMessageID);\n+ }\n+ const {\n+ sourceMessage,\n+ validateMembers: { initialMemberIDs, ghostMemberIDs },\n+ } = await promiseAll(checkPromises);\nconst [id] = await createIDs('threads', 1);\nconst newRoles = await createInitialRolesForNewThread(id, threadType);\n@@ -386,6 +337,7 @@ async function createThread(\n...creatorMembershipRows,\n...recalculateMembershipRows,\n];\n+ const relationshipChangeset = new RelationshipChangeset();\nrelationshipChangeset.addAll(creatorRelationshipChangeset);\nrelationshipChangeset.addAll(recalculateRelationshipChangeset);\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-permission-fetchers.js", "new_path": "server/src/fetchers/thread-permission-fetchers.js", "diff": "// @flow\n-import { permissionLookup } from 'lib/permissions/thread-permissions';\n+import {\n+ permissionLookup,\n+ makePermissionsBlob,\n+} from 'lib/permissions/thread-permissions';\n+import { relationshipBlockedInEitherDirection } from 'lib/shared/relationship-utils';\nimport {\nthreadFrozenDueToBlock,\npermissionsDisabledByBlock,\n} from 'lib/shared/thread-utils';\n-import type {\n- ThreadPermission,\n- ThreadPermissionsBlob,\n+import { userRelationshipStatus } from 'lib/types/relationship-types';\n+import {\n+ threadPermissions,\n+ type ThreadType,\n+ type ThreadPermission,\n+ type ThreadPermissionsBlob,\n+ type ThreadRolePermissionsBlob,\n} from 'lib/types/thread-types';\nimport { dbQuery, SQL } from '../database/database';\n@@ -180,6 +188,117 @@ async function checkThread(\nreturn validThreads.has(threadID);\n}\n+type CandidateMembers = {\n+ +[key: string]: ?$ReadOnlyArray<string>,\n+ ...\n+};\n+type ValidateCandidateMembersParams = {|\n+ +threadType: ThreadType,\n+ +parentThreadID: ?string,\n+ +defaultRolePermissions: ThreadRolePermissionsBlob,\n+|};\n+type ValidateCandidateMembersOptions = {| +requireRelationship?: boolean |};\n+async function validateCandidateMembers(\n+ viewer: Viewer,\n+ candidates: CandidateMembers,\n+ params: ValidateCandidateMembersParams,\n+ options?: ValidateCandidateMembersOptions,\n+): Promise<CandidateMembers> {\n+ const requireRelationship = options?.requireRelationship ?? true;\n+\n+ const allCandidatesSet = new Set();\n+ for (const key in candidates) {\n+ const candidateGroup = candidates[key];\n+ if (!candidateGroup) {\n+ continue;\n+ }\n+ for (const candidate of candidateGroup) {\n+ allCandidatesSet.add(candidate);\n+ }\n+ }\n+ const allCandidates = [...allCandidatesSet];\n+\n+ const fetchMembersPromise = fetchKnownUserInfos(viewer, allCandidates);\n+\n+ const parentPermissionsPromise = (async () => {\n+ const parentPermissions = {};\n+ if (!params.parentThreadID) {\n+ return parentPermissions;\n+ }\n+ const parentPermissionsQuery = SQL`\n+ SELECT user, permissions\n+ FROM memberships\n+ WHERE thread = ${params.parentThreadID} AND user IN (${allCandidates})\n+ `;\n+ const [result] = await dbQuery(parentPermissionsQuery);\n+ for (const row of result) {\n+ parentPermissions[row.user] = row.permissions;\n+ }\n+ return parentPermissions;\n+ })();\n+\n+ const [fetchedMembers, parentPermissions] = await Promise.all([\n+ fetchMembersPromise,\n+ parentPermissionsPromise,\n+ ]);\n+\n+ const ignoreMembers = new Set();\n+ for (const memberID of allCandidates) {\n+ const member = fetchedMembers[memberID];\n+ if (!member && requireRelationship) {\n+ ignoreMembers.add(memberID);\n+ continue;\n+ }\n+ const relationshipStatus = member?.relationshipStatus;\n+ const memberRelationshipHasBlock = !!(\n+ relationshipStatus &&\n+ relationshipBlockedInEitherDirection(relationshipStatus)\n+ );\n+ if (memberRelationshipHasBlock) {\n+ ignoreMembers.add(memberID);\n+ continue;\n+ }\n+ const permissionsFromParent = parentPermissions[memberID];\n+ if (\n+ relationshipStatus !== userRelationshipStatus.FRIEND &&\n+ !permissionsFromParent &&\n+ requireRelationship\n+ ) {\n+ ignoreMembers.add(memberID);\n+ continue;\n+ }\n+ const permissions = makePermissionsBlob(\n+ params.defaultRolePermissions,\n+ permissionsFromParent,\n+ '-1',\n+ params.threadType,\n+ );\n+ if (!permissionLookup(permissions, threadPermissions.MEMBERSHIP)) {\n+ ignoreMembers.add(memberID);\n+ continue;\n+ }\n+ }\n+ if (ignoreMembers.size === 0) {\n+ return candidates;\n+ }\n+\n+ const result = {};\n+ for (const key in candidates) {\n+ const candidateGroup = candidates[key];\n+ if (!candidateGroup) {\n+ result[key] = candidates[key];\n+ continue;\n+ }\n+ result[key] = [];\n+ for (const candidate of candidateGroup) {\n+ if (!ignoreMembers.has(candidate)) {\n+ result[key].push(candidate);\n+ }\n+ }\n+ }\n+ return result;\n+}\n+\nexport {\nfetchThreadPermissionsBlob,\ncheckThreadPermission,\n@@ -188,4 +307,5 @@ export {\ngetValidThreads,\ncheckThread,\ncheckIfThreadIsBlocked,\n+ validateCandidateMembers,\n};\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "// @flow\n-import invariant from 'invariant';\n-\nimport { filteredThreadIDs } from 'lib/selectors/calendar-filter-selectors';\nimport {\nthreadHasAdminRole,\nroleIsAdminRole,\nviewerIsMember,\ngetThreadTypeParentRequirement,\n- threadMemberHasPermission,\n} from 'lib/shared/thread-utils';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\nimport type { Shape } from 'lib/types/core';\nimport { messageTypes, defaultNumberPerThread } from 'lib/types/message-types';\n-import { userRelationshipStatus } from 'lib/types/relationship-types';\nimport {\ntype RoleChangeRequest,\ntype ChangeThreadSettingsResult,\n@@ -32,6 +28,7 @@ import { promiseAll } from 'lib/utils/promises';\nimport { firstLine } from 'lib/utils/string-utils';\nimport createMessages from '../creators/message-creator';\n+import { getRolePermissionBlobsForChat } from '../creators/role-creator';\nimport { createUpdates } from '../creators/update-creator';\nimport { dbQuery, SQL } from '../database/database';\nimport { fetchEntryInfos } from '../fetchers/entry-fetchers';\n@@ -44,11 +41,11 @@ import {\ncheckThreadPermission,\nviewerIsMember as fetchViewerIsMember,\ncheckThread,\n+ validateCandidateMembers,\n} from '../fetchers/thread-permission-fetchers';\nimport {\nverifyUserIDs,\nverifyUserOrCookieIDs,\n- fetchKnownUserInfos,\n} from '../fetchers/user-fetchers';\nimport type { Viewer } from '../session/viewer';\nimport RelationshipChangeset from '../utils/relationship-changeset';\n@@ -358,13 +355,6 @@ async function updateThread(\nthrow new ServerError('invalid_parameters');\n}\n- if (newMemberIDs) {\n- validationPromises.fetchNewMembers = fetchKnownUserInfos(\n- viewer,\n- newMemberIDs,\n- );\n- }\n-\nvalidationPromises.serverThreadInfos = fetchServerThreadInfos(\nSQL`t.id = ${request.threadID}`,\n);\n@@ -399,11 +389,9 @@ async function updateThread(\nchecks,\n);\n- const {\n- fetchNewMembers,\n- serverThreadInfos,\n- hasNecessaryPermissions,\n- } = await promiseAll(validationPromises);\n+ const { serverThreadInfos, hasNecessaryPermissions } = await promiseAll(\n+ validationPromises,\n+ );\nconst serverThreadInfo = serverThreadInfos.threadInfos[request.threadID];\nif (!serverThreadInfo) {\n@@ -461,6 +449,7 @@ async function updateThread(\nthrow new ServerError('no_parent_thread_specified');\n}\n+ const confirmParentPermissionPromise = (async () => {\nif (\nnextParentThreadID &&\n(nextParentThreadID !== oldParentThreadID ||\n@@ -478,46 +467,53 @@ async function updateThread(\nthrow new ServerError('invalid_parameters');\n}\n}\n+ })();\n- if (fetchNewMembers) {\n- invariant(newMemberIDs, 'should be set');\n- const newIDs = newMemberIDs; // for Flow\n- for (const newMemberID of newIDs) {\n- if (!fetchNewMembers[newMemberID]) {\n- if (!forceAddMembers) {\n- throw new ServerError('invalid_credentials');\n- } else if (nextThreadType === threadTypes.SIDEBAR) {\n- throw new ServerError('invalid_thread_type');\n- } else {\n- continue;\n+ const validateNewMembersPromise = (async () => {\n+ if (!newMemberIDs) {\n+ return;\n+ }\n+\n+ let defaultRolePermissions;\n+ if (threadType === null || threadType === undefined) {\n+ const rolePermissionsQuery = SQL`\n+ SELECT r.permissions\n+ FROM threads t\n+ LEFT JOIN roles r ON r.id = t.default_role\n+ WHERE t.id = ${request.threadID}\n+ `;\n+ const [result] = await dbQuery(rolePermissionsQuery);\n+ if (result.length > 0) {\n+ defaultRolePermissions = result[0].permissions;\n+ }\n}\n+ if (!defaultRolePermissions) {\n+ defaultRolePermissions = getRolePermissionBlobsForChat(nextThreadType)\n+ .Members;\n}\n- const { relationshipStatus } = fetchNewMembers[newMemberID];\n+\n+ const { newMemberIDs: validatedIDs } = await validateCandidateMembers(\n+ viewer,\n+ { newMemberIDs },\n+ {\n+ threadType: nextThreadType,\n+ parentThreadID: nextParentThreadID,\n+ defaultRolePermissions,\n+ },\n+ { requireRelationship: !forceAddMembers },\n+ );\nif (\n- relationshipStatus === userRelationshipStatus.FRIEND &&\n- nextThreadType !== threadTypes.SIDEBAR\n- ) {\n- continue;\n- } else if (\n- relationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER ||\n- relationshipStatus === userRelationshipStatus.BLOCKED_VIEWER ||\n- relationshipStatus === userRelationshipStatus.BOTH_BLOCKED\n- ) {\n- throw new ServerError('invalid_credentials');\n- } else if (\n- threadMemberHasPermission(\n- serverThreadInfo,\n- newMemberID,\n- threadPermissions.KNOW_OF,\n- )\n+ validatedIDs &&\n+ Number(validatedIDs?.length) < Number(newMemberIDs?.length)\n) {\n- continue;\n- } else if (forceAddMembers && nextThreadType !== threadTypes.SIDEBAR) {\n- continue;\n- }\nthrow new ServerError('invalid_credentials');\n}\n- }\n+ })();\n+\n+ await Promise.all([\n+ confirmParentPermissionPromise,\n+ validateNewMembersPromise,\n+ ]);\nconst updateQueryPromise = (async () => {\nif (Object.keys(sqlUpdate).length === 0) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Introduce validateCandidateMembers Summary: This function unifies member validation across `create_thread` and `update_thread`, and uses our new `MEMBERSHIP` permission to do the validation. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1212
129,187
20.05.2021 23:22:01
14,400
8fb1b155bc52691fb19c7e4320e0670d3ed28e77
[lib] Simplify rolePermissions merge condition in makePermissionsBlob Summary: These conditions are logically equivalent. Test Plan: Careful visual inspection Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/permissions/thread-permissions.js", "new_path": "lib/permissions/thread-permissions.js", "diff": "@@ -80,10 +80,7 @@ function makePermissionsBlob(\nfor (const permissionKey in rolePermissions) {\nconst permissionValue = rolePermissions[permissionKey];\nconst currentValue = combinedPermissions[permissionKey];\n- if (\n- permissionValue ||\n- (!permissionValue && (!currentValue || !currentValue.value))\n- ) {\n+ if (permissionValue || !currentValue || !currentValue.value) {\ncombinedPermissions[permissionKey] = {\nvalue: permissionValue,\nsource: threadID,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Simplify rolePermissions merge condition in makePermissionsBlob Summary: These conditions are logically equivalent. Test Plan: Careful visual inspection Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1215
129,187
21.05.2021 15:23:37
14,400
508039a0ddb05a302798730d9947134ee79a18f9
[native] Use font-weight 500 ("Medium") for wordmark Test Plan: Visual inspection Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/drawable-hdpi/header.png", "new_path": "native/android/app/src/main/res/drawable-hdpi/header.png", "diff": "Binary files a/native/android/app/src/main/res/drawable-hdpi/header.png and b/native/android/app/src/main/res/drawable-hdpi/header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/drawable-xhdpi/header.png", "new_path": "native/android/app/src/main/res/drawable-xhdpi/header.png", "diff": "Binary files a/native/android/app/src/main/res/drawable-xhdpi/header.png and b/native/android/app/src/main/res/drawable-xhdpi/header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/drawable-xxhdpi/header.png", "new_path": "native/android/app/src/main/res/drawable-xxhdpi/header.png", "diff": "Binary files a/native/android/app/src/main/res/drawable-xxhdpi/header.png and b/native/android/app/src/main/res/drawable-xxhdpi/header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/drawable-xxxhdpi/header.png", "new_path": "native/android/app/src/main/res/drawable-xxxhdpi/header.png", "diff": "Binary files a/native/android/app/src/main/res/drawable-xxxhdpi/header.png and b/native/android/app/src/main/res/drawable-xxxhdpi/header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/drawable/header.png", "new_path": "native/android/app/src/main/res/drawable/header.png", "diff": "Binary files a/native/android/app/src/main/res/drawable/header.png and b/native/android/app/src/main/res/drawable/header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header.png", "new_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/Header.imageset/Header.png and b/native/ios/Comm/Images.xcassets/Header.imageset/Header.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header@2x.png", "new_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header@2x.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/Header.imageset/Header@2x.png and b/native/ios/Comm/Images.xcassets/Header.imageset/Header@2x.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header@3x.png", "new_path": "native/ios/Comm/Images.xcassets/Header.imageset/Header@3x.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/Header.imageset/Header@3x.png and b/native/ios/Comm/Images.xcassets/Header.imageset/Header@3x.png differ\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use font-weight 500 ("Medium") for wordmark Test Plan: Visual inspection Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1220
129,187
21.05.2021 15:24:04
14,400
daff6f95e430bb6922dc2ca61c958324904cbb5f
[landing] Use font-weight 500 ("Medium") for wordmark Test Plan: Visual inspection Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -10,7 +10,7 @@ html {\nh1,\nh2 {\nfont-family: 'IBM Plex Mono', monospace;\n- font-weight: 600;\n+ font-weight: 500;\n}\nh1.title {\n@@ -107,7 +107,7 @@ div.footer_logo {\nfont-size: 24px;\ngrid-area: footer_logo;\nalign-self: center;\n- font-weight: 600;\n+ font-weight: 500;\n}\ndiv.subscribe_updates {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Use font-weight 500 ("Medium") for wordmark Test Plan: Visual inspection Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1221
129,187
21.05.2021 16:23:20
14,400
f299c0862b7f19c2b50047f5105824a87ecded7a
[landing] Capitalize Internet Test Plan: Visual inspection Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "landing/landing.react.js", "new_path": "landing/landing.react.js", "diff": "@@ -87,7 +87,7 @@ function Landing(): React.Node {\n<span className={css.purple}> digital&nbsp;identity.</span>\n</h1>\n<p>\n- The internet is broken today. Private user data is owned by\n+ The Internet is broken today. Private user data is owned by\nmega-corporations and farmed for their benefit.\n</p>\n<p>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Capitalize Internet Test Plan: Visual inspection Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1222
129,187
21.05.2021 16:58:11
14,400
9a2ed32d77fb78502f3ce0d8a4bbbe7df3feabe9
Introduce threadTypes.COMMUNITY_ROOT Summary: Necessary for the soft launch since we're putting everything inside a community named "GENESIS" Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -24,6 +24,8 @@ export const threadTypes = Object.freeze({\nPERSONAL: 6,\n// canonical thread for each single user\nPRIVATE: 7,\n+ // aka \"org\". no parent, top-level, has admin\n+ COMMUNITY_ROOT: 8,\n// an open subthread. has parent, top-level (not sidebar), and visible to all\n// members of parent. root ancestor is a COMMUNITY_ROOT\nCOMMUNITY_OPEN_SUBTHREAD: 3,\n@@ -38,7 +40,8 @@ export function assertThreadType(threadType: number): ThreadType {\nthreadType === 4 ||\nthreadType === 5 ||\nthreadType === 6 ||\n- threadType === 7,\n+ threadType === 7 ||\n+ threadType === 8,\n'number is not ThreadType enum',\n);\nreturn threadType;\n@@ -95,11 +98,12 @@ export type ThreadPermissionPropagationPrefix = $Values<\n>;\nexport const threadPermissionFilterPrefixes = Object.freeze({\n- // excludes COMMUNITY_SECRET_SUBTHREAD, PERSONAL, PRIVATE\n+ // excludes COMMUNITY_ROOT, COMMUNITY_SECRET_SUBTHREAD, PERSONAL, PRIVATE\nOPEN: 'open_',\n// excludes SIDEBAR\nTOP_LEVEL: 'toplevel_',\n- // excludes COMMUNITY_SECRET_SUBTHREAD, PERSONAL, PRIVATE and SIDEBAR\n+ // excludes COMMUNITY_ROOT, COMMUNITY_SECRET_SUBTHREAD, PERSONAL, PRIVATE\n+ // and SIDEBAR\nOPEN_TOP_LEVEL: 'opentoplevel_',\n});\nexport type ThreadPermissionFilterPrefix = $Values<\n" }, { "change_type": "MODIFY", "old_path": "native/chat/compose-thread.react.js", "new_path": "native/chat/compose-thread.react.js", "diff": "@@ -349,8 +349,8 @@ class ComposeThread extends React.PureComponent<Props, State> {\nconst parentThreadInfo = ComposeThread.getParentThreadInfo(this.props);\nconst query = this.props.calendarQuery();\ninvariant(\n- threadType !== 5,\n- 'Creating sidebars from thread composer is not yet supported',\n+ threadType !== 5 && threadType !== 8,\n+ \"Sidebars and communities can't be created from the thread composer\",\n);\nconst result = await this.props.newThread({\ntype: threadType,\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -77,10 +77,7 @@ const OPEN_DESCENDANT = DESCENDANT + OPEN;\nconst TOP_LEVEL_DESCENDANT = DESCENDANT + TOP_LEVEL;\nconst OPEN_TOP_LEVEL_DESCENDANT = DESCENDANT + OPEN_TOP_LEVEL;\n-// Originally all chat threads were orgs, but for the alpha launch I decided\n-// it's better to keep it simple. I'll probably reintroduce orgs at some point.\n-// eslint-disable-next-line no-unused-vars\n-function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n+function getRolePermissionBlobsForCommunity(): RolePermissionBlobs {\nconst openDescendantKnowOf = OPEN_DESCENDANT + threadPermissions.KNOW_OF;\nconst openDescendantVisible = OPEN_DESCENDANT + threadPermissions.VISIBLE;\nconst topLevelDescendantMembership =\n@@ -239,6 +236,10 @@ function getRolePermissionBlobs(threadType: ThreadType): RolePermissionBlobs {\n};\n}\n+ if (threadType === threadTypes.COMMUNITY_ROOT) {\n+ return getRolePermissionBlobsForCommunity();\n+ }\n+\nconst openTopLevelDescendantJoinThread =\nOPEN_TOP_LEVEL_DESCENDANT + threadPermissions.JOIN_THREAD;\nconst memberPermissions = {\n" }, { "change_type": "MODIFY", "old_path": "web/modals/threads/new-thread-modal.react.js", "new_path": "web/modals/threads/new-thread-modal.react.js", "diff": "@@ -251,8 +251,8 @@ class NewThreadModal extends React.PureComponent<Props, State> {\nconst name = this.state.name.trim();\ntry {\ninvariant(\n- threadType !== 5,\n- 'Creating sidebars from modal is not yet supported',\n+ threadType !== 5 && threadType !== 8,\n+ \"Sidebars and communities can't be created from the thread composer\",\n);\nconst query = this.props.calendarQuery();\nconst response = await this.props.newThread({\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Introduce threadTypes.COMMUNITY_ROOT Summary: Necessary for the soft launch since we're putting everything inside a community named "GENESIS" Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1225
129,187
24.05.2021 19:58:42
14,400
55dca642a6aa4a3264cf65143669fe10a417a51f
[server] Prevent users from turning threads into COMMUNITY_ROOTs Summary: I also switched from a denylist to an allowlist. The intention was to change the default behavior for new thread types. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -339,9 +339,8 @@ async function updateThread(\nif (\n!viewer.isScriptViewer &&\n- (threadType === threadTypes.PERSONAL ||\n- threadType === threadTypes.PRIVATE ||\n- threadType === threadTypes.SIDEBAR)\n+ threadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&\n+ threadType !== threadTypes.COMMUNITY_SECRET_SUBTHREAD\n) {\nthrow new ServerError('invalid_parameters');\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Prevent users from turning threads into COMMUNITY_ROOTs Summary: I also switched from a denylist to an allowlist. The intention was to change the default behavior for new thread types. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1232
129,187
24.05.2021 20:01:23
14,400
d2e2462d981a227cdf8cd4b5c64ff9f2676c4558
[server] Disable EDIT_PERMISSIONS for admins of COMMUNITY_ROOTs Summary: Not even admins should be able to change the parent thread or thread type of a `COMMUNITY_ROOT`. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -134,7 +134,6 @@ function getRolePermissionBlobsForCommunity(): RolePermissionBlobs {\n[threadPermissions.CREATE_SIDEBARS]: true,\n[threadPermissions.ADD_MEMBERS]: true,\n[threadPermissions.DELETE_THREAD]: true,\n- [threadPermissions.EDIT_PERMISSIONS]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n[threadPermissions.CHANGE_ROLE]: true,\n[threadPermissions.LEAVE_THREAD]: true,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Disable EDIT_PERMISSIONS for admins of COMMUNITY_ROOTs Summary: Not even admins should be able to change the parent thread or thread type of a `COMMUNITY_ROOT`. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1233
129,187
24.05.2021 20:28:29
14,400
185f673698f46c6440cd91fb9cad14c8c4b96f79
[server] Prevent changing thread parents Summary: See code comment. [This Notion task](https://www.notion.so/commapp/Add-community-column-to-threads-table-a8c542df0e7745fa8fc615cd52924882) tracks reverting this change. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -337,6 +337,15 @@ async function updateThread(\nsqlUpdate.type = threadType;\n}\n+ // We're temporarily blocking changing parent thread IDs. Note that even if we\n+ // remove this condition it is only possible for community subthreads (open or\n+ // secret). We've disabled it for community subthreads because we don't yet\n+ // have any efficient way of checking if the new parent is in the same\n+ // community as the old parent.\n+ if (parentThreadID !== undefined) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+\nif (\n!viewer.isScriptViewer &&\nthreadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Prevent changing thread parents Summary: See code comment. [This Notion task](https://www.notion.so/commapp/Add-community-column-to-threads-table-a8c542df0e7745fa8fc615cd52924882) tracks reverting this change. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1235
129,190
25.05.2021 07:47:05
-7,200
b116da6efd1251fdfe195e6dc72ab815f3a8079c
[native] Fix core module shim Summary: Fix core module shim so now it implements the interface from `CommCoreModuleSchema` Test Plan: try to modify methods of `SpecImpl` and see flow errors Reviewers: palys-swm, ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "native/data/core-module-shim.js", "new_path": "native/data/core-module-shim.js", "diff": "// @flow\n+import { type Spec } from '../schema/CommCoreModuleSchema';\n+\nif (!global.CommCoreModule) {\nconsole.warn(\n'Comm Core Module has not been attached! ' +\n'Some functionalities may not work properly.',\n);\n- global.CommCoreModule = {\n- getDraft: () => '',\n- updateDraft: () => {},\n+ const SpecImpl: Spec = {\n+ getDraft: () => Promise.resolve(''),\n+ updateDraft: () => Promise.resolve(false),\ngetAllDrafts: () => Promise.resolve([]),\n};\n+ global.CommCoreModule = SpecImpl;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Fix core module shim Summary: Fix core module shim so now it implements the interface from `CommCoreModuleSchema` Test Plan: try to modify methods of `SpecImpl` and see flow errors Reviewers: palys-swm, ashoat Reviewed By: ashoat Subscribers: ashoat, KatPo, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1218
129,184
24.05.2021 09:27:20
14,400
6f8cb3e46ea564879f88f43abc13d247138f5c94
[ios] change display name to Comm Summary: change display name to 'Comm' Test Plan: looks as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<key>CFBundleDevelopmentRegion</key>\n<string>en</string>\n<key>CFBundleDisplayName</key>\n- <string>SquadCal</string>\n+ <string>Comm</string>\n<key>CFBundleExecutable</key>\n<string>$(EXECUTABLE_NAME)</string>\n<key>CFBundleIdentifier</key>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<key>CFBundleDevelopmentRegion</key>\n<string>en</string>\n<key>CFBundleDisplayName</key>\n- <string>SquadCal</string>\n+ <string>Comm</string>\n<key>CFBundleExecutable</key>\n<string>$(EXECUTABLE_NAME)</string>\n<key>CFBundleIdentifier</key>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[ios] change display name to Comm Summary: change display name to 'Comm' Test Plan: looks as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1238
129,184
25.05.2021 13:37:17
14,400
2d37da5baa5347338d8136370312e6eb795f4926
[ios] replace splash screen for soft launch Summary: Replace splash screen with background that uses same radial gradient as landing page Here's what it looks like: Test Plan: Looks as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/Contents.json", "new_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/Contents.json", "diff": "{\n\"images\" : [\n{\n- \"idiom\" : \"universal\",\n\"filename\" : \"SplashBackground.png\",\n+ \"idiom\" : \"universal\",\n\"scale\" : \"1x\"\n},\n{\n- \"idiom\" : \"universal\",\n\"filename\" : \"SplashBackground@2x.png\",\n+ \"idiom\" : \"universal\",\n\"scale\" : \"2x\"\n},\n{\n- \"idiom\" : \"universal\",\n\"filename\" : \"SplashBackground@3x.png\",\n+ \"idiom\" : \"universal\",\n\"scale\" : \"3x\"\n}\n],\n\"info\" : {\n- \"version\" : 1,\n- \"author\" : \"xcode\"\n+ \"author\" : \"xcode\",\n+ \"version\" : 1\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground.png", "new_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground.png and b/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png", "new_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png and b/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png", "new_path": "native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png", "diff": "Binary files a/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png and b/native/ios/Comm/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png differ\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[ios] replace splash screen for soft launch Summary: Replace splash screen with background that uses same radial gradient as landing page Here's what it looks like: https://blob.sh/atul/splash.png Test Plan: Looks as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1239
129,187
25.05.2021 15:40:20
14,400
2e92bdf306d60361469ae629a110289a2272e6cf
[server] Don't throw in updateThread if threadType isn't specified Summary: I made a mistake in D1232. We should make sure we don't throw if `threadType` isn't specified. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -348,6 +348,8 @@ async function updateThread(\nif (\n!viewer.isScriptViewer &&\n+ threadType !== null &&\n+ threadType !== undefined &&\nthreadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&\nthreadType !== threadTypes.COMMUNITY_SECRET_SUBTHREAD\n) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Don't throw in updateThread if threadType isn't specified Summary: I made a mistake in D1232. We should make sure we don't throw if `threadType` isn't specified. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1241
129,187
25.05.2021 17:54:43
14,400
ee79883ee5de1a42f7fc2ceac2deafd266a8bd23
[server] Reduce indentation for confirmParentPermissionPromise in updateThread Summary: Separating this from the following diff to make it easier to review. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -462,12 +462,16 @@ async function updateThread(\n}\nconst confirmParentPermissionPromise = (async () => {\n+ if (!nextParentThreadID) {\n+ return;\n+ }\nif (\n- nextParentThreadID &&\n- (nextParentThreadID !== oldParentThreadID ||\n- (nextThreadType === threadTypes.SIDEBAR) !==\n- (oldThreadType === threadTypes.SIDEBAR))\n+ nextParentThreadID === oldParentThreadID &&\n+ (nextThreadType === threadTypes.SIDEBAR) ===\n+ (oldThreadType === threadTypes.SIDEBAR)\n) {\n+ return;\n+ }\nconst hasParentPermission = await checkThreadPermission(\nviewer,\nnextParentThreadID,\n@@ -478,7 +482,6 @@ async function updateThread(\nif (!hasParentPermission) {\nthrow new ServerError('invalid_parameters');\n}\n- }\n})();\nconst rolesNeedUpdate = forceUpdateRoot || nextThreadType !== oldThreadType;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Reduce indentation for confirmParentPermissionPromise in updateThread Summary: Separating this from the following diff to make it easier to review. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1243
129,187
25.05.2021 15:42:46
14,400
09e1c1b14b852747847458b9cf8eb894fe95c536
[server] Add ignorePermissions to UpdateThreadOptions Summary: This is necessary to allow us to call `updateThread` in the context of the soft launch migration script. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -294,6 +294,7 @@ type UpdateThreadOptions = Shape<{|\n+forceAddMembers: boolean,\n+forceUpdateRoot: boolean,\n+silenceMessages: boolean,\n+ +ignorePermissions: boolean,\n|}>;\nasync function updateThread(\n@@ -307,6 +308,8 @@ async function updateThread(\nconst forceAddMembers = options?.forceAddMembers ?? false;\nconst forceUpdateRoot = options?.forceUpdateRoot ?? false;\nconst silenceMessages = options?.silenceMessages ?? false;\n+ const ignorePermissions =\n+ (options?.ignorePermissions && viewer.isScriptViewer) ?? false;\nconst validationPromises = {};\nconst changedFields = {};\n@@ -344,12 +347,12 @@ async function updateThread(\n// secret). We've disabled it for community subthreads because we don't yet\n// have any efficient way of checking if the new parent is in the same\n// community as the old parent.\n- if (parentThreadID !== undefined) {\n+ if (!ignorePermissions && parentThreadID !== undefined) {\nthrow new ServerError('invalid_parameters');\n}\nif (\n- !viewer.isScriptViewer &&\n+ !ignorePermissions &&\nthreadType !== null &&\nthreadType !== undefined &&\nthreadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&\n@@ -371,6 +374,10 @@ async function updateThread(\nSQL`t.id = ${request.threadID}`,\n);\n+ validationPromises.hasNecessaryPermissions = (async () => {\n+ if (ignorePermissions) {\n+ return;\n+ }\nconst checks = [];\nif (\nsqlUpdate.name !== undefined ||\n@@ -394,26 +401,23 @@ async function updateThread(\npermission: threadPermissions.ADD_MEMBERS,\n});\n}\n-\n- validationPromises.hasNecessaryPermissions = checkThread(\n+ const hasNecessaryPermissions = await checkThread(\nviewer,\nrequest.threadID,\nchecks,\n);\n+ if (!hasNecessaryPermissions) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+ })();\n- const { serverThreadInfos, hasNecessaryPermissions } = await promiseAll(\n- validationPromises,\n- );\n+ const { serverThreadInfos } = await promiseAll(validationPromises);\nconst serverThreadInfo = serverThreadInfos.threadInfos[request.threadID];\nif (!serverThreadInfo) {\nthrow new ServerError('internal_error');\n}\n- if (!hasNecessaryPermissions) {\n- throw new ServerError('invalid_credentials');\n- }\n-\n// Threads with source message should be visible to everyone, but we can't\n// guarantee it for COMMUNITY_SECRET_SUBTHREAD threads so we forbid it for\n// now. In the future, if we want to support this, we would need to unlink the\n@@ -462,7 +466,7 @@ async function updateThread(\n}\nconst confirmParentPermissionPromise = (async () => {\n- if (!nextParentThreadID) {\n+ if (ignorePermissions || !nextParentThreadID) {\nreturn;\n}\nif (\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add ignorePermissions to UpdateThreadOptions Summary: This is necessary to allow us to call `updateThread` in the context of the soft launch migration script. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1244
129,187
26.05.2021 00:58:04
14,400
effa74832dd4ad5e0efe5937b359d33a52bb2dfe
[native] Add turbomodulejsijni to targets list for Android build Summary: Android crashes on startup without this Test Plan: Build Android Reviewers: karol-bisztyga, atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -306,7 +306,7 @@ android {\nexternalNativeBuild {\ncmake {\narguments \"-DANDROID_STL=c++_shared\"\n- targets \"comm_jni_module\"\n+ targets \"comm_jni_module\", \"turbomodulejsijni\"\n}\n}\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add turbomodulejsijni to targets list for Android build Summary: Android crashes on startup without this Test Plan: Build Android Reviewers: karol-bisztyga, atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1249
129,187
26.05.2021 03:09:34
14,400
191cb97585f041f124c6be0ac0530f4cb9eb7532
[server] Batch memberships table INSERTS and push notifs rescinds in thread-permission-updaters.js Summary: These were causing MySQL timeouts when they were allowed all at the same time (~150,000 simultaneous queries). Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-permission-updaters.js", "new_path": "server/src/updaters/thread-permission-updaters.js", "diff": "@@ -531,6 +531,8 @@ const defaultSubscriptionString = JSON.stringify({\n});\nconst joinSubscriptionString = JSON.stringify({ home: true, pushNotifs: true });\n+const membershipInsertBatchSize = 50;\n+\nasync function saveMemberships(toSave: $ReadOnlyArray<MembershipRowToSave>) {\nif (toSave.length === 0) {\nreturn;\n@@ -564,10 +566,12 @@ async function saveMemberships(toSave: $ReadOnlyArray<MembershipRowToSave>) {\n// column and this is an INSERT, but we don't want to require people to have\n// to know the current `subscription` when they're just using this function to\n// update the permissions of an existing membership row.\n+ while (insertRows.length > 0) {\n+ const batch = insertRows.splice(0, membershipInsertBatchSize);\nconst query = SQL`\nINSERT INTO memberships (user, thread, role, creation_time, subscription,\npermissions, permissions_for_children, last_message, last_read_message)\n- VALUES ${insertRows}\n+ VALUES ${batch}\nON DUPLICATE KEY UPDATE\nsubscription = IF(\n(role <= 0 AND VALUES(role) > 0)\n@@ -581,6 +585,7 @@ async function saveMemberships(toSave: $ReadOnlyArray<MembershipRowToSave>) {\n`;\nawait dbQuery(query);\n}\n+}\nasync function deleteMemberships(\ntoDelete: $ReadOnlyArray<MembershipRowToDelete>,\n@@ -602,10 +607,12 @@ async function deleteMemberships(\n0,\n]);\n+ while (insertRows.length > 0) {\n+ const batch = insertRows.splice(0, membershipInsertBatchSize);\nconst query = SQL`\nINSERT INTO memberships (user, thread, role, creation_time, subscription,\npermissions, permissions_for_children, last_message, last_read_message)\n- VALUES ${insertRows}\n+ VALUES ${batch}\nON DUPLICATE KEY UPDATE\nrole = -1,\npermissions = NULL,\n@@ -616,6 +623,7 @@ async function deleteMemberships(\n`;\nawait dbQuery(query);\n}\n+}\n// Specify non-empty changedThreadIDs to force updates to be generated for those\n// threads, presumably for reasons not covered in the changeset. calendarQuery\n@@ -662,19 +670,14 @@ async function commitMembershipChangeset(\nconst toSave = [],\ntoDelete = [],\n- rescindPromises = [];\n+ toRescindPushNotifs = [];\nfor (const row of membershipRowMap.values()) {\nif (\nrow.operation === 'delete' ||\n(row.operation === 'save' && Number(row.role) <= 0)\n) {\nconst { userID, threadID } = row;\n- rescindPromises.push(\n- rescindPushNotifs(\n- SQL`n.thread = ${threadID} AND n.user = ${userID}`,\n- SQL`IF(m.thread = ${threadID}, NULL, m.thread)`,\n- ),\n- );\n+ toRescindPushNotifs.push({ userID, threadID });\n}\nif (row.operation === 'delete') {\ntoDelete.push(row);\n@@ -702,7 +705,7 @@ async function commitMembershipChangeset(\nsaveMemberships(toSave),\ndeleteMemberships(toDelete),\nupdateUndirectedRelationships(relationshipRows),\n- ...rescindPromises,\n+ rescindPushNotifsForMemberDeletion(toRescindPushNotifs),\n]);\n// We fetch all threads here because old clients still expect the full list of\n@@ -777,6 +780,24 @@ async function commitMembershipChangeset(\n};\n}\n+const rescindPushNotifsBatchSize = 3;\n+async function rescindPushNotifsForMemberDeletion(\n+ toRescindPushNotifs: $ReadOnlyArray<{| +userID: string, +threadID: string |}>,\n+): Promise<void> {\n+ const queue = [...toRescindPushNotifs];\n+ while (queue.length > 0) {\n+ const batch = queue.splice(0, rescindPushNotifsBatchSize);\n+ await Promise.all(\n+ batch.map(({ userID, threadID }) =>\n+ rescindPushNotifs(\n+ SQL`n.thread = ${threadID} AND n.user = ${userID}`,\n+ SQL`IF(m.thread = ${threadID}, NULL, m.thread)`,\n+ ),\n+ ),\n+ );\n+ }\n+}\n+\nasync function recalculateAllThreadPermissions() {\nconst getAllThreads = SQL`SELECT id, type FROM threads`;\nconst [result] = await dbQuery(getAllThreads);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Batch memberships table INSERTS and push notifs rescinds in thread-permission-updaters.js Summary: These were causing MySQL timeouts when they were allowed all at the same time (~150,000 simultaneous queries). Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1255
129,184
26.05.2021 15:34:22
14,400
5e5f302c83e46526f90a938d72360775f03a706e
[android] replace launcher icon for soft launch Test Plan: looks as expected on android emulator Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "native/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n+ <background android:drawable=\"@color/ic_launcher_background\"/>\n+ <foreground android:drawable=\"@mipmap/ic_launcher_foreground\"/>\n+</adaptive-icon>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png", "new_path": "native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png", "diff": "Binary files a/native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png", "new_path": "native/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png", "diff": "Binary files /dev/null and b/native/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png", "new_path": "native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png", "diff": "Binary files a/native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png", "new_path": "native/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png", "diff": "Binary files /dev/null and b/native/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png", "new_path": "native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png", "diff": "Binary files a/native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png", "new_path": "native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png", "diff": "Binary files /dev/null and b/native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png", "new_path": "native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png", "diff": "Binary files a/native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png", "new_path": "native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png", "diff": "Binary files /dev/null and b/native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png", "new_path": "native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png", "diff": "Binary files a/native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png", "new_path": "native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png", "diff": "Binary files /dev/null and b/native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/android/app/src/main/res/values/ic_launcher_background.xml", "diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<resources>\n+ <color name=\"ic_launcher_background\">#111827</color>\n+</resources>\n\\ No newline at end of file\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[android] replace launcher icon for soft launch Test Plan: looks as expected on android emulator Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1257
129,184
25.05.2021 21:33:04
14,400
c0d3abf65c1dd6585e2b76b61a1b1ef11fb5885b
[native] Add IBM Plex Sans Medium font Summary: Added medium weight of IBM Plex Sans. Modified `logged-out-modal` to keep consistent with wordmark + splash screen. Test Plan: Appears as expected on iOS simulator Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/logged-out-modal.react.js", "new_path": "native/account/logged-out-modal.react.js", "diff": "@@ -763,8 +763,8 @@ const styles = StyleSheet.create({\ncolor: 'white',\nfontFamily: 'IBMPlexSans',\nfontSize: 56,\n- fontWeight: 'bold',\n- lineHeight: 67,\n+ fontWeight: '500',\n+ lineHeight: 66,\ntextAlign: 'center',\n},\nloadingIndicator: {\n" }, { "change_type": "ADD", "old_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Medium.ttf", "new_path": "native/android/app/src/main/assets/fonts/IBMPlexSans-Medium.ttf", "diff": "Binary files /dev/null and b/native/android/app/src/main/assets/fonts/IBMPlexSans-Medium.ttf differ\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm.xcodeproj/project.pbxproj", "new_path": "native/ios/Comm.xcodeproj/project.pbxproj", "diff": "7F8D602326535E060053CB29 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */; };\n7F8D602826535F240053CB29 /* IBMPlexSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */; };\n7F8D602926535F2A0053CB29 /* IBMPlexSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */; };\n+ B71AFF1F265EDD8600B22352 /* IBMPlexSans-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B71AFF1E265EDD8600B22352 /* IBMPlexSans-Medium.ttf */; };\nD7DB6E0F85B2DBE15B01EC21 /* libPods-Comm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 994BEBDD4E4959F69CEA0BC3 /* libPods-Comm.a */; };\n/* End PBXBuildFile section */\n7FCEA2DC2444010B004017B1 /* Comm-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"Comm-Bridging-Header.h\"; sourceTree = \"<group>\"; };\n7FCFD8BD1E81B8DF00629B0E /* Comm.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Comm.entitlements; path = Comm/Comm.entitlements; sourceTree = \"<group>\"; };\n994BEBDD4E4959F69CEA0BC3 /* libPods-Comm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-Comm.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n+ B71AFF1E265EDD8600B22352 /* IBMPlexSans-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = \"IBMPlexSans-Medium.ttf\"; path = \"Resources/IBMPlexSans-Medium.ttf\"; sourceTree = \"<group>\"; };\nC562A7004903539402D988CE /* Pods-Comm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-Comm.release.xcconfig\"; path = \"Target Support Files/Pods-Comm/Pods-Comm.release.xcconfig\"; sourceTree = \"<group>\"; };\nF53DA7B3F26C2798DCE74A94 /* Pods-Comm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-Comm.debug.xcconfig\"; path = \"Target Support Files/Pods-Comm/Pods-Comm.debug.xcconfig\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\nchildren = (\n7F8D601F26535E060053CB29 /* Anaheim-Regular.ttf */,\n7F8D602026535E060053CB29 /* OpenSans-Regular.ttf */,\n+ B71AFF1E265EDD8600B22352 /* IBMPlexSans-Medium.ttf */,\n7F8D601E26535E060053CB29 /* OpenSans-Semibold.ttf */,\n7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */,\n7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */,\n13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */,\n7F8D602226535E060053CB29 /* Anaheim-Regular.ttf in Resources */,\n+ B71AFF1F265EDD8600B22352 /* IBMPlexSans-Medium.ttf in Resources */,\n7F8D602326535E060053CB29 /* OpenSans-Regular.ttf in Resources */,\n);\nrunOnlyForDeploymentPostprocessing = 0;\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.debug.plist", "new_path": "native/ios/Comm/Info.debug.plist", "diff": "<string>SimpleLineIcons.ttf</string>\n<string>Zocial.ttf</string>\n<string>IBMPlexSans-Regular.ttf</string>\n+ <string>IBMPlexSans-Medium.ttf</string>\n<string>IBMPlexSans-Bold.ttf</string>\n</array>\n<key>UIBackgroundModes</key>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Comm/Info.release.plist", "new_path": "native/ios/Comm/Info.release.plist", "diff": "<string>SimpleLineIcons.ttf</string>\n<string>Zocial.ttf</string>\n<string>IBMPlexSans-Regular.ttf</string>\n+ <string>IBMPlexSans-Medium.ttf</string>\n<string>IBMPlexSans-Bold.ttf</string>\n</array>\n<key>UIBackgroundModes</key>\n" }, { "change_type": "ADD", "old_path": "native/ios/Resources/IBMPlexSans-Medium.ttf", "new_path": "native/ios/Resources/IBMPlexSans-Medium.ttf", "diff": "Binary files /dev/null and b/native/ios/Resources/IBMPlexSans-Medium.ttf differ\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add IBM Plex Sans Medium font Summary: Added medium weight of IBM Plex Sans. Modified `logged-out-modal` to keep consistent with wordmark + splash screen. Test Plan: Appears as expected on iOS simulator Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1248
129,184
26.05.2021 20:08:40
14,400
566885a7304640f525e0ac517f4edc5eca61eb0c
[landing] Center landing page Summary: Diff addresses issue from Test Plan: Looks as expected on 28in display Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "landing/landing.css", "new_path": "landing/landing.css", "diff": "@@ -4,7 +4,6 @@ html {\nfont-family: 'IBM Plex Sans', sans-serif;\ncolor: white;\nword-break: break-word;\n- max-width: 1920px;\n}\nh1,\n@@ -37,6 +36,9 @@ p {\n}\ndiv.grid {\n+ max-width: 1920px;\n+ margin-left: auto;\n+ margin-right: auto;\ndisplay: grid;\npadding-top: 20px;\npadding-left: 80px;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[landing] Center landing page Summary: Diff addresses issue from https://www.notion.so/commapp/Landing-page-doesn-t-look-great-on-ultrawide-displays-dcdb7854d1f748cf9bd132e7c2c0e113 Test Plan: Looks as expected on 28in display Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1263
129,187
27.05.2021 10:06:44
14,400
e61161c1a22b3738a2d544c98c97a2e37f9d58a4
[lib] Fix boolean logic in includeThreadPermissionForThreadType Summary: I made a pretty dumb mistake in D1200... This diff should actually resolve [this Notion issue](https://www.notion.so/Cannot-post-in-a-new-thread-3f7f095994e74c74bd37fda8db6d0b67). Test Plan: Make sure it's possible to create a sidebar from a message you sent Reviewers: karol-bisztyga, atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/permissions/prefixes.js", "new_path": "lib/permissions/prefixes.js", "diff": "@@ -53,8 +53,8 @@ function includeThreadPermissionForThreadType(\nthreadType: ThreadType,\n): boolean {\nif (\n- (threadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD ||\n- threadType !== threadTypes.SIDEBAR) &&\n+ threadType !== threadTypes.COMMUNITY_OPEN_SUBTHREAD &&\n+ threadType !== threadTypes.SIDEBAR &&\n(parsed.filterPrefix === threadPermissionFilterPrefixes.OPEN ||\nparsed.filterPrefix === threadPermissionFilterPrefixes.OPEN_TOP_LEVEL)\n) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Fix boolean logic in includeThreadPermissionForThreadType Summary: I made a pretty dumb mistake in D1200... This diff should actually resolve [this Notion issue](https://www.notion.so/Cannot-post-in-a-new-thread-3f7f095994e74c74bd37fda8db6d0b67). Test Plan: Make sure it's possible to create a sidebar from a message you sent Reviewers: karol-bisztyga, atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1267
129,184
27.05.2021 11:22:48
14,400
3acf5b3ffec71e3522ce7de6b7de897b1c0c9a82
[lib] Don't show parent admin in `robotextName` Test Plan: `robotextName` changes as expected following this change Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -543,11 +543,7 @@ function robotextName(\nuserInfos: UserInfos,\n): string {\nconst threadUsernames: string[] = threadInfo.members\n- .filter(\n- (threadMember) =>\n- threadMember.id !== viewerID &&\n- (threadMember.role || memberHasAdminPowers(threadMember)),\n- )\n+ .filter((threadMember) => threadMember.id !== viewerID && threadMember.role)\n.map(\n(threadMember) =>\nuserInfos[threadMember.id] && userInfos[threadMember.id].username,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Don't show parent admin in `robotextName` Test Plan: `robotextName` changes as expected following this change Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1268
129,187
27.05.2021 12:43:27
14,400
94a1bf222c4900a9db4830b1dc96b6f854114d52
[lib] Remove unknown from LifecycleState Summary: It's confusing for this to be included in `LifecycleState`, which is the type of `redux.lifecycleState`. We never actually set `redux.lifecycleState` to `unknown`, so we shouldn't have the type include that value. Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/lifecycle-state-types.js", "new_path": "lib/types/lifecycle-state-types.js", "diff": "// @flow\n-export type LifecycleState = 'active' | 'inactive' | 'background' | 'unknown';\n+export type LifecycleState = 'active' | 'inactive' | 'background';\n" }, { "change_type": "MODIFY", "old_path": "native/lifecycle/lifecycle-handler.react.js", "new_path": "native/lifecycle/lifecycle-handler.react.js", "diff": "@@ -14,7 +14,7 @@ const LifecycleHandler = React.memo<{||}>(() => {\nconst lastStateRef = React.useRef();\nconst onLifecycleChange = React.useCallback(\n- (nextState: ?LifecycleState) => {\n+ (nextState: ?(LifecycleState | 'unknown')) => {\nif (!nextState || nextState === 'unknown') {\nreturn;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Remove unknown from LifecycleState Summary: It's confusing for this to be included in `LifecycleState`, which is the type of `redux.lifecycleState`. We never actually set `redux.lifecycleState` to `unknown`, so we shouldn't have the type include that value. Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1272
129,187
27.05.2021 14:28:58
14,400
8d1799811d9553f94f4ec6779ce8c8d8b7caf201
[native] codeVersion -> 84
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -268,8 +268,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 83\n- versionName \"0.0.83\"\n+ versionCode 84\n+ versionName \"0.0.84\"\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.83</string>\n+ <string>0.0.84</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>83</string>\n+ <string>84</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.83</string>\n+ <string>0.0.84</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>83</string>\n+ <string>84</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": "@@ -232,7 +232,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 83;\n+const codeVersion = 84;\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 -> 84
129,184
27.05.2021 15:50:36
14,400
0cbdb485fa51d21a6df49a148c1622882a77a9d4
[native] Restrict appearance preferences and dev tools to staff Summary: Conditionally display appearance preferences/dev tools with `isStaff` Test Plan: Added/removed test id from staff list and observed whether appearance preferences/dev tools appeared. Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/profile/profile-screen.react.js", "new_path": "native/profile/profile-screen.react.js", "diff": "@@ -20,6 +20,7 @@ import {\n} from 'lib/actions/user-actions';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+import { isStaff } from 'lib/shared/user-utils';\nimport type { LogOutResult } from 'lib/types/account-types';\nimport { type PreRequestUserState } from 'lib/types/session-types';\nimport { type CurrentUserInfo } from 'lib/types/user-types';\n@@ -154,7 +155,12 @@ class ProfileScreen extends React.PureComponent<Props> {\nlink: linkColor,\n} = this.props.colors;\n- const appearancePreferences = (\n+ let appearancePreferences, developerTools;\n+ if (\n+ (this.props.currentUserInfo && isStaff(this.props.currentUserInfo.id)) ||\n+ __DEV__\n+ ) {\n+ appearancePreferences = (\n<>\n<Text style={this.props.styles.header}>PREFERENCES</Text>\n<View style={this.props.styles.slightlyPaddedSection}>\n@@ -170,6 +176,18 @@ class ProfileScreen extends React.PureComponent<Props> {\n</View>\n</>\n);\n+ developerTools = (\n+ <Button\n+ onPress={this.onPressDevTools}\n+ style={this.props.styles.submenuButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={underlay}\n+ >\n+ <Text style={this.props.styles.submenuText}>Developer tools</Text>\n+ <Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n+ </Button>\n+ );\n+ }\nreturn (\n<View style={this.props.styles.container}>\n@@ -247,8 +265,7 @@ class ProfileScreen extends React.PureComponent<Props> {\n</Button>\n</View>\n- {/* revert the conditional rendering of `appearancePreferences` to re-enable theming */}\n- {__DEV__ ? appearancePreferences : null}\n+ {appearancePreferences}\n<View style={this.props.styles.slightlyPaddedSection}>\n<Button\n@@ -260,15 +277,7 @@ class ProfileScreen extends React.PureComponent<Props> {\n<Text style={this.props.styles.submenuText}>Build info</Text>\n<Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n</Button>\n- <Button\n- onPress={this.onPressDevTools}\n- style={this.props.styles.submenuButton}\n- iosFormat=\"highlight\"\n- iosHighlightUnderlayColor={underlay}\n- >\n- <Text style={this.props.styles.submenuText}>Developer tools</Text>\n- <Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n- </Button>\n+ {developerTools}\n</View>\n<View style={this.props.styles.unpaddedSection}>\n<Button\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Restrict appearance preferences and dev tools to staff Summary: Conditionally display appearance preferences/dev tools with `isStaff` Test Plan: Added/removed test id from staff list and observed whether appearance preferences/dev tools appeared. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1278
129,187
27.05.2021 16:34:46
14,400
31ebfe12c58213bcb4758773bdfcc6ddd74af590
[server] Flip final condition in getRolePermissionBlobs Summary: Putting this in a separate diff to make review easier. Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -235,10 +235,7 @@ function getRolePermissionBlobs(threadType: ThreadType): RolePermissionBlobs {\n};\n}\n- if (threadType === threadTypes.COMMUNITY_ROOT) {\n- return getRolePermissionBlobsForCommunity();\n- }\n-\n+ if (threadType === threadTypes.COMMUNITY_SECRET_SUBTHREAD) {\nconst openTopLevelDescendantJoinThread =\nOPEN_TOP_LEVEL_DESCENDANT + threadPermissions.JOIN_THREAD;\nconst memberPermissions = {\n@@ -264,4 +261,7 @@ function getRolePermissionBlobs(threadType: ThreadType): RolePermissionBlobs {\n};\n}\n+ return getRolePermissionBlobsForCommunity();\n+}\n+\nexport { createInitialRolesForNewThread, getRolePermissionBlobs };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Flip final condition in getRolePermissionBlobs Summary: Putting this in a separate diff to make review easier. Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1279
129,187
27.05.2021 17:45:22
14,400
53ba155c630941151ffbbcedca9787e50cf1cdcb
[native] Clear thread search text when cancel button pressed Test Plan: Make sure it clears Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list.react.js", "new_path": "native/chat/chat-thread-list.react.js", "diff": "@@ -229,6 +229,11 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nthis.setState({ searchStatus: 'inactive' });\n};\n+ onSearchCancel = () => {\n+ this.onChangeSearchText('');\n+ this.onSearchBlur();\n+ };\n+\nrenderSearch(additionalProps?: $Shape<React.ElementConfig<typeof Search>>) {\nconst searchBoxStyle = [\nthis.props.styles.searchBox,\n@@ -241,7 +246,7 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nreturn (\n<View style={this.props.styles.searchContainer}>\n<Button\n- onPress={this.onSearchBlur}\n+ onPress={this.onSearchCancel}\ndisabled={this.state.searchStatus !== 'active'}\nstyle={this.props.styles.cancelSearchButton}\n>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Clear thread search text when cancel button pressed Test Plan: Make sure it clears Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1282
129,187
27.05.2021 21:01:38
14,400
8d9b9c420d37add15fcc990e46c34f392120089a
[server] Convert second param of dbQuery to options blob Summary: Going to add another parameter and I thought it would be cleaner this way. Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/database/database.js", "new_path": "server/src/database/database.js", "diff": "@@ -76,7 +76,11 @@ function FakeSQLResult() {\nFakeSQLResult.prototype = Array.prototype;\nconst fakeResult: any = new FakeSQLResult();\n-async function dbQuery(statement: SQLStatement, triesLeft?: number = 2) {\n+type QueryOptions = {|\n+ +triesLeft?: number,\n+|};\n+async function dbQuery(statement: SQLStatement, options?: QueryOptions) {\n+ const triesLeft = options?.triesLeft ?? 2;\nconst connectionPool = getPool();\nconst timeoutID = setTimeout(\n() => databaseMonitor.reportLaggingQuery(statement.sql),\n@@ -99,7 +103,7 @@ async function dbQuery(statement: SQLStatement, triesLeft?: number = 2) {\n} catch (e) {\nif (e.errno === 1213 && triesLeft > 0) {\nconsole.log('deadlock occurred, trying again', e);\n- return await dbQuery(statement, triesLeft - 1);\n+ return await dbQuery(statement, { ...options, triesLeft: triesLeft - 1 });\n}\ne.query = statement.sql;\nthrow e;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Convert second param of dbQuery to options blob Summary: Going to add another parameter and I thought it would be cleaner this way. Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1285
129,187
27.05.2021 21:04:00
14,400
d814c1d53f8f5e5b87cf99b8d5349f727c91cd38
[server] Add multipleStatements support to dbQuery Summary: I need this for an upcoming diff Test Plan: Tested in combination with following diff Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/database/database.js", "new_path": "server/src/database/database.js", "diff": "@@ -78,10 +78,20 @@ const fakeResult: any = new FakeSQLResult();\ntype QueryOptions = {|\n+triesLeft?: number,\n+ +multipleStatements?: boolean,\n|};\nasync function dbQuery(statement: SQLStatement, options?: QueryOptions) {\nconst triesLeft = options?.triesLeft ?? 2;\n- const connectionPool = getPool();\n+ const multipleStatements = options?.multipleStatements ?? false;\n+\n+ let connection;\n+ if (multipleStatements) {\n+ connection = await getMultipleStatementsConnection();\n+ }\n+ if (!connection) {\n+ connection = getPool();\n+ }\n+\nconst timeoutID = setTimeout(\n() => databaseMonitor.reportLaggingQuery(statement.sql),\nqueryWarnTime,\n@@ -99,7 +109,7 @@ async function dbQuery(statement: SQLStatement, options?: QueryOptions) {\nconsole.log(rawSQL(statement));\nreturn [fakeResult];\n}\n- return await connectionPool.query(statement);\n+ return await connection.query(statement);\n} catch (e) {\nif (e.errno === 1213 && triesLeft > 0) {\nconsole.log('deadlock occurred, trying again', e);\n@@ -109,6 +119,9 @@ async function dbQuery(statement: SQLStatement, options?: QueryOptions) {\nthrow e;\n} finally {\nclearTimeout(timeoutID);\n+ if (multipleStatements) {\n+ connection.end();\n+ }\n}\n}\n@@ -116,6 +129,13 @@ function rawSQL(statement: SQLStatement) {\nreturn mysql.format(statement.sql, statement.values);\n}\n+async function getMultipleStatementsConnection() {\n+ return await mysqlPromise.createConnection({\n+ ...dbConfig,\n+ multipleStatements: true,\n+ });\n+}\n+\nexport {\ngetPool,\nSQL,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add multipleStatements support to dbQuery Summary: I need this for an upcoming diff Test Plan: Tested in combination with following diff Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1287
129,187
27.05.2021 21:13:23
14,400
4c71d9edeb5f626890f3bc9c890d89d1afeeacf1
[server] Add all new users to Genesis in createAccount Summary: This is necessary so that they have the right permissions Test Plan: Make sure account registration no longer errors Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/account-creator.js", "new_path": "server/src/creators/account-creator.js", "diff": "@@ -5,6 +5,7 @@ import bcrypt from 'twin-bcrypt';\nimport ashoat from 'lib/facts/ashoat';\nimport bots from 'lib/facts/bots';\n+import genesis from 'lib/facts/genesis';\nimport {\nvalidUsernameRegex,\noldValidUsernameRegex,\n@@ -27,7 +28,9 @@ import { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport { fetchKnownUserInfos } from '../fetchers/user-fetchers';\nimport { verifyCalendarQueryThreadIDs } from '../responders/entry-responders';\nimport { createNewUserCookie, setNewSession } from '../session/cookies';\n+import { createScriptViewer } from '../session/scripts';\nimport type { Viewer } from '../session/viewer';\n+import { updateThread } from '../updaters/thread-updaters';\nimport createIDs from './id-creator';\nimport createMessages from './message-creator';\nimport {\n@@ -116,6 +119,15 @@ async function createAccount(\nawait setNewSession(viewer, calendarQuery, 0);\n}\n+ await updateThread(\n+ createScriptViewer(ashoat.id),\n+ {\n+ threadID: genesis.id,\n+ changes: { newMemberIDs: [id] },\n+ },\n+ { forceAddMembers: true, silenceMessages: true, ignorePermissions: true },\n+ );\n+\nconst [privateThreadResult, ashoatThreadResult] = await Promise.all([\ncreatePrivateThread(viewer, request.username),\ncreateThread(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add all new users to Genesis in createAccount Summary: This is necessary so that they have the right permissions Test Plan: Make sure account registration no longer errors Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1291
129,187
28.05.2021 12:17:03
14,400
349c2fb28a3fc7778b1cb05f3b71a071601b30d3
[native] Use getSingleOtherUser in RelationshipPrompt Summary: Best to have a single utility that we use everywhere. Identified this while investigating [this Notion issue](https://www.notion.so/commapp/Invalid-friend-request-123d5fe61edf42e39ad5e6563d99caee) Test Plan: Flow, also tested in combination with the next diff Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/relationship-prompt.react.js", "new_path": "native/chat/relationship-prompt.react.js", "diff": "@@ -9,6 +9,7 @@ import {\nupdateRelationships as serverUpdateRelationships,\nupdateRelationshipsActionTypes,\n} from 'lib/actions/relationship-actions';\n+import { getSingleOtherUser } from 'lib/shared/thread-utils';\nimport type { RelationshipAction } from 'lib/types/relationship-types';\nimport {\nrelationshipActions,\n@@ -38,13 +39,9 @@ export default React.memo<Props>(function RelationshipPrompt({\n// relationship status. Additionally, member info does not contain info\n// about relationship.\nconst otherUserInfo = useSelector((state) => {\n- const currentUserID = state.currentUserInfo?.id;\nconst otherUserID =\n- threadInfo.members\n- .map((member) => member.id)\n- .find((id) => id !== currentUserID) ??\n+ getSingleOtherUser(threadInfo, state.currentUserInfo?.id) ??\npendingPersonalThreadUserInfo?.id;\n-\nconst { userInfos } = state.userStore;\nreturn otherUserID && userInfos[otherUserID]\n? userInfos[otherUserID]\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use getSingleOtherUser in RelationshipPrompt Summary: Best to have a single utility that we use everywhere. Identified this while investigating [this Notion issue](https://www.notion.so/commapp/Invalid-friend-request-123d5fe61edf42e39ad5e6563d99caee) Test Plan: Flow, also tested in combination with the next diff Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1292
129,187
28.05.2021 12:32:47
14,400
94dec1b7a2cc8ed725505688ff8ecc6d62e7775b
[native] codeVersion -> 85
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -268,8 +268,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 84\n- versionName \"0.0.84\"\n+ versionCode 85\n+ versionName \"0.0.85\"\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.84</string>\n+ <string>0.0.85</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>84</string>\n+ <string>85</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.84</string>\n+ <string>0.0.85</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>84</string>\n+ <string>85</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": "@@ -232,7 +232,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 84;\n+const codeVersion = 85;\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 -> 85
129,187
28.05.2021 12:30:15
14,400
c1abdc054fc96dae84fc6c328cdef26fc9d4010f
[server] Further push back the launch of some features Summary: Similar to D1276. Realized I'll need to make another release... Test Plan: Flow Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -280,7 +280,7 @@ async function createThread(\nlet joinRequest = {\nthreadID: existingThreadID,\n};\n- if (hasMinCodeVersion(viewer.platformDetails, 85)) {\n+ if (hasMinCodeVersion(viewer.platformDetails, 86)) {\ninvariant(request.calendarQuery, 'calendar query should exist');\nconst calendarQuery = {\n...request.calendarQuery,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -117,7 +117,7 @@ function rawThreadInfosFromServerThreadInfos(\n): FetchThreadInfosResult {\nconst viewerID = viewer.id;\nconst hasCodeVersionBelow70 = !hasMinCodeVersion(viewer.platformDetails, 70);\n- const hasCodeVersionBelow85 = !hasMinCodeVersion(viewer.platformDetails, 85);\n+ const hasCodeVersionBelow86 = !hasMinCodeVersion(viewer.platformDetails, 86);\nconst threadInfos = {};\nfor (const threadID in serverResult.threadInfos) {\nconst serverThreadInfo = serverResult.threadInfos[threadID];\n@@ -127,7 +127,7 @@ function rawThreadInfosFromServerThreadInfos(\n{\nincludeVisibilityRules: hasCodeVersionBelow70,\nfilterMemberList: hasCodeVersionBelow70,\n- shimThreadTypes: hasCodeVersionBelow85 ? shimCommunityRoot : null,\n+ shimThreadTypes: hasCodeVersionBelow86 ? shimCommunityRoot : null,\n},\n);\nif (threadInfo) {\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -683,7 +683,7 @@ async function joinThread(\n}\n// TODO: determine code version\n- const hasCodeVersionBelow85 = !hasMinCodeVersion(viewer.platformDetails, 85);\n+ const hasCodeVersionBelow86 = !hasMinCodeVersion(viewer.platformDetails, 86);\nconst hasCodeVersionBelow62 = !hasMinCodeVersion(viewer.platformDetails, 62);\nconst { calendarQuery } = request;\n@@ -696,7 +696,7 @@ async function joinThread(\nnewUpdates: [],\n},\n};\n- if (calendarQuery && hasCodeVersionBelow85) {\n+ if (calendarQuery && hasCodeVersionBelow86) {\nresponse.rawEntryInfos = [];\n}\nif (hasCodeVersionBelow62) {\n@@ -737,7 +737,7 @@ async function joinThread(\nthreadCursors: { [request.threadID]: false },\n};\n- if (!hasCodeVersionBelow85) {\n+ if (!hasCodeVersionBelow86) {\nreturn {\nrawMessageInfos: newMessages,\ntruncationStatuses: {},\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Further push back the launch of some features Summary: Similar to D1276. Realized I'll need to make another release... Test Plan: Flow Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1294
129,184
28.05.2021 14:28:57
14,400
9536d51461be0403acb8ec05cb0340781aaff060
[native] OS-specific `fontFamily` Test Plan: Did a clean build on iOS (Product > Clean Build Folder) and Android (https://www.notion.so/commapp/Android-debugging-stuff-9a0da814517b4178a76588e8b278f324) and things appear as expected: Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/logged-out-modal.react.js", "new_path": "native/account/logged-out-modal.react.js", "diff": "@@ -761,7 +761,7 @@ const styles = StyleSheet.create({\n},\nheader: {\ncolor: 'white',\n- fontFamily: 'IBMPlexSans',\n+ fontFamily: Platform.OS === 'ios' ? 'IBMPlexSans' : 'IBMPlexSans-Medium',\nfontSize: 56,\nfontWeight: '500',\nlineHeight: 66,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] OS-specific `fontFamily` Test Plan: Did a clean build on iOS (Product > Clean Build Folder) and Android (https://www.notion.so/commapp/Android-debugging-stuff-9a0da814517b4178a76588e8b278f324) and things appear as expected: https://blob.sh/atul/0b40.png Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1295
129,187
28.05.2021 16:02:36
14,400
47dc9853e6cefb7956e3d4f09c5265e610fb3399
[server] Get rid of eslint-disable no-irregular-whitespace Test Plan: N/A Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/add-indexes-for-account-deletion.js", "new_path": "server/src/scripts/add-indexes-for-account-deletion.js", "diff": "@@ -4,13 +4,11 @@ import { dbQuery, SQL } from '../database/database';\nimport { main } from './utils';\nasync function addIndexes() {\n- /* eslint-disable no-irregular-whitespace */\nawait dbQuery(SQL`\nALTER TABLE memberships ADD INDEX user (user);\nALTER TABLE notifications ADD INDEX user (user);\nALTER TABLE relationships_directed ADD UNIQUE user2_user1 (user2, user1);\n`);\n- /* eslint-enable no-irregular-whitespace */\n}\nmain([addIndexes]);\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "@@ -33,7 +33,6 @@ async function main() {\n}\nasync function createTables() {\n- /* eslint-disable no-irregular-whitespace */\nawait dbQuery(SQL`\nCREATE TABLE cookies (\nid bigint(20) NOT NULL,\n@@ -316,7 +315,6 @@ async function createTables() {\nALTER TABLE ids\nMODIFY id bigint(20) NOT NULL AUTO_INCREMENT;\n`);\n- /* eslint-enable no-irregular-whitespace */\n}\nasync function createUsers() {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Get rid of eslint-disable no-irregular-whitespace Test Plan: N/A Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1296
129,187
28.05.2021 17:33:42
14,400
7c612fdab83ad0d59fd33010002094f508df50c3
[server] Script to add containing_thread_id column Summary: Also adds indices for both `parent_thread_id` and the new `containing_thread_id`. Test Plan: Run the script Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "server/src/scripts/add-containing-thread-id-column.js", "diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database/database';\n+import { main } from './utils';\n+\n+async function addColumnAndIndexes() {\n+ await dbQuery(SQL`\n+ ALTER TABLE threads\n+ ADD containing_thread_id BIGINT(20) NULL AFTER parent_thread_id,\n+ ADD INDEX parent_thread_id (parent_thread_id),\n+ ADD INDEX containing_thread_id (containing_thread_id);\n+ `);\n+}\n+\n+main([addColumnAndIndexes]);\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "@@ -151,6 +151,7 @@ async function createTables() {\nname varchar(191) COLLATE utf8mb4_bin DEFAULT NULL,\ndescription mediumtext COLLATE utf8mb4_bin,\nparent_thread_id bigint(20) DEFAULT NULL,\n+ containing_thread_id bigint(20) DEFAULT NULL,\ndefault_role bigint(20) NOT NULL,\ncreator bigint(20) NOT NULL,\ncreation_time bigint(20) NOT NULL,\n@@ -280,7 +281,9 @@ async function createTables() {\nADD KEY user (user);\nALTER TABLE threads\n- ADD PRIMARY KEY (id);\n+ ADD PRIMARY KEY (id),\n+ ADD INDEX parent_thread_id (parent_thread_id),\n+ ADD INDEX containing_thread_id (containing_thread_id);\nALTER TABLE updates\nADD PRIMARY KEY (id),\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Script to add containing_thread_id column Summary: Also adds indices for both `parent_thread_id` and the new `containing_thread_id`. Test Plan: Run the script Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1297
129,187
28.05.2021 17:34:43
14,400
c54059719e0857635ff0a04396c6ff2200411fa4
[server] Add containingThreadID to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -212,6 +212,7 @@ export type ServerThreadInfo = {|\n+color: string, // hex, without \"#\" or \"0x\"\n+creationTime: number, // millisecond timestamp\n+parentThreadID: ?string,\n+ +containingThreadID: ?string,\n+members: $ReadOnlyArray<ServerMemberInfo>,\n+roles: { [id: string]: RoleInfo },\n+sourceMessageID?: string,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -22,10 +22,10 @@ async function fetchServerThreadInfos(\nconst whereClause = condition ? SQL`WHERE `.append(condition) : '';\nconst query = SQL`\n- SELECT t.id, t.name, t.parent_thread_id, t.color, t.description,\n- t.type, t.creation_time, t.default_role, t.source_message, t.replies_count,\n- r.id AS role, r.name AS role_name, r.permissions AS role_permissions,\n- m.user, m.permissions, m.subscription,\n+ SELECT t.id, t.name, t.parent_thread_id, t.containing_thread_id, t.color,\n+ t.description, t.type, t.creation_time, t.default_role, t.source_message,\n+ t.replies_count, r.id AS role, r.name AS role_name,\n+ r.permissions AS role_permissions, m.user, m.permissions, m.subscription,\nm.last_read_message < m.last_message AS unread, m.sender\nFROM threads t\nLEFT JOIN (\n@@ -52,6 +52,9 @@ async function fetchServerThreadInfos(\ndescription: row.description ? row.description : '',\ncolor: row.color,\ncreationTime: row.creation_time,\n+ containingThreadID: row.containing_thread_id\n+ ? row.containing_thread_id.toString()\n+ : null,\nparentThreadID: row.parent_thread_id\n? row.parent_thread_id.toString()\n: null,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add containingThreadID to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1298
129,187
28.05.2021 17:45:08
14,400
592dc67169e97d3392f7c505ad16239f7f380ead
[server] Set containingThreadID in createThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -25,6 +25,7 @@ import { firstLine } from 'lib/utils/string-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport { fetchMessageInfoByID } from '../fetchers/message-fetchers';\n+import { determineContainingThreadID } from '../fetchers/thread-fetchers';\nimport {\ncheckThreadPermission,\nvalidateCandidateMembers,\n@@ -142,6 +143,11 @@ async function createThread(\nparentThreadID = genesis.id;\n}\n+ const containingThreadIDPromise = determineContainingThreadID(\n+ parentThreadID,\n+ threadType,\n+ );\n+\nconst validateMembersPromise = (async () => {\nconst defaultRolePermissions = getRolePermissionBlobs(threadType).Members;\nconst { initialMemberIDs, ghostMemberIDs } = await validateCandidateMembers(\n@@ -171,12 +177,14 @@ async function createThread(\nconst checkPromises = {};\ncheckPromises.confirmParentPermission = confirmParentPermissionPromise;\n+ checkPromises.containingThreadID = containingThreadIDPromise;\ncheckPromises.validateMembers = validateMembersPromise;\nif (sourceMessageID) {\ncheckPromises.sourceMessage = fetchMessageInfoByID(viewer, sourceMessageID);\n}\nconst {\nsourceMessage,\n+ containingThreadID,\nvalidateMembers: { initialMemberIDs, ghostMemberIDs },\n} = await promiseAll(checkPromises);\n@@ -210,6 +218,7 @@ async function createThread(\ntime,\ncolor,\nparentThreadID,\n+ containingThreadID,\nnewRoles.default.id,\nsourceMessageID,\n];\n@@ -242,8 +251,9 @@ async function createThread(\nif (existingThreadQuery) {\nconst query = SQL`\n- INSERT INTO threads(id, type, name, description, creator,\n- creation_time, color, parent_thread_id, default_role, source_message)\n+ INSERT INTO threads(id, type, name, description, creator, creation_time,\n+ color, parent_thread_id, containing_thread_id, default_role,\n+ source_message)\nSELECT ${row}\nWHERE NOT EXISTS (`;\nquery.append(existingThreadQuery).append(SQL`)`);\n@@ -308,8 +318,9 @@ async function createThread(\n}\n} else {\nconst query = SQL`\n- INSERT INTO threads(id, type, name, description, creator,\n- creation_time, color, parent_thread_id, default_role, source_message)\n+ INSERT INTO threads(id, type, name, description, creator, creation_time,\n+ color, parent_thread_id, containing_thread_id, default_role,\n+ source_message)\nVALUES ${[row]}\n`;\nawait dbQuery(query);\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -5,9 +5,11 @@ import { rawThreadInfoFromServerThreadInfo } from 'lib/shared/thread-utils';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\nimport {\nthreadTypes,\n+ type ThreadType,\ntype RawThreadInfo,\ntype ServerThreadInfo,\n} from 'lib/types/thread-types';\n+import { ServerError } from 'lib/utils/errors';\nimport { dbQuery, SQL, SQLStatement } from '../database/database';\nimport type { Viewer } from '../session/viewer';\n@@ -162,10 +164,34 @@ async function verifyThreadID(threadID: string): Promise<boolean> {\nreturn result.length !== 0;\n}\n+async function determineContainingThreadID(\n+ parentThreadID: ?string,\n+ threadType: ThreadType,\n+): Promise<?string> {\n+ if (!parentThreadID) {\n+ return null;\n+ }\n+ if (threadType === threadTypes.SIDEBAR) {\n+ return parentThreadID;\n+ }\n+ const parentThreadInfos = await fetchServerThreadInfos(\n+ SQL`t.id = ${parentThreadID}`,\n+ );\n+ const parentThreadInfo = parentThreadInfos.threadInfos[parentThreadID];\n+ if (!parentThreadInfo) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ if (!parentThreadInfo.containingThreadID) {\n+ return parentThreadID;\n+ }\n+ return parentThreadInfo.containingThreadID;\n+}\n+\nexport {\nfetchServerThreadInfos,\nfetchThreadInfos,\nrawThreadInfosFromServerThreadInfos,\nverifyThreadIDs,\nverifyThreadID,\n+ determineContainingThreadID,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Set containingThreadID in createThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1299
129,187
28.05.2021 17:50:16
14,400
cd3a384b1ff905c68147125731e217333e38815c
[server] Update containingThreadID in updateThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -36,6 +36,7 @@ import { fetchMessageInfos } from '../fetchers/message-fetchers';\nimport {\nfetchThreadInfos,\nfetchServerThreadInfos,\n+ determineContainingThreadID,\n} from '../fetchers/thread-fetchers';\nimport {\ncheckThreadPermission,\n@@ -443,6 +444,7 @@ async function updateThread(\nconst oldThreadType = serverThreadInfo.type;\nconst oldParentThreadID = serverThreadInfo.parentThreadID;\n+ const oldContainingThreadID = serverThreadInfo.containingThreadID;\nconst nextThreadType =\nthreadType !== null && threadType !== undefined\n@@ -472,6 +474,11 @@ async function updateThread(\nthrow new ServerError('no_parent_thread_specified');\n}\n+ const containingThreadIDPromise = determineContainingThreadID(\n+ nextParentThreadID,\n+ nextThreadType,\n+ );\n+\nconst confirmParentPermissionPromise = (async () => {\nif (ignorePermissions || !nextParentThreadID) {\nreturn;\n@@ -537,10 +544,14 @@ async function updateThread(\n}\n})();\n- await Promise.all([\n+ const { nextContainingThreadID } = await promiseAll({\n+ nextContainingThreadID: containingThreadIDPromise,\nconfirmParentPermissionPromise,\nvalidateNewMembersPromise,\n- ]);\n+ });\n+ if (nextContainingThreadID !== oldContainingThreadID) {\n+ sqlUpdate.containing_thread_id = nextContainingThreadID;\n+ }\nconst updateQueryPromise = (async () => {\nif (Object.keys(sqlUpdate).length === 0) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Update containingThreadID in updateThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1300
129,187
28.05.2021 18:40:39
14,400
c54f727b07137e30f4f19d6196de4dca9ac75d52
[server] Update containing_thread_id to set values for new column Test Plan: Run the script Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/add-containing-thread-id-column.js", "new_path": "server/src/scripts/add-containing-thread-id-column.js", "diff": "// @flow\n+import invariant from 'invariant';\n+\n+import { threadTypes, type ServerThreadInfo } from 'lib/types/thread-types';\n+\nimport { dbQuery, SQL } from '../database/database';\n+import { fetchServerThreadInfos } from '../fetchers/thread-fetchers';\nimport { main } from './utils';\nasync function addColumnAndIndexes() {\n@@ -12,4 +17,70 @@ async function addColumnAndIndexes() {\n`);\n}\n-main([addColumnAndIndexes]);\n+async function setColumn() {\n+ const stack = [[null, SQL`t.parent_thread_id IS NULL`]];\n+\n+ while (stack.length > 0) {\n+ const [parentThreadInfo, predicate] = stack.shift();\n+ const { threadInfos } = await fetchServerThreadInfos(predicate);\n+ const updatedThreadInfos = await setColumnForLayer(\n+ parentThreadInfo,\n+ threadInfos,\n+ );\n+ for (const threadInfo of updatedThreadInfos) {\n+ stack.push([threadInfo, SQL`t.parent_thread_id = ${threadInfo.id}`]);\n+ }\n+ }\n+}\n+\n+async function setColumnForLayer(\n+ parentThreadInfo: ?ServerThreadInfo,\n+ threadInfos: { [id: string]: ServerThreadInfo },\n+): Promise<ServerThreadInfo[]> {\n+ const updatedThreadInfos = [];\n+ for (const threadID in threadInfos) {\n+ const threadInfo = threadInfos[threadID];\n+ const containingThreadID = getContainingThread(\n+ threadInfo,\n+ parentThreadInfo,\n+ );\n+ if (!containingThreadID) {\n+ console.log(`containingThreadID is null for ${threadID}, skipping...`);\n+ updatedThreadInfos.push(threadInfo);\n+ continue;\n+ }\n+ console.log(\n+ `setting containingThreadID to ${containingThreadID} for ${threadID}`,\n+ );\n+ await dbQuery(SQL`\n+ UPDATE threads\n+ SET containing_thread_id = ${containingThreadID}\n+ WHERE id = ${threadID}\n+ `);\n+ updatedThreadInfos.push({\n+ ...threadInfo,\n+ containingThreadID,\n+ });\n+ }\n+ return updatedThreadInfos;\n+}\n+\n+function getContainingThread(\n+ threadInfo: ServerThreadInfo,\n+ parentThreadInfo: ?ServerThreadInfo,\n+) {\n+ const { type, parentThreadID } = threadInfo;\n+ if (!parentThreadID) {\n+ return null;\n+ }\n+ if (type === threadTypes.SIDEBAR) {\n+ return parentThreadID;\n+ }\n+ invariant(parentThreadInfo, 'parentThreadInfo should be set');\n+ if (!parentThreadInfo.containingThreadID) {\n+ return parentThreadID;\n+ }\n+ return parentThreadInfo.containingThreadID;\n+}\n+\n+main([addColumnAndIndexes, setColumn]);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Update containing_thread_id to set values for new column Test Plan: Run the script Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1301
129,187
28.05.2021 17:13:37
14,400
6b614e170a7b997cc5b9222dbeddef368ff33dfb
[server] Change parameter format of updateDescendantPermissions Summary: This is in preparation for adding a second property to `AncestorChanges`. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-permission-updaters.js", "new_path": "server/src/updaters/thread-permission-updaters.js", "diff": "@@ -210,7 +210,9 @@ async function changeRole(\n}\nif (!_isEqual(permissionsForChildren)(oldPermissionsForChildren)) {\n- toUpdateDescendants.set(userID, permissionsForChildren);\n+ toUpdateDescendants.set(userID, {\n+ permissionsFromParent: permissionsForChildren,\n+ });\n}\n}\n@@ -218,7 +220,10 @@ async function changeRole(\nconst {\nmembershipRows: descendantMembershipRows,\nrelationshipChangeset: descendantRelationshipChangeset,\n- } = await updateDescendantPermissions(threadID, toUpdateDescendants);\n+ } = await updateDescendantPermissions({\n+ threadID,\n+ changesByUser: toUpdateDescendants,\n+ });\npushAll(membershipRows, descendantMembershipRows);\nrelationshipChangeset.addAll(descendantRelationshipChangeset);\n}\n@@ -296,15 +301,22 @@ async function changeRoleThreadQuery(\n}\n}\n+type ChangedAncestor = {|\n+ +threadID: string,\n+ +changesByUser: Map<string, AncestorChanges>,\n+|};\n+type AncestorChanges = {|\n+ +permissionsFromParent: ?ThreadPermissionsBlob,\n+|};\n+\nasync function updateDescendantPermissions(\n- initialParentThreadID: string,\n- initialUsersToPermissionsFromParent: Map<string, ?ThreadPermissionsBlob>,\n+ initialChangedAncestor: ChangedAncestor,\n): Promise<Changeset> {\n- const stack = [[initialParentThreadID, initialUsersToPermissionsFromParent]];\n+ const stack = [initialChangedAncestor];\nconst membershipRows = [];\nconst relationshipChangeset = new RelationshipChangeset();\nwhile (stack.length > 0) {\n- const [parentThreadID, usersToPermissionsFromParent] = stack.shift();\n+ const { threadID, changesByUser } = stack.shift();\nconst query = SQL`\nSELECT t.id, m.user, t.type,\n@@ -313,15 +325,15 @@ async function updateDescendantPermissions(\nFROM threads t\nLEFT JOIN memberships m ON m.thread = t.id\nLEFT JOIN roles r ON r.id = m.role\n- WHERE t.parent_thread_id = ${parentThreadID}\n+ WHERE t.parent_thread_id = ${threadID}\n`;\nconst [result] = await dbQuery(query);\nconst childThreadInfos = new Map();\nfor (const row of result) {\n- const threadID = row.id.toString();\n- if (!childThreadInfos.has(threadID)) {\n- childThreadInfos.set(threadID, {\n+ const childThreadID = row.id.toString();\n+ if (!childThreadInfos.has(childThreadID)) {\n+ childThreadInfos.set(childThreadID, {\nthreadType: assertThreadType(row.type),\nuserInfos: new Map(),\n});\n@@ -329,8 +341,8 @@ async function updateDescendantPermissions(\nif (!row.user) {\ncontinue;\n}\n- const childThreadInfo = childThreadInfos.get(threadID);\n- invariant(childThreadInfo, `value should exist for key ${threadID}`);\n+ const childThreadInfo = childThreadInfos.get(childThreadID);\n+ invariant(childThreadInfo, `value should exist for key ${childThreadID}`);\nconst userID = row.user.toString();\nchildThreadInfo.userInfos.set(userID, {\nrole: row.role.toString(),\n@@ -340,15 +352,14 @@ async function updateDescendantPermissions(\n});\n}\n- for (const [threadID, childThreadInfo] of childThreadInfos) {\n+ for (const [childThreadID, childThreadInfo] of childThreadInfos) {\nconst userInfos = childThreadInfo.userInfos;\nconst existingMemberIDs = [...userInfos.keys()];\nrelationshipChangeset.setAllRelationshipsExist(existingMemberIDs);\nconst usersForNextLayer = new Map();\n- for (const [\n- userID,\n- permissionsFromParent,\n- ] of usersToPermissionsFromParent) {\n+ for (const [userID, ancestorChanges] of changesByUser) {\n+ const { permissionsFromParent } = ancestorChanges;\n+\nconst userInfo = userInfos.get(userID);\nconst role =\nuserInfo && Number(userInfo.role) > 0 ? userInfo.role : '0';\n@@ -361,7 +372,7 @@ async function updateDescendantPermissions(\nconst permissions = makePermissionsBlob(\nrolePermissions,\npermissionsFromParent,\n- threadID,\n+ childThreadID,\nchildThreadInfo.threadType,\n);\nif (_isEqual(permissions)(oldPermissions)) {\n@@ -378,7 +389,7 @@ async function updateDescendantPermissions(\noperation: 'save',\nintent: 'none',\nuserID,\n- threadID,\n+ threadID: childThreadID,\nuserNeedsFullThreadDetails: false,\npermissions,\npermissionsForChildren,\n@@ -390,7 +401,7 @@ async function updateDescendantPermissions(\noperation: 'delete',\nintent: 'none',\nuserID,\n- threadID,\n+ threadID: childThreadID,\noldRole: userInfo?.role ?? '-1',\n});\n}\n@@ -408,11 +419,16 @@ async function updateDescendantPermissions(\n}\nif (!_isEqual(permissionsForChildren)(oldPermissionsForChildren)) {\n- usersForNextLayer.set(userID, permissionsForChildren);\n+ usersForNextLayer.set(userID, {\n+ permissionsFromParent: permissionsForChildren,\n+ });\n}\n}\nif (usersForNextLayer.size > 0) {\n- stack.push([threadID, usersForNextLayer]);\n+ stack.push({\n+ threadID: childThreadID,\n+ changesByUser: usersForNextLayer,\n+ });\n}\n}\n}\n@@ -509,7 +525,9 @@ async function recalculateThreadPermissions(\n}\nif (!_isEqual(permissionsForChildren)(oldPermissionsForChildren)) {\n- toUpdateDescendants.set(userID, permissionsForChildren);\n+ toUpdateDescendants.set(userID, {\n+ permissionsFromParent: permissionsForChildren,\n+ });\n}\n}\n@@ -517,7 +535,10 @@ async function recalculateThreadPermissions(\nconst {\nmembershipRows: descendantMembershipRows,\nrelationshipChangeset: descendantRelationshipChangeset,\n- } = await updateDescendantPermissions(threadID, toUpdateDescendants);\n+ } = await updateDescendantPermissions({\n+ threadID,\n+ changesByUser: toUpdateDescendants,\n+ });\npushAll(membershipRows, descendantMembershipRows);\nrelationshipChangeset.addAll(descendantRelationshipChangeset);\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Change parameter format of updateDescendantPermissions Summary: This is in preparation for adding a second property to `AncestorChanges`. Test Plan: Will be tested in combination with following diffs Reviewers: atul Reviewed By: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1302
129,187
30.05.2021 11:48:08
14,400
07bfd498d5f31d25405f86d8be24be7bed620bac
[lib] Introduce threadTypeIsCommunityRoot Summary: Going to use this check in a couple other places. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -60,6 +60,13 @@ export function assertThreadType(threadType: number): ThreadType {\nreturn threadType;\n}\n+export function threadTypeIsCommunityRoot(threadType: ThreadType): boolean {\n+ return (\n+ threadType === threadTypes.COMMUNITY_ROOT ||\n+ threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT\n+ );\n+}\n+\nexport const threadPermissions = Object.freeze({\nKNOW_OF: 'know_of',\nMEMBERSHIP: 'membership',\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -17,6 +17,7 @@ import {\ntype NewThreadResponse,\nthreadTypes,\nthreadPermissions,\n+ threadTypeIsCommunityRoot,\n} from 'lib/types/thread-types';\nimport { pushAll } from 'lib/utils/array';\nimport { ServerError } from 'lib/utils/errors';\n@@ -135,11 +136,7 @@ async function createThread(\n// conversations. For now we are hosting all root threads on Ashoat's\n// keyserver, so we set them to the have the Genesis community as their\n// parent thread.\n- if (\n- !parentThreadID &&\n- threadType !== threadTypes.COMMUNITY_ROOT &&\n- threadType !== threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT\n- ) {\n+ if (!parentThreadID && !threadTypeIsCommunityRoot(threadType)) {\nparentThreadID = genesis.id;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce threadTypeIsCommunityRoot Summary: Going to use this check in a couple other places. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1303
129,187
30.05.2021 11:57:59
14,400
814a3e9f878a9fa1cbdf5f113163d032b58bb4b7
[server] Add community column to threads table Summary: This diff addresses [this issue](https://www.notion.so/commapp/Add-community-column-to-threads-table-a8c542df0e7745fa8fc615cd52924882). It will make it more efficient for us to check whether two threads are in the same community, for instance. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/add-containing-thread-id-column.js", "new_path": "server/src/scripts/add-containing-thread-id-column.js", "diff": "@@ -12,7 +12,9 @@ async function addColumnAndIndexes() {\nawait dbQuery(SQL`\nALTER TABLE threads\nADD containing_thread_id BIGINT(20) NULL AFTER parent_thread_id,\n+ ADD community BIGINT(20) NULL AFTER containing_thread_id,\nADD INDEX parent_thread_id (parent_thread_id),\n+ ADD INDEX community (community),\nADD INDEX containing_thread_id (containing_thread_id);\n`);\n}\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "@@ -152,6 +152,7 @@ async function createTables() {\ndescription mediumtext COLLATE utf8mb4_bin,\nparent_thread_id bigint(20) DEFAULT NULL,\ncontaining_thread_id bigint(20) DEFAULT NULL,\n+ community bigint(20) DEFAULT NULL,\ndefault_role bigint(20) NOT NULL,\ncreator bigint(20) NOT NULL,\ncreation_time bigint(20) NOT NULL,\n@@ -283,7 +284,8 @@ async function createTables() {\nALTER TABLE threads\nADD PRIMARY KEY (id),\nADD INDEX parent_thread_id (parent_thread_id),\n- ADD INDEX containing_thread_id (containing_thread_id);\n+ ADD INDEX containing_thread_id (containing_thread_id),\n+ ADD INDEX community (community);\nALTER TABLE updates\nADD PRIMARY KEY (id),\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add community column to threads table Summary: This diff addresses [this issue](https://www.notion.so/commapp/Add-community-column-to-threads-table-a8c542df0e7745fa8fc615cd52924882). It will make it more efficient for us to check whether two threads are in the same community, for instance. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1304
129,187
30.05.2021 13:03:22
14,400
37c739f07d91542a50892f1fe7293f2a522dc6bf
[server] Add community to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -220,6 +220,7 @@ export type ServerThreadInfo = {|\n+creationTime: number, // millisecond timestamp\n+parentThreadID: ?string,\n+containingThreadID: ?string,\n+ +community: ?string,\n+members: $ReadOnlyArray<ServerMemberInfo>,\n+roles: { [id: string]: RoleInfo },\n+sourceMessageID?: string,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -24,10 +24,11 @@ async function fetchServerThreadInfos(\nconst whereClause = condition ? SQL`WHERE `.append(condition) : '';\nconst query = SQL`\n- SELECT t.id, t.name, t.parent_thread_id, t.containing_thread_id, t.color,\n- t.description, t.type, t.creation_time, t.default_role, t.source_message,\n- t.replies_count, r.id AS role, r.name AS role_name,\n- r.permissions AS role_permissions, m.user, m.permissions, m.subscription,\n+ SELECT t.id, t.name, t.parent_thread_id, t.containing_thread_id,\n+ t.community, t.color, t.description, t.type, t.creation_time,\n+ t.default_role, t.source_message, t.replies_count, r.id AS role,\n+ r.name AS role_name, r.permissions AS role_permissions, m.user,\n+ m.permissions, m.subscription,\nm.last_read_message < m.last_message AS unread, m.sender\nFROM threads t\nLEFT JOIN (\n@@ -54,12 +55,13 @@ async function fetchServerThreadInfos(\ndescription: row.description ? row.description : '',\ncolor: row.color,\ncreationTime: row.creation_time,\n- containingThreadID: row.containing_thread_id\n- ? row.containing_thread_id.toString()\n- : null,\nparentThreadID: row.parent_thread_id\n? row.parent_thread_id.toString()\n: null,\n+ containingThreadID: row.containing_thread_id\n+ ? row.containing_thread_id.toString()\n+ : null,\n+ community: row.community ? row.community.toString() : null,\nmembers: [],\nroles: {},\nrepliesCount: row.replies_count,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add community to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1305
129,187
30.05.2021 13:08:27
14,400
859542a2defd4e2400102eb11ee0cda745ad6cda
[server] determineContainingThreadID -> determineThreadAncestry Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -26,7 +26,7 @@ import { firstLine } from 'lib/utils/string-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport { fetchMessageInfoByID } from '../fetchers/message-fetchers';\n-import { determineContainingThreadID } from '../fetchers/thread-fetchers';\n+import { determineThreadAncestry } from '../fetchers/thread-fetchers';\nimport {\ncheckThreadPermission,\nvalidateCandidateMembers,\n@@ -140,7 +140,7 @@ async function createThread(\nparentThreadID = genesis.id;\n}\n- const containingThreadIDPromise = determineContainingThreadID(\n+ const determineThreadAncestryPromise = determineThreadAncestry(\nparentThreadID,\nthreadType,\n);\n@@ -174,14 +174,14 @@ async function createThread(\nconst checkPromises = {};\ncheckPromises.confirmParentPermission = confirmParentPermissionPromise;\n- checkPromises.containingThreadID = containingThreadIDPromise;\n+ checkPromises.threadAncestry = determineThreadAncestryPromise;\ncheckPromises.validateMembers = validateMembersPromise;\nif (sourceMessageID) {\ncheckPromises.sourceMessage = fetchMessageInfoByID(viewer, sourceMessageID);\n}\nconst {\nsourceMessage,\n- containingThreadID,\n+ threadAncestry,\nvalidateMembers: { initialMemberIDs, ghostMemberIDs },\n} = await promiseAll(checkPromises);\n@@ -215,7 +215,7 @@ async function createThread(\ntime,\ncolor,\nparentThreadID,\n- containingThreadID,\n+ threadAncestry.containingThreadID,\nnewRoles.default.id,\nsourceMessageID,\n];\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -166,15 +166,18 @@ async function verifyThreadID(threadID: string): Promise<boolean> {\nreturn result.length !== 0;\n}\n-async function determineContainingThreadID(\n+type ThreadAncestry = {|\n+ +containingThreadID: ?string,\n+|};\n+async function determineThreadAncestry(\nparentThreadID: ?string,\nthreadType: ThreadType,\n-): Promise<?string> {\n+): Promise<ThreadAncestry> {\nif (!parentThreadID) {\n- return null;\n+ return { containingThreadID: null };\n}\nif (threadType === threadTypes.SIDEBAR) {\n- return parentThreadID;\n+ return { containingThreadID: parentThreadID };\n}\nconst parentThreadInfos = await fetchServerThreadInfos(\nSQL`t.id = ${parentThreadID}`,\n@@ -184,9 +187,9 @@ async function determineContainingThreadID(\nthrow new ServerError('invalid_parameters');\n}\nif (!parentThreadInfo.containingThreadID) {\n- return parentThreadID;\n+ return { containingThreadID: parentThreadID };\n}\n- return parentThreadInfo.containingThreadID;\n+ return { containingThreadID: parentThreadInfo.containingThreadID };\n}\nexport {\n@@ -195,5 +198,5 @@ export {\nrawThreadInfosFromServerThreadInfos,\nverifyThreadIDs,\nverifyThreadID,\n- determineContainingThreadID,\n+ determineThreadAncestry,\n};\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -36,7 +36,7 @@ import { fetchMessageInfos } from '../fetchers/message-fetchers';\nimport {\nfetchThreadInfos,\nfetchServerThreadInfos,\n- determineContainingThreadID,\n+ determineThreadAncestry,\n} from '../fetchers/thread-fetchers';\nimport {\ncheckThreadPermission,\n@@ -474,7 +474,7 @@ async function updateThread(\nthrow new ServerError('no_parent_thread_specified');\n}\n- const containingThreadIDPromise = determineContainingThreadID(\n+ const determineThreadAncestryPromise = determineThreadAncestry(\nnextParentThreadID,\nnextThreadType,\n);\n@@ -544,13 +544,13 @@ async function updateThread(\n}\n})();\n- const { nextContainingThreadID } = await promiseAll({\n- nextContainingThreadID: containingThreadIDPromise,\n+ const { nextThreadAncestry } = await promiseAll({\n+ nextThreadAncestry: determineThreadAncestryPromise,\nconfirmParentPermissionPromise,\nvalidateNewMembersPromise,\n});\n- if (nextContainingThreadID !== oldContainingThreadID) {\n- sqlUpdate.containing_thread_id = nextContainingThreadID;\n+ if (nextThreadAncestry.containingThreadID !== oldContainingThreadID) {\n+ sqlUpdate.containing_thread_id = nextThreadAncestry.containingThreadID;\n}\nconst updateQueryPromise = (async () => {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] determineContainingThreadID -> determineThreadAncestry Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1306
129,187
30.05.2021 16:27:55
14,400
98f27bbacde584e89af0f1e085e3509dc9077da1
[server] Set community in createThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -216,6 +216,7 @@ async function createThread(\ncolor,\nparentThreadID,\nthreadAncestry.containingThreadID,\n+ threadAncestry.community,\nnewRoles.default.id,\nsourceMessageID,\n];\n@@ -249,7 +250,7 @@ async function createThread(\nif (existingThreadQuery) {\nconst query = SQL`\nINSERT INTO threads(id, type, name, description, creator, creation_time,\n- color, parent_thread_id, containing_thread_id, default_role,\n+ color, parent_thread_id, containing_thread_id, community, default_role,\nsource_message)\nSELECT ${row}\nWHERE NOT EXISTS (`;\n@@ -316,7 +317,7 @@ async function createThread(\n} else {\nconst query = SQL`\nINSERT INTO threads(id, type, name, description, creator, creation_time,\n- color, parent_thread_id, containing_thread_id, default_role,\n+ color, parent_thread_id, containing_thread_id, community, default_role,\nsource_message)\nVALUES ${[row]}\n`;\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -8,6 +8,7 @@ import {\ntype ThreadType,\ntype RawThreadInfo,\ntype ServerThreadInfo,\n+ threadTypeIsCommunityRoot,\n} from 'lib/types/thread-types';\nimport { ServerError } from 'lib/utils/errors';\n@@ -168,13 +169,14 @@ async function verifyThreadID(threadID: string): Promise<boolean> {\ntype ThreadAncestry = {|\n+containingThreadID: ?string,\n+ +community: ?string,\n|};\nasync function determineThreadAncestry(\nparentThreadID: ?string,\nthreadType: ThreadType,\n): Promise<ThreadAncestry> {\nif (!parentThreadID) {\n- return { containingThreadID: null };\n+ return { containingThreadID: null, community: null };\n}\nconst parentThreadInfos = await fetchServerThreadInfos(\nSQL`t.id = ${parentThreadID}`,\n@@ -187,7 +189,8 @@ async function determineThreadAncestry(\nparentThreadInfo,\nthreadType,\n);\n- return { containingThreadID };\n+ const community = getCommunity(parentThreadInfo);\n+ return { containingThreadID, community };\n}\nfunction getContainingThreadID(\n@@ -206,6 +209,20 @@ function getContainingThreadID(\nreturn parentThreadInfo.containingThreadID;\n}\n+function getCommunity(parentThreadInfo: ?ServerThreadInfo) {\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@@ -213,5 +230,6 @@ export {\nverifyThreadIDs,\nverifyThreadID,\ndetermineThreadAncestry,\n+ getCommunity,\ngetContainingThreadID,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Set community in createThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1308
129,187
30.05.2021 16:57:29
14,400
37423af0e259c459c9fd9c0caa7ce0e72f3b7fe2
[server] Update community in updateThread Summary: Now that we can make sure that `parentThreadID` changes don't change the containing community, we can reenable them (despite it not being done anywhere in the UI). Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -343,15 +343,6 @@ async function updateThread(\nsqlUpdate.type = threadType;\n}\n- // We're temporarily blocking changing parent thread IDs. Note that even if we\n- // remove this condition it is only possible for community subthreads (open or\n- // secret). We've disabled it for community subthreads because we don't yet\n- // have any efficient way of checking if the new parent is in the same\n- // community as the old parent.\n- if (!ignorePermissions && parentThreadID !== undefined) {\n- throw new ServerError('invalid_parameters');\n- }\n-\nif (\n!ignorePermissions &&\nthreadType !== null &&\n@@ -445,6 +436,7 @@ async function updateThread(\nconst oldThreadType = serverThreadInfo.type;\nconst oldParentThreadID = serverThreadInfo.parentThreadID;\nconst oldContainingThreadID = serverThreadInfo.containingThreadID;\n+ const oldCommunity = serverThreadInfo.community;\nconst nextThreadType =\nthreadType !== null && threadType !== undefined\n@@ -552,6 +544,12 @@ async function updateThread(\nif (nextThreadAncestry.containingThreadID !== oldContainingThreadID) {\nsqlUpdate.containing_thread_id = nextThreadAncestry.containingThreadID;\n}\n+ if (nextThreadAncestry.community !== oldCommunity) {\n+ if (!ignorePermissions) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ sqlUpdate.community = nextThreadAncestry.community;\n+ }\nconst updateQueryPromise = (async () => {\nif (Object.keys(sqlUpdate).length === 0) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Update community in updateThread Summary: Now that we can make sure that `parentThreadID` changes don't change the containing community, we can reenable them (despite it not being done anywhere in the UI). Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1309
129,187
30.05.2021 16:36:08
14,400
6bb786394b6027241a2c33b3db80ac5b910218fc
[server] Set community in same script that sets containing thread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "RENAME", "old_path": "server/src/scripts/add-containing-thread-id-column.js", "new_path": "server/src/scripts/add-thread-ancestry.js", "diff": "@@ -6,6 +6,7 @@ import { dbQuery, SQL } from '../database/database';\nimport {\nfetchServerThreadInfos,\ngetContainingThreadID,\n+ getCommunity,\n} from '../fetchers/thread-fetchers';\nimport { main } from './utils';\n@@ -47,22 +48,28 @@ async function setColumnForLayer(\nparentThreadInfo,\nthreadInfo.type,\n);\n- if (!containingThreadID) {\n- console.log(`containingThreadID is null for ${threadID}, skipping...`);\n+ const community = getCommunity(parentThreadInfo);\n+ if (!containingThreadID && !community) {\n+ console.log(\n+ `containingThreadID and community are null for ${threadID}, ` +\n+ 'skipping...',\n+ );\nupdatedThreadInfos.push(threadInfo);\ncontinue;\n}\nconsole.log(\n- `setting containingThreadID to ${containingThreadID} for ${threadID}`,\n+ `setting containingThreadID to ${containingThreadID ?? 'null'} and ` +\n+ `community to ${community ?? 'null'} for ${threadID}`,\n);\nawait dbQuery(SQL`\nUPDATE threads\n- SET containing_thread_id = ${containingThreadID}\n+ SET containing_thread_id = ${containingThreadID}, community = ${community}\nWHERE id = ${threadID}\n`);\nupdatedThreadInfos.push({\n...threadInfo,\ncontainingThreadID,\n+ community,\n});\n}\nreturn updatedThreadInfos;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Set community in same script that sets containing thread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1310
129,187
30.05.2021 17:02:28
14,400
ff9b0a8f9fae9dfa36bdeabdeb0e89339bcbc0e1
[server] Add depth to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -221,6 +221,7 @@ export type ServerThreadInfo = {|\n+parentThreadID: ?string,\n+containingThreadID: ?string,\n+community: ?string,\n+ +depth: number,\n+members: $ReadOnlyArray<ServerMemberInfo>,\n+roles: { [id: string]: RoleInfo },\n+sourceMessageID?: string,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -26,7 +26,7 @@ async function fetchServerThreadInfos(\nconst query = SQL`\nSELECT t.id, t.name, t.parent_thread_id, t.containing_thread_id,\n- t.community, t.color, t.description, t.type, t.creation_time,\n+ t.community, t.depth, t.color, t.description, t.type, t.creation_time,\nt.default_role, t.source_message, t.replies_count, r.id AS role,\nr.name AS role_name, r.permissions AS role_permissions, m.user,\nm.permissions, m.subscription,\n@@ -62,6 +62,7 @@ async function fetchServerThreadInfos(\ncontainingThreadID: row.containing_thread_id\n? row.containing_thread_id.toString()\n: null,\n+ depth: row.depth,\ncommunity: row.community ? row.community.toString() : null,\nmembers: [],\nroles: {},\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Add depth to ServerThreadInfo Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1312
129,187
30.05.2021 17:04:09
14,400
94dc24207596761e589e3a1024c2a80bc27085a4
[server] Set depth in createThread and updateThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -217,6 +217,7 @@ async function createThread(\nparentThreadID,\nthreadAncestry.containingThreadID,\nthreadAncestry.community,\n+ threadAncestry.depth,\nnewRoles.default.id,\nsourceMessageID,\n];\n@@ -250,8 +251,8 @@ async function createThread(\nif (existingThreadQuery) {\nconst query = SQL`\nINSERT INTO threads(id, type, name, description, creator, creation_time,\n- color, parent_thread_id, containing_thread_id, community, default_role,\n- source_message)\n+ color, parent_thread_id, containing_thread_id, community, depth,\n+ default_role, source_message)\nSELECT ${row}\nWHERE NOT EXISTS (`;\nquery.append(existingThreadQuery).append(SQL`)`);\n@@ -317,8 +318,8 @@ async function createThread(\n} else {\nconst query = SQL`\nINSERT INTO threads(id, type, name, description, creator, creation_time,\n- color, parent_thread_id, containing_thread_id, community, default_role,\n- source_message)\n+ color, parent_thread_id, containing_thread_id, community, depth,\n+ default_role, source_message)\nVALUES ${[row]}\n`;\nawait dbQuery(query);\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -171,13 +171,14 @@ async function verifyThreadID(threadID: string): Promise<boolean> {\ntype ThreadAncestry = {|\n+containingThreadID: ?string,\n+community: ?string,\n+ +depth: number,\n|};\nasync function determineThreadAncestry(\nparentThreadID: ?string,\nthreadType: ThreadType,\n): Promise<ThreadAncestry> {\nif (!parentThreadID) {\n- return { containingThreadID: null, community: null };\n+ return { containingThreadID: null, community: null, depth: 0 };\n}\nconst parentThreadInfos = await fetchServerThreadInfos(\nSQL`t.id = ${parentThreadID}`,\n@@ -191,7 +192,8 @@ async function determineThreadAncestry(\nthreadType,\n);\nconst community = getCommunity(parentThreadInfo);\n- return { containingThreadID, community };\n+ const depth = parentThreadInfo.depth + 1;\n+ return { containingThreadID, community, depth };\n}\nfunction getContainingThreadID(\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -437,6 +437,7 @@ async function updateThread(\nconst oldParentThreadID = serverThreadInfo.parentThreadID;\nconst oldContainingThreadID = serverThreadInfo.containingThreadID;\nconst oldCommunity = serverThreadInfo.community;\n+ const oldDepth = serverThreadInfo.depth;\nconst nextThreadType =\nthreadType !== null && threadType !== undefined\n@@ -550,6 +551,9 @@ async function updateThread(\n}\nsqlUpdate.community = nextThreadAncestry.community;\n}\n+ if (nextThreadAncestry.depth !== oldDepth) {\n+ sqlUpdate.depth = nextThreadAncestry.depth;\n+ }\nconst updateQueryPromise = (async () => {\nif (Object.keys(sqlUpdate).length === 0) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Set depth in createThread and updateThread Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1313
129,187
30.05.2021 17:09:30
14,400
b7eb6ac6fd608b126a7dfca74394da8e9ebf8943
[server] Set depth in add-thread-ancestory.js script Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/add-thread-ancestry.js", "new_path": "server/src/scripts/add-thread-ancestry.js", "diff": "@@ -58,19 +58,24 @@ async function setColumnForLayer(\nupdatedThreadInfos.push(threadInfo);\ncontinue;\n}\n+ const depth = parentThreadInfo ? parentThreadInfo.depth + 1 : 0;\nconsole.log(\n- `setting containingThreadID to ${containingThreadID ?? 'null'} and ` +\n- `community to ${community ?? 'null'} for ${threadID}`,\n+ `setting containingThreadID to ${containingThreadID ?? 'null'}, ` +\n+ `community to ${community ?? 'null'}, and ` +\n+ `depth to ${depth} for ${threadID}`,\n);\nawait dbQuery(SQL`\nUPDATE threads\n- SET containing_thread_id = ${containingThreadID}, community = ${community}\n+ SET containing_thread_id = ${containingThreadID},\n+ community = ${community},\n+ depth = ${depth}\nWHERE id = ${threadID}\n`);\nupdatedThreadInfos.push({\n...threadInfo,\ncontainingThreadID,\ncommunity,\n+ depth,\n});\n}\nreturn updatedThreadInfos;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Set depth in add-thread-ancestory.js script Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1314
129,187
30.05.2021 22:21:18
14,400
4e4a543e9538dc84bd1329cedad9ab05e6e907fd
[lib] Store thread name/description in genesis.json Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/facts/genesis.json", "new_path": "lib/facts/genesis.json", "diff": "{\n- \"id\": \"1\"\n+ \"id\": \"1\",\n+ \"name\": \"GENESIS\",\n+ \"description\": \"This is the first community on Comm. In the future it will be possible to create threads outside of a community, but for now all of these threads get set with GENESIS as their parent. GENESIS is hosted on Ashoat's keyserver.\"\n}\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/soft-launch-migration.js", "new_path": "server/src/scripts/soft-launch-migration.js", "diff": "@@ -56,12 +56,8 @@ async function createGenesisCommunity() {\n{\nid: genesis.id,\ntype: threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT,\n- name: 'GENESIS',\n- description:\n- 'This is the first community on Comm. In the future it will be ' +\n- 'possible to create threads outside of a community, but for now all ' +\n- 'of these threads get set with GENESIS as their parent. GENESIS is ' +\n- \"hosted on Ashoat's keyserver.\",\n+ name: genesis.name,\n+ description: genesis.description,\ninitialMemberIDs: nonAshoatUserIDs,\n},\ncreateThreadOptions,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Store thread name/description in genesis.json Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1315
129,187
30.05.2021 22:43:31
14,400
a4efcdb283831ada1ce06b89ec13c4b05a78c28c
[server] Create GENESIS community in create-db.js script Summary: Also updates it to use `createThread` directly. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "import ashoat from 'lib/facts/ashoat';\nimport bots from 'lib/facts/bots';\n-import {\n- makePermissionsBlob,\n- makePermissionsForChildrenBlob,\n-} from 'lib/permissions/thread-permissions';\n+import genesis from 'lib/facts/genesis';\nimport { usernameMaxLength } from 'lib/shared/account-utils';\nimport { sortIDs } from 'lib/shared/relationship-utils';\nimport { undirectedStatus } from 'lib/types/relationship-types';\nimport { threadTypes } from 'lib/types/thread-types';\n-import { getRolePermissionBlobs } from '../creators/role-creator';\n+import { createThread } from '../creators/thread-creator';\nimport { dbQuery, SQL } from '../database/database';\n+import { createScriptViewer } from '../session/scripts';\nimport { setScriptContext } from './script-context';\nimport { endScript } from './utils';\n@@ -342,50 +340,40 @@ async function createUsers() {\n`);\n}\n+const createThreadOptions = { forceAddMembers: true };\n+\nasync function createThreads() {\n- const staffSquadbotThreadRoleID = 118821;\n- const defaultRolePermissions = getRolePermissionBlobs(\n- threadTypes.COMMUNITY_SECRET_SUBTHREAD,\n- ).Members;\n- const membershipPermissions = makePermissionsBlob(\n- defaultRolePermissions,\n- null,\n- bots.squadbot.staffThreadID,\n- threadTypes.COMMUNITY_SECRET_SUBTHREAD,\n- );\n- const membershipPermissionsString = JSON.stringify(membershipPermissions);\n- const membershipChildPermissionsString = JSON.stringify(\n- makePermissionsForChildrenBlob(membershipPermissions),\n- );\n- const subscriptionString = JSON.stringify({ home: true, pushNotifs: true });\n- await dbQuery(SQL`\n+ const insertIDsPromise = dbQuery(SQL`\nINSERT INTO ids (id, table_name)\nVALUES\n- (${bots.squadbot.staffThreadID}, 'threads'),\n- (${staffSquadbotThreadRoleID}, 'roles');\n- INSERT INTO roles (id, thread, name, permissions, creation_time)\n- VALUES\n- (${staffSquadbotThreadRoleID}, ${bots.squadbot.staffThreadID},\n- 'Members', ${JSON.stringify(defaultRolePermissions)}, 1530049901882);\n- INSERT INTO threads (id, type, name, description, parent_thread_id,\n- default_role, creator, creation_time, color)\n- VALUES\n- (${bots.squadbot.staffThreadID},\n- ${threadTypes.COMMUNITY_SECRET_SUBTHREAD}, NULL, NULL, NULL,\n- ${staffSquadbotThreadRoleID}, ${bots.squadbot.userID}, 1530049901942,\n- 'ef1a63');\n- INSERT INTO memberships (thread, user, role, permissions,\n- permissions_for_children, creation_time, subscription)\n- VALUES\n- (${bots.squadbot.staffThreadID}, ${bots.squadbot.userID},\n- ${staffSquadbotThreadRoleID}, ${membershipPermissionsString},\n- ${membershipChildPermissionsString}, 1530049902080,\n- ${subscriptionString}),\n- (${bots.squadbot.staffThreadID}, ${ashoat.id},\n- ${staffSquadbotThreadRoleID}, ${membershipPermissionsString},\n- ${membershipChildPermissionsString}, 1530049902080,\n- ${subscriptionString});\n+ (${genesis.id}, 'threads'),\n+ (${bots.squadbot.staffThreadID}, 'threads');\n`);\n+\n+ const ashoatViewer = createScriptViewer(ashoat.id);\n+ const createGenesisPromise = createThread(\n+ ashoatViewer,\n+ {\n+ id: genesis.id,\n+ type: threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT,\n+ name: genesis.name,\n+ description: genesis.description,\n+ initialMemberIDs: [bots.squadbot.userID],\n+ },\n+ createThreadOptions,\n+ );\n+ await Promise.all([insertIDsPromise, createGenesisPromise]);\n+\n+ const squadbotViewer = createScriptViewer(bots.squadbot.userID);\n+ await createThread(\n+ squadbotViewer,\n+ {\n+ id: bots.squadbot.staffThreadID,\n+ type: threadTypes.COMMUNITY_SECRET_SUBTHREAD,\n+ initialMemberIDs: [ashoat.id],\n+ },\n+ createThreadOptions,\n+ );\n}\nmain();\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Create GENESIS community in create-db.js script Summary: Also updates it to use `createThread` directly. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1316
129,187
30.05.2021 22:56:59
14,400
c60074de06467ab8ab03e65a82fb6c2f2dede90f
Add new GENESIS ThreadType Summary: We need this one to prevent users from leaving GENESIS. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -940,6 +940,7 @@ function getThreadTypeParentRequirement(\n} else if (\nthreadType === threadTypes.COMMUNITY_ROOT ||\nthreadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT ||\n+ threadType === threadTypes.GENESIS ||\nthreadType === threadTypes.PERSONAL ||\nthreadType === threadTypes.PRIVATE\n) {\n" }, { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -42,6 +42,8 @@ export const threadTypes = Object.freeze({\nCOMMUNITY_SECRET_SUBTHREAD: 4,\n// like COMMUNITY_SECRET_SUBTHREAD, but members aren't voiced\nCOMMUNITY_SECRET_ANNOUNCEMENT_SUBTHREAD: 11,\n+ // like COMMUNITY_SECRET_ANNOUNCEMENT_SUBTHREAD, but you can't leave\n+ GENESIS: 12,\n});\nexport type ThreadType = $Values<typeof threadTypes>;\nexport function assertThreadType(threadType: number): ThreadType {\n@@ -54,7 +56,8 @@ export function assertThreadType(threadType: number): ThreadType {\nthreadType === 8 ||\nthreadType === 9 ||\nthreadType === 10 ||\n- threadType === 11,\n+ threadType === 11 ||\n+ threadType === 12,\n'number is not ThreadType enum',\n);\nreturn threadType;\n@@ -63,7 +66,8 @@ export function assertThreadType(threadType: number): ThreadType {\nexport function threadTypeIsCommunityRoot(threadType: ThreadType): boolean {\nreturn (\nthreadType === threadTypes.COMMUNITY_ROOT ||\n- threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT\n+ threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT ||\n+ threadType === threadTypes.GENESIS\n);\n}\n@@ -307,7 +311,7 @@ export type BaseNewThreadRequest = {|\n|};\ntype NewThreadRequest =\n| {|\n- +type: 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11,\n+ +type: 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12,\n...BaseNewThreadRequest,\n|}\n| {|\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -108,12 +108,23 @@ function getRolePermissionBlobsForCommunity(\n[openChildMembership]: true,\n[openChildJoinThread]: true,\n[threadPermissions.CREATE_SIDEBARS]: true,\n+ };\n+\n+ let memberPermissions;\n+ if (threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT) {\n+ memberPermissions = {\n+ ...baseMemberPermissions,\n+ [threadPermissions.LEAVE_THREAD]: true,\n+ };\n+ } else if (threadType === threadTypes.GENESIS) {\n+ memberPermissions = baseMemberPermissions;\n+ } else {\n+ memberPermissions = {\n+ ...baseMemberPermissions,\n+ ...voicedPermissions,\n[threadPermissions.LEAVE_THREAD]: true,\n};\n- const memberPermissions =\n- threadType === threadTypes.COMMUNITY_ROOT\n- ? { ...baseMemberPermissions, ...voicedPermissions }\n- : baseMemberPermissions;\n+ }\nconst descendantKnowOf = DESCENDANT + threadPermissions.KNOW_OF;\nconst descendantVisible = DESCENDANT + threadPermissions.VISIBLE;\n@@ -135,7 +146,7 @@ function getRolePermissionBlobsForCommunity(\nconst descendantRemoveMembers = DESCENDANT + threadPermissions.REMOVE_MEMBERS;\nconst descendantChangeRole = DESCENDANT + threadPermissions.CHANGE_ROLE;\n- const adminPermissions = {\n+ const baseAdminPermissions = {\n[threadPermissions.KNOW_OF]: true,\n[threadPermissions.MEMBERSHIP]: true,\n[threadPermissions.VISIBLE]: true,\n@@ -148,7 +159,6 @@ function getRolePermissionBlobsForCommunity(\n[threadPermissions.DELETE_THREAD]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n[threadPermissions.CHANGE_ROLE]: true,\n- [threadPermissions.LEAVE_THREAD]: true,\n[descendantKnowOf]: true,\n[descendantVisible]: true,\n[topLevelDescendantMembership]: true,\n@@ -167,6 +177,16 @@ function getRolePermissionBlobsForCommunity(\n[descendantChangeRole]: true,\n};\n+ let adminPermissions;\n+ if (threadType === threadTypes.GENESIS) {\n+ adminPermissions = baseAdminPermissions;\n+ } else {\n+ adminPermissions = {\n+ ...baseAdminPermissions,\n+ [threadPermissions.LEAVE_THREAD]: true,\n+ };\n+ }\n+\nreturn {\nMembers: memberPermissions,\nAdmins: adminPermissions,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -118,6 +118,7 @@ const shimCommunityRoot = {\nthreadTypes.COMMUNITY_OPEN_SUBTHREAD,\n[threadTypes.COMMUNITY_SECRET_ANNOUNCEMENT_SUBTHREAD]:\nthreadTypes.COMMUNITY_SECRET_SUBTHREAD,\n+ [threadTypes.GENESIS]: threadTypes.COMMUNITY_SECRET_SUBTHREAD,\n};\nfunction rawThreadInfosFromServerThreadInfos(\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/create-db.js", "new_path": "server/src/scripts/create-db.js", "diff": "@@ -355,7 +355,7 @@ async function createThreads() {\nashoatViewer,\n{\nid: genesis.id,\n- type: threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT,\n+ type: threadTypes.GENESIS,\nname: genesis.name,\ndescription: genesis.description,\ninitialMemberIDs: [bots.squadbot.userID],\n" }, { "change_type": "MODIFY", "old_path": "server/src/scripts/soft-launch-migration.js", "new_path": "server/src/scripts/soft-launch-migration.js", "diff": "@@ -30,10 +30,7 @@ async function createGenesisCommunity() {\nSQL`t.id = ${genesis.id}`,\n);\nconst genesisThreadInfo = genesisThreadInfos.threadInfos[genesis.id];\n- if (\n- genesisThreadInfo &&\n- genesisThreadInfo.type === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT\n- ) {\n+ if (genesisThreadInfo && genesisThreadInfo.type === threadTypes.GENESIS) {\nreturn;\n} else if (genesisThreadInfo) {\nreturn await updateGenesisCommunityType();\n@@ -55,7 +52,7 @@ async function createGenesisCommunity() {\nashoatViewer,\n{\nid: genesis.id,\n- type: threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT,\n+ type: threadTypes.GENESIS,\nname: genesis.name,\ndescription: genesis.description,\ninitialMemberIDs: nonAshoatUserIDs,\n@@ -65,7 +62,7 @@ async function createGenesisCommunity() {\n}\nasync function updateGenesisCommunityType() {\n- console.log('updating GENESIS community to COMMUNITY_ANNOUNCEMENT_ROOT');\n+ console.log('updating GENESIS community to GENESIS type');\nconst ashoatViewer = createScriptViewer(ashoat.id);\nawait updateThread(\n@@ -73,7 +70,7 @@ async function updateGenesisCommunityType() {\n{\nthreadID: genesis.id,\nchanges: {\n- type: threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT,\n+ type: threadTypes.GENESIS,\n},\n},\nupdateThreadOptions,\n@@ -186,6 +183,7 @@ async function moveThreadsToGenesis() {\nFROM threads\nWHERE type != ${threadTypes.COMMUNITY_ROOT}\nAND type != ${threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT}\n+ AND type != ${threadTypes.GENESIS}\nAND parent_thread_id IS NULL\n`;\nconst [noParentThreads] = await dbQuery(noParentQuery);\n@@ -215,6 +213,7 @@ async function moveThreadsToGenesis() {\nFROM threads\nWHERE type != ${threadTypes.COMMUNITY_ROOT}\nAND type != ${threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT}\n+ AND type != ${threadTypes.GENESIS}\nAND parent_thread_id IS NOT NULL\nAND parent_thread_id != ${genesis.id}\n`;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Add new GENESIS ThreadType Summary: We need this one to prevent users from leaving GENESIS. Test Plan: Will be tested in combination with following diffs Reviewers: atul Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1317
129,187
31.05.2021 12:40:52
14,400
7a9f86bb07cf19efd1317efab4996364de2822b4
[native] codeVersion -> 86
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -268,8 +268,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 85\n- versionName \"0.0.85\"\n+ versionCode 86\n+ versionName \"0.0.86\"\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.85</string>\n+ <string>0.0.86</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>85</string>\n+ <string>86</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.85</string>\n+ <string>0.0.86</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>85</string>\n+ <string>86</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": "@@ -232,7 +232,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 85;\n+const codeVersion = 86;\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 -> 86
129,187
31.05.2021 14:26:00
14,400
4dc01130d0f7bb3cc50661120ff93aa586c3f2c8
[server] Continue pushing back the launch of some features Summary: Similar to D1276 and D1294. Realized I'll need to make another release (see comment in D1320)... Test Plan: Flow Reviewers: palys-swm, karol-bisztyga, atul Subscribers: KatPo, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -289,7 +289,7 @@ async function createThread(\nlet joinRequest = {\nthreadID: existingThreadID,\n};\n- if (hasMinCodeVersion(viewer.platformDetails, 86)) {\n+ if (hasMinCodeVersion(viewer.platformDetails, 87)) {\ninvariant(request.calendarQuery, 'calendar query should exist');\nconst calendarQuery = {\n...request.calendarQuery,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-fetchers.js", "new_path": "server/src/fetchers/thread-fetchers.js", "diff": "@@ -127,7 +127,7 @@ function rawThreadInfosFromServerThreadInfos(\n): FetchThreadInfosResult {\nconst viewerID = viewer.id;\nconst hasCodeVersionBelow70 = !hasMinCodeVersion(viewer.platformDetails, 70);\n- const hasCodeVersionBelow86 = !hasMinCodeVersion(viewer.platformDetails, 86);\n+ const hasCodeVersionBelow87 = !hasMinCodeVersion(viewer.platformDetails, 87);\nconst threadInfos = {};\nfor (const threadID in serverResult.threadInfos) {\nconst serverThreadInfo = serverResult.threadInfos[threadID];\n@@ -137,7 +137,7 @@ function rawThreadInfosFromServerThreadInfos(\n{\nincludeVisibilityRules: hasCodeVersionBelow70,\nfilterMemberList: hasCodeVersionBelow70,\n- shimThreadTypes: hasCodeVersionBelow86 ? shimCommunityRoot : null,\n+ shimThreadTypes: hasCodeVersionBelow87 ? shimCommunityRoot : null,\n},\n);\nif (threadInfo) {\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -696,7 +696,7 @@ async function joinThread(\n}\n// TODO: determine code version\n- const hasCodeVersionBelow86 = !hasMinCodeVersion(viewer.platformDetails, 86);\n+ const hasCodeVersionBelow87 = !hasMinCodeVersion(viewer.platformDetails, 87);\nconst hasCodeVersionBelow62 = !hasMinCodeVersion(viewer.platformDetails, 62);\nconst { calendarQuery } = request;\n@@ -709,7 +709,7 @@ async function joinThread(\nnewUpdates: [],\n},\n};\n- if (calendarQuery && hasCodeVersionBelow86) {\n+ if (calendarQuery && hasCodeVersionBelow87) {\nresponse.rawEntryInfos = [];\n}\nif (hasCodeVersionBelow62) {\n@@ -750,7 +750,7 @@ async function joinThread(\nthreadCursors: { [request.threadID]: false },\n};\n- if (!hasCodeVersionBelow86) {\n+ if (!hasCodeVersionBelow87) {\nreturn {\nrawMessageInfos: newMessages,\ntruncationStatuses: {},\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Continue pushing back the launch of some features Summary: Similar to D1276 and D1294. Realized I'll need to make another release (see comment in D1320)... Test Plan: Flow Reviewers: palys-swm, karol-bisztyga, atul Reviewed By: atul Subscribers: KatPo, Adrian Differential Revision: https://phabricator.ashoat.com/D1321
129,187
01.06.2021 14:07:42
14,400
d5d518b1b5a661e0678d65a61ef0ccd883b27aad
[lib] Add string for community ThreadTypes to threadLabel Test Plan: Flow Reviewers: atul, palys-swm Subscribers: KatPo, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -818,6 +818,12 @@ function threadLabel(threadType: ThreadType) {\nreturn 'Sidebar';\n} else if (threadType === threadTypes.PRIVATE) {\nreturn 'Private';\n+ } else if (\n+ threadType === threadTypes.COMMUNITY_ROOT ||\n+ threadType === threadTypes.COMMUNITY_ANNOUNCEMENT_ROOT ||\n+ threadType === threadTypes.GENESIS\n+ ) {\n+ return 'Community';\n} else {\nreturn 'Secret';\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Add string for community ThreadTypes to threadLabel Test Plan: Flow Reviewers: atul, palys-swm Reviewed By: atul Subscribers: KatPo, Adrian Differential Revision: https://phabricator.ashoat.com/D1327
129,184
01.06.2021 09:43:19
14,400
e40af1864494cf6faa69db514b25681297a15f02
[native] Introduce `thread-settings-ancestors` component Summary: Here's what it looks like: Test Plan: Looks as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "native/chat/settings/thread-settings-ancestors.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { Text, View, ScrollView } from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome5';\n+\n+import { memberHasAdminPowers } from 'lib/shared/thread-utils';\n+import { type ThreadInfo, type MemberInfo } from 'lib/types/thread-types';\n+\n+import { useSelector } from '../../redux/redux-utils';\n+import { useStyles } from '../../themes/colors';\n+\n+type Props = {|\n+ +ancestorThreads: $ReadOnlyArray<ThreadInfo>,\n+|};\n+function ThreadSettingsAncestors(props: Props) {\n+ const { ancestorThreads } = props;\n+ const styles = useStyles(unboundStyles);\n+ const userInfos = useSelector((state) => state.userStore.userInfos);\n+\n+ const parentAdmin: ?string = React.useMemo(() => {\n+ for (const member: MemberInfo of ancestorThreads[0].members) {\n+ if (memberHasAdminPowers(member)) {\n+ return userInfos[member.id].username;\n+ }\n+ }\n+ }, [ancestorThreads, userInfos]);\n+\n+ const pathElements = [];\n+ for (const [idx, threadInfo] of ancestorThreads.entries()) {\n+ if (idx === ancestorThreads.length - 1) {\n+ pathElements.push(\n+ <View key={threadInfo.id} style={styles.pathItem}>\n+ <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n+ </View>,\n+ );\n+ } else {\n+ pathElements.push(\n+ <View key={threadInfo.id} style={styles.pathItem}>\n+ <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n+ <Icon\n+ name=\"chevron-right\"\n+ size={12}\n+ color=\"white\"\n+ style={styles.arrowIcon}\n+ />\n+ </View>,\n+ );\n+ }\n+ }\n+\n+ let adminLabel;\n+ if (parentAdmin) {\n+ adminLabel = (\n+ <View style={styles.adminBadge}>\n+ <Icon name=\"cloud\" size={12} color=\"white\" style={styles.cloudIcon} />\n+ <Text style={styles.adminName}>{parentAdmin}</Text>\n+ </View>\n+ );\n+ }\n+\n+ return (\n+ <View style={styles.cell}>\n+ <Text style={styles.label}>Path</Text>\n+ <ScrollView horizontal={true}>\n+ <View style={styles.pathItem}>\n+ {adminLabel}\n+ {pathElements}\n+ </View>\n+ </ScrollView>\n+ </View>\n+ );\n+}\n+\n+const unboundStyles = {\n+ adminBadge: {\n+ fontSize: 16,\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ backgroundColor: 'codeBackground',\n+ paddingHorizontal: 8,\n+ paddingVertical: 4,\n+ borderRadius: 8,\n+ },\n+ adminName: {\n+ fontSize: 16,\n+ fontWeight: 'bold',\n+ color: 'panelForegroundLabel',\n+ },\n+ cell: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ paddingHorizontal: 24,\n+ backgroundColor: 'panelForeground',\n+ },\n+ label: {\n+ fontSize: 16,\n+ width: 96,\n+ color: 'panelForegroundTertiaryLabel',\n+ },\n+ pathItem: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ height: 40,\n+ },\n+ pathLabel: {\n+ fontSize: 16,\n+ paddingLeft: 8,\n+ fontWeight: 'bold',\n+ color: 'panelForegroundSecondaryLabel',\n+ },\n+ cloudIcon: {\n+ paddingRight: 8,\n+ },\n+ arrowIcon: {\n+ paddingLeft: 8,\n+ },\n+};\n+\n+export default ThreadSettingsAncestors;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Introduce `thread-settings-ancestors` component Summary: Here's what it looks like: https://blob.sh/atul/thead-ancestors.mp4 Test Plan: Looks as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1328
129,184
01.06.2021 16:34:04
14,400
b71287438ed288be2fa5dd24f51efdb175389828
[native] Introduce `baseAncestorThreadInfos` selector and add ancestor path to `thread-settings` Test Plan: Path appears as expected. Tested with threads with many ancestors and no ancestors (genesis) Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/thread-selectors.js", "new_path": "lib/selectors/thread-selectors.js", "diff": "@@ -240,6 +240,27 @@ const unreadBackgroundCount: (\n).length,\n);\n+const baseAncestorThreadInfos = (threadID: string) =>\n+ createSelector(\n+ (state: BaseAppState<*>) => threadInfoSelector(state),\n+ (threadInfos: { [id: string]: ThreadInfo }): $ReadOnlyArray<ThreadInfo> => {\n+ const pathComponents: ThreadInfo[] = [];\n+ let node: ?ThreadInfo = threadInfos[threadID];\n+ while (node) {\n+ pathComponents.push(node);\n+ node = node.parentThreadID ? threadInfos[node.parentThreadID] : null;\n+ }\n+ pathComponents.reverse();\n+ return pathComponents;\n+ },\n+ );\n+\n+const ancestorThreadInfos: (\n+ threadID: string,\n+) => (state: BaseAppState<*>) => $ReadOnlyArray<ThreadInfo> = _memoize(\n+ baseAncestorThreadInfos,\n+);\n+\nconst baseOtherUsersButNoOtherAdmins = (threadID: string) =>\ncreateSelector(\n(state: BaseAppState<*>) => state.threadStore.threadInfos[threadID],\n@@ -371,6 +392,7 @@ const pendingToRealizedThreadIDsSelector: (rawThreadInfos: {\n);\nexport {\n+ ancestorThreadInfos,\nthreadInfoSelector,\nonScreenThreadInfos,\nonScreenEntryEditableThreadInfos,\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -15,6 +15,7 @@ import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport {\nthreadInfoSelector,\nchildThreadInfos,\n+ ancestorThreadInfos,\n} from 'lib/selectors/thread-selectors';\nimport { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';\nimport { getAvailableRelationshipButtons } from 'lib/shared/relationship-utils';\n@@ -58,6 +59,7 @@ import {\nimport type { VerticalBounds } from '../../types/layout-types';\nimport type { ViewStyle } from '../../types/styles';\nimport type { ChatNavigationProp } from '../chat.react';\n+import ThreadSettingsAncestors from './thread-settings-ancestors.react';\nimport type { CategoryType } from './thread-settings-category.react';\nimport {\nThreadSettingsCategoryHeader,\n@@ -141,6 +143,11 @@ type ChatSettingsItem =\n+key: string,\n+threadInfo: ThreadInfo,\n|}\n+ | {|\n+ +itemType: 'ancestors',\n+ +key: string,\n+ +ancestorThreads: $ReadOnlyArray<ThreadInfo>,\n+ |}\n| {|\n+itemType: 'pushNotifs',\n+key: string,\n@@ -210,6 +217,7 @@ type Props = {|\n+userInfos: UserInfos,\n+viewerID: ?string,\n+threadInfo: ?ThreadInfo,\n+ +ancestorThreads: $ReadOnlyArray<ThreadInfo>,\n+parentThreadInfo: ?ThreadInfo,\n+threadMembers: $ReadOnlyArray<RelativeMemberInfo>,\n+childThreadInfos: ?$ReadOnlyArray<ThreadInfo>,\n@@ -335,6 +343,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nthreadBasicsListDataSelector = createSelector(\n(propsAndState: PropsAndState) =>\nThreadSettings.getThreadInfo(propsAndState),\n+ (propsAndState: PropsAndState) => propsAndState.ancestorThreads,\n(propsAndState: PropsAndState) => propsAndState.parentThreadInfo,\n(propsAndState: PropsAndState) => propsAndState.nameEditValue,\n(propsAndState: PropsAndState) => propsAndState.colorEditValue,\n@@ -345,6 +354,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n(propsAndState: PropsAndState) => propsAndState.route.key,\n(\nthreadInfo: ThreadInfo,\n+ ancestorThreads: $ReadOnlyArray<ThreadInfo>,\nparentThreadInfo: ?ThreadInfo,\nnameEditValue: ?string,\ncolorEditValue: string,\n@@ -435,6 +445,11 @@ class ThreadSettings extends React.PureComponent<Props, State> {\ntitle: 'Privacy',\ncategoryType: 'full',\n});\n+ listData.push({\n+ itemType: 'visibility',\n+ key: 'visibility',\n+ threadInfo,\n+ });\nlistData.push({\nitemType: 'parent',\nkey: 'parent',\n@@ -443,9 +458,9 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nnavigate,\n});\nlistData.push({\n- itemType: 'visibility',\n- key: 'visibility',\n- threadInfo,\n+ itemType: 'ancestors',\n+ key: 'ancestors',\n+ ancestorThreads,\n});\nlistData.push({\nitemType: 'footer',\n@@ -914,6 +929,8 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n);\n} else if (item.itemType === 'visibility') {\nreturn <ThreadSettingsVisibility threadInfo={item.threadInfo} />;\n+ } else if (item.itemType === 'ancestors') {\n+ return <ThreadSettingsAncestors ancestorThreads={item.ancestorThreads} />;\n} else if (item.itemType === 'pushNotifs') {\nreturn <ThreadSettingsPushNotifs threadInfo={item.threadInfo} />;\n} else if (item.itemType === 'homeNotifs') {\n@@ -1115,6 +1132,10 @@ export default React.memo<BaseProps>(function ConnectedThreadSettings(\nconst parentThreadInfo: ?ThreadInfo = useSelector((state) =>\nparentThreadID ? threadInfoSelector(state)[parentThreadID] : null,\n);\n+\n+ const ancestorThreads: $ReadOnlyArray<ThreadInfo> = useSelector(\n+ ancestorThreadInfos(threadID),\n+ );\nconst threadMembers = useSelector(\nrelativeMemberInfoSelectorForMembersOfThread(threadID),\n);\n@@ -1134,6 +1155,7 @@ export default React.memo<BaseProps>(function ConnectedThreadSettings(\nuserInfos={userInfos}\nviewerID={viewerID}\nthreadInfo={threadInfo}\n+ ancestorThreads={ancestorThreads}\nparentThreadInfo={parentThreadInfo}\nthreadMembers={threadMembers}\nchildThreadInfos={boundChildThreadInfos}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Introduce `baseAncestorThreadInfos` selector and add ancestor path to `thread-settings` Test Plan: Path appears as expected. Tested with threads with many ancestors and no ancestors (genesis) Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1329
129,191
31.05.2021 13:38:18
-7,200
6762465ae9f721c086bcccac4887c34242a8210d
[server] Use multipleStatements mode in account deletion indexes script Summary: Without multipleStatements mode an error is returned `You have an error in your SQL syntax...`. Enabling multipleStatements fixes the issue. Test Plan: Run the script and check if indexes were added Reviewers: ashoat Subscribers: KatPo, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/add-indexes-for-account-deletion.js", "new_path": "server/src/scripts/add-indexes-for-account-deletion.js", "diff": "// @flow\nimport { dbQuery, SQL } from '../database/database';\n+import { setScriptContext } from './script-context';\nimport { main } from './utils';\n+setScriptContext({\n+ allowMultiStatementSQLQueries: true,\n+});\n+\nasync function addIndexes() {\nawait dbQuery(SQL`\nALTER TABLE memberships ADD INDEX user (user);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Use multipleStatements mode in account deletion indexes script Summary: Without multipleStatements mode an error is returned `You have an error in your SQL syntax...`. Enabling multipleStatements fixes the issue. Test Plan: Run the script and check if indexes were added Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1319
129,184
02.06.2021 11:08:04
14,400
88fc77db44169bdb319c528e1d1ee8f0ab0ae150
[native] Only send crash reports when staff or dev Test Plan: Tested with different scenarios (staff and dev, staff and !dev, etc) and logged to ensure crash reports only sent when expected. Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/crash.react.js", "new_path": "native/crash.react.js", "diff": "@@ -18,6 +18,7 @@ import Icon from 'react-native-vector-icons/FontAwesome';\nimport { sendReportActionTypes, sendReport } from 'lib/actions/report-actions';\nimport { logOutActionTypes, logOut } from 'lib/actions/user-actions';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\n+import { isStaff } from 'lib/shared/user-utils';\nimport type { LogOutResult } from 'lib/types/account-types';\nimport type { ErrorData } from 'lib/types/report-types';\nimport {\n@@ -26,6 +27,7 @@ import {\nreportTypes,\n} from 'lib/types/report-types';\nimport type { PreRequestUserState } from 'lib/types/session-types';\n+import { type CurrentUserInfo } from 'lib/types/user-types';\nimport { actionLogger } from 'lib/utils/action-logger';\nimport {\ntype DispatchActionPromise,\n@@ -57,6 +59,7 @@ type Props = {|\nrequest: ClientReportCreationRequest,\n) => Promise<ReportCreationResponse>,\n+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,\n+ +currentUserInfo: ?CurrentUserInfo,\n|};\ntype State = {|\n+errorReportID: ?string,\n@@ -64,12 +67,22 @@ type State = {|\n|};\nclass Crash extends React.PureComponent<Props, State> {\nerrorTitle = _shuffle(errorTitles)[0];\n- state: State = {\n- errorReportID: null,\n- doneWaiting: false,\n- };\n+\n+ constructor(props) {\n+ super(props);\n+\n+ const doneWaiting = !(\n+ (props.currentUserInfo && isStaff(props.currentUserInfo.id)) ||\n+ __DEV__\n+ );\n+\n+ this.state = { errorReportID: null, doneWaiting };\n+ }\ncomponentDidMount() {\n+ if (this.state.doneWaiting) {\n+ return;\n+ }\nthis.props.dispatchActionPromise(sendReportActionTypes, this.sendReport());\nthis.timeOut();\n}\n@@ -87,19 +100,22 @@ class Crash extends React.PureComponent<Props, State> {\n.join('\\n');\nlet crashID;\n- if (this.state.errorReportID) {\n+ if (!this.state.doneWaiting) {\n+ crashID = <ActivityIndicator size=\"small\" color=\"black\" />;\n+ } else if (this.state.doneWaiting && this.state.errorReportID) {\ncrashID = (\n- <React.Fragment>\n+ <View style={styles.crashID}>\n+ <Text style={styles.crashIDText}>Crash report ID:</Text>\n+ <View style={styles.errorReportID}>\n<Text style={styles.errorReportIDText}>\n{this.state.errorReportID}\n</Text>\n<Button onPress={this.onCopyCrashReportID}>\n<Text style={styles.copyCrashReportIDButtonText}>(Copy)</Text>\n</Button>\n- </React.Fragment>\n+ </View>\n+ </View>\n);\n- } else {\n- crashID = <ActivityIndicator size=\"small\" color=\"black\" />;\n}\nconst buttonStyle = { opacity: Number(this.state.doneWaiting) };\n@@ -110,10 +126,7 @@ class Crash extends React.PureComponent<Props, State> {\n<Icon name=\"bug\" size={32} color=\"red\" />\n<Text style={styles.header}>{this.errorTitle}</Text>\n<Text style={styles.text}>I&apos;m sorry, but the app crashed.</Text>\n- <View style={styles.crashID}>\n- <Text style={styles.crashIDText}>Crash report ID:</Text>\n- <View style={styles.errorReportID}>{crashID}</View>\n- </View>\n+ {crashID}\n<Text style={styles.text}>\nHere&apos;s some text that&apos;s probably not helpful:\n</Text>\n@@ -254,6 +267,7 @@ export default React.memo<BaseProps>(function ConnectedCrash(props: BaseProps) {\nconst dispatchActionPromise = useDispatchActionPromise();\nconst callSendReport = useServerCall(sendReport);\nconst callLogOut = useServerCall(logOut);\n+ const currentUserInfo = useSelector((state) => state.currentUserInfo);\nreturn (\n<Crash\n{...props}\n@@ -261,6 +275,7 @@ export default React.memo<BaseProps>(function ConnectedCrash(props: BaseProps) {\ndispatchActionPromise={dispatchActionPromise}\nsendReport={callSendReport}\nlogOut={callLogOut}\n+ currentUserInfo={currentUserInfo}\n/>\n);\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Only send crash reports when staff or dev Test Plan: Tested with different scenarios (staff and dev, staff and !dev, etc) and logged to ensure crash reports only sent when expected. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1330
129,184
02.06.2021 15:43:59
14,400
08471ce68a9758c59de495018370fc08e4afb42a
Add `require-valid-file-annotation` rule to eslint Summary: Added `require-valid-file-annotation` rule to eslint as suggested by (https://phabricator.ashoat.com/D1331#31510) Test Plan: Removed `@flow` annotation from a file, ran eslint, got an error as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, ashoat, Adrian
[ { "change_type": "MODIFY", "old_path": ".eslintrc.json", "new_path": ".eslintrc.json", "diff": "\"parser\": \"babel-eslint\",\n\"plugins\": [\"react\", \"react-hooks\", \"flowtype\", \"monorepo\", \"import\"],\n\"rules\": {\n+ \"flowtype/require-valid-file-annotation\": [\"error\", \"always\"],\n\"curly\": \"error\",\n\"linebreak-style\": \"error\",\n\"semi\": \"error\",\n\"order\": \"asc\",\n\"caseInsensitive\": true\n},\n- \"groups\": [\n- [\"builtin\", \"external\"],\n- \"internal\"\n- ]\n+ \"groups\": [[\"builtin\", \"external\"], \"internal\"]\n}\n],\n\"prefer-const\": \"error\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Add `require-valid-file-annotation` rule to eslint Summary: Added `require-valid-file-annotation` rule to eslint as suggested by @ashoat (https://phabricator.ashoat.com/D1331#31510) Test Plan: Removed `@flow` annotation from a file, ran eslint, got an error as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, ashoat, Adrian Differential Revision: https://phabricator.ashoat.com/D1332
129,184
02.06.2021 18:15:27
14,400
ae1402fa636adcb90faeca2e4684a5dec4a35a6e
[lib] Fix eslint unused import in `calendar-query-handler` Test Plan: NA Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/socket/calendar-query-handler.react.js", "new_path": "lib/socket/calendar-query-handler.react.js", "diff": "@@ -14,7 +14,6 @@ import type {\nCalendarQueryUpdateResult,\nCalendarQueryUpdateStartingPayload,\n} from '../types/entry-types';\n-import { type LifecycleState } from '../types/lifecycle-state-types';\nimport { type ConnectionInfo } from '../types/socket-types';\nimport {\ntype DispatchActionPromise,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Fix eslint unused import in `calendar-query-handler` Test Plan: NA Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1333
129,184
02.06.2021 18:57:44
14,400
406ef39753993a229023dafe4726cbd2aad7f545
[lib][web][native] add `crashReportsEnabled` to redux Test Plan: Verified with redux devtools Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "lib/reducers/crash-reports-enabled-reducer.js", "diff": "+// @flow\n+\n+import type { BaseAction } from '../types/redux-types';\n+\n+export const updateCrashReportsEnabledActionType =\n+ 'UPDATE_CRASH_REPORTS_ENABLED';\n+\n+export default function reduceCrashReportsEnabled(\n+ state: boolean,\n+ action: BaseAction,\n+): boolean {\n+ if (action.type === updateCrashReportsEnabledActionType) {\n+ return action.payload;\n+ }\n+ return state;\n+}\n" }, { "change_type": "MODIFY", "old_path": "lib/reducers/master-reducer.js", "new_path": "lib/reducers/master-reducer.js", "diff": "@@ -13,6 +13,7 @@ import {\n} from '../types/socket-types';\nimport reduceCalendarFilters from './calendar-filters-reducer';\nimport reduceConnectionInfo from './connection-reducer';\n+import reduceCrashReportsEnabled from './crash-reports-enabled-reducer';\nimport reduceDataLoaded from './data-loaded-reducer';\nimport reduceEnabledApps from './enabled-apps-reducer';\nimport { reduceEntryInfos } from './entry-reducer';\n@@ -80,6 +81,10 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\nconnection,\nlifecycleState: reduceLifecycleState(state.lifecycleState, action),\nenabledApps: reduceEnabledApps(state.enabledApps, action),\n+ crashReportsEnabled: reduceCrashReportsEnabled(\n+ state.crashReportsEnabled,\n+ action,\n+ ),\nnextLocalID: reduceNextLocalID(state.nextLocalID, action),\nqueuedReports: reduceQueuedReports(state.queuedReports, action),\ndataLoaded: reduceDataLoaded(state.dataLoaded, action),\n" }, { "change_type": "MODIFY", "old_path": "lib/types/redux-types.js", "new_path": "lib/types/redux-types.js", "diff": "@@ -87,6 +87,7 @@ export type BaseAppState<NavInfo: BaseNavInfo> = {\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\nenabledApps: EnabledApps,\n+ crashReportsEnabled: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ndataLoaded: boolean,\n@@ -741,6 +742,10 @@ export type BaseAction =\n+type: 'DISABLE_APP',\n+payload: SupportedApps,\n|}\n+ | {|\n+ +type: 'UPDATE_CRASH_REPORTS_ENABLED',\n+ +payload: boolean,\n+ |}\n| {|\n+type: 'PROCESS_UPDATES',\n+payload: UpdatesResultWithUserInfos,\n" }, { "change_type": "MODIFY", "old_path": "native/redux/persist.js", "new_path": "native/redux/persist.js", "diff": "@@ -213,6 +213,10 @@ const migrations = {\n...state,\nenabledApps: defaultEnabledApps,\n}),\n+ [25]: (state) => ({\n+ ...state,\n+ crashReportsEnabled: __DEV__,\n+ }),\n};\nconst persistConfig = {\n@@ -227,7 +231,7 @@ const persistConfig = {\n'frozen',\n],\ndebug: __DEV__,\n- version: 24,\n+ version: 25,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\ntimeout: __DEV__ ? 0 : undefined,\n};\n" }, { "change_type": "MODIFY", "old_path": "native/redux/redux-setup.js", "new_path": "native/redux/redux-setup.js", "diff": "@@ -110,6 +110,7 @@ export type AppState = {|\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\nenabledApps: EnabledApps,\n+ crashReportsEnabled: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\n_persist: ?PersistState,\n@@ -159,6 +160,7 @@ const defaultState = ({\nwatchedThreadIDs: [],\nlifecycleState: 'active',\nenabledApps: defaultEnabledApps,\n+ crashReportsEnabled: __DEV__,\nnextLocalID: 0,\nqueuedReports: [],\n_persist: null,\n" }, { "change_type": "MODIFY", "old_path": "server/src/responders/website-responders.js", "new_path": "server/src/responders/website-responders.js", "diff": "@@ -278,6 +278,7 @@ async function websiteResponder(\nwatchedThreadIDs: [],\nlifecycleState: 'active',\nenabledApps: defaultWebEnabledApps,\n+ crashReportsEnabled: false,\nnextLocalID: 0,\nqueuedReports: [],\ntimeZone: viewer.timeZone,\n" }, { "change_type": "MODIFY", "old_path": "web/redux/redux-setup.js", "new_path": "web/redux/redux-setup.js", "diff": "@@ -52,6 +52,7 @@ export type AppState = {|\nwatchedThreadIDs: $ReadOnlyArray<string>,\nlifecycleState: LifecycleState,\nenabledApps: EnabledApps,\n+ crashReportsEnabled: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ntimeZone: ?string,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib][web][native] add `crashReportsEnabled` to redux Test Plan: Verified with redux devtools Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1335
129,184
02.06.2021 21:56:27
14,400
7ff4eea99d6e830c18bc08bf906d428d6cc50cdf
[native] Introduce `useIsCrashReportingEnabled` hook and use in `crash.react.js` Test Plan: Toggled `crashReportingEnabled` on/off and the `crash` component behaved/looked as expected when crash was manually triggered from dev menu Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/crash.react.js", "new_path": "native/crash.react.js", "diff": "@@ -18,7 +18,6 @@ import Icon from 'react-native-vector-icons/FontAwesome';\nimport { sendReportActionTypes, sendReport } from 'lib/actions/report-actions';\nimport { logOutActionTypes, logOut } from 'lib/actions/user-actions';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\n-import { isStaff } from 'lib/shared/user-utils';\nimport type { LogOutResult } from 'lib/types/account-types';\nimport type { ErrorData } from 'lib/types/report-types';\nimport {\n@@ -27,7 +26,6 @@ import {\nreportTypes,\n} from 'lib/types/report-types';\nimport type { PreRequestUserState } from 'lib/types/session-types';\n-import { type CurrentUserInfo } from 'lib/types/user-types';\nimport { actionLogger } from 'lib/utils/action-logger';\nimport {\ntype DispatchActionPromise,\n@@ -41,7 +39,7 @@ import Button from './components/button.react';\nimport ConnectedStatusBar from './connected-status-bar.react';\nimport { persistConfig, codeVersion } from './redux/persist';\nimport { useSelector } from './redux/redux-utils';\n-import { wipeAndExit } from './utils/crash-utils';\n+import { useIsCrashReportingEnabled, wipeAndExit } from './utils/crash-utils';\nconst errorTitles = ['Oh no!!', 'Womp womp womp...'];\n@@ -59,7 +57,7 @@ type Props = {|\nrequest: ClientReportCreationRequest,\n) => Promise<ReportCreationResponse>,\n+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,\n- +currentUserInfo: ?CurrentUserInfo,\n+ +crashReportingEnabled: boolean,\n|};\ntype State = {|\n+errorReportID: ?string,\n@@ -70,13 +68,10 @@ class Crash extends React.PureComponent<Props, State> {\nconstructor(props) {\nsuper(props);\n-\n- const doneWaiting = !(\n- (props.currentUserInfo && isStaff(props.currentUserInfo.id)) ||\n- __DEV__\n- );\n-\n- this.state = { errorReportID: null, doneWaiting };\n+ this.state = {\n+ errorReportID: null,\n+ doneWaiting: !props.crashReportingEnabled,\n+ };\n}\ncomponentDidMount() {\n@@ -116,6 +111,12 @@ class Crash extends React.PureComponent<Props, State> {\n</View>\n</View>\n);\n+ } else {\n+ crashID = (\n+ <Text style={styles.text}>\n+ Crash reporting can be enabled in the Profile tab.\n+ </Text>\n+ );\n}\nconst buttonStyle = { opacity: Number(this.state.doneWaiting) };\n@@ -267,7 +268,7 @@ export default React.memo<BaseProps>(function ConnectedCrash(props: BaseProps) {\nconst dispatchActionPromise = useDispatchActionPromise();\nconst callSendReport = useServerCall(sendReport);\nconst callLogOut = useServerCall(logOut);\n- const currentUserInfo = useSelector((state) => state.currentUserInfo);\n+ const crashReportingEnabled = useIsCrashReportingEnabled();\nreturn (\n<Crash\n{...props}\n@@ -275,7 +276,7 @@ export default React.memo<BaseProps>(function ConnectedCrash(props: BaseProps) {\ndispatchActionPromise={dispatchActionPromise}\nsendReport={callSendReport}\nlogOut={callLogOut}\n- currentUserInfo={currentUserInfo}\n+ crashReportingEnabled={crashReportingEnabled}\n/>\n);\n});\n" }, { "change_type": "MODIFY", "old_path": "native/utils/crash-utils.js", "new_path": "native/utils/crash-utils.js", "diff": "import AsyncStorage from '@react-native-community/async-storage';\nimport ExitApp from 'react-native-exit-app';\n+import { useSelector } from 'lib/utils/redux-utils';\nimport sleep from 'lib/utils/sleep';\nimport { navStateAsyncStorageKey } from '../navigation/persistance';\n@@ -17,4 +18,8 @@ async function wipeAndExit() {\nExitApp.exitApp();\n}\n-export { wipeAndExit };\n+function useIsCrashReportingEnabled(): boolean {\n+ return useSelector((state) => state.crashReportsEnabled);\n+}\n+\n+export { wipeAndExit, useIsCrashReportingEnabled };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Introduce `useIsCrashReportingEnabled` hook and use in `crash.react.js` Test Plan: Toggled `crashReportingEnabled` on/off and the `crash` component behaved/looked as expected when crash was manually triggered from dev menu Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1337
129,184
02.06.2021 19:45:27
14,400
47de31ad201ad3bcb32c7f6e38bd31bebbb7e05a
[native] Introduce `toggle-crash-reports` component and include in `profile-screen` Summary: Note: The `toggle-crash-reports` component will be moved to a separate page in a subsequent diff. Test Plan: Toggled the switch on/off and observed redux dev tools to confirm state changed as expected Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/profile/profile-screen.react.js", "new_path": "native/profile/profile-screen.react.js", "diff": "@@ -51,6 +51,7 @@ import {\nimport { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\nimport type { ProfileNavigationProp } from './profile.react';\n+import ToggleCrashReports from './toggle-crash-reports.react';\ntype BaseProps = {|\n+navigation: ProfileNavigationProp<'ProfileScreen'>,\n@@ -267,6 +268,11 @@ class ProfileScreen extends React.PureComponent<Props> {\n{appearancePreferences}\n+ <Text style={this.props.styles.header}>PRIVACY</Text>\n+ <View style={this.props.styles.slightlyPaddedSection}>\n+ <ToggleCrashReports />\n+ </View>\n+\n<View style={this.props.styles.slightlyPaddedSection}>\n<Button\nonPress={this.onPressBuildInfo}\n@@ -500,6 +506,7 @@ const unboundStyles = {\nflexDirection: 'row',\npaddingHorizontal: 24,\npaddingVertical: 10,\n+ alignItems: 'center',\n},\nsubmenuText: {\ncolor: 'panelForegroundLabel',\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/profile/toggle-crash-reports.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { Text, View, Switch } from 'react-native';\n+import { useDispatch } from 'react-redux';\n+\n+import { updateCrashReportsEnabledActionType } from 'lib/reducers/crash-reports-enabled-reducer';\n+\n+import { useStyles } from '../themes/colors';\n+import { useIsCrashReportingEnabled } from '../utils/crash-utils';\n+\n+function ToggleCrashReports() {\n+ const styles = useStyles(unboundStyles);\n+ const dispatch = useDispatch();\n+ const crashReportsEnabled = useIsCrashReportingEnabled();\n+\n+ const onCrashReportsToggled = React.useCallback(\n+ (value) => {\n+ dispatch({ type: updateCrashReportsEnabledActionType, payload: value });\n+ },\n+ [dispatch],\n+ );\n+\n+ return (\n+ <View style={styles.submenuButton}>\n+ <Text style={styles.submenuText}>Send crash reports</Text>\n+ <Switch\n+ value={crashReportsEnabled}\n+ onValueChange={onCrashReportsToggled}\n+ />\n+ </View>\n+ );\n+}\n+\n+const unboundStyles = {\n+ submenuButton: {\n+ flexDirection: 'row',\n+ paddingHorizontal: 24,\n+ paddingVertical: 10,\n+ alignItems: 'center',\n+ },\n+ submenuText: {\n+ color: 'panelForegroundLabel',\n+ flex: 1,\n+ fontSize: 16,\n+ },\n+};\n+\n+export default ToggleCrashReports;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Introduce `toggle-crash-reports` component and include in `profile-screen` Summary: Note: The `toggle-crash-reports` component will be moved to a separate page in a subsequent diff. Test Plan: Toggled the switch on/off and observed redux dev tools to confirm state changed as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1336
129,184
03.06.2021 19:07:19
14,400
bd0686a9c0bf7892d47dee5f8d61294997160a2e
[native] Extract `thread-ancestors` component out of `thread-settings-ancestors` Summary: Simple cut/paste refactor, sets things up for subsequent diffs. Test Plan: `thread-ancestors` continued to look and work as expected. should be simple cut/paste diff Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-ancestors.react.js", "new_path": "native/chat/settings/thread-settings-ancestors.react.js", "diff": "// @flow\nimport * as React from 'react';\n-import { Text, View, ScrollView } from 'react-native';\n-import Icon from 'react-native-vector-icons/FontAwesome5';\n+import { Text, View } from 'react-native';\n-import { memberHasAdminPowers } from 'lib/shared/thread-utils';\n-import { type ThreadInfo, type MemberInfo } from 'lib/types/thread-types';\n+import { type ThreadInfo } from 'lib/types/thread-types';\n-import { useSelector } from '../../redux/redux-utils';\n+import ThreadAncestors from '../../components/thread-ancestors.react';\nimport { useStyles } from '../../themes/colors';\ntype Props = {|\n@@ -16,77 +14,16 @@ type Props = {|\nfunction ThreadSettingsAncestors(props: Props) {\nconst { ancestorThreads } = props;\nconst styles = useStyles(unboundStyles);\n- const userInfos = useSelector((state) => state.userStore.userInfos);\n-\n- const parentAdmin: ?string = React.useMemo(() => {\n- for (const member: MemberInfo of ancestorThreads[0].members) {\n- if (memberHasAdminPowers(member)) {\n- return userInfos[member.id].username;\n- }\n- }\n- }, [ancestorThreads, userInfos]);\n-\n- const pathElements = [];\n- for (const [idx, threadInfo] of ancestorThreads.entries()) {\n- if (idx === ancestorThreads.length - 1) {\n- pathElements.push(\n- <View key={threadInfo.id} style={styles.pathItem}>\n- <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n- </View>,\n- );\n- } else {\n- pathElements.push(\n- <View key={threadInfo.id} style={styles.pathItem}>\n- <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n- <Icon\n- name=\"chevron-right\"\n- size={12}\n- color=\"white\"\n- style={styles.arrowIcon}\n- />\n- </View>,\n- );\n- }\n- }\n-\n- let adminLabel;\n- if (parentAdmin) {\n- adminLabel = (\n- <View style={styles.adminBadge}>\n- <Icon name=\"cloud\" size={12} color=\"white\" style={styles.cloudIcon} />\n- <Text style={styles.adminName}>{parentAdmin}</Text>\n- </View>\n- );\n- }\nreturn (\n<View style={styles.cell}>\n<Text style={styles.label}>Path</Text>\n- <ScrollView horizontal={true}>\n- <View style={styles.pathItem}>\n- {adminLabel}\n- {pathElements}\n- </View>\n- </ScrollView>\n+ <ThreadAncestors ancestorThreads={ancestorThreads} />\n</View>\n);\n}\nconst unboundStyles = {\n- adminBadge: {\n- fontSize: 16,\n- flexDirection: 'row',\n- alignItems: 'center',\n- backgroundColor: 'codeBackground',\n- paddingHorizontal: 8,\n- paddingVertical: 4,\n- borderRadius: 8,\n- },\n- adminName: {\n- fontSize: 16,\n- fontWeight: 'bold',\n- color: 'panelForegroundLabel',\n- },\ncell: {\nflexDirection: 'row',\nalignItems: 'center',\n@@ -98,23 +35,6 @@ const unboundStyles = {\nwidth: 96,\ncolor: 'panelForegroundTertiaryLabel',\n},\n- pathItem: {\n- flexDirection: 'row',\n- alignItems: 'center',\n- height: 40,\n- },\n- pathLabel: {\n- fontSize: 16,\n- paddingLeft: 8,\n- fontWeight: 'bold',\n- color: 'panelForegroundSecondaryLabel',\n- },\n- cloudIcon: {\n- paddingRight: 8,\n- },\n- arrowIcon: {\n- paddingLeft: 8,\n- },\n};\nexport default ThreadSettingsAncestors;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/components/thread-ancestors.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { Text, View, ScrollView } from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome5';\n+\n+import { memberHasAdminPowers } from 'lib/shared/thread-utils';\n+import { type ThreadInfo, type MemberInfo } from 'lib/types/thread-types';\n+\n+import { useSelector } from '../redux/redux-utils';\n+import { useStyles } from '../themes/colors';\n+\n+type Props = {|\n+ +ancestorThreads: $ReadOnlyArray<ThreadInfo>,\n+|};\n+\n+function ThreadAncestors(props: Props) {\n+ const { ancestorThreads } = props;\n+ const styles = useStyles(unboundStyles);\n+ const userInfos = useSelector((state) => state.userStore.userInfos);\n+\n+ const parentAdmin: ?string = React.useMemo(() => {\n+ for (const member: MemberInfo of ancestorThreads[0].members) {\n+ if (memberHasAdminPowers(member)) {\n+ return userInfos[member.id].username;\n+ }\n+ }\n+ }, [ancestorThreads, userInfos]);\n+\n+ const pathElements = [];\n+ for (const [idx, threadInfo] of ancestorThreads.entries()) {\n+ if (idx === ancestorThreads.length - 1) {\n+ pathElements.push(\n+ <View key={threadInfo.id} style={styles.pathItem}>\n+ <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n+ </View>,\n+ );\n+ } else {\n+ pathElements.push(\n+ <View key={threadInfo.id} style={styles.pathItem}>\n+ <Text style={styles.pathLabel}>{threadInfo.uiName}</Text>\n+ <Icon\n+ name=\"chevron-right\"\n+ size={12}\n+ color=\"white\"\n+ style={styles.arrowIcon}\n+ />\n+ </View>,\n+ );\n+ }\n+ }\n+\n+ let adminLabel;\n+ if (parentAdmin) {\n+ adminLabel = (\n+ <View style={styles.adminBadge}>\n+ <Icon name=\"cloud\" size={12} color=\"white\" style={styles.cloudIcon} />\n+ <Text style={styles.adminName}>{parentAdmin}</Text>\n+ </View>\n+ );\n+ }\n+\n+ return (\n+ <ScrollView horizontal={true}>\n+ <View style={styles.pathItem}>\n+ {adminLabel}\n+ {pathElements}\n+ </View>\n+ </ScrollView>\n+ );\n+}\n+\n+const unboundStyles = {\n+ adminBadge: {\n+ fontSize: 16,\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ backgroundColor: 'codeBackground',\n+ paddingHorizontal: 8,\n+ paddingVertical: 4,\n+ borderRadius: 8,\n+ },\n+ adminName: {\n+ fontSize: 16,\n+ fontWeight: 'bold',\n+ color: 'panelForegroundLabel',\n+ },\n+ pathItem: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ height: 40,\n+ },\n+ pathLabel: {\n+ fontSize: 16,\n+ paddingLeft: 8,\n+ fontWeight: 'bold',\n+ color: 'panelForegroundSecondaryLabel',\n+ },\n+ cloudIcon: {\n+ paddingRight: 8,\n+ },\n+ arrowIcon: {\n+ paddingLeft: 8,\n+ },\n+};\n+\n+export default ThreadAncestors;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Extract `thread-ancestors` component out of `thread-settings-ancestors` Summary: Simple cut/paste refactor, sets things up for subsequent diffs. Test Plan: `thread-ancestors` continued to look and work as expected. should be simple cut/paste diff Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1343
129,202
04.06.2021 09:45:06
-28,800
75c589b8f40961b4e6784d88b20db0cdd73b46bb
Updating the README with the Ubuntu Setup information for Reactotron Summary: Issue reactotron#815 prevents reactotron to connect to the android emulator. Running adb reverse fixes the issue. Test Plan: Running the adb reverse command fixed the Issue on Ubuntu 20.04. Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian, atul
[ { "change_type": "MODIFY", "old_path": "docs/linux_dev_environment.md", "new_path": "docs/linux_dev_environment.md", "diff": "@@ -28,6 +28,20 @@ If you're not on Ubuntu, you can look for distro-specific binaries using your pr\nFollow installation instructions from [react-native-debugger/issues/116#issuecomment-475866514](https://github.com/jhen0409/react-native-debugger/issues/116#issuecomment-475866514)\n+## Reactotron\n+\n+Reactotron is an event tracker and logger that can be used to aid in debugging on React Native.\n+\n+Download and install the Reactotron package from their [release](https://github.com/infinitered/reactotron/blob/master/docs/installing.md) page.\n+\n+If Reactotron does not connect to the Android Emulator, run the following command and restart the Metro bundler:\n+\n+```\n+adb reverse tcp:9090 tcp:9090\n+```\n+\n+Read more information in the [Reactotron installation instructions](https://github.com/infinitered/reactotron/blob/master/docs/quick-start-react-native.md#configure-reactotron-with-your-project).\n+\n## phpMyAdmin\nInstall and run `phpmyadmin`\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Updating the README with the Ubuntu Setup information for Reactotron Summary: Issue reactotron#815 prevents reactotron to connect to the android emulator. Running adb reverse fixes the issue. Test Plan: Running the adb reverse command fixed the Issue on Ubuntu 20.04. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1340
129,184
07.06.2021 23:42:46
14,400
e95ece27b9323c4d61a5736dc27557df186f936c
[native] Move crash report toggling from main Profile page to separate Privacy page Test Plan: Toggled crash report preferences and confirmed expected behavior by looking at Redux dev tools and triggering crashes via Developer Tools Reviewers: ashoat Subscribers: KatPo, palys-swm, Adrian
[ { "change_type": "MODIFY", "old_path": "native/navigation/route-names.js", "new_path": "native/navigation/route-names.js", "diff": "@@ -48,6 +48,7 @@ export const DevToolsRouteName = 'DevTools';\nexport const EditEmailRouteName = 'EditEmail';\nexport const EditPasswordRouteName = 'EditPassword';\nexport const AppearancePreferencesRouteName = 'AppearancePreferences';\n+export const PrivacyPreferencesRouteName = 'PrivacyPreferences';\nexport const ThreadPickerModalRouteName = 'ThreadPickerModal';\nexport const AddUsersModalRouteName = 'AddUsersModal';\nexport const CustomServerModalRouteName = 'CustomServerModal';\n@@ -126,6 +127,7 @@ export type ProfileParamList = {|\n+BuildInfo: void,\n+DevTools: void,\n+AppearancePreferences: void,\n+ +PrivacyPreferences: void,\n+FriendList: void,\n+BlockList: void,\n|};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/profile/privacy-preferences.react.js", "diff": "+// @flow\n+\n+import * as React from 'react';\n+import { View, Text, ScrollView } from 'react-native';\n+\n+import { useStyles } from '../themes/colors';\n+import ToggleCrashReports from './toggle-crash-reports.react';\n+\n+function PrivacyPreferences(): React.Node {\n+ const styles = useStyles(unboundStyles);\n+\n+ return (\n+ <ScrollView\n+ contentContainerStyle={styles.scrollViewContentContainer}\n+ style={styles.scrollView}\n+ >\n+ <Text style={styles.header}>CRASH REPORTS</Text>\n+ <View style={styles.section}>\n+ <ToggleCrashReports />\n+ </View>\n+ </ScrollView>\n+ );\n+}\n+\n+const unboundStyles = {\n+ scrollView: {\n+ backgroundColor: 'panelBackground',\n+ },\n+ scrollViewContentContainer: {\n+ paddingTop: 24,\n+ },\n+ section: {\n+ backgroundColor: 'panelForeground',\n+ borderBottomWidth: 1,\n+ borderColor: 'panelForegroundBorder',\n+ borderTopWidth: 1,\n+ marginBottom: 24,\n+ marginVertical: 2,\n+ },\n+ header: {\n+ color: 'panelBackgroundLabel',\n+ fontSize: 12,\n+ fontWeight: '400',\n+ paddingBottom: 3,\n+ paddingHorizontal: 24,\n+ },\n+};\n+\n+export default PrivacyPreferences;\n" }, { "change_type": "MODIFY", "old_path": "native/profile/profile-screen.react.js", "new_path": "native/profile/profile-screen.react.js", "diff": "@@ -47,11 +47,11 @@ import {\nAppearancePreferencesRouteName,\nFriendListRouteName,\nBlockListRouteName,\n+ PrivacyPreferencesRouteName,\n} from '../navigation/route-names';\nimport { useSelector } from '../redux/redux-utils';\nimport { type Colors, useColors, useStyles } from '../themes/colors';\nimport type { ProfileNavigationProp } from './profile.react';\n-import ToggleCrashReports from './toggle-crash-reports.react';\ntype BaseProps = {|\n+navigation: ProfileNavigationProp<'ProfileScreen'>,\n@@ -162,9 +162,6 @@ class ProfileScreen extends React.PureComponent<Props> {\n__DEV__\n) {\nappearancePreferences = (\n- <>\n- <Text style={this.props.styles.header}>PREFERENCES</Text>\n- <View style={this.props.styles.slightlyPaddedSection}>\n<Button\nonPress={this.onPressAppearance}\nstyle={this.props.styles.submenuButton}\n@@ -174,8 +171,6 @@ class ProfileScreen extends React.PureComponent<Props> {\n<Text style={this.props.styles.submenuText}>Appearance</Text>\n<Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n</Button>\n- </View>\n- </>\n);\ndeveloperTools = (\n<Button\n@@ -266,11 +261,18 @@ class ProfileScreen extends React.PureComponent<Props> {\n</Button>\n</View>\n- {appearancePreferences}\n-\n- <Text style={this.props.styles.header}>PRIVACY</Text>\n+ <Text style={this.props.styles.header}>PREFERENCES</Text>\n<View style={this.props.styles.slightlyPaddedSection}>\n- <ToggleCrashReports />\n+ {appearancePreferences}\n+ <Button\n+ onPress={this.onPressPrivacy}\n+ style={this.props.styles.submenuButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={underlay}\n+ >\n+ <Text style={this.props.styles.submenuText}>Privacy</Text>\n+ <Icon name=\"ios-arrow-forward\" size={20} color={linkColor} />\n+ </Button>\n</View>\n<View style={this.props.styles.slightlyPaddedSection}>\n@@ -404,6 +406,10 @@ class ProfileScreen extends React.PureComponent<Props> {\nthis.navigateIfActive(AppearancePreferencesRouteName);\n};\n+ onPressPrivacy = () => {\n+ this.navigateIfActive(PrivacyPreferencesRouteName);\n+ };\n+\nonPressFriendList = () => {\nthis.navigateIfActive(FriendListRouteName);\n};\n" }, { "change_type": "MODIFY", "old_path": "native/profile/profile.react.js", "new_path": "native/profile/profile.react.js", "diff": "@@ -18,6 +18,7 @@ import {\nBuildInfoRouteName,\nDevToolsRouteName,\nAppearancePreferencesRouteName,\n+ PrivacyPreferencesRouteName,\nFriendListRouteName,\nBlockListRouteName,\ntype ScreenParamList,\n@@ -30,6 +31,7 @@ import DeleteAccount from './delete-account.react';\nimport DevTools from './dev-tools.react';\nimport EditEmail from './edit-email.react';\nimport EditPassword from './edit-password.react';\n+import PrivacyPreferences from './privacy-preferences.react';\nimport ProfileHeader from './profile-header.react';\nimport ProfileScreen from './profile-screen.react';\nimport RelationshipList from './relationship-list.react';\n@@ -47,6 +49,7 @@ const deleteAccountOptions = { headerTitle: 'Delete account' };\nconst buildInfoOptions = { headerTitle: 'Build info' };\nconst devToolsOptions = { headerTitle: 'Developer tools' };\nconst appearanceOptions = { headerTitle: 'Appearance' };\n+const privacyOptions = { headerTitle: 'Privacy' };\nconst friendListOptions = {\nheaderTitle: 'Friend list',\nheaderBackTitle: 'Back',\n@@ -112,6 +115,11 @@ function ProfileComponent() {\ncomponent={AppearancePreferences}\noptions={appearanceOptions}\n/>\n+ <Profile.Screen\n+ name={PrivacyPreferencesRouteName}\n+ component={PrivacyPreferences}\n+ options={privacyOptions}\n+ />\n<Profile.Screen\nname={FriendListRouteName}\ncomponent={RelationshipList}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Move crash report toggling from main Profile page to separate Privacy page Test Plan: Toggled crash report preferences and confirmed expected behavior by looking at Redux dev tools and triggering crashes via Developer Tools Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, palys-swm, Adrian Differential Revision: https://phabricator.ashoat.com/D1363