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
15.10.2020 13:40:39
-7,200
414e9b7523235a4c35b1dc10a4e9e0b64e9019c8
[server] Do not update unread column in activity updater Reviewers: ashoat Subscribers: Adrian, zrebcu411, KatPo
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/activity-updaters.js", "new_path": "server/src/updaters/activity-updaters.js", "diff": "@@ -146,17 +146,11 @@ async function activityUpdater(\nviewer,\nupdatesForCurrentSession: 'ignore',\n});\n- const setUnreadStatusPromise = updateUnreadStatus(\n- viewer,\n- setToRead,\n- setToUnread,\n- );\nawait Promise.all([\nfocusUpdatePromise,\nupdateLatestReadMessagePromise,\nupdatesPromise,\n- setUnreadStatusPromise,\n]);\n// We do this afterwards so the badge count is correct\n@@ -294,36 +288,6 @@ async function updateLastReadMessage(\nreturn await dbQuery(query);\n}\n-async function updateUnreadStatus(\n- viewer: Viewer,\n- setToRead: $ReadOnlyArray<string>,\n- setToUnread: $ReadOnlyArray<string>,\n-) {\n- const promises = [];\n- if (setToRead.length > 0) {\n- promises.push(\n- dbQuery(SQL`\n- UPDATE memberships\n- SET unread = 0\n- WHERE thread IN (${setToRead})\n- AND user = ${viewer.userID}\n- `),\n- );\n- }\n- if (setToUnread.length > 0) {\n- promises.push(\n- dbQuery(SQL`\n- UPDATE memberships\n- SET unread = 1\n- WHERE thread IN (${setToUnread})\n- AND user = ${viewer.userID}\n- `),\n- );\n- }\n-\n- return await Promise.all(promises);\n-}\n-\nasync function setThreadUnreadStatus(\nviewer: Viewer,\nrequest: SetThreadUnreadStatusRequest,\n@@ -352,8 +316,7 @@ async function setThreadUnreadStatus(\n: SQL`GREATEST(m.last_read_message, ${request.latestMessage ?? 0})`;\nconst update = SQL`\nUPDATE memberships m\n- SET m.unread = ${request.unread ? 1 : 0},\n- m.last_read_message =\n+ SET m.last_read_message =\n`;\nupdate.append(lastReadMessage);\nupdate.append(SQL`\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Do not update unread column in activity updater Reviewers: ashoat Reviewed By: ashoat Subscribers: Adrian, zrebcu411, KatPo Differential Revision: https://phabricator.ashoat.com/D240
129,187
19.10.2020 13:42:49
14,400
7b15c602aa73511a03b88a77bbdfab50b2b59cab
[native] Don't list sidebars under subthreads in ThreadSettings Summary: I'll display them in a separate category in the next diff. Test Plan: I checked a thread that has sidebars and made sure the sidebars were no longer listed Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -6,6 +6,7 @@ import {\ntype RelativeMemberInfo,\nrelativeMemberInfoPropType,\nthreadPermissions,\n+ threadTypes,\n} from 'lib/types/thread-types';\nimport type { AppState } from '../../redux/redux-setup';\nimport type { CategoryType } from './thread-settings-category.react';\n@@ -471,19 +472,28 @@ class ThreadSettings extends React.PureComponent<Props, State> {\ncategoryType: 'full',\n});\n- let subthreadItems = null;\n+ const subthreads = [];\nif (childThreads) {\n+ for (const childThreadInfo of childThreads) {\n+ if (childThreadInfo.type !== threadTypes.SIDEBAR) {\n+ subthreads.push(childThreadInfo);\n+ }\n+ }\n+ }\n+\n+ let subthreadItems = null;\n+ if (subthreads.length > 0) {\nlet subthreadInfosSlice;\nlet seeMoreSubthreads = null;\n- if (childThreads.length > showMaxSubthreads) {\n- subthreadInfosSlice = childThreads.slice(0, showMaxSubthreads);\n+ if (subthreads.length > showMaxSubthreads) {\n+ subthreadInfosSlice = subthreads.slice(0, showMaxSubthreads);\nseeMoreSubthreads = {\nitemType: 'seeMore',\nkey: 'seeMoreSubthreads',\nonPress: this.onPressSeeMoreSubthreads,\n};\n} else {\n- subthreadInfosSlice = childThreads;\n+ subthreadInfosSlice = subthreads;\n}\nconst subthreadSlice = subthreadInfosSlice.map(subthreadInfo => ({\nitemType: 'childThread',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Don't list sidebars under subthreads in ThreadSettings Summary: I'll display them in a separate category in the next diff. Test Plan: I checked a thread that has sidebars and made sure the sidebars were no longer listed Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D259
129,187
19.10.2020 13:52:09
14,400
0d7af7e95bc6c02e3b291714b6b18ad142a50008
[native] Display list of sidebars in ThreadSettings Summary: Displaying them in a separate list Test Plan: I checked a thread with sidebars and made sure they were listed Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -210,6 +210,7 @@ type Props = {|\ntype State = {|\n+showMaxMembers: number,\n+showMaxSubthreads: number,\n+ +showMaxSidebars: number,\n+nameEditValue: ?string,\n+descriptionEditValue: ?string,\n+nameTextHeight: ?number,\n@@ -251,6 +252,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nthis.state = {\nshowMaxMembers: itemPageLength,\nshowMaxSubthreads: itemPageLength,\n+ showMaxSidebars: itemPageLength,\nnameEditValue: null,\ndescriptionEditValue: null,\nnameTextHeight: null,\n@@ -354,6 +356,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n(propsAndState: PropsAndState) => propsAndState.route.key,\n(propsAndState: PropsAndState) => propsAndState.childThreadInfos,\n(propsAndState: PropsAndState) => propsAndState.showMaxSubthreads,\n+ (propsAndState: PropsAndState) => propsAndState.showMaxSidebars,\n(propsAndState: PropsAndState) => propsAndState.threadMembers,\n(propsAndState: PropsAndState) => propsAndState.showMaxMembers,\n(propsAndState: PropsAndState) => propsAndState.verticalBounds,\n@@ -369,6 +372,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nrouteKey: string,\nchildThreads: ?(ThreadInfo[]),\nshowMaxSubthreads: number,\n+ showMaxSidebars: number,\nthreadMembers: RelativeMemberInfo[],\nshowMaxMembers: number,\nverticalBounds: ?VerticalBounds,\n@@ -473,9 +477,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n});\nconst subthreads = [];\n+ const sidebars = [];\nif (childThreads) {\nfor (const childThreadInfo of childThreads) {\n- if (childThreadInfo.type !== threadTypes.SIDEBAR) {\n+ if (childThreadInfo.type === threadTypes.SIDEBAR) {\n+ sidebars.push(childThreadInfo);\n+ } else {\nsubthreads.push(childThreadInfo);\n}\n}\n@@ -544,6 +551,50 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n});\n}\n+ let sidebarItems = null;\n+ if (sidebars.length > 0) {\n+ let sidebarInfosSlice;\n+ let seeMoreSidebars = null;\n+ if (sidebars.length > showMaxSidebars) {\n+ sidebarInfosSlice = sidebars.slice(0, showMaxSidebars);\n+ seeMoreSidebars = {\n+ itemType: 'seeMore',\n+ key: 'seeMoreSidebars',\n+ onPress: this.onPressSeeMoreSidebars,\n+ };\n+ } else {\n+ sidebarInfosSlice = sidebars;\n+ }\n+ const sidebarSlice = sidebarInfosSlice.map(sidebarInfo => ({\n+ itemType: 'childThread',\n+ key: `childThread${sidebarInfo.id}`,\n+ threadInfo: sidebarInfo,\n+ navigate,\n+ lastListItem: false,\n+ }));\n+ if (seeMoreSidebars) {\n+ sidebarItems = [...sidebarSlice, seeMoreSidebars];\n+ } else {\n+ sidebarSlice[sidebarSlice.length - 1].lastListItem = true;\n+ sidebarItems = sidebarSlice;\n+ }\n+ }\n+\n+ if (sidebarItems) {\n+ listData.push({\n+ itemType: 'header',\n+ key: 'sidebarHeader',\n+ title: 'Sidebars',\n+ categoryType: 'unpadded',\n+ });\n+ listData.push(...sidebarItems);\n+ listData.push({\n+ itemType: 'footer',\n+ key: 'sidebarFooter',\n+ categoryType: 'unpadded',\n+ });\n+ }\n+\nlet threadMemberItems;\nlet seeMoreMembers = null;\nif (threadMembers.length > showMaxMembers) {\n@@ -849,6 +900,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nshowMaxSubthreads: prevState.showMaxSubthreads + itemPageLength,\n}));\n};\n+\n+ onPressSeeMoreSidebars = () => {\n+ this.setState(prevState => ({\n+ showMaxSidebars: prevState.showMaxSidebars + itemPageLength,\n+ }));\n+ };\n}\nconst unboundStyles = {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Display list of sidebars in ThreadSettings Summary: Displaying them in a separate list Test Plan: I checked a thread with sidebars and made sure they were listed Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D260
129,187
19.10.2020 15:10:59
14,400
d69df31d283d9ef0e11b7b9139892ccdcbfbffa4
[native] Memoize getMarkdownStyles Summary: This makes it so it only ever gets computed twice (for `light` and `dark`) instead of getting recomputed for every time it's used. Test Plan: Flow, make sure it loads. This is a pretty minimal change Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/markdown/styles.js", "new_path": "native/markdown/styles.js", "diff": "import type { GlobalTheme } from '../types/themes';\nimport { Platform } from 'react-native';\n+import _memoize from 'lodash/memoize';\nimport { getStylesForTheme } from '../themes/colors';\n@@ -96,6 +97,10 @@ const unboundStyles = {\nexport type MarkdownStyles = typeof unboundStyles;\n-export function getMarkdownStyles(theme: GlobalTheme) {\n+const getMarkdownStyles: GlobalTheme => MarkdownStyles = _memoize(\n+ (theme: GlobalTheme) => {\nreturn getStylesForTheme(unboundStyles, theme);\n-}\n+ },\n+);\n+\n+export { getMarkdownStyles };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Memoize getMarkdownStyles Summary: This makes it so it only ever gets computed twice (for `light` and `dark`) instead of getting recomputed for every time it's used. Test Plan: Flow, make sure it loads. This is a pretty minimal change Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D263
129,187
19.10.2020 15:18:52
14,400
5c5853f4b747dcf0fe456d5f4e344eecf4abf966
[client] Memoize MarkdownRules Summary: This makes it so it only ever gets computed twice (for `light` and `dark`) instead of getting recomputed for every time it's used. Test Plan: Another minor change, once again just Flow and reloading... Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/markdown/rules.react.js", "new_path": "native/markdown/rules.react.js", "diff": "import * as React from 'react';\nimport { Text, Linking, Alert, View } from 'react-native';\nimport * as SimpleMarkdown from 'simple-markdown';\n+import _memoize from 'lodash/memoize';\nimport * as SharedMarkdown from 'lib/shared/markdown';\nimport { normalizeURL } from 'lib/utils/url-utils';\n@@ -44,7 +45,7 @@ function displayLinkPrompt(inputURL: string) {\n// Entry requires a seamless transition between Markdown and TextInput\n// components, so we can't do anything that would change the position of text\n-function inlineMarkdownRules(useDarkStyle: boolean): MarkdownRules {\n+const inlineMarkdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\nconst styles = getMarkdownStyles(useDarkStyle ? 'dark' : 'light');\nconst simpleMarkdownRules = {\n// Matches 'https://google.com' during parse phase and returns a 'link' node\n@@ -123,11 +124,11 @@ function inlineMarkdownRules(useDarkStyle: boolean): MarkdownRules {\nemojiOnlyFactor: null,\ncontainer: 'Text',\n};\n-}\n+});\n// We allow the most markdown features for TextMessage, which doesn't have the\n// same requirements as Entry\n-function fullMarkdownRules(useDarkStyle: boolean): MarkdownRules {\n+const fullMarkdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\nconst styles = getMarkdownStyles(useDarkStyle ? 'dark' : 'light');\nconst inlineRules = inlineMarkdownRules(useDarkStyle);\nconst simpleMarkdownRules = {\n@@ -349,6 +350,6 @@ function fullMarkdownRules(useDarkStyle: boolean): MarkdownRules {\nemojiOnlyFactor: 2,\ncontainer: 'View',\n};\n-}\n+});\nexport { inlineMarkdownRules, fullMarkdownRules };\n" }, { "change_type": "MODIFY", "old_path": "web/markdown/rules.react.js", "new_path": "web/markdown/rules.react.js", "diff": "import * as SimpleMarkdown from 'simple-markdown';\nimport * as React from 'react';\n+import _memoize from 'lodash/memoize';\nimport * as SharedMarkdown from 'lib/shared/markdown';\n@@ -10,7 +11,7 @@ export type MarkdownRules = {|\n+useDarkStyle: boolean,\n|};\n-function linkRules(useDarkStyle: boolean): MarkdownRules {\n+const linkRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\nconst simpleMarkdownRules = {\n// We are using default simple-markdown rules\n// For more details, look at native/markdown/rules.react\n@@ -58,10 +59,10 @@ function linkRules(useDarkStyle: boolean): MarkdownRules {\nsimpleMarkdownRules: simpleMarkdownRules,\nuseDarkStyle,\n};\n-}\n+});\n// function will contain additional rules for message formatting\n-function markdownRules(useDarkStyle: boolean): MarkdownRules {\n+const markdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\nconst linkMarkdownRules = linkRules(useDarkStyle);\nconst simpleMarkdownRules = {\n@@ -149,6 +150,6 @@ function markdownRules(useDarkStyle: boolean): MarkdownRules {\nsimpleMarkdownRules,\nuseDarkStyle,\n};\n-}\n+});\nexport { linkRules, markdownRules };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[client] Memoize MarkdownRules Summary: This makes it so it only ever gets computed twice (for `light` and `dark`) instead of getting recomputed for every time it's used. Test Plan: Another minor change, once again just Flow and reloading... Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D265
129,187
19.10.2020 15:51:02
14,400
227450012a27303aa3dd587ba01668ab4385a702
[native] Convert InnerTextMessage to hook Test Plan: Flow, reloading... Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/inner-text-message.react.js", "new_path": "native/chat/inner-text-message.react.js", "diff": "// @flow\n-import { chatMessageItemPropType } from 'lib/selectors/chat-selectors';\nimport type { ChatTextMessageInfoItemWithHeight } from './text-message.react';\n-import { type GlobalTheme, globalThemePropType } from '../types/themes';\n-import type { AppState } from '../redux/redux-setup';\nimport * as React from 'react';\nimport { View, StyleSheet } from 'react-native';\n-import PropTypes from 'prop-types';\nimport { useSelector } from 'react-redux';\nimport { colorIsDark } from 'lib/shared/thread-utils';\n-import { connect } from 'lib/utils/redux-utils';\nimport {\nallCorners,\nfilterCorners,\ngetRoundedContainerStyle,\n} from './rounded-corners';\n-import {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- colors,\n-} from '../themes/colors';\n+import { useColors, colors } from '../themes/colors';\nimport Markdown from '../markdown/markdown.react';\nimport { fullMarkdownRules } from '../markdown/rules.react';\nimport { composedMessageMaxWidthSelector } from './composed-message-width';\n@@ -51,27 +41,18 @@ function DummyTextNode(props: DummyTextNodeProps) {\n}\ntype Props = {|\n- item: ChatTextMessageInfoItemWithHeight,\n- onPress: () => void,\n- messageRef?: (message: ?React.ElementRef<typeof View>) => void,\n- // Redux state\n- activeTheme: ?GlobalTheme,\n- colors: Colors,\n+ +item: ChatTextMessageInfoItemWithHeight,\n+ +onPress: () => void,\n+ +messageRef?: (message: ?React.ElementRef<typeof View>) => void,\n|};\n-class InnerTextMessage extends React.PureComponent<Props> {\n- static propTypes = {\n- item: chatMessageItemPropType.isRequired,\n- onPress: PropTypes.func.isRequired,\n- messageRef: PropTypes.func,\n- activeTheme: globalThemePropType,\n- colors: colorsPropType.isRequired,\n- };\n-\n- render() {\n- const { item } = this.props;\n+function InnerTextMessage(props: Props) {\n+ const { item } = props;\nconst { text, creator } = item.messageInfo;\nconst { isViewer } = creator;\n+ const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme);\n+ const boundColors = useColors();\n+\nlet messageStyle = {},\ntextStyle = { ...styles.text },\ndarkColor;\n@@ -80,16 +61,14 @@ class InnerTextMessage extends React.PureComponent<Props> {\nmessageStyle.backgroundColor = `#${threadColor}`;\ndarkColor = colorIsDark(threadColor);\n} else {\n- messageStyle.backgroundColor = this.props.colors.listChatBubble;\n- darkColor = this.props.activeTheme === 'dark';\n+ messageStyle.backgroundColor = boundColors.listChatBubble;\n+ darkColor = activeTheme === 'dark';\n}\ntextStyle.color = darkColor\n? colors.dark.listForegroundLabel\n: colors.light.listForegroundLabel;\n- const cornerStyle = getRoundedContainerStyle(\n- filterCorners(allCorners, item),\n- );\n+ const cornerStyle = getRoundedContainerStyle(filterCorners(allCorners, item));\nif (!__DEV__) {\n// We don't force view height in dev mode because we\n@@ -99,8 +78,8 @@ class InnerTextMessage extends React.PureComponent<Props> {\nconst message = (\n<GestureTouchableOpacity\n- onPress={this.props.onPress}\n- onLongPress={this.props.onPress}\n+ onPress={props.onPress}\n+ onLongPress={props.onPress}\nactiveOpacity={0.6}\nstyle={[styles.message, messageStyle, cornerStyle]}\n>\n@@ -110,22 +89,21 @@ class InnerTextMessage extends React.PureComponent<Props> {\n</GestureTouchableOpacity>\n);\n- const { messageRef } = this.props;\n+ // We need to set onLayout in order to allow .measure() to be on the ref\n+ const onLayout = React.useCallback(() => {}, []);\n+\n+ const { messageRef } = props;\nif (!messageRef) {\nreturn message;\n}\nreturn (\n- <View onLayout={this.onLayout} ref={messageRef}>\n+ <View onLayout={onLayout} ref={messageRef}>\n{message}\n</View>\n);\n}\n- // We need to set onLayout in order to allow .measure() to be on the ref\n- onLayout = () => {};\n-}\n-\nconst styles = StyleSheet.create({\ndummyMessage: {\npaddingHorizontal: 12,\n@@ -142,12 +120,4 @@ const styles = StyleSheet.create({\n},\n});\n-const ConnectedInnerTextMessage = connect((state: AppState) => ({\n- activeTheme: state.globalThemeInfo.activeTheme,\n- colors: colorsSelector(state),\n-}))(InnerTextMessage);\n-\n-export {\n- ConnectedInnerTextMessage as InnerTextMessage,\n- dummyNodeForTextMessageHeightMeasurement,\n-};\n+export { InnerTextMessage, dummyNodeForTextMessageHeightMeasurement };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Convert InnerTextMessage to hook Test Plan: Flow, reloading... Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D266
129,187
19.10.2020 15:54:01
14,400
77562ba5d529385246e442e20ee3ce54d92dafa8
[web] Convert TextMessage to hook Test Plan: Flow, reloading... Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/text-message.react.js", "new_path": "web/chat/text-message.react.js", "diff": "// @flow\n-import {\n- type ChatMessageInfoItem,\n- chatMessageItemPropType,\n-} from 'lib/selectors/chat-selectors';\n+import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors';\nimport { messageTypes } from 'lib/types/message-types';\n-import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n-import {\n- type MessagePositionInfo,\n- type OnMessagePositionInfo,\n- onMessagePositionInfoPropType,\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+import type {\n+ MessagePositionInfo,\n+ OnMessagePositionInfo,\n} from './message-position-types';\nimport * as React from 'react';\nimport invariant from 'invariant';\nimport classNames from 'classnames';\n-import PropTypes from 'prop-types';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport { onlyEmojiRegex } from 'lib/shared/emojis';\n@@ -27,50 +22,27 @@ import Markdown from '../markdown/markdown.react';\nimport { markdownRules } from '../markdown/rules.react';\ntype Props = {|\n- item: ChatMessageInfoItem,\n- threadInfo: ThreadInfo,\n- setMouseOverMessagePosition: (\n+ +item: ChatMessageInfoItem,\n+ +threadInfo: ThreadInfo,\n+ +setMouseOverMessagePosition: (\nmessagePositionInfo: MessagePositionInfo,\n) => void,\n- mouseOverMessagePosition: ?OnMessagePositionInfo,\n+ +mouseOverMessagePosition: ?OnMessagePositionInfo,\n|};\n-class TextMessage extends React.PureComponent<Props> {\n- static propTypes = {\n- item: chatMessageItemPropType.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n- setMouseOverMessagePosition: PropTypes.func.isRequired,\n- mouseOverMessagePosition: onMessagePositionInfoPropType,\n- };\n-\n- constructor(props: Props) {\n- super(props);\n+function TextMessage(props: Props) {\ninvariant(\nprops.item.messageInfo.type === messageTypes.TEXT,\n'TextMessage should only be used for messageTypes.TEXT',\n);\n- }\n-\n- componentDidUpdate() {\n- invariant(\n- this.props.item.messageInfo.type === messageTypes.TEXT,\n- 'TextMessage should only be used for messageTypes.TEXT',\n- );\n- }\n-\n- render() {\n- invariant(\n- this.props.item.messageInfo.type === messageTypes.TEXT,\n- 'TextMessage should only be used for messageTypes.TEXT',\n- );\nconst {\ntext,\ncreator: { isViewer },\n- } = this.props.item.messageInfo;\n+ } = props.item.messageInfo;\nconst messageStyle = {};\nlet darkColor = false;\nif (isViewer) {\n- const threadColor = this.props.threadInfo.color;\n+ const threadColor = props.threadInfo.color;\ndarkColor = colorIsDark(threadColor);\nmessageStyle.backgroundColor = `#${threadColor}`;\n} else {\n@@ -88,11 +60,11 @@ class TextMessage extends React.PureComponent<Props> {\nreturn (\n<ComposedMessage\n- item={this.props.item}\n- threadInfo={this.props.threadInfo}\n- sendFailed={textMessageSendFailed(this.props.item)}\n- setMouseOverMessagePosition={this.props.setMouseOverMessagePosition}\n- mouseOverMessagePosition={this.props.mouseOverMessagePosition}\n+ item={props.item}\n+ threadInfo={props.threadInfo}\n+ sendFailed={textMessageSendFailed(props.item)}\n+ setMouseOverMessagePosition={props.setMouseOverMessagePosition}\n+ mouseOverMessagePosition={props.mouseOverMessagePosition}\ncanReply={true}\n>\n<div className={messageClassName} style={messageStyle}>\n@@ -101,6 +73,5 @@ class TextMessage extends React.PureComponent<Props> {\n</ComposedMessage>\n);\n}\n-}\nexport default TextMessage;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Convert TextMessage to hook Test Plan: Flow, reloading... Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D267
129,187
19.10.2020 16:14:56
14,400
1e9cdb90a6d785f0629e8cbb6692dc979f5169a6
[client] Only bold if they match usernames of thread members Summary: This is the final goal of all that Markdown work. Test Plan: Test that match usernames and ones that don't Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/markdown.js", "new_path": "lib/shared/markdown.js", "diff": "// @flow\n+import type { RelativeMemberInfo } from '../types/thread-types';\n+\n+import invariant from 'invariant';\n+\nimport { oldValidUsernameRegexString } from './account-utils';\n// simple-markdown types\n@@ -42,7 +46,7 @@ const blockQuoteStripFollowingNewlineRegex = /^( *>[^\\n]+(?:\\n[^\\n]+)*)(?:\\n|$){\nconst urlRegex = /^(https?:\\/\\/[^\\s<]+[^<.,:;\"')\\]\\s])/i;\n-const mentionRegex = new RegExp(`^(@${oldValidUsernameRegexString})\\\\b`);\n+const mentionRegex = new RegExp(`^(@(${oldValidUsernameRegexString}))\\\\b`);\ntype JSONCapture = {|\n+[0]: string,\n@@ -145,11 +149,33 @@ function parseList(\n};\n}\n+function matchMentions(members: $ReadOnlyArray<RelativeMemberInfo>) {\n+ const memberSet = new Set(\n+ members.map(({ username }) => username).filter(Boolean),\n+ );\n+ const match = (source: string, state: State) => {\n+ if (!state.inline) {\n+ return null;\n+ }\n+ const result = mentionRegex.exec(source);\n+ if (!result) {\n+ return null;\n+ }\n+ const username = result[2];\n+ invariant(username, 'mentionRegex should match two capture groups');\n+ if (!memberSet.has(username)) {\n+ return null;\n+ }\n+ return result;\n+ };\n+ match.regex = mentionRegex;\n+ return match;\n+}\n+\nexport {\nparagraphRegex,\nparagraphStripTrailingNewlineRegex,\nurlRegex,\n- mentionRegex,\nblockQuoteRegex,\nblockQuoteStripFollowingNewlineRegex,\nheadingRegex,\n@@ -162,4 +188,5 @@ export {\njsonPrint,\nmatchList,\nparseList,\n+ matchMentions,\n};\n" }, { "change_type": "MODIFY", "old_path": "native/chat/inner-text-message.react.js", "new_path": "native/chat/inner-text-message.react.js", "diff": "// @flow\nimport type { ChatTextMessageInfoItemWithHeight } from './text-message.react';\n+import type { RelativeMemberInfo } from 'lib/types/thread-types';\nimport * as React from 'react';\nimport { View, StyleSheet } from 'react-native';\nimport { useSelector } from 'react-redux';\nimport { colorIsDark } from 'lib/shared/thread-utils';\n+import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';\nimport {\nallCorners,\n@@ -15,25 +17,29 @@ import {\n} from './rounded-corners';\nimport { useColors, colors } from '../themes/colors';\nimport Markdown from '../markdown/markdown.react';\n-import { fullMarkdownRules } from '../markdown/rules.react';\n+import { textMessageRules } from '../markdown/rules.react';\nimport { composedMessageMaxWidthSelector } from './composed-message-width';\nimport GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';\n-function dummyNodeForTextMessageHeightMeasurement(text: string) {\n- return <DummyTextNode>{text}</DummyTextNode>;\n+function dummyNodeForTextMessageHeightMeasurement(\n+ text: string,\n+ members: $ReadOnlyArray<RelativeMemberInfo>,\n+) {\n+ return <DummyTextNode members={members}>{text}</DummyTextNode>;\n}\ntype DummyTextNodeProps = {|\n...React.ElementConfig<typeof View>,\n- children: string,\n+ +members: $ReadOnlyArray<RelativeMemberInfo>,\n+ +children: string,\n|};\nfunction DummyTextNode(props: DummyTextNodeProps) {\n- const { children, style, ...rest } = props;\n+ const { members, children, style, ...rest } = props;\nconst maxWidth = useSelector(state => composedMessageMaxWidthSelector(state));\nconst viewStyle = [props.style, styles.dummyMessage, { maxWidth }];\nreturn (\n<View {...rest} style={viewStyle}>\n- <Markdown style={styles.text} rules={fullMarkdownRules(false)}>\n+ <Markdown style={styles.text} rules={textMessageRules(false, members)}>\n{children}\n</Markdown>\n</View>\n@@ -76,6 +82,11 @@ function InnerTextMessage(props: Props) {\nmessageStyle.height = item.contentHeight;\n}\n+ const threadID = item.threadInfo.id;\n+ const threadMembers = useSelector(\n+ relativeMemberInfoSelectorForMembersOfThread(threadID),\n+ );\n+\nconst message = (\n<GestureTouchableOpacity\nonPress={props.onPress}\n@@ -83,7 +94,10 @@ function InnerTextMessage(props: Props) {\nactiveOpacity={0.6}\nstyle={[styles.message, messageStyle, cornerStyle]}\n>\n- <Markdown style={textStyle} rules={fullMarkdownRules(darkColor)}>\n+ <Markdown\n+ style={textStyle}\n+ rules={textMessageRules(darkColor, threadMembers)}\n+ >\n{text}\n</Markdown>\n</GestureTouchableOpacity>\n" }, { "change_type": "MODIFY", "old_path": "native/chat/message-list-container.react.js", "new_path": "native/chat/message-list-container.react.js", "diff": "// @flow\nimport { messageTypes } from 'lib/types/message-types';\n-import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import {\n+ type ThreadInfo,\n+ threadInfoPropType,\n+ type RelativeMemberInfo,\n+ relativeMemberInfoPropType,\n+} from 'lib/types/thread-types';\nimport type { ChatMessageInfoItemWithHeight } from './message.react';\nimport {\nmessageListRoutePropType,\n@@ -23,6 +28,7 @@ import {\nmessageListData,\n} from 'lib/selectors/chat-selectors';\nimport { messageID } from 'lib/shared/message-utils';\n+import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';\nimport MessageList from './message-list.react';\nimport NodeHeightMeasurer from '../components/node-height-measurer.react';\n@@ -62,6 +68,7 @@ type Props = {|\n...BaseProps,\n// Redux state\n+threadInfo: ?ThreadInfo,\n+ +threadMembers: $ReadOnlyArray<RelativeMemberInfo>,\n+messageListData: $ReadOnlyArray<ChatMessageItem>,\n+composedMessageMaxWidth: number,\n+colors: Colors,\n@@ -79,6 +86,7 @@ class MessageListContainer extends React.PureComponent<Props, State> {\nnavigation: messageListNavPropType.isRequired,\nroute: messageListRoutePropType.isRequired,\nthreadInfo: threadInfoPropType,\n+ threadMembers: PropTypes.arrayOf(relativeMemberInfoPropType).isRequired,\nmessageListData: PropTypes.arrayOf(chatMessageItemPropType).isRequired,\ncomposedMessageMaxWidth: PropTypes.number.isRequired,\ncolors: colorsPropType.isRequired,\n@@ -193,7 +201,10 @@ class MessageListContainer extends React.PureComponent<Props, State> {\n);\nconst { messageInfo } = item;\nif (messageInfo.type === messageTypes.TEXT) {\n- return dummyNodeForTextMessageHeightMeasurement(messageInfo.text);\n+ return dummyNodeForTextMessageHeightMeasurement(\n+ messageInfo.text,\n+ this.props.threadMembers,\n+ );\n} else if (item.robotext && typeof item.robotext === 'string') {\nreturn dummyNodeForRobotextMessageHeightMeasurement(item.robotext);\n}\n@@ -298,6 +309,9 @@ export default React.memo<BaseProps>(function ConnectedMessageListContainer(\n) {\nconst threadID = props.route.params.threadInfo.id;\nconst threadInfo = useSelector(state => threadInfoSelector(state)[threadID]);\n+ const threadMembers = useSelector(state =>\n+ relativeMemberInfoSelectorForMembersOfThread(threadID)(state),\n+ );\nconst boundMessageListData = useSelector(state =>\nmessageListData(threadID)(state),\n);\n@@ -310,6 +324,7 @@ export default React.memo<BaseProps>(function ConnectedMessageListContainer(\n<MessageListContainer\n{...props}\nthreadInfo={threadInfo}\n+ threadMembers={threadMembers}\nmessageListData={boundMessageListData}\ncomposedMessageMaxWidth={composedMessageMaxWidth}\ncolors={colors}\n" }, { "change_type": "MODIFY", "old_path": "native/markdown/rules.react.js", "new_path": "native/markdown/rules.react.js", "diff": "// @flow\n+import type { RelativeMemberInfo } from 'lib/types/thread-types';\n+\nimport * as React from 'react';\nimport { Text, Linking, Alert, View } from 'react-native';\nimport * as SimpleMarkdown from 'simple-markdown';\n@@ -169,23 +171,6 @@ const fullMarkdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\n</Text>\n),\n},\n- mention: {\n- ...SimpleMarkdown.defaultRules.strong,\n- match: SimpleMarkdown.inlineRegex(SharedMarkdown.mentionRegex),\n- parse: (capture: SimpleMarkdown.Capture) => ({\n- content: capture[0],\n- }),\n- // eslint-disable-next-line react/display-name\n- react: (\n- node: SimpleMarkdown.SingleASTNode,\n- output: SimpleMarkdown.Output<SimpleMarkdown.ReactElement>,\n- state: SimpleMarkdown.State,\n- ) => (\n- <Text key={state.key} style={styles.bold}>\n- {node.content}\n- </Text>\n- ),\n- },\nu: {\n...SimpleMarkdown.defaultRules.u,\n// eslint-disable-next-line react/display-name\n@@ -352,4 +337,35 @@ const fullMarkdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\n};\n});\n-export { inlineMarkdownRules, fullMarkdownRules };\n+const textMessageRules: (\n+ boolean,\n+ $ReadOnlyArray<RelativeMemberInfo>,\n+) => MarkdownRules = _memoize((useDarkStyle, members) => {\n+ const styles = getMarkdownStyles(useDarkStyle ? 'dark' : 'light');\n+ const baseRules = fullMarkdownRules(useDarkStyle);\n+ return {\n+ ...baseRules,\n+ simpleMarkdownRules: {\n+ ...baseRules.simpleMarkdownRules,\n+ mention: {\n+ ...SimpleMarkdown.defaultRules.strong,\n+ match: SharedMarkdown.matchMentions(members),\n+ parse: (capture: SimpleMarkdown.Capture) => ({\n+ content: capture[0],\n+ }),\n+ // eslint-disable-next-line react/display-name\n+ react: (\n+ node: SimpleMarkdown.SingleASTNode,\n+ output: SimpleMarkdown.Output<SimpleMarkdown.ReactElement>,\n+ state: SimpleMarkdown.State,\n+ ) => (\n+ <Text key={state.key} style={styles.bold}>\n+ {node.content}\n+ </Text>\n+ ),\n+ },\n+ },\n+ };\n+});\n+\n+export { inlineMarkdownRules, textMessageRules };\n" }, { "change_type": "MODIFY", "old_path": "web/chat/text-message.react.js", "new_path": "web/chat/text-message.react.js", "diff": "@@ -11,15 +11,17 @@ import type {\nimport * as React from 'react';\nimport invariant from 'invariant';\nimport classNames from 'classnames';\n+import { useSelector } from 'react-redux';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport { onlyEmojiRegex } from 'lib/shared/emojis';\n+import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors';\nimport css from './chat-message-list.css';\nimport ComposedMessage from './composed-message.react';\nimport textMessageSendFailed from './text-message-send-failed';\nimport Markdown from '../markdown/markdown.react';\n-import { markdownRules } from '../markdown/rules.react';\n+import { textMessageRules } from '../markdown/rules.react';\ntype Props = {|\n+item: ChatMessageInfoItem,\n@@ -58,6 +60,11 @@ function TextMessage(props: Props) {\n[css.lightTextMessage]: !darkColor,\n});\n+ const threadID = props.threadInfo.id;\n+ const threadMembers = useSelector(state =>\n+ relativeMemberInfoSelectorForMembersOfThread(threadID)(state),\n+ );\n+\nreturn (\n<ComposedMessage\nitem={props.item}\n@@ -68,7 +75,9 @@ function TextMessage(props: Props) {\ncanReply={true}\n>\n<div className={messageClassName} style={messageStyle}>\n- <Markdown rules={markdownRules(darkColor)}>{text}</Markdown>\n+ <Markdown rules={textMessageRules(darkColor, threadMembers)}>\n+ {text}\n+ </Markdown>\n</div>\n</ComposedMessage>\n);\n" }, { "change_type": "MODIFY", "old_path": "web/markdown/rules.react.js", "new_path": "web/markdown/rules.react.js", "diff": "// @flow\n+import type { RelativeMemberInfo } from 'lib/types/thread-types';\n+\nimport * as SimpleMarkdown from 'simple-markdown';\nimport * as React from 'react';\nimport _memoize from 'lodash/memoize';\n@@ -61,7 +63,6 @@ const linkRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\n};\n});\n-// function will contain additional rules for message formatting\nconst markdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\nconst linkMarkdownRules = linkRules(useDarkStyle);\n@@ -90,19 +91,6 @@ const markdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\ninlineCode: SimpleMarkdown.defaultRules.inlineCode,\nem: SimpleMarkdown.defaultRules.em,\nstrong: SimpleMarkdown.defaultRules.strong,\n- mention: {\n- ...SimpleMarkdown.defaultRules.strong,\n- match: SimpleMarkdown.inlineRegex(SharedMarkdown.mentionRegex),\n- parse: (capture: SimpleMarkdown.Capture) => ({\n- content: capture[0],\n- }),\n- // eslint-disable-next-line react/display-name\n- react: (\n- node: SimpleMarkdown.SingleASTNode,\n- output: SimpleMarkdown.Output<SimpleMarkdown.ReactElement>,\n- state: SimpleMarkdown.State,\n- ) => <strong key={state.key}>{node.content}</strong>,\n- },\ndel: SimpleMarkdown.defaultRules.del,\nu: SimpleMarkdown.defaultRules.u,\nheading: {\n@@ -152,4 +140,30 @@ const markdownRules: boolean => MarkdownRules = _memoize(useDarkStyle => {\n};\n});\n-export { linkRules, markdownRules };\n+const textMessageRules: (\n+ boolean,\n+ $ReadOnlyArray<RelativeMemberInfo>,\n+) => MarkdownRules = _memoize((useDarkStyle, members) => {\n+ const baseRules = markdownRules(useDarkStyle);\n+ return {\n+ ...baseRules,\n+ simpleMarkdownRules: {\n+ ...baseRules.simpleMarkdownRules,\n+ mention: {\n+ ...SimpleMarkdown.defaultRules.strong,\n+ match: SharedMarkdown.matchMentions(members),\n+ parse: (capture: SimpleMarkdown.Capture) => ({\n+ content: capture[0],\n+ }),\n+ // eslint-disable-next-line react/display-name\n+ react: (\n+ node: SimpleMarkdown.SingleASTNode,\n+ output: SimpleMarkdown.Output<SimpleMarkdown.ReactElement>,\n+ state: SimpleMarkdown.State,\n+ ) => <strong key={state.key}>{node.content}</strong>,\n+ },\n+ },\n+ };\n+});\n+\n+export { linkRules, textMessageRules };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[client] Only bold @mentions if they match usernames of thread members Summary: This is the final goal of all that Markdown work. Test Plan: Test @mentions that match usernames and ones that don't Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D268
129,187
19.10.2020 16:33:13
14,400
04c6b02ffc47ec81a7f1acdab60988265a1296a9
[native] Convert ThreadSettingsDeleteThread to hook Test Plan: This is just a refactor. I used Flow, and reloaded to make sure it worked Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-delete-thread.react.js", "new_path": "native/chat/settings/thread-settings-delete-thread.react.js", "diff": "// @flow\n-import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport type { ThreadSettingsNavigate } from './thread-settings.react';\n-import type { AppState } from '../../redux/redux-setup';\nimport * as React from 'react';\nimport { Text, View, Platform } from 'react-native';\n-import PropTypes from 'prop-types';\n-\n-import { connect } from 'lib/utils/redux-utils';\nimport Button from '../../components/button.react';\nimport { DeleteThreadRouteName } from '../../navigation/route-names';\n-import {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\n-} from '../../themes/colors';\n+import { useColors, useStyles } from '../../themes/colors';\ntype Props = {|\n- threadInfo: ThreadInfo,\n- navigate: ThreadSettingsNavigate,\n- canLeaveThread: boolean,\n- // Redux state\n- colors: Colors,\n- styles: typeof styles,\n+ +threadInfo: ThreadInfo,\n+ +navigate: ThreadSettingsNavigate,\n+ +canLeaveThread: boolean,\n|};\n-class ThreadSettingsDeleteThread extends React.PureComponent<Props> {\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- navigate: PropTypes.func.isRequired,\n- canLeaveThread: PropTypes.bool.isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- };\n+function ThreadSettingsDeleteThread(props: Props) {\n+ const { navigate, threadInfo } = props;\n+ const onPress = React.useCallback(() => {\n+ navigate({\n+ name: DeleteThreadRouteName,\n+ params: { threadInfo },\n+ key: `${DeleteThreadRouteName}${threadInfo.id}`,\n+ });\n+ }, [navigate, threadInfo]);\n+\n+ const styles = useStyles(unboundStyles);\n+ const { canLeaveThread } = props;\n+ const borderStyle = canLeaveThread ? styles.border : null;\n+\n+ const colors = useColors();\n+ const { panelIosHighlightUnderlay } = colors;\n- render() {\n- const borderStyle = this.props.canLeaveThread\n- ? this.props.styles.border\n- : null;\n- const { panelIosHighlightUnderlay } = this.props.colors;\nreturn (\n- <View style={this.props.styles.container}>\n+ <View style={styles.container}>\n<Button\n- onPress={this.onPress}\n- style={[this.props.styles.button, borderStyle]}\n+ onPress={onPress}\n+ style={[styles.button, borderStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n- <Text style={this.props.styles.text}>Delete thread...</Text>\n+ <Text style={styles.text}>Delete thread...</Text>\n</Button>\n</View>\n);\n}\n- onPress = () => {\n- const threadInfo = this.props.threadInfo;\n- this.props.navigate({\n- name: DeleteThreadRouteName,\n- params: { threadInfo },\n- key: `${DeleteThreadRouteName}${threadInfo.id}`,\n- });\n- };\n-}\n-\n-const styles = {\n+const unboundStyles = {\nborder: {\nborderColor: 'panelForegroundBorder',\nborderTopWidth: 1,\n@@ -86,9 +67,5 @@ const styles = {\nfontSize: 16,\n},\n};\n-const stylesSelector = styleSelector(styles);\n-export default connect((state: AppState) => ({\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n-}))(ThreadSettingsDeleteThread);\n+export default ThreadSettingsDeleteThread;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Convert ThreadSettingsDeleteThread to hook Test Plan: This is just a refactor. I used Flow, and reloaded to make sure it worked Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D269
129,187
19.10.2020 16:40:50
14,400
04c26827cdad3b708d60b2cd31d5d74c67289426
[native] Use hook for data-binding in ThreadSettingsLeaveThread Test Plan: This is just a refactor. I used Flow, and reloaded to make sure it worked Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-leave-thread.react.js", "new_path": "native/chat/settings/thread-settings-leave-thread.react.js", "diff": "@@ -5,17 +5,17 @@ import {\nthreadInfoPropType,\ntype LeaveThreadPayload,\n} from 'lib/types/thread-types';\n-import type { LoadingStatus } from 'lib/types/loading-types';\n-import { loadingStatusPropType } from 'lib/types/loading-types';\n-import type { AppState } from '../../redux/redux-setup';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import {\n+ type LoadingStatus,\n+ loadingStatusPropType,\n+} from 'lib/types/loading-types';\nimport * as React from 'react';\nimport { Text, Alert, ActivityIndicator, View, Platform } from 'react-native';\nimport PropTypes from 'prop-types';\nimport invariant from 'invariant';\n+import { useSelector } from 'react-redux';\n-import { connect } from 'lib/utils/redux-utils';\nimport {\nleaveThreadActionTypes,\nleaveThread,\n@@ -23,35 +23,43 @@ import {\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { otherUsersButNoOtherAdmins } from 'lib/selectors/thread-selectors';\nimport { identifyInvalidatedThreads } from 'lib/shared/thread-utils';\n+import {\n+ type DispatchActionPromise,\n+ useServerCall,\n+ useDispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport Button from '../../components/button.react';\nimport {\ntype Colors,\ncolorsPropType,\n- colorsSelector,\n- styleSelector,\n+ useColors,\n+ useStyles,\n} from '../../themes/colors';\nimport {\n- withNavContext,\n+ NavContext,\ntype NavContextType,\nnavContextPropType,\n} from '../../navigation/navigation-context';\nimport { clearThreadsActionType } from '../../navigation/action-types';\n+type BaseProps = {|\n+ +threadInfo: ThreadInfo,\n+ +canDeleteThread: boolean,\n+|};\ntype Props = {|\n- threadInfo: ThreadInfo,\n- canDeleteThread: boolean,\n+ ...BaseProps,\n// Redux state\n- loadingStatus: LoadingStatus,\n- otherUsersButNoOtherAdmins: boolean,\n- colors: Colors,\n- styles: typeof styles,\n+ +loadingStatus: LoadingStatus,\n+ +otherUsersButNoOtherAdmins: boolean,\n+ +colors: Colors,\n+ +styles: typeof unboundStyles,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- leaveThread: (threadID: string) => Promise<LeaveThreadPayload>,\n+ +leaveThread: (threadID: string) => Promise<LeaveThreadPayload>,\n// withNavContext\n- navContext: ?NavContextType,\n+ +navContext: ?NavContextType,\n|};\nclass ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nstatic propTypes = {\n@@ -149,7 +157,7 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\n}\n}\n-const styles = {\n+const unboundStyles = {\nbutton: {\nflexDirection: 'row',\npaddingHorizontal: 12,\n@@ -169,20 +177,33 @@ const styles = {\nfontSize: 16,\n},\n};\n-const stylesSelector = styleSelector(styles);\nconst loadingStatusSelector = createLoadingStatusSelector(\nleaveThreadActionTypes,\n);\n-export default connect(\n- (state: AppState, ownProps: { threadInfo: ThreadInfo }) => ({\n- loadingStatus: loadingStatusSelector(state),\n- otherUsersButNoOtherAdmins: otherUsersButNoOtherAdmins(\n- ownProps.threadInfo.id,\n- )(state),\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n- }),\n- { leaveThread },\n-)(withNavContext(ThreadSettingsLeaveThread));\n+export default React.memo<BaseProps>(\n+ function ConnectedThreadSettingsLeaveThread(props: BaseProps) {\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+ const otherUsersButNoOtherAdminsValue = useSelector(\n+ otherUsersButNoOtherAdmins(props.threadInfo.id),\n+ );\n+ const colors = useColors();\n+ const styles = useStyles(unboundStyles);\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callLeaveThread = useServerCall(leaveThread);\n+ const navContext = React.useContext(NavContext);\n+ return (\n+ <ThreadSettingsLeaveThread\n+ {...props}\n+ loadingStatus={loadingStatus}\n+ otherUsersButNoOtherAdmins={otherUsersButNoOtherAdminsValue}\n+ colors={colors}\n+ styles={styles}\n+ dispatchActionPromise={dispatchActionPromise}\n+ leaveThread={callLeaveThread}\n+ navContext={navContext}\n+ />\n+ );\n+ },\n+);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in ThreadSettingsLeaveThread Test Plan: This is just a refactor. I used Flow, and reloaded to make sure it worked Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D270
129,187
19.10.2020 19:16:42
14,400
7701631b269ef14b1bb70dec7642f612702d7750
[native] Add a button to promote sidebars to subthreads Summary: This button lets you take a sidebar that grew out of an initial conversation and turn it into a full-fledged subthread Test Plan: Test the button and make sure it works! Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-leave-thread.react.js", "new_path": "native/chat/settings/thread-settings-leave-thread.react.js", "diff": "@@ -45,6 +45,7 @@ import { clearThreadsActionType } from '../../navigation/action-types';\ntype BaseProps = {|\n+threadInfo: ThreadInfo,\n+ +firstActionButton: boolean,\n+lastActionButton: boolean,\n|};\ntype Props = {|\n@@ -64,6 +65,7 @@ type Props = {|\nclass ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\n+ firstActionButton: PropTypes.bool.isRequired,\nlastActionButton: PropTypes.bool.isRequired,\nloadingStatus: loadingStatusPropType.isRequired,\notherUsersButNoOtherAdmins: PropTypes.bool.isRequired,\n@@ -83,6 +85,9 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nthis.props.loadingStatus === 'loading' ? (\n<ActivityIndicator size=\"small\" color={panelForegroundSecondaryLabel} />\n) : null;\n+ const firstButtonStyle = this.props.firstActionButton\n+ ? null\n+ : this.props.styles.topBorder;\nconst lastButtonStyle = this.props.lastActionButton\n? this.props.styles.lastButton\n: null;\n@@ -90,7 +95,7 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\n<View style={this.props.styles.container}>\n<Button\nonPress={this.onPress}\n- style={[this.props.styles.button, lastButtonStyle]}\n+ style={[this.props.styles.button, firstButtonStyle, lastButtonStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n@@ -167,6 +172,10 @@ const unboundStyles = {\nbackgroundColor: 'panelForeground',\npaddingHorizontal: 12,\n},\n+ topBorder: {\n+ borderColor: 'panelForegroundBorder',\n+ borderTopWidth: 1,\n+ },\nlastButton: {\npaddingBottom: Platform.OS === 'ios' ? 14 : 12,\npaddingTop: 10,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/chat/settings/thread-settings-promote-sidebar.react.js", "diff": "+// @flow\n+\n+import {\n+ type ThreadInfo,\n+ threadInfoPropType,\n+ type UpdateThreadRequest,\n+ type ChangeThreadSettingsPayload,\n+ threadTypes,\n+} from 'lib/types/thread-types';\n+import {\n+ type LoadingStatus,\n+ loadingStatusPropType,\n+} from 'lib/types/loading-types';\n+\n+import * as React from 'react';\n+import { Text, Alert, ActivityIndicator, View, Platform } from 'react-native';\n+import PropTypes from 'prop-types';\n+import { useSelector } from 'react-redux';\n+\n+import {\n+ changeThreadSettingsActionTypes,\n+ changeThreadSettings,\n+} from 'lib/actions/thread-actions';\n+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+import {\n+ type DispatchActionPromise,\n+ useServerCall,\n+ useDispatchActionPromise,\n+} from 'lib/utils/action-utils';\n+\n+import Button from '../../components/button.react';\n+import {\n+ type Colors,\n+ colorsPropType,\n+ useColors,\n+ useStyles,\n+} from '../../themes/colors';\n+\n+type BaseProps = {|\n+ +threadInfo: ThreadInfo,\n+ +lastActionButton: boolean,\n+|};\n+type Props = {|\n+ ...BaseProps,\n+ // Redux state\n+ +loadingStatus: LoadingStatus,\n+ +colors: Colors,\n+ +styles: typeof unboundStyles,\n+ // Redux dispatch functions\n+ +dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ +changeThreadSettings: (\n+ request: UpdateThreadRequest,\n+ ) => Promise<ChangeThreadSettingsPayload>,\n+|};\n+class ThreadSettingsPromoteSubthread extends React.PureComponent<Props> {\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ lastActionButton: PropTypes.bool.isRequired,\n+ loadingStatus: loadingStatusPropType.isRequired,\n+ colors: colorsPropType.isRequired,\n+ styles: PropTypes.objectOf(PropTypes.object).isRequired,\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ changeThreadSettings: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ const {\n+ panelIosHighlightUnderlay,\n+ panelForegroundSecondaryLabel,\n+ } = this.props.colors;\n+ const loadingIndicator =\n+ this.props.loadingStatus === 'loading' ? (\n+ <ActivityIndicator size=\"small\" color={panelForegroundSecondaryLabel} />\n+ ) : null;\n+ const lastButtonStyle = this.props.lastActionButton\n+ ? this.props.styles.lastButton\n+ : null;\n+ return (\n+ <View style={this.props.styles.container}>\n+ <Button\n+ onPress={this.onPress}\n+ style={[this.props.styles.button, lastButtonStyle]}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={panelIosHighlightUnderlay}\n+ >\n+ <Text style={this.props.styles.text}>Promote to subthread...</Text>\n+ {loadingIndicator}\n+ </Button>\n+ </View>\n+ );\n+ }\n+\n+ onPress = () => {\n+ this.props.dispatchActionPromise(\n+ changeThreadSettingsActionTypes,\n+ this.changeThreadSettings(),\n+ );\n+ };\n+\n+ async changeThreadSettings() {\n+ const threadID = this.props.threadInfo.id;\n+ try {\n+ return await this.props.changeThreadSettings({\n+ threadID,\n+ changes: { type: threadTypes.CHAT_NESTED_OPEN },\n+ });\n+ } catch (e) {\n+ Alert.alert('Unknown error', 'Uhh... try again?', undefined, {\n+ cancelable: true,\n+ });\n+ throw e;\n+ }\n+ }\n+}\n+\n+const unboundStyles = {\n+ button: {\n+ flexDirection: 'row',\n+ paddingHorizontal: 12,\n+ paddingVertical: 10,\n+ },\n+ container: {\n+ backgroundColor: 'panelForeground',\n+ paddingHorizontal: 12,\n+ },\n+ lastButton: {\n+ paddingBottom: Platform.OS === 'ios' ? 14 : 12,\n+ paddingTop: 10,\n+ },\n+ text: {\n+ color: 'panelForegroundSecondaryLabel',\n+ flex: 1,\n+ fontSize: 16,\n+ },\n+};\n+\n+const loadingStatusSelector = createLoadingStatusSelector(\n+ changeThreadSettingsActionTypes,\n+);\n+\n+export default React.memo<BaseProps>(\n+ function ConnectedThreadSettingsPromoteSubthread(props: BaseProps) {\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+ const colors = useColors();\n+ const styles = useStyles(unboundStyles);\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callChangeThreadSettings = useServerCall(changeThreadSettings);\n+ return (\n+ <ThreadSettingsPromoteSubthread\n+ {...props}\n+ loadingStatus={loadingStatus}\n+ colors={colors}\n+ styles={styles}\n+ dispatchActionPromise={dispatchActionPromise}\n+ changeThreadSettings={callChangeThreadSettings}\n+ />\n+ );\n+ },\n+);\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -61,6 +61,7 @@ import ThreadSettingsPushNotifs from './thread-settings-push-notifs.react';\nimport ThreadSettingsHomeNotifs from './thread-settings-home-notifs.react';\nimport ThreadSettingsLeaveThread from './thread-settings-leave-thread.react';\nimport ThreadSettingsDeleteThread from './thread-settings-delete-thread.react';\n+import ThreadSettingsPromoteSidebar from './thread-settings-promote-sidebar.react';\nimport {\nAddUsersModalRouteName,\nComposeSubthreadModalRouteName,\n@@ -177,10 +178,17 @@ type ChatSettingsItem =\nitemType: 'addMember',\nkey: string,\n|}\n+ | {|\n+ itemType: 'promoteSidebar',\n+ key: string,\n+ threadInfo: ThreadInfo,\n+ lastActionButton: boolean,\n+ |}\n| {|\nitemType: 'leaveThread',\nkey: string,\nthreadInfo: ThreadInfo,\n+ firstActionButton: boolean,\nlastActionButton: boolean,\n|}\n| {|\n@@ -665,7 +673,13 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nthreadInfo,\nthreadPermissions.DELETE_THREAD,\n);\n- if (isMember || canDeleteThread) {\n+ const canChangeThreadType = threadHasPermission(\n+ threadInfo,\n+ threadPermissions.EDIT_PERMISSIONS,\n+ );\n+ const canPromoteSidebar =\n+ threadInfo.type === threadTypes.SIDEBAR && canChangeThreadType;\n+ if (isMember || canDeleteThread || canPromoteSidebar) {\nlistData.push({\nitemType: 'header',\nkey: 'actionsHeader',\n@@ -673,11 +687,20 @@ class ThreadSettings extends React.PureComponent<Props, State> {\ncategoryType: 'unpadded',\n});\n}\n+ if (canPromoteSidebar) {\n+ listData.push({\n+ itemType: 'promoteSidebar',\n+ key: 'promoteSidebar',\n+ threadInfo,\n+ lastActionButton: !isMember && !canDeleteThread,\n+ });\n+ }\nif (isMember) {\nlistData.push({\nitemType: 'leaveThread',\nkey: 'leaveThread',\nthreadInfo,\n+ firstActionButton: !canPromoteSidebar,\nlastActionButton: !canDeleteThread,\n});\n}\n@@ -687,10 +710,10 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nkey: 'deleteThread',\nthreadInfo,\nnavigate,\n- firstActionButton: !isMember,\n+ firstActionButton: !canPromoteSidebar && !isMember,\n});\n}\n- if (isMember || canDeleteThread) {\n+ if (isMember || canDeleteThread || canPromoteSidebar) {\nlistData.push({\nitemType: 'footer',\nkey: 'actionsFooter',\n@@ -837,6 +860,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nreturn (\n<ThreadSettingsLeaveThread\nthreadInfo={item.threadInfo}\n+ firstActionButton={item.firstActionButton}\nlastActionButton={item.lastActionButton}\n/>\n);\n@@ -848,6 +872,13 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nnavigate={item.navigate}\n/>\n);\n+ } else if (item.itemType === 'promoteSidebar') {\n+ return (\n+ <ThreadSettingsPromoteSidebar\n+ threadInfo={item.threadInfo}\n+ lastActionButton={item.lastActionButton}\n+ />\n+ );\n} else {\ninvariant(false, `unexpected ThreadSettings item type ${item.itemType}`);\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add a button to promote sidebars to subthreads Summary: This button lets you take a sidebar that grew out of an initial conversation and turn it into a full-fledged subthread Test Plan: Test the button and make sure it works! Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D274
129,187
19.10.2020 19:18:14
14,400
c21949a65da7163327a92345700bd057d7febe65
[native] Make ChatSettingsItem type $ReadOnly Summary: Minor just, I just put this in a separate diff to make earlier ones easier to read Test Plan: Flow, make sure it loads Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -91,112 +91,112 @@ export type ThreadSettingsNavigate = $PropertyType<\ntype ChatSettingsItem =\n| {|\n- itemType: 'header',\n- key: string,\n- title: string,\n- categoryType: CategoryType,\n+ +itemType: 'header',\n+ +key: string,\n+ +title: string,\n+ +categoryType: CategoryType,\n|}\n| {|\n- itemType: 'footer',\n- key: string,\n- categoryType: CategoryType,\n+ +itemType: 'footer',\n+ +key: string,\n+ +categoryType: CategoryType,\n|}\n| {|\n- itemType: 'name',\n- key: string,\n- threadInfo: ThreadInfo,\n- nameEditValue: ?string,\n- nameTextHeight: ?number,\n- canChangeSettings: boolean,\n+ +itemType: 'name',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +nameEditValue: ?string,\n+ +nameTextHeight: ?number,\n+ +canChangeSettings: boolean,\n|}\n| {|\n- itemType: 'color',\n- key: string,\n- threadInfo: ThreadInfo,\n- colorEditValue: string,\n- canChangeSettings: boolean,\n- navigate: ThreadSettingsNavigate,\n- threadSettingsRouteKey: string,\n+ +itemType: 'color',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +colorEditValue: string,\n+ +canChangeSettings: boolean,\n+ +navigate: ThreadSettingsNavigate,\n+ +threadSettingsRouteKey: string,\n|}\n| {|\n- itemType: 'description',\n- key: string,\n- threadInfo: ThreadInfo,\n- descriptionEditValue: ?string,\n- descriptionTextHeight: ?number,\n- canChangeSettings: boolean,\n+ +itemType: 'description',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +descriptionEditValue: ?string,\n+ +descriptionTextHeight: ?number,\n+ +canChangeSettings: boolean,\n|}\n| {|\n- itemType: 'parent',\n- key: string,\n- threadInfo: ThreadInfo,\n- navigate: ThreadSettingsNavigate,\n+ +itemType: 'parent',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +navigate: ThreadSettingsNavigate,\n|}\n| {|\n- itemType: 'visibility',\n- key: string,\n- threadInfo: ThreadInfo,\n+ +itemType: 'visibility',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n|}\n| {|\n- itemType: 'pushNotifs',\n- key: string,\n- threadInfo: ThreadInfo,\n+ +itemType: 'pushNotifs',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n|}\n| {|\n- itemType: 'homeNotifs',\n- key: string,\n- threadInfo: ThreadInfo,\n+ +itemType: 'homeNotifs',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n|}\n| {|\n- itemType: 'seeMore',\n- key: string,\n- onPress: () => void,\n+ +itemType: 'seeMore',\n+ +key: string,\n+ +onPress: () => void,\n|}\n| {|\n- itemType: 'childThread',\n- key: string,\n- threadInfo: ThreadInfo,\n- navigate: ThreadSettingsNavigate,\n- lastListItem: boolean,\n+ +itemType: 'childThread',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +navigate: ThreadSettingsNavigate,\n+ +lastListItem: boolean,\n|}\n| {|\n- itemType: 'addSubthread',\n- key: string,\n+ +itemType: 'addSubthread',\n+ +key: string,\n|}\n| {|\n- itemType: 'member',\n- key: string,\n- memberInfo: RelativeMemberInfo,\n- threadInfo: ThreadInfo,\n- canEdit: boolean,\n- navigate: ThreadSettingsNavigate,\n- lastListItem: boolean,\n- verticalBounds: ?VerticalBounds,\n- threadSettingsRouteKey: string,\n+ +itemType: 'member',\n+ +key: string,\n+ +memberInfo: RelativeMemberInfo,\n+ +threadInfo: ThreadInfo,\n+ +canEdit: boolean,\n+ +navigate: ThreadSettingsNavigate,\n+ +lastListItem: boolean,\n+ +verticalBounds: ?VerticalBounds,\n+ +threadSettingsRouteKey: string,\n|}\n| {|\n- itemType: 'addMember',\n- key: string,\n+ +itemType: 'addMember',\n+ +key: string,\n|}\n| {|\n- itemType: 'promoteSidebar',\n- key: string,\n- threadInfo: ThreadInfo,\n- lastActionButton: boolean,\n+ +itemType: 'promoteSidebar',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +lastActionButton: boolean,\n|}\n| {|\n- itemType: 'leaveThread',\n- key: string,\n- threadInfo: ThreadInfo,\n- firstActionButton: boolean,\n- lastActionButton: boolean,\n+ +itemType: 'leaveThread',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +firstActionButton: boolean,\n+ +lastActionButton: boolean,\n|}\n| {|\n- itemType: 'deleteThread',\n- key: string,\n- threadInfo: ThreadInfo,\n- navigate: ThreadSettingsNavigate,\n- firstActionButton: boolean,\n+ +itemType: 'deleteThread',\n+ +key: string,\n+ +threadInfo: ThreadInfo,\n+ +navigate: ThreadSettingsNavigate,\n+ +firstActionButton: boolean,\n|};\ntype BaseProps = {|\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Make ChatSettingsItem type $ReadOnly Summary: Minor just, I just put this in a separate diff to make earlier ones easier to read Test Plan: Flow, make sure it loads Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D275
129,187
20.10.2020 19:07:39
14,400
cee435743ad58003ac874bf4ff8e6db81c88365d
[native] showMaxSubthreads -> numSubthreadsShowing Summary: [pointed out](https://phabricator.ashoat.com/D260#inline-1161) that the earlier name was confusing because it sounded like an action. I've updated it to be more clear. Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian, palys-swm
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -217,8 +217,8 @@ type Props = {|\n|};\ntype State = {|\n+showMaxMembers: number,\n- +showMaxSubthreads: number,\n- +showMaxSidebars: number,\n+ +numSubthreadsShowing: number,\n+ +numSidebarsShowing: number,\n+nameEditValue: ?string,\n+descriptionEditValue: ?string,\n+nameTextHeight: ?number,\n@@ -259,8 +259,8 @@ class ThreadSettings extends React.PureComponent<Props, State> {\ninvariant(threadInfo, 'ThreadInfo should exist when ThreadSettings opened');\nthis.state = {\nshowMaxMembers: itemPageLength,\n- showMaxSubthreads: itemPageLength,\n- showMaxSidebars: itemPageLength,\n+ numSubthreadsShowing: itemPageLength,\n+ numSidebarsShowing: itemPageLength,\nnameEditValue: null,\ndescriptionEditValue: null,\nnameTextHeight: null,\n@@ -480,12 +480,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nThreadSettings.getThreadInfo(propsAndState),\n(propsAndState: PropsAndState) => propsAndState.navigation.navigate,\n(propsAndState: PropsAndState) => propsAndState.childThreadInfos,\n- (propsAndState: PropsAndState) => propsAndState.showMaxSubthreads,\n+ (propsAndState: PropsAndState) => propsAndState.numSubthreadsShowing,\n(\nthreadInfo: ThreadInfo,\nnavigate: ThreadSettingsNavigate,\nchildThreads: ?(ThreadInfo[]),\n- showMaxSubthreads: number,\n+ numSubthreadsShowing: number,\n) => {\nconst listData: ChatSettingsItem[] = [];\n@@ -502,7 +502,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n}\nconst subthreadSlice = subthreads\n- .slice(0, showMaxSubthreads)\n+ .slice(0, numSubthreadsShowing)\n.map(subthreadInfo => ({\nitemType: 'childThread',\nkey: `childThread${subthreadInfo.id}`,\n@@ -512,7 +512,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n}));\nlet subthreadItems = subthreadSlice;\n- if (subthreads.length > showMaxSubthreads) {\n+ if (subthreads.length > numSubthreadsShowing) {\nsubthreadItems = [\n...subthreadItems, // for Flow\n{\n@@ -551,11 +551,11 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nsidebarsListDataSelector = createSelector(\n(propsAndState: PropsAndState) => propsAndState.navigation.navigate,\n(propsAndState: PropsAndState) => propsAndState.childThreadInfos,\n- (propsAndState: PropsAndState) => propsAndState.showMaxSidebars,\n+ (propsAndState: PropsAndState) => propsAndState.numSidebarsShowing,\n(\nnavigate: ThreadSettingsNavigate,\nchildThreads: ?(ThreadInfo[]),\n- showMaxSidebars: number,\n+ numSidebarsShowing: number,\n) => {\nconst listData: ChatSettingsItem[] = [];\n@@ -568,7 +568,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n}\nconst sidebarSlice = sidebars\n- .slice(0, showMaxSidebars)\n+ .slice(0, numSidebarsShowing)\n.map(sidebarInfo => ({\nitemType: 'childThread',\nkey: `childThread${sidebarInfo.id}`,\n@@ -578,7 +578,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n}));\nlet sidebarItems = sidebarSlice;\n- if (sidebars.length > showMaxSidebars) {\n+ if (sidebars.length > numSidebarsShowing) {\nsidebarItems = [\n...sidebarItems, // for Flow\n{\n@@ -983,13 +983,13 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nonPressSeeMoreSubthreads = () => {\nthis.setState(prevState => ({\n- showMaxSubthreads: prevState.showMaxSubthreads + itemPageLength,\n+ numSubthreadsShowing: prevState.numSubthreadsShowing + itemPageLength,\n}));\n};\nonPressSeeMoreSidebars = () => {\nthis.setState(prevState => ({\n- showMaxSidebars: prevState.showMaxSidebars + itemPageLength,\n+ numSidebarsShowing: prevState.numSidebarsShowing + itemPageLength,\n}));\n};\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] showMaxSubthreads -> numSubthreadsShowing Summary: @palys-swm [pointed out](https://phabricator.ashoat.com/D260#inline-1161) that the earlier name was confusing because it sounded like an action. I've updated it to be more clear. Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian, palys-swm Differential Revision: https://phabricator.ashoat.com/D277
129,187
21.10.2020 17:01:06
14,400
70063e4d7c03a46d6d5b1832160857d875d41352
Make case-insensistive Summary: `lib` code affects bolding in `Markdown` components, `server` code affects delivery of push notifs Test Plan: I tested the RegEx in a JavaScript CLI Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/markdown.js", "new_path": "lib/shared/markdown.js", "diff": "@@ -151,7 +151,7 @@ function parseList(\nfunction matchMentions(members: $ReadOnlyArray<RelativeMemberInfo>) {\nconst memberSet = new Set(\n- members.map(({ username }) => username).filter(Boolean),\n+ members.map(({ username }) => username?.toLowerCase()).filter(Boolean),\n);\nconst match = (source: string, state: State) => {\nif (!state.inline) {\n@@ -163,7 +163,7 @@ function matchMentions(members: $ReadOnlyArray<RelativeMemberInfo>) {\n}\nconst username = result[2];\ninvariant(username, 'mentionRegex should match two capture groups');\n- if (!memberSet.has(username)) {\n+ if (!memberSet.has(username.toLowerCase())) {\nreturn null;\n}\nreturn result;\n" }, { "change_type": "MODIFY", "old_path": "server/src/push/send.js", "new_path": "server/src/push/send.js", "diff": "@@ -125,7 +125,7 @@ async function sendPushNotifs(pushInfo: PushInfo) {\nusername &&\noldValidUsernameRegex.test(username) &&\nfirstNewMessageInfo.type === messageTypes.TEXT &&\n- new RegExp(`\\\\B@${username}\\\\b`).test(firstNewMessageInfo.text);\n+ new RegExp(`\\\\B@${username}\\\\b`, 'i').test(firstNewMessageInfo.text);\nif (!updateBadge && !displayBanner && !userWasMentioned) {\ncontinue;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Make @mentions case-insensistive Summary: `lib` code affects bolding in `Markdown` components, `server` code affects delivery of push notifs Test Plan: I tested the RegEx in a JavaScript CLI Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D280
129,187
21.10.2020 19:05:11
14,400
5a52f78319e9c77b1931fb3ac78c17227e2d686b
[native] Programmatically determine firstActionButton/lastActionButton in ThreadSettings Summary: This way is more futureproof for when we need to add another one of these buttons Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -152,13 +152,7 @@ type ChatSettingsItem =\n+key: string,\n+onPress: () => void,\n|}\n- | {|\n- +itemType: 'childThread',\n- +key: string,\n- +threadInfo: ThreadInfo,\n- +navigate: ThreadSettingsNavigate,\n- +lastListItem: boolean,\n- |}\n+ | ChatSettingsChildThreadItem\n| {|\n+itemType: 'addSubthread',\n+key: string,\n@@ -178,25 +172,26 @@ type ChatSettingsItem =\n+itemType: 'addMember',\n+key: string,\n|}\n- | {|\n- +itemType: 'promoteSidebar',\n- +key: string,\n- +threadInfo: ThreadInfo,\n- +lastActionButton: boolean,\n- |}\n- | {|\n- +itemType: 'leaveThread',\n+ | ChatSettingsButtonItem;\n+\n+type ChatSettingsChildThreadItem = {|\n+ +itemType: 'childThread',\n+key: string,\n+threadInfo: ThreadInfo,\n- +firstActionButton: boolean,\n- +lastActionButton: boolean,\n- |}\n- | {|\n- +itemType: 'deleteThread',\n+ +navigate: ThreadSettingsNavigate,\n+ +lastListItem: boolean,\n+|};\n+\n+type ChatSettingsButtonItemBase = {|\n+ +itemType: 'promoteSidebar' | 'leaveThread' | 'deleteThread',\n+key: string,\n+threadInfo: ThreadInfo,\n+navigate: ThreadSettingsNavigate,\n+|};\n+type ChatSettingsButtonItem = {|\n+ ...ChatSettingsButtonItemBase,\n+firstActionButton: boolean,\n+ +lastActionButton: boolean,\n|};\ntype BaseProps = {|\n@@ -501,15 +496,16 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nreturn listData;\n}\n- const subthreadSlice = subthreads\n- .slice(0, numSubthreadsShowing)\n- .map(subthreadInfo => ({\n+ const subthreadSlice = subthreads.slice(0, numSubthreadsShowing).map(\n+ subthreadInfo =>\n+ ({\nitemType: 'childThread',\nkey: `childThread${subthreadInfo.id}`,\nthreadInfo: subthreadInfo,\nnavigate,\nlastListItem: false,\n- }));\n+ }: ChatSettingsChildThreadItem),\n+ );\nlet subthreadItems = subthreadSlice;\nif (subthreads.length > numSubthreadsShowing) {\n@@ -522,7 +518,10 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n},\n];\n} else if (subthreadItems.length > 0) {\n- subthreadItems[subthreadItems.length - 1].lastListItem = true;\n+ subthreadItems[subthreadItems.length - 1] = {\n+ ...subthreadItems[subthreadItems.length - 1],\n+ lastListItem: true,\n+ };\n}\nlistData.push({\n@@ -567,15 +566,16 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nreturn listData;\n}\n- const sidebarSlice = sidebars\n- .slice(0, numSidebarsShowing)\n- .map(sidebarInfo => ({\n+ const sidebarSlice = sidebars.slice(0, numSidebarsShowing).map(\n+ sidebarInfo =>\n+ ({\nitemType: 'childThread',\nkey: `childThread${sidebarInfo.id}`,\nthreadInfo: sidebarInfo,\nnavigate,\nlastListItem: false,\n- }));\n+ }: ChatSettingsChildThreadItem),\n+ );\nlet sidebarItems = sidebarSlice;\nif (sidebars.length > numSidebarsShowing) {\n@@ -588,7 +588,10 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n},\n];\n} else {\n- sidebarItems[sidebarItems.length - 1].lastListItem = true;\n+ sidebarItems[sidebarItems.length - 1] = {\n+ ...sidebarItems[sidebarItems.length - 1],\n+ lastListItem: true,\n+ };\n}\nlistData.push({\n@@ -661,7 +664,10 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n},\n];\n} else if (membershipItems.length > 0) {\n- membershipItems[membershipItems.length - 1].lastListItem = true;\n+ membershipItems[membershipItems.length - 1] = {\n+ ...membershipItems[membershipItems.length - 1],\n+ lastListItem: true,\n+ };\n}\nlistData.push({\n@@ -692,61 +698,68 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nThreadSettings.getThreadInfo(propsAndState),\n(propsAndState: PropsAndState) => propsAndState.navigation.navigate,\n(threadInfo: ThreadInfo, navigate: ThreadSettingsNavigate) => {\n- const listData: ChatSettingsItem[] = [];\n+ const buttons: ChatSettingsButtonItemBase[] = [];\n- const isMember = viewerIsMember(threadInfo);\n- const canDeleteThread = threadHasPermission(\n- threadInfo,\n- threadPermissions.DELETE_THREAD,\n- );\nconst canChangeThreadType = threadHasPermission(\nthreadInfo,\nthreadPermissions.EDIT_PERMISSIONS,\n);\nconst canPromoteSidebar =\nthreadInfo.type === threadTypes.SIDEBAR && canChangeThreadType;\n-\n- if (isMember || canDeleteThread || canPromoteSidebar) {\n- listData.push({\n- itemType: 'header',\n- key: 'actionsHeader',\n- title: 'Actions',\n- categoryType: 'unpadded',\n- });\n- }\nif (canPromoteSidebar) {\n- listData.push({\n+ buttons.push({\nitemType: 'promoteSidebar',\nkey: 'promoteSidebar',\nthreadInfo,\n- lastActionButton: !isMember && !canDeleteThread,\n+ navigate,\n});\n}\n- if (isMember) {\n- listData.push({\n+\n+ if (viewerIsMember(threadInfo)) {\n+ buttons.push({\nitemType: 'leaveThread',\nkey: 'leaveThread',\nthreadInfo,\n- firstActionButton: !canPromoteSidebar,\n- lastActionButton: !canDeleteThread,\n+ navigate,\n});\n}\n+\n+ const canDeleteThread = threadHasPermission(\n+ threadInfo,\n+ threadPermissions.DELETE_THREAD,\n+ );\nif (canDeleteThread) {\n- listData.push({\n+ buttons.push({\nitemType: 'deleteThread',\nkey: 'deleteThread',\nthreadInfo,\nnavigate,\n- firstActionButton: !canPromoteSidebar && !isMember,\n});\n}\n- if (isMember || canDeleteThread || canPromoteSidebar) {\n+\n+ const listData: ChatSettingsItem[] = [];\n+ if (buttons.length === 0) {\n+ return listData;\n+ }\n+\n+ listData.push({\n+ itemType: 'header',\n+ key: 'actionsHeader',\n+ title: 'Actions',\n+ categoryType: 'unpadded',\n+ });\n+ for (let i = 0; i < buttons.length; i++) {\n+ listData.push({\n+ ...buttons[i],\n+ firstActionButton: i === 0,\n+ lastActionButton: i === buttons.length - 1,\n+ });\n+ }\nlistData.push({\nitemType: 'footer',\nkey: 'actionsFooter',\ncategoryType: 'unpadded',\n});\n- }\nreturn listData;\n},\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Programmatically determine firstActionButton/lastActionButton in ThreadSettings Summary: This way is more futureproof for when we need to add another one of these buttons Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D284
129,187
21.10.2020 19:18:08
14,400
ac1149dd8ab79facd13d9cf9e516f9f4950eb54e
[native] Determine buttonsStyle in ThreadSettings Summary: This centralizes the logic instead of having it be separate in the different button components. Follow-up to feedback in D271. Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-delete-thread.react.js", "new_path": "native/chat/settings/thread-settings-delete-thread.react.js", "diff": "import type { ThreadInfo } from 'lib/types/thread-types';\nimport type { ThreadSettingsNavigate } from './thread-settings.react';\n+import type { ViewStyle } from '../../types/styles';\nimport * as React from 'react';\n-import { Text, View, Platform } from 'react-native';\n+import { Text, View } from 'react-native';\nimport Button from '../../components/button.react';\nimport { DeleteThreadRouteName } from '../../navigation/route-names';\n@@ -13,7 +14,7 @@ import { useColors, useStyles } from '../../themes/colors';\ntype Props = {|\n+threadInfo: ThreadInfo,\n+navigate: ThreadSettingsNavigate,\n- +firstActionButton: boolean,\n+ +buttonStyle: ViewStyle,\n|};\nfunction ThreadSettingsDeleteThread(props: Props) {\nconst { navigate, threadInfo } = props;\n@@ -25,17 +26,15 @@ function ThreadSettingsDeleteThread(props: Props) {\n});\n}, [navigate, threadInfo]);\n- const styles = useStyles(unboundStyles);\n- const borderStyle = props.firstActionButton ? null : styles.topBorder;\n-\nconst colors = useColors();\nconst { panelIosHighlightUnderlay } = colors;\n+ const styles = useStyles(unboundStyles);\nreturn (\n<View style={styles.container}>\n<Button\nonPress={onPress}\n- style={[styles.button, borderStyle]}\n+ style={[styles.button, props.buttonStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n@@ -46,15 +45,10 @@ function ThreadSettingsDeleteThread(props: Props) {\n}\nconst unboundStyles = {\n- topBorder: {\n- borderColor: 'panelForegroundBorder',\n- borderTopWidth: 1,\n- },\nbutton: {\nflexDirection: 'row',\n- paddingBottom: Platform.OS === 'ios' ? 14 : 12,\npaddingHorizontal: 12,\n- paddingTop: 10,\n+ paddingVertical: 10,\n},\ncontainer: {\nbackgroundColor: 'panelForeground',\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-leave-thread.react.js", "new_path": "native/chat/settings/thread-settings-leave-thread.react.js", "diff": "// @flow\n-import {\n- type ThreadInfo,\n- threadInfoPropType,\n- type LeaveThreadPayload,\n-} from 'lib/types/thread-types';\n-import {\n- type LoadingStatus,\n- loadingStatusPropType,\n-} from 'lib/types/loading-types';\n+import type { ThreadInfo, LeaveThreadPayload } from 'lib/types/thread-types';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import type { ViewStyle } from '../../types/styles';\nimport * as React from 'react';\n-import { Text, Alert, ActivityIndicator, View, Platform } from 'react-native';\n-import PropTypes from 'prop-types';\n+import { Text, Alert, ActivityIndicator, View } from 'react-native';\nimport invariant from 'invariant';\nimport { useSelector } from 'react-redux';\n@@ -30,23 +23,16 @@ import {\n} from 'lib/utils/action-utils';\nimport Button from '../../components/button.react';\n-import {\n- type Colors,\n- colorsPropType,\n- useColors,\n- useStyles,\n-} from '../../themes/colors';\n+import { type Colors, useColors, useStyles } from '../../themes/colors';\nimport {\nNavContext,\ntype NavContextType,\n- navContextPropType,\n} from '../../navigation/navigation-context';\nimport { clearThreadsActionType } from '../../navigation/action-types';\ntype BaseProps = {|\n+threadInfo: ThreadInfo,\n- +firstActionButton: boolean,\n- +lastActionButton: boolean,\n+ +buttonStyle: ViewStyle,\n|};\ntype Props = {|\n...BaseProps,\n@@ -63,19 +49,6 @@ type Props = {|\n+navContext: ?NavContextType,\n|};\nclass ThreadSettingsLeaveThread extends React.PureComponent<Props> {\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- firstActionButton: PropTypes.bool.isRequired,\n- lastActionButton: PropTypes.bool.isRequired,\n- loadingStatus: loadingStatusPropType.isRequired,\n- otherUsersButNoOtherAdmins: PropTypes.bool.isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- leaveThread: PropTypes.func.isRequired,\n- navContext: navContextPropType,\n- };\n-\nrender() {\nconst {\npanelIosHighlightUnderlay,\n@@ -85,17 +58,11 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nthis.props.loadingStatus === 'loading' ? (\n<ActivityIndicator size=\"small\" color={panelForegroundSecondaryLabel} />\n) : null;\n- const firstButtonStyle = this.props.firstActionButton\n- ? null\n- : this.props.styles.topBorder;\n- const lastButtonStyle = this.props.lastActionButton\n- ? this.props.styles.lastButton\n- : null;\nreturn (\n<View style={this.props.styles.container}>\n<Button\nonPress={this.onPress}\n- style={[this.props.styles.button, firstButtonStyle, lastButtonStyle]}\n+ style={[this.props.styles.button, this.props.buttonStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n@@ -172,14 +139,6 @@ const unboundStyles = {\nbackgroundColor: 'panelForeground',\npaddingHorizontal: 12,\n},\n- topBorder: {\n- borderColor: 'panelForegroundBorder',\n- borderTopWidth: 1,\n- },\n- lastButton: {\n- paddingBottom: Platform.OS === 'ios' ? 14 : 12,\n- paddingTop: 10,\n- },\ntext: {\ncolor: 'redText',\nflex: 1,\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-promote-sidebar.react.js", "new_path": "native/chat/settings/thread-settings-promote-sidebar.react.js", "diff": "import {\ntype ThreadInfo,\n- threadInfoPropType,\ntype UpdateThreadRequest,\ntype ChangeThreadSettingsPayload,\nthreadTypes,\n} from 'lib/types/thread-types';\n-import {\n- type LoadingStatus,\n- loadingStatusPropType,\n-} from 'lib/types/loading-types';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import type { ViewStyle } from '../../types/styles';\nimport * as React from 'react';\n-import { Text, Alert, ActivityIndicator, View, Platform } from 'react-native';\n-import PropTypes from 'prop-types';\n+import { Text, Alert, ActivityIndicator, View } from 'react-native';\nimport { useSelector } from 'react-redux';\nimport {\n@@ -29,16 +25,11 @@ import {\n} from 'lib/utils/action-utils';\nimport Button from '../../components/button.react';\n-import {\n- type Colors,\n- colorsPropType,\n- useColors,\n- useStyles,\n-} from '../../themes/colors';\n+import { type Colors, useColors, useStyles } from '../../themes/colors';\ntype BaseProps = {|\n+threadInfo: ThreadInfo,\n- +lastActionButton: boolean,\n+ +buttonStyle: ViewStyle,\n|};\ntype Props = {|\n...BaseProps,\n@@ -54,16 +45,6 @@ type Props = {|\n) => Promise<ChangeThreadSettingsPayload>,\n|};\nclass ThreadSettingsPromoteSubthread extends React.PureComponent<Props> {\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- lastActionButton: PropTypes.bool.isRequired,\n- loadingStatus: loadingStatusPropType.isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- changeThreadSettings: PropTypes.func.isRequired,\n- };\n-\nrender() {\nconst {\npanelIosHighlightUnderlay,\n@@ -73,14 +54,11 @@ class ThreadSettingsPromoteSubthread extends React.PureComponent<Props> {\nthis.props.loadingStatus === 'loading' ? (\n<ActivityIndicator size=\"small\" color={panelForegroundSecondaryLabel} />\n) : null;\n- const lastButtonStyle = this.props.lastActionButton\n- ? this.props.styles.lastButton\n- : null;\nreturn (\n<View style={this.props.styles.container}>\n<Button\nonPress={this.onPress}\n- style={[this.props.styles.button, lastButtonStyle]}\n+ style={[this.props.styles.button, this.props.buttonStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n@@ -124,10 +102,6 @@ const unboundStyles = {\nbackgroundColor: 'panelForeground',\npaddingHorizontal: 12,\n},\n- lastButton: {\n- paddingBottom: Platform.OS === 'ios' ? 14 : 12,\n- paddingTop: 10,\n- },\ntext: {\ncolor: 'panelForegroundSecondaryLabel',\nflex: 1,\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -14,10 +14,11 @@ import type { VerticalBounds } from '../../types/layout-types';\nimport type { ChatNavigationProp } from '../chat.react';\nimport type { TabNavigationProp } from '../../navigation/app-navigator.react';\nimport type { NavigationRoute } from '../../navigation/route-names';\n+import type { ViewStyle } from '../../types/styles';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n-import { View, FlatList } from 'react-native';\n+import { View, FlatList, Platform } from 'react-native';\nimport invariant from 'invariant';\nimport { createSelector } from 'reselect';\nimport { useSelector } from 'react-redux';\n@@ -190,8 +191,7 @@ type ChatSettingsButtonItemBase = {|\n|};\ntype ChatSettingsButtonItem = {|\n...ChatSettingsButtonItemBase,\n- +firstActionButton: boolean,\n- +lastActionButton: boolean,\n+ +buttonStyle: ViewStyle,\n|};\ntype BaseProps = {|\n@@ -697,7 +697,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n(propsAndState: PropsAndState) =>\nThreadSettings.getThreadInfo(propsAndState),\n(propsAndState: PropsAndState) => propsAndState.navigation.navigate,\n- (threadInfo: ThreadInfo, navigate: ThreadSettingsNavigate) => {\n+ (propsAndState: PropsAndState) => propsAndState.styles,\n+ (\n+ threadInfo: ThreadInfo,\n+ navigate: ThreadSettingsNavigate,\n+ styles: typeof unboundStyles,\n+ ) => {\nconst buttons: ChatSettingsButtonItemBase[] = [];\nconst canChangeThreadType = threadHasPermission(\n@@ -751,8 +756,10 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nfor (let i = 0; i < buttons.length; i++) {\nlistData.push({\n...buttons[i],\n- firstActionButton: i === 0,\n- lastActionButton: i === buttons.length - 1,\n+ buttonStyle: [\n+ i === 0 ? null : styles.nonTopButton,\n+ i === buttons.length - 1 ? styles.lastButton : null,\n+ ],\n});\n}\nlistData.push({\n@@ -921,23 +928,22 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nreturn (\n<ThreadSettingsLeaveThread\nthreadInfo={item.threadInfo}\n- firstActionButton={item.firstActionButton}\n- lastActionButton={item.lastActionButton}\n+ buttonStyle={item.buttonStyle}\n/>\n);\n} else if (item.itemType === 'deleteThread') {\nreturn (\n<ThreadSettingsDeleteThread\nthreadInfo={item.threadInfo}\n- firstActionButton={item.firstActionButton}\nnavigate={item.navigate}\n+ buttonStyle={item.buttonStyle}\n/>\n);\n} else if (item.itemType === 'promoteSidebar') {\nreturn (\n<ThreadSettingsPromoteSidebar\nthreadInfo={item.threadInfo}\n- lastActionButton={item.lastActionButton}\n+ buttonStyle={item.buttonStyle}\n/>\n);\n} else {\n@@ -1008,6 +1014,13 @@ const unboundStyles = {\nflatList: {\npaddingVertical: 16,\n},\n+ nonTopButton: {\n+ borderColor: 'panelForegroundBorder',\n+ borderTopWidth: 1,\n+ },\n+ lastButton: {\n+ paddingBottom: Platform.OS === 'ios' ? 14 : 12,\n+ },\n};\nconst editNameLoadingStatusSelector = createLoadingStatusSelector(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Determine buttonsStyle in ThreadSettings Summary: This centralizes the logic instead of having it be separate in the different button components. Follow-up to feedback in D271. Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D285
129,187
21.10.2020 23:56:05
14,400
78011383f4629169bc1de597c35e5f329b8c6547
[native] Convert ThreadSettingsChildThread to hook Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-child-thread.react.js", "new_path": "native/chat/settings/thread-settings-child-thread.react.js", "diff": "// @flow\n-import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport type { ThreadSettingsNavigate } from './thread-settings.react';\n-import type { AppState } from '../../redux/redux-setup';\nimport * as React from 'react';\nimport { View, Platform } from 'react-native';\n-import PropTypes from 'prop-types';\n-\n-import { connect } from 'lib/utils/redux-utils';\nimport { MessageListRouteName } from '../../navigation/route-names';\nimport Button from '../../components/button.react';\nimport ColorSplotch from '../../components/color-splotch.react';\nimport ThreadIcon from '../../components/thread-icon.react';\n-import {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\n-} from '../../themes/colors';\n+import { useColors, useStyles } from '../../themes/colors';\nimport { SingleLine } from '../../components/single-line.react';\ntype Props = {|\n- threadInfo: ThreadInfo,\n- navigate: ThreadSettingsNavigate,\n- lastListItem: boolean,\n- // Redux state\n- colors: Colors,\n- styles: typeof styles,\n+ +threadInfo: ThreadInfo,\n+ +navigate: ThreadSettingsNavigate,\n+ +lastListItem: boolean,\n|};\n-class ThreadSettingsChildThread extends React.PureComponent<Props> {\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- navigate: PropTypes.func.isRequired,\n- lastListItem: PropTypes.bool.isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- };\n+function ThreadSettingsChildThread(props: Props) {\n+ const { navigate, threadInfo } = props;\n+ const onPress = React.useCallback(() => {\n+ navigate({\n+ name: MessageListRouteName,\n+ params: { threadInfo },\n+ key: `${MessageListRouteName}${threadInfo.id}`,\n+ });\n+ }, [navigate, threadInfo]);\n+\n+ const styles = useStyles(unboundStyles);\n+ const colors = useColors();\n- render() {\n- const lastButtonStyle = this.props.lastListItem\n- ? this.props.styles.lastButton\n- : null;\n+ const lastButtonStyle = props.lastListItem ? styles.lastButton : null;\nreturn (\n- <View style={this.props.styles.container}>\n- <Button\n- onPress={this.onPress}\n- style={[this.props.styles.button, lastButtonStyle]}\n- >\n- <View style={this.props.styles.leftSide}>\n- <ColorSplotch color={this.props.threadInfo.color} />\n- <SingleLine style={this.props.styles.text}>\n- {this.props.threadInfo.uiName}\n- </SingleLine>\n+ <View style={styles.container}>\n+ <Button onPress={onPress} style={[styles.button, lastButtonStyle]}>\n+ <View style={styles.leftSide}>\n+ <ColorSplotch color={threadInfo.color} />\n+ <SingleLine style={styles.text}>{threadInfo.uiName}</SingleLine>\n</View>\n<ThreadIcon\n- threadType={this.props.threadInfo.type}\n- color={this.props.colors.panelForegroundSecondaryLabel}\n+ threadType={threadInfo.type}\n+ color={colors.panelForegroundSecondaryLabel}\n/>\n</Button>\n</View>\n);\n}\n- onPress = () => {\n- const { threadInfo, navigate } = this.props;\n- navigate({\n- name: MessageListRouteName,\n- params: { threadInfo },\n- key: `${MessageListRouteName}${threadInfo.id}`,\n- });\n- };\n-}\n-\n-const styles = {\n+const unboundStyles = {\nbutton: {\nflex: 1,\nflexDirection: 'row',\n@@ -106,9 +80,5 @@ const styles = {\npaddingLeft: 8,\n},\n};\n-const stylesSelector = styleSelector(styles);\n-export default connect((state: AppState) => ({\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n-}))(ThreadSettingsChildThread);\n+export default ThreadSettingsChildThread;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Convert ThreadSettingsChildThread to hook Test Plan: Flow, make sure `ThreadSettings` still loads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D287
129,187
22.10.2020 00:14:01
14,400
076f493c92a7f2ac3ab005992510be798a02aeac
[native] Simplify ChatSettingsItem type Summary: After the work in D286 and D288, we no longer have to explicitly type `listData` items as we're constructing them, so we can now type `ChatSettingsItem` in one statement again. Test Plan: Flow Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -153,28 +153,19 @@ type ChatSettingsItem =\n+key: string,\n+onPress: () => void,\n|}\n- | ChatSettingsChildThreadItem\n| {|\n- +itemType: 'addSubthread',\n- +key: string,\n- |}\n- | ChatSettingsMemberItem\n- | {|\n- +itemType: 'addMember',\n- +key: string,\n- |}\n- | ChatSettingsButtonItem;\n-\n-type ChatSettingsChildThreadItem = {|\n+itemType: 'childThread',\n+key: string,\n+threadInfo: ThreadInfo,\n+navigate: ThreadSettingsNavigate,\n+firstListItem: boolean,\n+lastListItem: boolean,\n-|};\n-\n-type ChatSettingsMemberItem = {|\n+ |}\n+ | {|\n+ +itemType: 'addSubthread',\n+ +key: string,\n+ |}\n+ | {|\n+itemType: 'member',\n+key: string,\n+memberInfo: RelativeMemberInfo,\n@@ -185,16 +176,16 @@ type ChatSettingsMemberItem = {|\n+lastListItem: boolean,\n+verticalBounds: ?VerticalBounds,\n+threadSettingsRouteKey: string,\n-|};\n-\n-type ChatSettingsButtonItemBase = {|\n+ |}\n+ | {|\n+ +itemType: 'addMember',\n+ +key: string,\n+ |}\n+ | {|\n+itemType: 'promoteSidebar' | 'leaveThread' | 'deleteThread',\n+key: string,\n+threadInfo: ThreadInfo,\n+navigate: ThreadSettingsNavigate,\n-|};\n-type ChatSettingsButtonItem = {|\n- ...ChatSettingsButtonItemBase,\n+buttonStyle: ViewStyle,\n|};\n@@ -689,7 +680,7 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nnavigate: ThreadSettingsNavigate,\nstyles: typeof unboundStyles,\n) => {\n- const buttons: ChatSettingsButtonItemBase[] = [];\n+ const buttons = [];\nconst canChangeThreadType = threadHasPermission(\nthreadInfo,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Simplify ChatSettingsItem type Summary: After the work in D286 and D288, we no longer have to explicitly type `listData` items as we're constructing them, so we can now type `ChatSettingsItem` in one statement again. Test Plan: Flow Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D289
129,187
22.10.2020 00:27:33
14,400
6248a1303749e81baf868ccc8ff2d5d632d35e51
[native] Don't update verticalBounds while keyboard is showing Summary: Fixes this bug: Test Plan: Made sure the bug doesn't occur anymore Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/message-list.react.js", "new_path": "native/chat/message-list.react.js", "diff": "@@ -296,6 +296,12 @@ class MessageList extends React.PureComponent<Props, State> {\nif (!flatListContainer) {\nreturn;\n}\n+\n+ const { keyboardState } = this.props;\n+ if (!keyboardState || keyboardState.keyboardShowing) {\n+ return;\n+ }\n+\nflatListContainer.measure((x, y, width, height, pageX, pageY) => {\nif (\nheight === null ||\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "import {\ntype ThreadInfo,\n- threadInfoPropType,\ntype RelativeMemberInfo,\n- relativeMemberInfoPropType,\nthreadPermissions,\nthreadTypes,\n} from 'lib/types/thread-types';\n@@ -17,7 +15,6 @@ import type { NavigationRoute } from '../../navigation/route-names';\nimport type { ViewStyle } from '../../types/styles';\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\nimport { View, FlatList, Platform } from 'react-native';\nimport invariant from 'invariant';\nimport { createSelector } from 'reselect';\n@@ -70,14 +67,16 @@ import {\nimport {\nuseStyles,\ntype IndicatorStyle,\n- indicatorStylePropType,\nuseIndicatorStyle,\n} from '../../themes/colors';\nimport {\nOverlayContext,\ntype OverlayContextType,\n- overlayContextPropType,\n} from '../../navigation/overlay-context';\n+import {\n+ type KeyboardState,\n+ KeyboardContext,\n+} from '../../keyboard/keyboard-state';\nconst itemPageLength = 5;\n@@ -204,6 +203,8 @@ type Props = {|\n+indicatorStyle: IndicatorStyle,\n// withOverlayContext\n+overlayContext: ?OverlayContextType,\n+ // withKeyboardState\n+ +keyboardState: ?KeyboardState,\n|};\ntype State = {|\n+numMembersShowing: number,\n@@ -218,29 +219,6 @@ type State = {|\n|};\ntype PropsAndState = {| ...Props, ...State |};\nclass ThreadSettings extends React.PureComponent<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- navigate: PropTypes.func.isRequired,\n- setParams: PropTypes.func.isRequired,\n- setOptions: PropTypes.func.isRequired,\n- dangerouslyGetParent: PropTypes.func.isRequired,\n- isFocused: PropTypes.func.isRequired,\n- popToTop: PropTypes.func.isRequired,\n- }).isRequired,\n- route: PropTypes.shape({\n- key: PropTypes.string.isRequired,\n- params: PropTypes.shape({\n- threadInfo: threadInfoPropType.isRequired,\n- }).isRequired,\n- }).isRequired,\n- threadInfo: threadInfoPropType,\n- threadMembers: PropTypes.arrayOf(relativeMemberInfoPropType).isRequired,\n- childThreadInfos: PropTypes.arrayOf(threadInfoPropType),\n- somethingIsSaving: PropTypes.bool.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- indicatorStyle: indicatorStylePropType.isRequired,\n- overlayContext: overlayContextPropType,\n- };\nflatListContainer: ?React.ElementRef<typeof View>;\nconstructor(props: Props) {\n@@ -803,6 +781,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\nif (!flatListContainer) {\nreturn;\n}\n+\n+ const { keyboardState } = this.props;\n+ if (!keyboardState || keyboardState.keyboardShowing) {\n+ return;\n+ }\n+\nflatListContainer.measure((x, y, width, height, pageX, pageY) => {\nif (\nheight === null ||\n@@ -1066,6 +1050,7 @@ export default React.memo<BaseProps>(function ConnectedThreadSettings(\nconst styles = useStyles(unboundStyles);\nconst indicatorStyle = useIndicatorStyle();\nconst overlayContext = React.useContext(OverlayContext);\n+ const keyboardState = React.useContext(KeyboardContext);\nreturn (\n<ThreadSettings\n{...props}\n@@ -1076,6 +1061,7 @@ export default React.memo<BaseProps>(function ConnectedThreadSettings(\nstyles={styles}\nindicatorStyle={indicatorStyle}\noverlayContext={overlayContext}\n+ keyboardState={keyboardState}\n/>\n);\n});\n" }, { "change_type": "MODIFY", "old_path": "native/more/relationship-list.react.js", "new_path": "native/more/relationship-list.react.js", "diff": "@@ -23,6 +23,10 @@ import {\ntype IndicatorStyle,\nuseIndicatorStyle,\n} from '../themes/colors';\n+import {\n+ type KeyboardState,\n+ KeyboardContext,\n+} from '../keyboard/keyboard-state';\nimport RelationshipListItem from './relationship-list-item.react';\n@@ -54,6 +58,8 @@ type Props = {|\n+indicatorStyle: IndicatorStyle,\n// withOverlayContext\n+overlayContext: ?OverlayContextType,\n+ // withKeyboardState\n+ +keyboardState: ?KeyboardState,\n|};\ntype State = {|\n+verticalBounds: ?VerticalBounds,\n@@ -150,6 +156,12 @@ class RelationshipList extends React.PureComponent<Props, State> {\nif (!flatListContainerRef.current) {\nreturn;\n}\n+\n+ const { keyboardState } = this.props;\n+ if (!keyboardState || keyboardState.keyboardShowing) {\n+ return;\n+ }\n+\nflatListContainerRef.current.measure(\n(x, y, width, height, pageX, pageY) => {\nif (\n@@ -227,6 +239,7 @@ export default React.memo<BaseProps>(function ConnectedRelationshipList(\nconst styles = useStyles(unboundStyles);\nconst indicatorStyle = useIndicatorStyle();\nconst overlayContext = React.useContext(OverlayContext);\n+ const keyboardState = React.useContext(KeyboardContext);\nreturn (\n<RelationshipList\n{...props}\n@@ -234,6 +247,7 @@ export default React.memo<BaseProps>(function ConnectedRelationshipList(\nstyles={styles}\nindicatorStyle={indicatorStyle}\noverlayContext={overlayContext}\n+ keyboardState={keyboardState}\n/>\n);\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Don't update verticalBounds while keyboard is showing Summary: Fixes this bug: https://www.dropbox.com/s/mcfsn9gjjpl7l2n/2020-10-22%2000.25.39.mp4?dl=0 Test Plan: Made sure the bug doesn't occur anymore Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D290
129,187
23.10.2020 17:30:55
14,400
fc71cc43ed1a0f98e54525181e48a28ba0abd687
[native] Convert InlineMultimedia to hook Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/inline-multimedia.react.js", "new_path": "native/chat/inline-multimedia.react.js", "diff": "// @flow\n-import { type MediaInfo, mediaInfoPropType } from 'lib/types/media-types';\n-import {\n- type PendingMultimediaUpload,\n- pendingMultimediaUploadPropType,\n-} from '../input/input-state';\n+import type { MediaInfo } from 'lib/types/media-types';\n+import type { PendingMultimediaUpload } from '../input/input-state';\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\nimport { View, StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Feather';\nimport * as Progress from 'react-native-progress';\n@@ -15,26 +11,19 @@ import * as Progress from 'react-native-progress';\nimport Multimedia from '../media/multimedia.react';\nimport GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';\n+const formatProgressText = (progress: number) =>\n+ `${Math.floor(progress * 100)}%`;\n+\ntype Props = {|\n- mediaInfo: MediaInfo,\n- onPress: () => void,\n- onLongPress: () => void,\n- postInProgress: boolean,\n- pendingUpload: ?PendingMultimediaUpload,\n- spinnerColor: string,\n+ +mediaInfo: MediaInfo,\n+ +onPress: () => void,\n+ +onLongPress: () => void,\n+ +postInProgress: boolean,\n+ +pendingUpload: ?PendingMultimediaUpload,\n+ +spinnerColor: string,\n|};\n-class InlineMultimedia extends React.PureComponent<Props> {\n- static propTypes = {\n- mediaInfo: mediaInfoPropType.isRequired,\n- onPress: PropTypes.func.isRequired,\n- onLongPress: PropTypes.func.isRequired,\n- postInProgress: PropTypes.bool.isRequired,\n- pendingUpload: pendingMultimediaUploadPropType,\n- spinnerColor: PropTypes.string.isRequired,\n- };\n-\n- render() {\n- const { mediaInfo, pendingUpload, postInProgress } = this.props;\n+function InlineMultimedia(props: Props) {\n+ const { mediaInfo, pendingUpload, postInProgress } = props;\nlet failed = mediaInfo.id.startsWith('localUpload') && !postInProgress;\nlet progressPercent = 1;\n@@ -63,7 +52,7 @@ class InlineMultimedia extends React.PureComponent<Props> {\nthickness={15}\nshowsText={true}\ntextStyle={styles.progressIndicatorText}\n- formatText={this.formatProgressText}\n+ formatText={formatProgressText}\n/>\n</View>\n);\n@@ -71,22 +60,16 @@ class InlineMultimedia extends React.PureComponent<Props> {\nreturn (\n<GestureTouchableOpacity\n- onPress={this.props.onPress}\n- onLongPress={this.props.onLongPress}\n+ onPress={props.onPress}\n+ onLongPress={props.onLongPress}\nstyle={styles.expand}\n>\n- <Multimedia\n- mediaInfo={mediaInfo}\n- spinnerColor={this.props.spinnerColor}\n- />\n+ <Multimedia mediaInfo={mediaInfo} spinnerColor={props.spinnerColor} />\n{progressIndicator}\n</GestureTouchableOpacity>\n);\n}\n- formatProgressText = (progress: number) => `${Math.floor(progress * 100)}%`;\n-}\n-\nconst styles = StyleSheet.create({\ncenterContainer: {\nalignItems: 'center',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Convert InlineMultimedia to hook Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D298
129,187
25.10.2020 18:26:26
14,400
baed4619869682312ff5434b17cbcebca6821d9d
[native] Use hook for data-binding in LogInPanel Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/log-in-panel.react.js", "new_path": "native/account/log-in-panel.react.js", "diff": "// @flow\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\n-import type { AppState } from '../redux/redux-setup';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type {\nLogInInfo,\n@@ -9,23 +7,23 @@ import type {\nLogInResult,\nLogInStartingPayload,\n} from 'lib/types/account-types';\n-import {\n- type StateContainer,\n- stateContainerPropType,\n-} from '../utils/state-container';\n+import type { StateContainer } from '../utils/state-container';\n-import React from 'react';\n+import * as React from 'react';\nimport { View, StyleSheet, Alert, Keyboard, Platform } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport Animated from 'react-native-reanimated';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport {\noldValidUsernameRegex,\nvalidEmailRegex,\n} from 'lib/shared/account-utils';\n-import { connect } from 'lib/utils/redux-utils';\nimport { logInActionTypes, logIn } from 'lib/actions/user-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n@@ -39,20 +37,21 @@ import {\nsetNativeCredentials,\n} from './native-credentials';\nimport { nativeLogInExtraInfoSelector } from '../selectors/account-selectors';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\n+import { useSelector } from '../redux/redux-utils';\nexport type LogInState = {|\n+usernameOrEmailInputText: string,\n+passwordInputText: string,\n|};\n-type Props = {|\n+type BaseProps = {|\n+setActiveAlert: (activeAlert: boolean) => void,\n+opacityValue: Animated.Value,\n+innerRef: (logInPanel: ?LogInPanel) => void,\n+state: StateContainer<LogInState>,\n+|};\n+type Props = {|\n+ ...BaseProps,\n// Redux state\n+loadingStatus: LoadingStatus,\n+logInExtraInfo: () => LogInExtraInfo,\n@@ -63,17 +62,6 @@ type Props = {|\n+logIn: (logInInfo: LogInInfo) => Promise<LogInResult>,\n|};\nclass LogInPanel extends React.PureComponent<Props> {\n- static propTypes = {\n- setActiveAlert: PropTypes.func.isRequired,\n- opacityValue: PropTypes.object.isRequired,\n- innerRef: PropTypes.func.isRequired,\n- state: stateContainerPropType.isRequired,\n- loadingStatus: PropTypes.string.isRequired,\n- logInExtraInfo: PropTypes.func.isRequired,\n- usernamePlaceholder: PropTypes.string.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- logIn: PropTypes.func.isRequired,\n- };\nusernameOrEmailInput: ?TextInput;\npasswordInput: ?TextInput;\n@@ -338,18 +326,31 @@ const styles = StyleSheet.create({\nconst loadingStatusSelector = createLoadingStatusSelector(logInActionTypes);\n-export default connectNav((context: ?NavContextType) => ({\n- navContext: context,\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- loadingStatus: loadingStatusSelector(state),\n- logInExtraInfo: nativeLogInExtraInfoSelector({\n+export default React.memo<BaseProps>(function ConnectedLogInPanel(\n+ props: BaseProps,\n+) {\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+ const usernamePlaceholder = useSelector(usernamePlaceholderSelector);\n+\n+ const navContext = React.useContext(NavContext);\n+ const logInExtraInfo = useSelector(state =>\n+ nativeLogInExtraInfoSelector({\nredux: state,\n- navContext: ownProps.navContext,\n- }),\n- usernamePlaceholder: usernamePlaceholderSelector(state),\n+ navContext,\n}),\n- { logIn },\n- )(LogInPanel),\n);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callLogIn = useServerCall(logIn);\n+\n+ return (\n+ <LogInPanel\n+ {...props}\n+ loadingStatus={loadingStatus}\n+ logInExtraInfo={logInExtraInfo}\n+ usernamePlaceholder={usernamePlaceholder}\n+ dispatchActionPromise={dispatchActionPromise}\n+ logIn={callLogIn}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in LogInPanel Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D305
129,187
25.10.2020 18:41:54
14,400
a479ac5d758cc397030e7f5ff3f457d94c4cb3e4
[native] Use hook for data-binding in LoggedOutModal Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/logged-out-modal.react.js", "new_path": "native/account/logged-out-modal.react.js", "diff": "// @flow\n-import type { DispatchActionPayload } from 'lib/utils/action-utils';\nimport type { Dispatch } from 'lib/types/redux-types';\n-import type { AppState } from '../redux/redux-setup';\nimport type { KeyboardEvent, EmitterSubscription } from '../keyboard/keyboard';\nimport type { LogInState } from './log-in-panel.react';\nimport type { RegisterState } from './register-panel.react';\n@@ -22,17 +20,16 @@ import {\n} from 'react-native';\nimport invariant from 'invariant';\nimport Icon from 'react-native-vector-icons/FontAwesome';\n-import PropTypes from 'prop-types';\nimport _isEqual from 'lodash/fp/isEqual';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport Animated, { Easing } from 'react-native-reanimated';\n+import { useDispatch } from 'react-redux';\nimport { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils';\nimport {\nappStartNativeCredentialsAutoLogIn,\nappStartReduxLoggedInButInvalidCookie,\n} from 'lib/actions/user-actions';\n-import { connect } from 'lib/utils/redux-utils';\nimport { isLoggedIn } from 'lib/selectors/user-selectors';\nimport LogInPanelContainer from './log-in-panel-container.react';\n@@ -53,20 +50,16 @@ import {\nsetStateForContainer,\n} from '../utils/state-container';\nimport { LoggedOutModalRouteName } from '../navigation/route-names';\n-import {\n- connectNav,\n- type NavContextType,\n- navContextPropType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\nimport {\nrunTiming,\nratchetAlongWithKeyboardHeight,\n} from '../utils/animation-utils';\nimport {\ntype DerivedDimensionsInfo,\n- derivedDimensionsInfoPropType,\nderivedDimensionsInfoSelector,\n} from '../selectors/dimensions-selectors';\n+import { useSelector } from '../redux/redux-utils';\nlet initialAppLoad = true;\nconst safeAreaEdges = ['top', 'bottom'];\n@@ -110,37 +103,24 @@ function isPastPrompt(modeValue: Animated.Node) {\ntype Props = {\n// Navigation state\n- isForeground: boolean,\n- navContext: ?NavContextType,\n+ +isForeground: boolean,\n// Redux state\n- rehydrateConcluded: boolean,\n- cookie: ?string,\n- urlPrefix: string,\n- loggedIn: boolean,\n- dimensions: DerivedDimensionsInfo,\n- splashStyle: ImageStyle,\n+ +rehydrateConcluded: boolean,\n+ +cookie: ?string,\n+ +urlPrefix: string,\n+ +loggedIn: boolean,\n+ +dimensions: DerivedDimensionsInfo,\n+ +splashStyle: ImageStyle,\n// Redux dispatch functions\n- dispatch: Dispatch,\n- dispatchActionPayload: DispatchActionPayload,\n+ +dispatch: Dispatch,\n+ ...\n};\ntype State = {|\n- mode: LoggedOutMode,\n- logInState: StateContainer<LogInState>,\n- registerState: StateContainer<RegisterState>,\n+ +mode: LoggedOutMode,\n+ +logInState: StateContainer<LogInState>,\n+ +registerState: StateContainer<RegisterState>,\n|};\nclass LoggedOutModal extends React.PureComponent<Props, State> {\n- static propTypes = {\n- isForeground: PropTypes.bool.isRequired,\n- navContext: navContextPropType,\n- rehydrateConcluded: PropTypes.bool.isRequired,\n- cookie: PropTypes.string,\n- urlPrefix: PropTypes.string.isRequired,\n- loggedIn: PropTypes.bool.isRequired,\n- dimensions: derivedDimensionsInfoPropType.isRequired,\n- dispatch: PropTypes.func.isRequired,\n- dispatchActionPayload: PropTypes.func.isRequired,\n- };\n-\nkeyboardShowListener: ?EmitterSubscription;\nkeyboardHideListener: ?EmitterSubscription;\n@@ -330,7 +310,10 @@ class LoggedOutModal extends React.PureComponent<Props, State> {\n}\nif (loggedIn || hasUserCookie) {\n- this.props.dispatchActionPayload(resetUserStateActionType, null);\n+ this.props.dispatch({\n+ type: resetUserStateActionType,\n+ payload: null,\n+ });\n}\n}\n@@ -792,24 +775,34 @@ const styles = StyleSheet.create({\nconst isForegroundSelector = createIsForegroundSelector(\nLoggedOutModalRouteName,\n);\n-export default connectNav((context: ?NavContextType) => ({\n- isForeground: isForegroundSelector(context),\n- navContext: context,\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- rehydrateConcluded: !!(\n- state._persist &&\n- state._persist.rehydrated &&\n- ownProps.navContext\n- ),\n- cookie: state.cookie,\n- urlPrefix: state.urlPrefix,\n- loggedIn: isLoggedIn(state),\n- dimensions: derivedDimensionsInfoSelector(state),\n- splashStyle: splashStyleSelector(state),\n- }),\n- null,\n- true,\n- )(LoggedOutModal),\n+\n+export default React.memo<{ ... }>(function ConnectedLoggedOutModal(props: {\n+ ...,\n+}) {\n+ const navContext = React.useContext(NavContext);\n+ const isForeground = isForegroundSelector(navContext);\n+\n+ const rehydrateConcluded = useSelector(\n+ state => !!(state._persist && state._persist.rehydrated && navContext),\n+ );\n+ const cookie = useSelector(state => state.cookie);\n+ const urlPrefix = useSelector(state => state.urlPrefix);\n+ const loggedIn = useSelector(isLoggedIn);\n+ const dimensions = useSelector(derivedDimensionsInfoSelector);\n+ const splashStyle = useSelector(splashStyleSelector);\n+\n+ const dispatch = useDispatch();\n+ return (\n+ <LoggedOutModal\n+ {...props}\n+ isForeground={isForeground}\n+ rehydrateConcluded={rehydrateConcluded}\n+ cookie={cookie}\n+ urlPrefix={urlPrefix}\n+ loggedIn={loggedIn}\n+ dimensions={dimensions}\n+ splashStyle={splashStyle}\n+ dispatch={dispatch}\n+ />\n);\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in LoggedOutModal Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D306
129,187
25.10.2020 18:45:27
14,400
f120d2a19d44d56d05d1d2733109757d8bda7544
[native] Use hook for data-binding in ResetPasswordPanel Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/reset-password-panel.react.js", "new_path": "native/account/reset-password-panel.react.js", "diff": "// @flow\n-import type { AppState } from '../redux/redux-setup';\nimport type { LoadingStatus } from 'lib/types/loading-types';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type {\nUpdatePasswordInfo,\nLogInExtraInfo,\n@@ -21,7 +19,6 @@ import {\n} from 'react-native';\nimport invariant from 'invariant';\nimport Icon from 'react-native-vector-icons/FontAwesome';\n-import PropTypes from 'prop-types';\nimport Animated from 'react-native-reanimated';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n@@ -29,46 +26,40 @@ import {\nresetPasswordActionTypes,\nresetPassword,\n} from 'lib/actions/user-actions';\n-import { connect } from 'lib/utils/redux-utils';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport { TextInput } from './modal-components.react';\nimport { PanelButton, Panel } from './panel-components.react';\nimport { nativeLogInExtraInfoSelector } from '../selectors/account-selectors';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\n+import { useSelector } from '../redux/redux-utils';\n-type Props = {\n- verifyCode: string,\n- username: string,\n- onSuccess: () => Promise<void>,\n- setActiveAlert: (activeAlert: boolean) => void,\n- opacityValue: Animated.Value,\n+type BaseProps = {|\n+ +verifyCode: string,\n+ +username: string,\n+ +onSuccess: () => Promise<void>,\n+ +setActiveAlert: (activeAlert: boolean) => void,\n+ +opacityValue: Animated.Value,\n+|};\n+type Props = {|\n+ ...BaseProps,\n// Redux state\n- loadingStatus: LoadingStatus,\n- logInExtraInfo: () => LogInExtraInfo,\n+ +loadingStatus: LoadingStatus,\n+ +logInExtraInfo: () => LogInExtraInfo,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- resetPassword: (info: UpdatePasswordInfo) => Promise<LogInResult>,\n-};\n-type State = {\n- passwordInputText: string,\n- confirmPasswordInputText: string,\n-};\n+ +resetPassword: (info: UpdatePasswordInfo) => Promise<LogInResult>,\n+|};\n+type State = {|\n+ +passwordInputText: string,\n+ +confirmPasswordInputText: string,\n+|};\nclass ResetPasswordPanel extends React.PureComponent<Props, State> {\n- static propTypes = {\n- verifyCode: PropTypes.string.isRequired,\n- username: PropTypes.string.isRequired,\n- onSuccess: PropTypes.func.isRequired,\n- setActiveAlert: PropTypes.func.isRequired,\n- opacityValue: PropTypes.object.isRequired,\n- loadingStatus: PropTypes.string.isRequired,\n- logInExtraInfo: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- resetPassword: PropTypes.func.isRequired,\n- };\nstate = {\npasswordInputText: '',\nconfirmPasswordInputText: '',\n@@ -289,17 +280,29 @@ const loadingStatusSelector = createLoadingStatusSelector(\nresetPasswordActionTypes,\n);\n-export default connectNav((context: ?NavContextType) => ({\n- navContext: context,\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- loadingStatus: loadingStatusSelector(state),\n- logInExtraInfo: nativeLogInExtraInfoSelector({\n+export default React.memo<BaseProps>(function ConnectedResetPasswordPanel(\n+ props: BaseProps,\n+) {\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+\n+ const navContext = React.useContext(NavContext);\n+ const logInExtraInfo = useSelector(state =>\n+ nativeLogInExtraInfoSelector({\nredux: state,\n- navContext: ownProps.navContext,\n+ navContext,\n}),\n- }),\n- { resetPassword },\n- )(ResetPasswordPanel),\n);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callResetPassword = useServerCall(resetPassword);\n+\n+ return (\n+ <ResetPasswordPanel\n+ {...props}\n+ loadingStatus={loadingStatus}\n+ logInExtraInfo={logInExtraInfo}\n+ dispatchActionPromise={dispatchActionPromise}\n+ resetPassword={callResetPassword}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in ResetPasswordPanel Test Plan: Flow, make sure it loads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D307
129,187
26.10.2020 13:41:14
14,400
cb3280bc7f9301b9db83e58145759ce7805d172d
[native] codeVersion -> 69
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -133,8 +133,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 68\n- versionName \"0.0.68\"\n+ versionCode 69\n+ versionName \"0.0.69\"\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal/Info.debug.plist", "new_path": "native/ios/SquadCal/Info.debug.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.68</string>\n+ <string>0.0.69</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>68</string>\n+ <string>69</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n" }, { "change_type": "MODIFY", "old_path": "native/ios/SquadCal/Info.release.plist", "new_path": "native/ios/SquadCal/Info.release.plist", "diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.68</string>\n+ <string>0.0.69</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>68</string>\n+ <string>69</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": "@@ -190,7 +190,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 68;\n+const codeVersion = 69;\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 -> 69
129,187
26.10.2020 20:01:31
14,400
150de37c48f7957b244a766a20bb2f6aea65749a
RN0.63 1/16: remove patch for RN0.62 Summary: These two patches are in the 0.63 release: 1. 2. Test Plan: I made sure the two patches are there Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "DELETE", "old_path": "patches/react-native+0.62.2.patch", "new_path": null, "diff": "-diff --git a/node_modules/react-native/Libraries/Image/AssetSourceResolver.js b/node_modules/react-native/Libraries/Image/AssetSourceResolver.js\n-index 624c622..bc67109 100644\n---- a/node_modules/react-native/Libraries/Image/AssetSourceResolver.js\n-+++ b/node_modules/react-native/Libraries/Image/AssetSourceResolver.js\n-@@ -114,7 +114,12 @@ class AssetSourceResolver {\n- */\n- scaledAssetURLNearBundle(): ResolvedAssetSource {\n- const path = this.jsbundleUrl || 'file://';\n-- return this.fromSource(path + getScaledAssetPath(this.asset));\n-+ return this.fromSource(\n-+ // Assets can have relative paths outside of the project root.\n-+ // When bundling them we replace `../` with `_` to make sure they\n-+ // don't end up outside of the expected assets directory.\n-+ path + getScaledAssetPath(this.asset).replace(/\\.\\.\\//g, '_'),\n-+ );\n- }\n-\n- /**\n-diff --git a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m\n-index 21f1a06..0ff66f3 100644\n---- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m\n-+++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m\n-@@ -275,6 +275,8 @@ - (void)displayLayer:(CALayer *)layer\n- if (_currentFrame) {\n- layer.contentsScale = self.animatedImageScale;\n- layer.contents = (__bridge id)_currentFrame.CGImage;\n-+ } else {\n-+ [super displayLayer:layer];\n- }\n- }\n-\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 1/16: remove patch for RN0.62 Summary: These two patches are in the 0.63 release: 1. https://github.com/facebook/react-native/commit/7deeec7 2. https://github.com/facebook/react-native/commit/b6ded72 Test Plan: I made sure the two patches are there Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D311
129,187
26.10.2020 20:06:56
14,400
bb0abbee84a8261fe62ce014fd3b79c13e1f1afd
RN0.63 2/16: Test Plan: I made sure web still loads, and tested the native stuff together with the rest Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/package.json", "new_path": "lib/package.json", "diff": "\"invariant\": \"^2.2.4\",\n\"lodash\": \"^4.17.19\",\n\"prop-types\": \"^15.7.2\",\n- \"react\": \"16.11.0\",\n+ \"react\": \"16.13.1\",\n\"react-redux\": \"^7.1.1\",\n\"reselect\": \"^4.0.0\",\n\"reselect-map\": \"^1.0.5\",\n" }, { "change_type": "MODIFY", "old_path": "native/package.json", "new_path": "native/package.json", "diff": "\"metro-react-native-babel-preset\": \"^0.58.0\",\n\"patch-package\": \"^6.2.2\",\n\"postinstall-postinstall\": \"^2.0.0\",\n- \"react-test-renderer\": \"16.11.0\"\n+ \"react-test-renderer\": \"16.13.1\"\n},\n\"dependencies\": {\n\"@react-native-community/art\": \"^1.1.2\",\n\"lottie-react-native\": \"^3.2.1\",\n\"md5\": \"^2.2.1\",\n\"prop-types\": \"^15.7.2\",\n- \"react\": \"16.11.0\",\n+ \"react\": \"16.13.1\",\n\"react-native\": \"0.62.2\",\n\"react-native-background-upload\": \"^5.6.0\",\n\"react-native-camera\": \"^3.31.0\",\n" }, { "change_type": "MODIFY", "old_path": "server/package.json", "new_path": "server/package.json", "diff": "\"mysql2\": \"^1.5.1\",\n\"node-schedule\": \"^1.3.0\",\n\"nodemailer\": \"^6.3.0\",\n- \"react\": \"16.11.0\",\n- \"react-dom\": \"16.11.0\",\n+ \"react\": \"16.13.1\",\n+ \"react-dom\": \"16.13.1\",\n\"react-html-email\": \"^3.0.0\",\n\"react-redux\": \"^7.1.1\",\n\"react-router\": \"^5.1.2\",\n" }, { "change_type": "MODIFY", "old_path": "web/package.json", "new_path": "web/package.json", "diff": "\"@babel/preset-env\": \"^7.9.0\",\n\"@babel/preset-flow\": \"^7.9.0\",\n\"@babel/preset-react\": \"^7.9.1\",\n- \"@hot-loader/react-dom\": \"16.9.0\",\n+ \"@hot-loader/react-dom\": \"16.13.0\",\n\"assets-webpack-plugin\": \"^3.9.7\",\n\"babel-loader\": \"^8.1.0\",\n\"babel-plugin-transform-remove-console\": \"^6.8.4\",\n\"lib\": \"0.0.1\",\n\"lodash\": \"^4.17.19\",\n\"prop-types\": \"^15.7.2\",\n- \"react\": \"16.11.0\",\n+ \"react\": \"16.13.1\",\n\"react-circular-progressbar\": \"^2.0.2\",\n\"react-color\": \"^2.13.0\",\n\"react-dnd\": \"^11.1.3\",\n\"react-dnd-html5-backend\": \"^11.1.3\",\n- \"react-dom\": \"16.11.0\",\n+ \"react-dom\": \"16.13.1\",\n\"react-feather\": \"^2.0.3\",\n\"react-hot-loader\": \"^4.12.14\",\n\"react-redux\": \"^7.1.1\",\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 2/16: react@16.13.1 Test Plan: I made sure web still loads, and tested the native stuff together with the rest Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D312
129,187
26.10.2020 20:20:45
14,400
e14efa2402792bc342730cc979ad37c1bc5c0792
RN0.63 5/16: Android updates Test Plan: I made sure Android compiled in dev and release modes on API level 29, and tested dev mode on API levels 21, 22, and 23. Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/build.gradle", "new_path": "native/android/app/build.gradle", "diff": "@@ -20,7 +20,7 @@ import com.android.build.OutputFile\n* // default. Can be overridden with ENTRY_FILE environment variable.\n* entryFile: \"index.android.js\",\n*\n- * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format\n+ * // https://reactnative.dev/docs/performance#enable-the-ram-format\n* bundleCommand: \"ram-bundle\",\n*\n* // whether to bundle JS and assets in debug mode\n" }, { "change_type": "MODIFY", "old_path": "native/android/build.gradle", "new_path": "native/android/build.gradle", "diff": "buildscript {\next {\n- buildToolsVersion = \"28.0.3\"\n+ buildToolsVersion = \"29.0.2\"\nminSdkVersion = 16\n- compileSdkVersion = 28\n- targetSdkVersion = 28\n- supportLibVersion = \"28.0.0\"\n+ compileSdkVersion = 29\n+ targetSdkVersion = 29\n}\nrepositories {\ngoogle()\njcenter()\n}\ndependencies {\n- classpath(\"com.android.tools.build:gradle:3.5.2\")\n+ classpath(\"com.android.tools.build:gradle:3.5.3\")\nclasspath(\"com.google.gms:google-services:4.2.0\")\n// NOTE: Do not place your application dependencies here; they belong\n" }, { "change_type": "MODIFY", "old_path": "native/android/gradle.properties", "new_path": "native/android/gradle.properties", "diff": "@@ -25,4 +25,4 @@ android.useAndroidX=true\nandroid.enableJetifier=true\n# Version of flipper SDK to use with React Native\n-FLIPPER_VERSION=0.33.1\n+FLIPPER_VERSION=0.54.0\n" }, { "change_type": "MODIFY", "old_path": "native/android/gradle/wrapper/gradle-wrapper.jar", "new_path": "native/android/gradle/wrapper/gradle-wrapper.jar", "diff": "Binary files a/native/android/gradle/wrapper/gradle-wrapper.jar and b/native/android/gradle/wrapper/gradle-wrapper.jar differ\n" }, { "change_type": "MODIFY", "old_path": "native/android/gradle/wrapper/gradle-wrapper.properties", "new_path": "native/android/gradle/wrapper/gradle-wrapper.properties", "diff": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\n-distributionUrl=https\\://services.gradle.org/distributions/gradle-6.0.1-all.zip\n+distributionUrl=https\\://services.gradle.org/distributions/gradle-6.2-all.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n" }, { "change_type": "MODIFY", "old_path": "native/android/gradlew", "new_path": "native/android/gradlew", "diff": "@@ -154,19 +154,19 @@ if [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\nelse\neval `echo args$i`=\"\\\"$arg\\\"\"\nfi\n- i=$((i+1))\n+ i=`expr $i + 1`\ndone\ncase $i in\n- (0) set -- ;;\n- (1) set -- \"$args0\" ;;\n- (2) set -- \"$args0\" \"$args1\" ;;\n- (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n- (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n- (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n- (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n- (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n- (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n- (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n+ 0) set -- ;;\n+ 1) set -- \"$args0\" ;;\n+ 2) set -- \"$args0\" \"$args1\" ;;\n+ 3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n+ 4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n+ 5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n+ 6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n+ 7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n+ 8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n+ 9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\nesac\nfi\n@@ -175,14 +175,9 @@ save () {\nfor i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\necho \" \"\n}\n-APP_ARGS=$(save \"$@\")\n+APP_ARGS=`save \"$@\"`\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong\n-if [ \"$(uname)\" = \"Darwin\" ] && [ \"$HOME\" = \"$PWD\" ]; then\n- cd \"$(dirname \"$0\")\"\n-fi\n-\nexec \"$JAVACMD\" \"$@\"\n" }, { "change_type": "MODIFY", "old_path": "native/android/gradlew.bat", "new_path": "native/android/gradlew.bat", "diff": "@@ -29,6 +29,9 @@ if \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n+@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\n+for %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n+\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 5/16: Android updates Test Plan: I made sure Android compiled in dev and release modes on API level 29, and tested dev mode on API levels 21, 22, and 23. Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D315
129,187
26.10.2020 21:40:28
14,400
91fccada54a5b00d4065f5c53bba5f0bcf362212
RN0.63 9/16: YellowBox -> LogBox Summary: In React Native 0.63, `YellowBox` is deprecated in favor of `LogBox`. Test Plan: I made sure the warnings about `YellowBox` deprecation stopped being printed Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/push/push-handler.react.js", "new_path": "native/push/push-handler.react.js", "diff": "@@ -22,7 +22,7 @@ import {\nPlatform,\nAlert,\nVibration,\n- YellowBox,\n+ LogBox,\n} from 'react-native';\nimport NotificationsIOS from 'react-native-notifications';\nimport {\n@@ -78,7 +78,7 @@ import {\n} from '../lifecycle/lifecycle';\nimport { useSelector } from '../redux/redux-utils';\n-YellowBox.ignoreWarnings([\n+LogBox.ignoreLogs([\n// react-native-firebase\n'Require cycle: ../node_modules/react-native-firebase',\n// react-native-in-app-message\n" }, { "change_type": "MODIFY", "old_path": "native/root.react.js", "new_path": "native/root.react.js", "diff": "@@ -4,7 +4,7 @@ import type { PossiblyStaleNavigationState } from '@react-navigation/native';\nimport * as React from 'react';\nimport { Provider } from 'react-redux';\n-import { Platform, UIManager, View, StyleSheet, YellowBox } from 'react-native';\n+import { Platform, UIManager, View, StyleSheet, LogBox } from 'react-native';\nimport Orientation from 'react-native-orientation-locker';\nimport { PersistGate } from 'redux-persist/integration/react';\nimport AsyncStorage from '@react-native-community/async-storage';\n@@ -43,7 +43,7 @@ import { validNavState } from './navigation/navigation-utils';\nimport { navStateAsyncStorageKey } from './navigation/persistance';\nimport { useSelector } from './redux/redux-utils';\n-YellowBox.ignoreWarnings([\n+LogBox.ignoreLogs([\n// react-native-reanimated\n'Please report: Excessive number of pending callbacks',\n]);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 9/16: YellowBox -> LogBox Summary: In React Native 0.63, `YellowBox` is deprecated in favor of `LogBox`. Test Plan: I made sure the warnings about `YellowBox` deprecation stopped being printed Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D319
129,187
27.10.2020 00:53:29
14,400
46403debd4cd7d64552483f77d7956c3fadda65e
RN0.63 11/16: Fix Flow bug when merging Media Summary: Flow is worried about `Video` getting merged with an `Image` Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/reducers/message-reducer.js", "new_path": "lib/reducers/message-reducer.js", "diff": "@@ -771,8 +771,22 @@ function reduceMessageStore(\nfor (let singleMedia of message.media) {\nif (singleMedia.id !== currentMediaID) {\nmedia.push(singleMedia);\n- } else {\n+ } else if (singleMedia.type === 'photo') {\n+ replaced = true;\n+ invariant(\n+ mediaUpdate.type === 'photo',\n+ 'media with matching IDs should have same media types',\n+ );\n+ media.push({\n+ ...singleMedia,\n+ ...mediaUpdate,\n+ });\n+ } else if (singleMedia.type === 'video') {\nreplaced = true;\n+ invariant(\n+ mediaUpdate.type === 'video',\n+ 'media with matching IDs should have same media types',\n+ );\nmedia.push({\n...singleMedia,\n...mediaUpdate,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 11/16: Fix Flow bug when merging Media Summary: Flow is worried about `Video` getting merged with an `Image` Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D321
129,187
27.10.2020 00:55:55
14,400
5a4b49c8651cae9c5de926cc2d4e43a96384561e
RN0.63 12/16: Fix Flow bug with Animated interpolate outputRange Summary: Not sure what's up here... Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-list.react.js", "new_path": "native/chat/chat-list.react.js", "diff": "@@ -88,7 +88,7 @@ class ChatList extends React.PureComponent<Props, State> {\nsuper(props);\nconst sendButtonTranslateY = this.newMessagesPillProgress.interpolate({\ninputRange: [0, 1],\n- outputRange: [10, 0],\n+ outputRange: ([10, 0]: number[]), // Flow...\n});\nthis.newMessagesPillStyle = {\nopacity: this.newMessagesPillProgress,\n" }, { "change_type": "MODIFY", "old_path": "native/media/camera-modal.react.js", "new_path": "native/media/camera-modal.react.js", "diff": "@@ -346,7 +346,7 @@ class CameraModal extends React.PureComponent<Props, State> {\nconst sendButtonScale = this.sendButtonProgress.interpolate({\ninputRange: [0, 1],\n- outputRange: [1.1, 1],\n+ outputRange: ([1.1, 1]: number[]), // Flow...\n});\nthis.sendButtonStyle = {\nopacity: this.sendButtonProgress,\n" }, { "change_type": "MODIFY", "old_path": "native/media/media-gallery-keyboard.react.js", "new_path": "native/media/media-gallery-keyboard.react.js", "diff": "@@ -81,7 +81,7 @@ class MediaGalleryKeyboard extends React.PureComponent<Props, State> {\nsuper(props);\nconst sendButtonScale = this.queueModeProgress.interpolate({\ninputRange: [0, 1],\n- outputRange: [1.3, 1],\n+ outputRange: ([1.3, 1]: number[]), // Flow...\n});\nthis.sendButtonStyle = {\nopacity: this.queueModeProgress,\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/disconnected-bar.react.js", "new_path": "native/navigation/disconnected-bar.react.js", "diff": "@@ -59,7 +59,7 @@ function DisconnectedBar(props: Props) {\n() => ({\nheight: showing.interpolate({\ninputRange: [0, 1],\n- outputRange: [0, expandedHeight],\n+ outputRange: ([0, expandedHeight]: number[]), // Flow...\n}),\n}),\n[showing],\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 12/16: Fix Flow bug with Animated interpolate outputRange Summary: Not sure what's up here... Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D322
129,187
27.10.2020 00:58:24
14,400
09fb0594b528e64afa2a4307dde0559f2fe8b579
RN0.63 14/16: Flow type NativeMethodsMixinType -> NativeMethods Summary: These types got restructured and renamed Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/media/camera-modal.react.js", "new_path": "native/media/camera-modal.react.js", "diff": "@@ -17,7 +17,7 @@ import {\nInputStateContext,\n} from '../input/input-state';\nimport type { ViewStyle } from '../types/styles';\n-import type { NativeMethodsMixinType } from '../types/react-native';\n+import type { NativeMethods } from '../types/react-native';\nimport type { AppNavigationProp } from '../navigation/app-navigator.react';\nimport type { NavigationRoute } from '../navigation/route-names';\nimport type { Dispatch } from 'lib/types/redux-types';\n@@ -233,7 +233,7 @@ export type CameraModalParams = {|\ntype TouchableOpacityInstance = React.AbstractComponent<\nReact.ElementConfig<typeof TouchableOpacity>,\n- NativeMethodsMixinType,\n+ NativeMethods,\n>;\ntype BaseProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/media/multimedia-modal.react.js", "new_path": "native/media/multimedia-modal.react.js", "diff": "@@ -11,7 +11,7 @@ import {\ntype LayoutCoordinates,\nlayoutCoordinatesPropType,\n} from '../types/layout-types';\n-import type { NativeMethodsMixinType } from '../types/react-native';\n+import type { NativeMethods } from '../types/react-native';\nimport type { ChatMultimediaMessageInfoItem } from '../chat/multimedia-message.react';\nimport { chatMessageItemPropType } from 'lib/selectors/chat-selectors';\nimport type { AppNavigationProp } from '../navigation/app-navigator.react';\n@@ -156,7 +156,7 @@ export type MultimediaModalParams = {|\ntype TouchableOpacityInstance = React.AbstractComponent<\nReact.ElementConfig<typeof TouchableOpacity>,\n- NativeMethodsMixinType,\n+ NativeMethods,\n>;\ntype BaseProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/types/react-native.js", "new_path": "native/types/react-native.js", "diff": "@@ -12,4 +12,4 @@ export type {\nKeyPressEvent,\n} from 'react-native/Libraries/Components/TextInput/TextInput';\n-export type { NativeMethodsMixinType } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';\n+export type { NativeMethods } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 14/16: Flow type NativeMethodsMixinType -> NativeMethods Summary: These types got restructured and renamed Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D324
129,187
27.10.2020 01:02:42
14,400
27535fb372ef0eb3d7963ac99109cc3ec5410f3f
RN0.63 15/16: Get rid of $FlowFixMe for object spreads Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/reducers/user-reducer.js", "new_path": "lib/reducers/user-reducer.js", "diff": "@@ -130,7 +130,6 @@ function reduceUserInfos(state: UserStore, action: BaseAction): UserStore {\nconst newUserInfos = _keyBy(userInfo => userInfo.id)(\naction.payload.userInfos,\n);\n- // $FlowFixMe should be fixed in flow-bin@0.115 / react-native@0.63\nconst updated = { ...state.userInfos, ...newUserInfos };\nif (!_isEqual(state.userInfos)(updated)) {\nreturn {\n@@ -173,7 +172,6 @@ function reduceUserInfos(state: UserStore, action: BaseAction): UserStore {\nconst newUserInfos = _keyBy(userInfo => userInfo.id)(\naction.payload.userInfos,\n);\n- // $FlowFixMe should be fixed in flow-bin@0.115 / react-native@0.63\nconst updated = { ...state.userInfos, ...newUserInfos };\nfor (let update of action.payload.updatesResult.newUpdates) {\nif (update.type === updateTypes.DELETE_ACCOUNT) {\n" }, { "change_type": "MODIFY", "old_path": "web/input/input-state-container.react.js", "new_path": "web/input/input-state-container.react.js", "diff": "@@ -423,8 +423,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nprevState => {\nconst prevUploads = prevState.pendingUploads[threadID];\nconst mergedUploads = prevUploads\n- ? // $FlowFixMe should be fixed in flow-bin@0.115 / react-native@0.63\n- { ...prevUploads, ...newUploadsObject }\n+ ? { ...prevUploads, ...newUploadsObject }\n: newUploadsObject;\nreturn {\npendingUploads: {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 15/16: Get rid of $FlowFixMe for object spreads Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D325
129,187
27.10.2020 01:10:49
14,400
4e365dec408fb31d384a42661b03117065ffa125
RN0.63 16/16: Patch react-native-firebase Flow type Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "patches/react-native-firebase+5.6.0.patch", "new_path": "patches/react-native-firebase+5.6.0.patch", "diff": "@@ -138,6 +138,19 @@ index 1716dbe..8a52a88 100644\n) {\nthrow new Error(\n'Query.onSnapshot failed: Observer.error must be a valid function.'\n+diff --git a/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow b/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow\n+index 624acf0..f4b3039 100644\n+--- a/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow\n++++ b/node_modules/react-native-firebase/dist/modules/firestore/TransactionHandler.js.flow\n+@@ -18,7 +18,7 @@ const generateTransactionId = (): number => transactionId++;\n+\n+ export type TransactionMeta = {\n+ id: number,\n+- stack: string[],\n++ stack: string,\n+ reject?: Function,\n+ resolve?: Function,\n+ transaction: Transaction,\ndiff --git a/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow b/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow\nindex 988be94..a030db8 100644\n--- a/node_modules/react-native-firebase/dist/modules/messaging/index.js.flow\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
RN0.63 16/16: Patch react-native-firebase Flow type Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D326
129,187
28.10.2020 18:33:44
14,400
7ad11fb1b5ebcd7dbbcacd82a1ea13801345a4f1
Introduce threadPermissions.CREATE_SIDEBARS Summary: In ["announcement threads"](https://site.ashoat.com/comm/app/demo#orgs) I want it so only admins can create subthreads, but anybody can create sidebars. This diffs creates a new permission type `CREATE_SIDEBARS`, separate from `CREATE_SUBTHREADS`. Test Plan: Flow Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -34,7 +34,6 @@ export function assertThreadType(threadType: number): ThreadType {\nreturn threadType;\n}\n-// Keep in sync with server/permissions.php\nexport const threadPermissions = Object.freeze({\nKNOW_OF: 'know_of',\nVISIBLE: 'visible',\n@@ -43,6 +42,7 @@ export const threadPermissions = Object.freeze({\nEDIT_THREAD: 'edit_thread',\nDELETE_THREAD: 'delete_thread',\nCREATE_SUBTHREADS: 'create_subthreads',\n+ CREATE_SIDEBARS: 'create_sidebars',\nJOIN_THREAD: 'join_thread',\nEDIT_PERMISSIONS: 'edit_permissions',\nADD_MEMBERS: 'add_members',\n@@ -61,6 +61,7 @@ export function assertThreadPermissions(\nourThreadPermissions === 'edit_thread' ||\nourThreadPermissions === 'delete_thread' ||\nourThreadPermissions === 'create_subthreads' ||\n+ ourThreadPermissions === 'create_sidebars' ||\nourThreadPermissions === 'join_thread' ||\nourThreadPermissions === 'edit_permissions' ||\nourThreadPermissions === 'add_members' ||\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -90,6 +90,7 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n[threadPermissions.EDIT_ENTRIES]: true,\n[threadPermissions.EDIT_THREAD]: true,\n[threadPermissions.CREATE_SUBTHREADS]: true,\n+ [threadPermissions.CREATE_SIDEBARS]: true,\n[threadPermissions.ADD_MEMBERS]: true,\n};\nconst descendantKnowOf =\n@@ -106,6 +107,8 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\nthreadPermissionPrefixes.DESCENDANT + threadPermissions.EDIT_THREAD;\nconst descendantCreateSubthreads =\nthreadPermissionPrefixes.DESCENDANT + threadPermissions.CREATE_SUBTHREADS;\n+ const descendantCreateSidebars =\n+ threadPermissionPrefixes.DESCENDANT + threadPermissions.CREATE_SIDEBARS;\nconst descendantAddMembers =\nthreadPermissionPrefixes.DESCENDANT + threadPermissions.ADD_MEMBERS;\nconst descendantDeleteThread =\n@@ -124,6 +127,7 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n[threadPermissions.EDIT_ENTRIES]: true,\n[threadPermissions.EDIT_THREAD]: true,\n[threadPermissions.CREATE_SUBTHREADS]: true,\n+ [threadPermissions.CREATE_SIDEBARS]: true,\n[threadPermissions.ADD_MEMBERS]: true,\n[threadPermissions.DELETE_THREAD]: true,\n[threadPermissions.EDIT_PERMISSIONS]: true,\n@@ -136,6 +140,7 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n[descendantEditEntries]: true,\n[descendantEditThread]: true,\n[descendantCreateSubthreads]: true,\n+ [descendantCreateSidebars]: true,\n[descendantAddMembers]: true,\n[descendantDeleteThread]: true,\n[descendantEditPermissions]: true,\n@@ -180,6 +185,7 @@ function getRolePermissionBlobsForChat(\n[threadPermissions.EDIT_ENTRIES]: true,\n[threadPermissions.EDIT_THREAD]: true,\n[threadPermissions.CREATE_SUBTHREADS]: true,\n+ [threadPermissions.CREATE_SIDEBARS]: true,\n[threadPermissions.ADD_MEMBERS]: true,\n[threadPermissions.EDIT_PERMISSIONS]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Introduce threadPermissions.CREATE_SIDEBARS Summary: In ["announcement threads"](https://site.ashoat.com/comm/app/demo#orgs) I want it so only admins can create subthreads, but anybody can create sidebars. This diffs creates a new permission type `CREATE_SIDEBARS`, separate from `CREATE_SUBTHREADS`. Test Plan: Flow Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D336
129,187
29.10.2020 14:47:46
14,400
a78742f4ca70101336ed9d11763dcbf1d3f30ffa
[server] Simplify validationQuery in updateThread Summary: In D273 I removed the need to query the `users` table, but didn't realize it. This diff simplies the query, since it only needs to hit the `threads` table now. Test Plan: Flow Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -336,10 +336,9 @@ async function updateThread(\n}\nconst validationQuery = SQL`\n- SELECT t.type, t.parent_thread_id\n- FROM users u\n- LEFT JOIN threads t ON t.id = ${request.threadID}\n- WHERE u.id = ${viewer.userID}\n+ SELECT type, parent_thread_id\n+ FROM threads\n+ WHERE id = ${request.threadID}\n`;\nvalidationPromises.validationQuery = dbQuery(validationQuery);\n@@ -384,7 +383,7 @@ async function updateThread(\nhasNecessaryPermissions,\n} = await promiseAll(validationPromises);\n- if (validationResult.length === 0 || validationResult[0].type === null) {\n+ if (validationResult.length === 0) {\nthrow new ServerError('internal_error');\n}\nconst validationRow = validationResult[0];\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Simplify validationQuery in updateThread Summary: In D273 I removed the need to query the `users` table, but didn't realize it. This diff simplies the query, since it only needs to hit the `threads` table now. Test Plan: Flow Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D343
129,187
29.10.2020 15:33:46
14,400
307e019fe412ac7440a1f285c6926268dac2b4eb
[server] Avoid double-fetching in leaveThread Summary: I noticed we could avoid double-fetching from the same table in `leaveThread` Test Plan: Flow, try leaving some threads Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -24,7 +24,7 @@ import { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\nimport { filteredThreadIDs } from 'lib/selectors/calendar-filter-selectors';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\n-import { threadHasPermission } from 'lib/shared/thread-utils';\n+import { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport {\n@@ -35,7 +35,7 @@ import {\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport {\ncheckThreadPermission,\n- viewerIsMember,\n+ viewerIsMember as fetchViewerIsMember,\ncheckThread,\n} from '../fetchers/thread-permission-fetchers';\nimport {\n@@ -221,12 +221,12 @@ async function leaveThread(\nthrow new ServerError('not_logged_in');\n}\n- const [isMember, fetchThreadResult] = await Promise.all([\n- viewerIsMember(viewer, request.threadID),\n- fetchThreadInfos(viewer, SQL`t.id = ${request.threadID}`),\n- ]);\n+ const fetchThreadResult = await fetchThreadInfos(\n+ viewer,\n+ SQL`t.id = ${request.threadID}`,\n+ );\nconst threadInfo = fetchThreadResult.threadInfos[request.threadID];\n- if (!isMember || !threadInfo) {\n+ if (!viewerIsMember(threadInfo)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -574,7 +574,7 @@ async function joinThread(\n}\nconst [isMember, hasPermission] = await Promise.all([\n- viewerIsMember(viewer, request.threadID),\n+ fetchViewerIsMember(viewer, request.threadID),\ncheckThreadPermission(\nviewer,\nrequest.threadID,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Avoid double-fetching in leaveThread Summary: I noticed we could avoid double-fetching from the same table in `leaveThread` Test Plan: Flow, try leaving some threads Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D345
129,187
29.10.2020 15:50:50
14,400
f01953b179d948aca02d25914fc846015144aaee
[server] Avoid double-fetching in createThread Summary: I noticed we could avoid double-fetching from the same table in `createThread` Test Plan: Flow, create a thread Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -12,17 +12,19 @@ import type { Viewer } from '../session/viewer';\nimport invariant from 'invariant';\n-import { generateRandomColor } from 'lib/shared/thread-utils';\n+import {\n+ generateRandomColor,\n+ threadHasPermission,\n+} from 'lib/shared/thread-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\nimport { dbQuery, SQL } from '../database/database';\n-import { checkThreadPermission } from '../fetchers/thread-permission-fetchers';\nimport createIDs from './id-creator';\nimport { createInitialRolesForNewThread } from './role-creator';\nimport { fetchKnownUserInfos } from '../fetchers/user-fetchers';\n-import { fetchServerThreadInfos } from '../fetchers/thread-fetchers';\n+import { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport {\nchangeRole,\nrecalculateAllPermissions,\n@@ -61,14 +63,8 @@ async function createThread(\nconst checkPromises = {};\nif (parentThreadID) {\n- checkPromises.hasParentPermission = checkThreadPermission(\n+ checkPromises.parentThreadFetch = fetchThreadInfos(\nviewer,\n- parentThreadID,\n- threadType === threadTypes.SIDEBAR\n- ? threadPermissions.CREATE_SIDEBARS\n- : threadPermissions.CREATE_SUBTHREADS,\n- );\n- checkPromises.parentThread = fetchServerThreadInfos(\nSQL`t.id = ${parentThreadID}`,\n);\n}\n@@ -78,21 +74,22 @@ async function createThread(\ninitialMemberIDs,\n);\n}\n- const {\n- hasParentPermission,\n- parentThread,\n- fetchInitialMembers,\n- } = await promiseAll(checkPromises);\n+ const { parentThreadFetch, fetchInitialMembers } = await promiseAll(\n+ checkPromises,\n+ );\n- if (hasParentPermission === false) {\n+ let parentThreadMembers;\n+ if (parentThreadID) {\n+ invariant(parentThreadFetch, 'parentThreadFetch should be set');\n+ const parentThreadInfo = parentThreadFetch.threadInfos[parentThreadID];\n+ const permission =\n+ threadType === threadTypes.SIDEBAR\n+ ? threadPermissions.CREATE_SIDEBARS\n+ : threadPermissions.CREATE_SUBTHREADS;\n+ if (!threadHasPermission(parentThreadInfo, permission)) {\nthrow new ServerError('invalid_credentials');\n}\n-\n- let parentThreadMembers;\n- if (parentThread && parentThreadID) {\n- parentThreadMembers = parentThread.threadInfos[parentThreadID].members.map(\n- userInfo => userInfo.id,\n- );\n+ parentThreadMembers = parentThreadInfo.members.map(userInfo => userInfo.id);\n}\nconst viewerNeedsRelationshipsWith = [];\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Avoid double-fetching in createThread Summary: I noticed we could avoid double-fetching from the same table in `createThread` Test Plan: Flow, create a thread Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D347
129,187
01.11.2020 19:44:42
18,000
9ec7df4b97475397b390a6896d6d5a1a64959ef2
[native] Use hook for data-binding in RegisterPanel Test Plan: Flow Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/register-panel.react.js", "new_path": "native/account/register-panel.react.js", "diff": "// @flow\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\n-import type { AppState } from '../redux/redux-setup';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type {\nRegisterInfo,\n@@ -9,31 +7,29 @@ import type {\nRegisterResult,\nLogInStartingPayload,\n} from 'lib/types/account-types';\n-import {\n- type StateContainer,\n- stateContainerPropType,\n-} from '../utils/state-container';\n+import { type StateContainer } from '../utils/state-container';\nimport React from 'react';\nimport { View, StyleSheet, Platform, Keyboard, Alert } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport Animated from 'react-native-reanimated';\n-import { connect } from 'lib/utils/redux-utils';\nimport { registerActionTypes, register } from 'lib/actions/user-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { validUsernameRegex, validEmailRegex } from 'lib/shared/account-utils';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport { TextInput } from './modal-components.react';\nimport { PanelButton, Panel } from './panel-components.react';\nimport { setNativeCredentials } from './native-credentials';\nimport { nativeLogInExtraInfoSelector } from '../selectors/account-selectors';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\n+import { useSelector } from '../redux/redux-utils';\nexport type RegisterState = {|\n+usernameInputText: string,\n@@ -41,10 +37,13 @@ export type RegisterState = {|\n+passwordInputText: string,\n+confirmPasswordInputText: string,\n|};\n-type Props = {\n+type BaseProps = {|\n+setActiveAlert: (activeAlert: boolean) => void,\n+opacityValue: Animated.Value,\n+state: StateContainer<RegisterState>,\n+|};\n+type Props = {|\n+ ...BaseProps,\n// Redux state\n+loadingStatus: LoadingStatus,\n+logInExtraInfo: () => LogInExtraInfo,\n@@ -52,20 +51,11 @@ type Props = {\n+dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n+register: (registerInfo: RegisterInfo) => Promise<RegisterResult>,\n-};\n+|};\ntype State = {|\n+confirmPasswordFocused: boolean,\n|};\nclass RegisterPanel extends React.PureComponent<Props, State> {\n- static propTypes = {\n- setActiveAlert: PropTypes.func.isRequired,\n- opacityValue: PropTypes.object.isRequired,\n- state: stateContainerPropType.isRequired,\n- loadingStatus: PropTypes.string.isRequired,\n- logInExtraInfo: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- register: PropTypes.func.isRequired,\n- };\nstate = {\nconfirmPasswordFocused: false,\n};\n@@ -450,17 +440,29 @@ const styles = StyleSheet.create({\nconst loadingStatusSelector = createLoadingStatusSelector(registerActionTypes);\n-export default connectNav((context: ?NavContextType) => ({\n- navContext: context,\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- loadingStatus: loadingStatusSelector(state),\n- logInExtraInfo: nativeLogInExtraInfoSelector({\n+export default React.memo<BaseProps>(function ConnectedRegisterPanel(\n+ props: BaseProps,\n+) {\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+\n+ const navContext = React.useContext(NavContext);\n+ const logInExtraInfo = useSelector(state =>\n+ nativeLogInExtraInfoSelector({\nredux: state,\n- navContext: ownProps.navContext,\n- }),\n+ navContext,\n}),\n- { register },\n- )(RegisterPanel),\n);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callRegister = useServerCall(register);\n+\n+ return (\n+ <RegisterPanel\n+ {...props}\n+ loadingStatus={loadingStatus}\n+ logInExtraInfo={logInExtraInfo}\n+ dispatchActionPromise={dispatchActionPromise}\n+ register={callRegister}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in RegisterPanel Test Plan: Flow Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D351
129,187
01.11.2020 19:50:55
18,000
195685a6700879390513db44a7a494a1b16db124
[native] Use hook for data-binding in VerificationModal Test Plan: Flow Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/account/verification-modal.react.js", "new_path": "native/account/verification-modal.react.js", "diff": "// @flow\n-import type { AppState } from '../redux/redux-setup';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport {\ntype VerifyField,\nverifyField,\n@@ -25,17 +23,20 @@ import {\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport Animated from 'react-native-reanimated';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\n-import { connect } from 'lib/utils/redux-utils';\nimport {\nhandleVerificationCodeActionTypes,\nhandleVerificationCode,\n} from 'lib/actions/user-actions';\nimport sleep from 'lib/utils/sleep';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport ConnectedStatusBar from '../connected-status-bar.react';\nimport ResetPasswordPanel from './reset-password-panel.react';\n@@ -48,19 +49,16 @@ import {\nremoveKeyboardListener,\n} from '../keyboard/keyboard';\nimport { VerificationModalRouteName } from '../navigation/route-names';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\nimport {\nrunTiming,\nratchetAlongWithKeyboardHeight,\n} from '../utils/animation-utils';\nimport {\ntype DerivedDimensionsInfo,\n- derivedDimensionsInfoPropType,\nderivedDimensionsInfoSelector,\n} from '../selectors/dimensions-selectors';\n+import { useSelector } from '../redux/redux-utils';\nconst safeAreaEdges = ['top', 'bottom'];\n@@ -87,7 +85,7 @@ const {\n/* eslint-enable import/no-named-as-default-member */\nexport type VerificationModalParams = {|\n- verifyCode: string,\n+ +verifyCode: string,\n|};\ntype VerificationModalMode = 'simple-text' | 'reset-password';\n@@ -96,44 +94,31 @@ const modeNumbers: { [VerificationModalMode]: number } = {\n'reset-password': 1,\n};\n-type Props = {\n- navigation: RootNavigationProp<'VerificationModal'>,\n- route: NavigationRoute<'VerificationModal'>,\n+type BaseProps = {|\n+ +navigation: RootNavigationProp<'VerificationModal'>,\n+ +route: NavigationRoute<'VerificationModal'>,\n+|};\n+type Props = {|\n+ ...BaseProps,\n// Navigation state\n- isForeground: boolean,\n+ +isForeground: boolean,\n// Redux state\n- dimensions: DerivedDimensionsInfo,\n- splashStyle: ImageStyle,\n+ +dimensions: DerivedDimensionsInfo,\n+ +splashStyle: ImageStyle,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- handleVerificationCode: (\n+ +handleVerificationCode: (\ncode: string,\n) => Promise<HandleVerificationCodeResult>,\n-};\n+|};\ntype State = {|\n- mode: VerificationModalMode,\n- verifyField: ?VerifyField,\n- errorMessage: ?string,\n- resetPasswordUsername: ?string,\n+ +mode: VerificationModalMode,\n+ +verifyField: ?VerifyField,\n+ +errorMessage: ?string,\n+ +resetPasswordUsername: ?string,\n|};\nclass VerificationModal extends React.PureComponent<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- clearRootModals: PropTypes.func.isRequired,\n- }).isRequired,\n- route: PropTypes.shape({\n- key: PropTypes.string.isRequired,\n- params: PropTypes.shape({\n- verifyCode: PropTypes.string.isRequired,\n- }).isRequired,\n- }).isRequired,\n- isForeground: PropTypes.bool.isRequired,\n- dimensions: derivedDimensionsInfoPropType.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- handleVerificationCode: PropTypes.func.isRequired,\n- };\n-\nkeyboardShowListener: ?Object;\nkeyboardHideListener: ?Object;\n@@ -563,14 +548,27 @@ registerFetchKey(handleVerificationCodeActionTypes);\nconst isForegroundSelector = createIsForegroundSelector(\nVerificationModalRouteName,\n);\n-export default connectNav((context: ?NavContextType) => ({\n- isForeground: isForegroundSelector(context),\n-}))(\n- connect(\n- (state: AppState) => ({\n- dimensions: derivedDimensionsInfoSelector(state),\n- splashStyle: splashStyleSelector(state),\n- }),\n- { handleVerificationCode },\n- )(VerificationModal),\n+\n+export default React.memo<BaseProps>(function ConnectedVerificationModal(\n+ props: BaseProps,\n+) {\n+ const navContext = React.useContext(NavContext);\n+ const isForeground = isForegroundSelector(navContext);\n+\n+ const dimensions = useSelector(derivedDimensionsInfoSelector);\n+ const splashStyle = useSelector(splashStyleSelector);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callHandleVerificationCode = useServerCall(handleVerificationCode);\n+\n+ return (\n+ <VerificationModal\n+ {...props}\n+ isForeground={isForeground}\n+ dimensions={dimensions}\n+ splashStyle={splashStyle}\n+ dispatchActionPromise={dispatchActionPromise}\n+ handleVerificationCode={callHandleVerificationCode}\n+ />\n);\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in VerificationModal Test Plan: Flow Reviewers: palys-swm, KatPo Reviewed By: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D352
129,187
02.11.2020 22:26:41
18,000
cf73c662136e526d29d397f7ffa2a3ef98cae42b
[server] Don't throw no_parent_thread_specified if parentThreadID not set Summary: Accidentally messed this up in D344. Should've tested better. This was breaking whenever I called `editThread` without setting `changes.parentThreadID`. Test Plan: Call `editThread` and make sure it doesn't crash Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -401,6 +401,8 @@ async function updateThread(\n// If the thread is being switched to nested, a parent must be specified\nif (\noldThreadType === threadTypes.CHAT_SECRET &&\n+ threadType !== undefined &&\n+ threadType !== null &&\nthreadType !== threadTypes.CHAT_SECRET &&\nnextParentThreadID === null\n) {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Don't throw no_parent_thread_specified if parentThreadID not set Summary: Accidentally messed this up in D344. Should've tested better. This was breaking whenever I called `editThread` without setting `changes.parentThreadID`. Test Plan: Call `editThread` and make sure it doesn't crash Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D353
129,191
29.10.2020 11:33:15
-3,600
59702810c7f701eec90912299a4ce9ac702d715b
[native] Add optional user info parameter to message list nav params Test Plan: flow Reviewers: ashoat Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/message-list-types.js", "new_path": "native/chat/message-list-types.js", "diff": "import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\nimport type { MarkdownRules } from '../markdown/rules.react';\n+import { type UserInfo, userInfoPropType } from 'lib/types/user-types';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\nexport type MessageListParams = {|\nthreadInfo: ThreadInfo,\n+ pendingPersonalThreadUserInfo?: UserInfo,\n|};\nexport const messageListRoutePropType = PropTypes.shape({\nkey: PropTypes.string.isRequired,\nparams: PropTypes.shape({\nthreadInfo: threadInfoPropType.isRequired,\n+ pendingPersonalThreadUserInfo: userInfoPropType,\n}).isRequired,\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add optional user info parameter to message list nav params Test Plan: flow Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D341
129,187
05.11.2020 23:53:53
18,000
43478d37ea0aee0935a512b4dc69c1037b0ca736
[native] Use hook for data-binding in Calendar Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/calendar/calendar.react.js", "new_path": "native/calendar/calendar.react.js", "diff": "// @flow\n-import {\n- type EntryInfo,\n- entryInfoPropType,\n- type CalendarQuery,\n- type CalendarQueryUpdateResult,\n+import type {\n+ EntryInfo,\n+ CalendarQuery,\n+ CalendarQueryUpdateResult,\n} from 'lib/types/entry-types';\n-import type { AppState } from '../redux/redux-setup';\nimport type {\nCalendarItem,\nSectionHeaderItem,\n@@ -14,21 +12,11 @@ import type {\nLoaderItem,\n} from '../selectors/calendar-selectors';\nimport type { ViewToken } from '../types/react-native';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { KeyboardEvent } from '../keyboard/keyboard';\n-import {\n- type CalendarFilter,\n- calendarFilterPropType,\n-} from 'lib/types/filter-types';\n-import {\n- type LoadingStatus,\n- loadingStatusPropType,\n-} from 'lib/types/loading-types';\n-import {\n- type ConnectionStatus,\n- connectionStatusPropType,\n-} from 'lib/types/socket-types';\n-import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { CalendarFilter } from 'lib/types/filter-types';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import type { ConnectionStatus } from 'lib/types/socket-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport type { TabNavigationProp } from '../navigation/app-navigator.react';\nimport type { NavigationRoute } from '../navigation/route-names';\n@@ -42,7 +30,6 @@ import {\nLayoutAnimation,\nTouchableWithoutFeedback,\n} from 'react-native';\n-import PropTypes from 'prop-types';\nimport invariant from 'invariant';\nimport _findIndex from 'lodash/fp/findIndex';\nimport _map from 'lodash/fp/map';\n@@ -60,9 +47,13 @@ import {\nupdateCalendarQueryActionTypes,\nupdateCalendarQuery,\n} from 'lib/actions/entry-actions';\n-import { connect } from 'lib/utils/redux-utils';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport sleep from 'lib/utils/sleep';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport {\nEntry,\n@@ -89,29 +80,24 @@ import {\n} from '../navigation/route-names';\nimport DisconnectedBar from '../navigation/disconnected-bar.react';\nimport {\n+ useColors,\n+ useStyles,\n+ useIndicatorStyle,\ntype Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\ntype IndicatorStyle,\n- indicatorStylePropType,\n- indicatorStyleSelector,\n} from '../themes/colors';\nimport ContentLoading from '../components/content-loading.react';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nimport {\ntype DerivedDimensionsInfo,\n- derivedDimensionsInfoPropType,\nderivedDimensionsInfoSelector,\n} from '../selectors/dimensions-selectors';\n+import { useSelector } from '../redux/redux-utils';\nexport type EntryInfoWithHeight = {|\n...EntryInfo,\n- textHeight: number,\n+ +textHeight: number,\n|};\ntype CalendarItemWithHeight =\n| LoaderItem\n@@ -122,90 +108,50 @@ type CalendarItemWithHeight =\nentryInfo: EntryInfoWithHeight,\nthreadInfo: ThreadInfo,\n|};\n-type ExtraData = $ReadOnly<{|\n- activeEntries: { [key: string]: boolean },\n- visibleEntries: { [key: string]: boolean },\n-|}>;\n+type ExtraData = {|\n+ +activeEntries: { +[key: string]: boolean },\n+ +visibleEntries: { +[key: string]: boolean },\n+|};\nconst safeAreaViewForceInset = {\ntop: 'always',\nbottom: 'never',\n};\n-type Props = {\n- navigation: TabNavigationProp<'Calendar'>,\n- route: NavigationRoute<'Calendar'>,\n+type BaseProps = {|\n+ +navigation: TabNavigationProp<'Calendar'>,\n+ +route: NavigationRoute<'Calendar'>,\n+|};\n+type Props = {|\n+ ...BaseProps,\n+ // Nav state\n+ +calendarActive: boolean,\n// Redux state\n- listData: ?$ReadOnlyArray<CalendarItem>,\n- calendarActive: boolean,\n- startDate: string,\n- endDate: string,\n- calendarFilters: $ReadOnlyArray<CalendarFilter>,\n- dimensions: DerivedDimensionsInfo,\n- loadingStatus: LoadingStatus,\n- connectionStatus: ConnectionStatus,\n- colors: Colors,\n- styles: typeof styles,\n- indicatorStyle: IndicatorStyle,\n+ +listData: ?$ReadOnlyArray<CalendarItem>,\n+ +startDate: string,\n+ +endDate: string,\n+ +calendarFilters: $ReadOnlyArray<CalendarFilter>,\n+ +dimensions: DerivedDimensionsInfo,\n+ +loadingStatus: LoadingStatus,\n+ +connectionStatus: ConnectionStatus,\n+ +colors: Colors,\n+ +styles: typeof unboundStyles,\n+ +indicatorStyle: IndicatorStyle,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- updateCalendarQuery: (\n+ +updateCalendarQuery: (\ncalendarQuery: CalendarQuery,\nreduxAlreadyUpdated?: boolean,\n) => Promise<CalendarQueryUpdateResult>,\n-};\n+|};\ntype State = {|\n- listDataWithHeights: ?$ReadOnlyArray<CalendarItemWithHeight>,\n- readyToShowList: boolean,\n- extraData: ExtraData,\n- currentlyEditing: $ReadOnlyArray<string>,\n+ +listDataWithHeights: ?$ReadOnlyArray<CalendarItemWithHeight>,\n+ +readyToShowList: boolean,\n+ +extraData: ExtraData,\n+ +currentlyEditing: $ReadOnlyArray<string>,\n|};\nclass Calendar extends React.PureComponent<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- navigate: PropTypes.func.isRequired,\n- addListener: PropTypes.func.isRequired,\n- removeListener: PropTypes.func.isRequired,\n- isFocused: PropTypes.func.isRequired,\n- }).isRequired,\n- route: PropTypes.shape({\n- key: PropTypes.string.isRequired,\n- }).isRequired,\n- listData: PropTypes.arrayOf(\n- PropTypes.oneOfType([\n- PropTypes.shape({\n- itemType: PropTypes.oneOf(['loader']),\n- key: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- itemType: PropTypes.oneOf(['header']),\n- dateString: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- itemType: PropTypes.oneOf(['entryInfo']),\n- entryInfo: entryInfoPropType.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n- }),\n- PropTypes.shape({\n- itemType: PropTypes.oneOf(['footer']),\n- dateString: PropTypes.string.isRequired,\n- }),\n- ]),\n- ),\n- calendarActive: PropTypes.bool.isRequired,\n- startDate: PropTypes.string.isRequired,\n- endDate: PropTypes.string.isRequired,\n- calendarFilters: PropTypes.arrayOf(calendarFilterPropType).isRequired,\n- dimensions: derivedDimensionsInfoPropType.isRequired,\n- loadingStatus: loadingStatusPropType.isRequired,\n- connectionStatus: connectionStatusPropType.isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- indicatorStyle: indicatorStylePropType.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- updateCalendarQuery: PropTypes.func.isRequired,\n- };\nflatList: ?FlatList<CalendarItemWithHeight> = null;\ncurrentState: ?string = NativeAppState.currentState;\nlastForegrounded = 0;\n@@ -1062,7 +1008,7 @@ class Calendar extends React.PureComponent<Props, State> {\n};\n}\n-const styles = {\n+const unboundStyles = {\ncontainer: {\nbackgroundColor: 'listBackground',\nflex: 1,\n@@ -1097,7 +1043,6 @@ const styles = {\n},\nweekendSectionHeader: {},\n};\n-const stylesSelector = styleSelector(styles);\nconst loadingStatusSelector = createLoadingStatusSelector(\nupdateCalendarQueryActionTypes,\n@@ -1106,23 +1051,44 @@ const activeTabSelector = createActiveTabSelector(CalendarRouteName);\nconst activeThreadPickerSelector = createIsForegroundSelector(\nThreadPickerModalRouteName,\n);\n-export default connectNav((context: ?NavContextType) => ({\n- calendarActive:\n- activeTabSelector(context) || activeThreadPickerSelector(context),\n-}))(\n- connect(\n- (state: AppState) => ({\n- listData: calendarListData(state),\n- startDate: state.navInfo.startDate,\n- endDate: state.navInfo.endDate,\n- calendarFilters: state.calendarFilters,\n- dimensions: derivedDimensionsInfoSelector(state),\n- loadingStatus: loadingStatusSelector(state),\n- connectionStatus: state.connection.status,\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n- indicatorStyle: indicatorStyleSelector(state),\n- }),\n- { updateCalendarQuery },\n- )(Calendar),\n+\n+export default React.memo<BaseProps>(function ConnectedCalendar(\n+ props: BaseProps,\n+) {\n+ const navContext = React.useContext(NavContext);\n+ const calendarActive =\n+ activeTabSelector(navContext) || activeThreadPickerSelector(navContext);\n+\n+ const listData = useSelector(calendarListData);\n+ const startDate = useSelector((state) => state.navInfo.startDate);\n+ const endDate = useSelector((state) => state.navInfo.endDate);\n+ const calendarFilters = useSelector((state) => state.calendarFilters);\n+ const dimensions = useSelector(derivedDimensionsInfoSelector);\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+ const connectionStatus = useSelector((state) => state.connection.status);\n+ const colors = useColors();\n+ const styles = useStyles(unboundStyles);\n+ const indicatorStyle = useIndicatorStyle();\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callUpdateCalendarQuery = useServerCall(updateCalendarQuery);\n+\n+ return (\n+ <Calendar\n+ {...props}\n+ calendarActive={calendarActive}\n+ listData={listData}\n+ startDate={startDate}\n+ endDate={endDate}\n+ calendarFilters={calendarFilters}\n+ dimensions={dimensions}\n+ loadingStatus={loadingStatus}\n+ connectionStatus={connectionStatus}\n+ colors={colors}\n+ styles={styles}\n+ indicatorStyle={indicatorStyle}\n+ dispatchActionPromise={dispatchActionPromise}\n+ updateCalendarQuery={callUpdateCalendarQuery}\n+ />\n);\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in Calendar Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D371
129,187
06.11.2020 00:06:13
18,000
723edc6e5e8677e0129cace060f90c8d3fe3974c
[native] Use hook for data-binding in Entry Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/calendar/entry.react.js", "new_path": "native/calendar/entry.react.js", "diff": "// @flow\nimport type { EntryInfoWithHeight } from './calendar.react';\n-import {\n- entryInfoPropType,\n- type CreateEntryInfo,\n- type SaveEntryInfo,\n- type SaveEntryResponse,\n- type CreateEntryPayload,\n- type DeleteEntryInfo,\n- type DeleteEntryResponse,\n- type CalendarQuery,\n+import type {\n+ CreateEntryInfo,\n+ SaveEntryInfo,\n+ SaveEntryResponse,\n+ CreateEntryPayload,\n+ DeleteEntryInfo,\n+ DeleteEntryResponse,\n+ CalendarQuery,\n} from 'lib/types/entry-types';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n-import { threadInfoPropType } from 'lib/types/thread-types';\n-import type { AppState } from '../redux/redux-setup';\n-import type {\n- DispatchActionPayload,\n- DispatchActionPromise,\n-} from 'lib/utils/action-utils';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { LayoutEvent } from '../types/react-native';\nimport type { TabNavigationProp } from '../navigation/app-navigator.react';\n+import type { Dispatch } from 'lib/types/redux-types';\nimport * as React from 'react';\nimport {\n@@ -33,13 +27,13 @@ import {\nLayoutAnimation,\nKeyboard,\n} from 'react-native';\n-import PropTypes from 'prop-types';\nimport invariant from 'invariant';\nimport shallowequal from 'shallowequal';\nimport _omit from 'lodash/fp/omit';\nimport _isEqual from 'lodash/fp/isEqual';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport tinycolor from 'tinycolor2';\n+import { useDispatch } from 'react-redux';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport {\n@@ -51,12 +45,16 @@ import {\ndeleteEntry,\nconcurrentModificationResetActionType,\n} from 'lib/actions/entry-actions';\n-import { connect } from 'lib/utils/redux-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport { entryKey } from 'lib/shared/entry-utils';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { dateString } from 'lib/utils/date-utils';\nimport sleep from 'lib/utils/sleep';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport Button from '../components/button.react';\nimport {\n@@ -68,15 +66,13 @@ import {\nnonThreadCalendarQuery,\n} from '../navigation/nav-selectors';\nimport LoadingIndicator from './loading-indicator.react';\n-import { colors, styleSelector } from '../themes/colors';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { colors, useStyles } from '../themes/colors';\n+import { NavContext } from '../navigation/navigation-context';\nimport { waitForInteractions } from '../utils/interactions';\nimport Markdown from '../markdown/markdown.react';\nimport { inlineMarkdownRules } from '../markdown/rules.react';\nimport { SingleLine } from '../components/single-line.react';\n+import { useSelector } from '../redux/redux-utils';\nfunction hueDistance(firstColor: string, secondColor: string): number {\nconst firstHue = tinycolor(firstColor).toHsv().h;\n@@ -89,68 +85,47 @@ const omitEntryInfo = _omit(['entryInfo']);\nfunction dummyNodeForEntryHeightMeasurement(entryText: string) {\nconst text = entryText === '' ? ' ' : entryText;\nreturn (\n- <View style={[styles.entry, styles.textContainer]}>\n- <Text style={styles.text}>{text}</Text>\n+ <View style={[unboundStyles.entry, unboundStyles.textContainer]}>\n+ <Text style={unboundStyles.text}>{text}</Text>\n</View>\n);\n}\n+type BaseProps = {|\n+ +navigation: TabNavigationProp<'Calendar'>,\n+ +entryInfo: EntryInfoWithHeight,\n+ +threadInfo: ThreadInfo,\n+ +visible: boolean,\n+ +active: boolean,\n+ +makeActive: (entryKey: string, active: boolean) => void,\n+ +onEnterEditMode: (entryInfo: EntryInfoWithHeight) => void,\n+ +onConcludeEditMode: (entryInfo: EntryInfoWithHeight) => void,\n+ +onPressWhitespace: () => void,\n+ +entryRef: (entryKey: string, entry: ?InternalEntry) => void,\n+|};\ntype Props = {|\n- navigation: TabNavigationProp<'Calendar'>,\n- entryInfo: EntryInfoWithHeight,\n- threadInfo: ThreadInfo,\n- visible: boolean,\n- active: boolean,\n- makeActive: (entryKey: string, active: boolean) => void,\n- onEnterEditMode: (entryInfo: EntryInfoWithHeight) => void,\n- onConcludeEditMode: (entryInfo: EntryInfoWithHeight) => void,\n- onPressWhitespace: () => void,\n- entryRef: (entryKey: string, entry: ?InternalEntry) => void,\n+ ...BaseProps,\n// Redux state\n- calendarQuery: () => CalendarQuery,\n- online: boolean,\n- styles: typeof styles,\n+ +calendarQuery: () => CalendarQuery,\n+ +online: boolean,\n+ +styles: typeof unboundStyles,\n// Nav state\n- threadPickerActive: boolean,\n+ +threadPickerActive: boolean,\n// Redux dispatch functions\n- dispatchActionPayload: DispatchActionPayload,\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatch: Dispatch,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- createEntry: (info: CreateEntryInfo) => Promise<CreateEntryPayload>,\n- saveEntry: (info: SaveEntryInfo) => Promise<SaveEntryResponse>,\n- deleteEntry: (info: DeleteEntryInfo) => Promise<DeleteEntryResponse>,\n+ +createEntry: (info: CreateEntryInfo) => Promise<CreateEntryPayload>,\n+ +saveEntry: (info: SaveEntryInfo) => Promise<SaveEntryResponse>,\n+ +deleteEntry: (info: DeleteEntryInfo) => Promise<DeleteEntryResponse>,\n|};\ntype State = {|\n- editing: boolean,\n- text: string,\n- loadingStatus: LoadingStatus,\n- height: number,\n+ +editing: boolean,\n+ +text: string,\n+ +loadingStatus: LoadingStatus,\n+ +height: number,\n|};\nclass InternalEntry extends React.Component<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- navigate: PropTypes.func.isRequired,\n- goBack: PropTypes.func.isRequired,\n- }).isRequired,\n- entryInfo: entryInfoPropType.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n- visible: PropTypes.bool.isRequired,\n- active: PropTypes.bool.isRequired,\n- makeActive: PropTypes.func.isRequired,\n- onEnterEditMode: PropTypes.func.isRequired,\n- onConcludeEditMode: PropTypes.func.isRequired,\n- onPressWhitespace: PropTypes.func.isRequired,\n- entryRef: PropTypes.func.isRequired,\n- calendarQuery: PropTypes.func.isRequired,\n- online: PropTypes.bool.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- threadPickerActive: PropTypes.bool.isRequired,\n- dispatchActionPayload: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- createEntry: PropTypes.func.isRequired,\n- saveEntry: PropTypes.func.isRequired,\n- deleteEntry: PropTypes.func.isRequired,\n- };\ntextInput: ?React.ElementRef<typeof TextInput>;\ncreating = false;\nneedsUpdateAfterCreation = false;\n@@ -168,7 +143,10 @@ class InternalEntry extends React.Component<Props, State> {\nloadingStatus: 'inactive',\nheight: props.entryInfo.textHeight,\n};\n- this.state.editing = InternalEntry.isActive(props, this.state);\n+ this.state = {\n+ ...this.state,\n+ editing: InternalEntry.isActive(props, this.state),\n+ };\n}\nguardedSetState(input: $Shape<State>) {\n@@ -616,10 +594,10 @@ class InternalEntry extends React.Component<Props, State> {\nloadingStatus: 'inactive',\ntext: revertedText,\n});\n- this.props.dispatchActionPayload(\n- concurrentModificationResetActionType,\n- { id: entryID, dbText: revertedText },\n- );\n+ this.props.dispatch({\n+ type: concurrentModificationResetActionType,\n+ payload: { id: entryID, dbText: revertedText },\n+ });\n};\nAlert.alert(\n'Concurrent modification',\n@@ -684,7 +662,7 @@ class InternalEntry extends React.Component<Props, State> {\n};\n}\n-const styles = {\n+const unboundStyles = {\nactionLinks: {\nflex: 1,\nflexDirection: 'row',\n@@ -754,7 +732,6 @@ const styles = {\ntop: Platform.OS === 'android' ? 4.8 : 0.5,\n},\n};\n-const stylesSelector = styleSelector(styles);\nregisterFetchKey(saveEntryActionTypes);\nregisterFetchKey(deleteEntryActionTypes);\n@@ -762,21 +739,41 @@ const activeThreadPickerSelector = createIsForegroundSelector(\nThreadPickerModalRouteName,\n);\n-const Entry = connectNav((context: ?NavContextType) => ({\n- navContext: context,\n- threadPickerActive: activeThreadPickerSelector(context),\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- calendarQuery: nonThreadCalendarQuery({\n+const Entry = React.memo<BaseProps>(function ConnectedEntry(props: BaseProps) {\n+ const navContext = React.useContext(NavContext);\n+ const threadPickerActive = activeThreadPickerSelector(navContext);\n+\n+ const calendarQuery = useSelector((state) =>\n+ nonThreadCalendarQuery({\nredux: state,\n- navContext: ownProps.navContext,\n+ navContext,\n}),\n- online: state.connection.status === 'connected',\n- styles: stylesSelector(state),\n- }),\n- { createEntry, saveEntry, deleteEntry },\n- )(InternalEntry),\n);\n+ const online = useSelector(\n+ (state) => state.connection.status === 'connected',\n+ );\n+ const styles = useStyles(unboundStyles);\n+\n+ const dispatch = useDispatch();\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callCreateEntry = useServerCall(createEntry);\n+ const callSaveEntry = useServerCall(saveEntry);\n+ const callDeleteEntry = useServerCall(deleteEntry);\n+\n+ return (\n+ <InternalEntry\n+ {...props}\n+ threadPickerActive={threadPickerActive}\n+ calendarQuery={calendarQuery}\n+ online={online}\n+ styles={styles}\n+ dispatch={dispatch}\n+ dispatchActionPromise={dispatchActionPromise}\n+ createEntry={callCreateEntry}\n+ saveEntry={callSaveEntry}\n+ deleteEntry={callDeleteEntry}\n+ />\n+ );\n+});\nexport { InternalEntry, Entry, dummyNodeForEntryHeightMeasurement };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in Entry Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D372
129,187
08.11.2020 17:48:35
18,000
91bb1b6c9338eb9db4ef62803793ad9122c7d382
[native] Use hook for data-binding in MoreHeader Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/more/more-header.react.js", "new_path": "native/more/more-header.react.js", "diff": "// @flow\n+import type { StackHeaderProps } from '@react-navigation/stack';\n+\n+import * as React from 'react';\n+\nimport Header from '../navigation/header.react';\nimport { createActiveTabSelector } from '../navigation/nav-selectors';\nimport { MoreRouteName } from '../navigation/route-names';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\nconst activeTabSelector = createActiveTabSelector(MoreRouteName);\n-export default connectNav((context: ?NavContextType) => ({\n- activeTab: activeTabSelector(context),\n-}))(Header);\n+export default React.memo<StackHeaderProps>(function MoreHeader(\n+ props: StackHeaderProps,\n+) {\n+ const navContext = React.useContext(NavContext);\n+ const activeTab = activeTabSelector(navContext);\n+ return <Header {...props} activeTab={activeTab} />;\n+});\n" }, { "change_type": "MODIFY", "old_path": "native/more/more.react.js", "new_path": "native/more/more.react.js", "diff": "// @flow\n-import type { StackNavigationProp } from '@react-navigation/stack';\n-\nimport * as React from 'react';\n-import { createStackNavigator } from '@react-navigation/stack';\n+import {\n+ createStackNavigator,\n+ type StackNavigationProp,\n+ type StackHeaderProps,\n+} from '@react-navigation/stack';\nimport MoreScreen from './more-screen.react';\nimport EditEmail from './edit-email.react';\n@@ -31,7 +33,7 @@ import {\nimport MoreHeader from './more-header.react';\nimport HeaderBackButton from '../navigation/header-back-button.react';\n-const header = (props) => <MoreHeader {...props} />;\n+const header = (props: StackHeaderProps) => <MoreHeader {...props} />;\nconst headerBackButton = (props) => <HeaderBackButton {...props} />;\nconst screenOptions = {\nheader,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in MoreHeader Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D374
129,187
08.11.2020 18:21:06
18,000
f5bae34105f0a91ef33560214a153e4046f66c20
[native] Convert MessageStorePruner to hook Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/message-store-pruner.react.js", "new_path": "native/chat/message-store-pruner.react.js", "diff": "// @flow\n-import type { AppState } from '../redux/redux-setup';\n-import { messageStorePruneActionType } from 'lib/actions/message-actions';\n-import type { DispatchActionPayload } from 'lib/utils/action-utils';\n-\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\n+import { useDispatch } from 'react-redux';\n-import { connect } from 'lib/utils/redux-utils';\n+import { messageStorePruneActionType } from 'lib/actions/message-actions';\nimport {\nnextMessagePruneTimeSelector,\npruneThreadIDsSelector,\n} from '../selectors/message-selectors';\n-import {\n- connectNav,\n- type NavContextType,\n-} from '../navigation/navigation-context';\n+import { NavContext } from '../navigation/navigation-context';\n+import { useSelector } from '../redux/redux-utils';\n+\n+function MessageStorePruner() {\n+ const nextMessagePruneTime = useSelector(nextMessagePruneTimeSelector);\n+ const prevNextMessagePruneTimeRef = React.useRef(nextMessagePruneTime);\n+\n+ const foreground = useSelector((state) => state.foreground);\n+ const frozen = useSelector((state) => state.frozen);\n+\n+ const navContext = React.useContext(NavContext);\n+ const pruneThreadIDs = useSelector((state) =>\n+ pruneThreadIDsSelector({\n+ redux: state,\n+ navContext,\n+ }),\n+ );\n+\n+ const prunedRef = React.useRef(false);\n-type Props = {|\n- // Redux state\n- nextMessagePruneTime: ?number,\n- pruneThreadIDs: () => $ReadOnlyArray<string>,\n- foreground: boolean,\n- frozen: boolean,\n- // Redux dispatch functions\n- dispatchActionPayload: DispatchActionPayload,\n-|};\n-class MessageStorePruner extends React.PureComponent<Props> {\n- static propTypes = {\n- nextMessagePruneTime: PropTypes.number,\n- pruneThreadIDs: PropTypes.func.isRequired,\n- foreground: PropTypes.bool.isRequired,\n- frozen: PropTypes.bool.isRequired,\n- dispatchActionPayload: PropTypes.func.isRequired,\n- };\n- pruned = false;\n+ const dispatch = useDispatch();\n- componentDidUpdate(prevProps: Props) {\n+ React.useEffect(() => {\nif (\n- this.pruned &&\n- this.props.nextMessagePruneTime !== prevProps.nextMessagePruneTime\n+ prunedRef.current &&\n+ nextMessagePruneTime !== prevNextMessagePruneTimeRef.current\n) {\n- this.pruned = false;\n+ prunedRef.current = false;\n}\n- if (this.props.frozen || this.pruned) {\n+ prevNextMessagePruneTimeRef.current = nextMessagePruneTime;\n+\n+ if (frozen || prunedRef.current) {\nreturn;\n}\n- const { nextMessagePruneTime } = this.props;\nif (nextMessagePruneTime === null || nextMessagePruneTime === undefined) {\nreturn;\n}\n@@ -55,36 +50,19 @@ class MessageStorePruner extends React.PureComponent<Props> {\nif (timeUntilExpiration > 0) {\nreturn;\n}\n- const threadIDs = this.props.pruneThreadIDs();\n+ const threadIDs = pruneThreadIDs();\nif (threadIDs.length === 0) {\nreturn;\n}\n- this.pruned = true;\n- this.props.dispatchActionPayload(messageStorePruneActionType, {\n- threadIDs,\n+ prunedRef.current = true;\n+ dispatch({\n+ type: messageStorePruneActionType,\n+ payload: { threadIDs },\n});\n- }\n+ // We include foreground so this effect will be called on foreground\n+ }, [nextMessagePruneTime, frozen, foreground, pruneThreadIDs, dispatch]);\n- render() {\nreturn null;\n}\n-}\n-export default connectNav((context: ?NavContextType) => ({\n- navContext: context,\n-}))(\n- connect(\n- (state: AppState, ownProps: { navContext: ?NavContextType }) => ({\n- nextMessagePruneTime: nextMessagePruneTimeSelector(state),\n- pruneThreadIDs: pruneThreadIDsSelector({\n- redux: state,\n- navContext: ownProps.navContext,\n- }),\n- // We include this so that componentDidUpdate will be called on foreground\n- foreground: state.foreground,\n- frozen: state.frozen,\n- }),\n- null,\n- true,\n- )(MessageStorePruner),\n-);\n+export default MessageStorePruner;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Convert MessageStorePruner to hook Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D376
129,187
08.11.2020 18:32:26
18,000
ad32a088f6731278fa183be8b95173854b81a6e1
[native] Use hook for data-binding in DeleteThread Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/delete-thread.react.js", "new_path": "native/chat/settings/delete-thread.react.js", "diff": "// @flow\n-import type { AppState } from '../../redux/redux-setup';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { LoadingStatus } from 'lib/types/loading-types';\n-import { loadingStatusPropType } from 'lib/types/loading-types';\n-import {\n- type ThreadInfo,\n- threadInfoPropType,\n- type LeaveThreadPayload,\n-} from 'lib/types/thread-types';\n-import { type GlobalTheme, globalThemePropType } from '../../types/themes';\n+import type { ThreadInfo, LeaveThreadPayload } from 'lib/types/thread-types';\n+import type { GlobalTheme } from '../../types/themes';\nimport type { ChatNavigationProp } from '../chat.react';\nimport type { NavigationRoute } from '../../navigation/route-names';\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\nimport {\nText,\nView,\n@@ -25,7 +17,6 @@ import {\n} from 'react-native';\nimport invariant from 'invariant';\n-import { connect } from 'lib/utils/redux-utils';\nimport {\ndeleteThreadActionTypes,\ndeleteThread,\n@@ -33,67 +24,51 @@ import {\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport { identifyInvalidatedThreads } from 'lib/shared/thread-utils';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport Button from '../../components/button.react';\n+import { type Colors, useColors, useStyles } from '../../themes/colors';\nimport {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\n-} from '../../themes/colors';\n-import {\n- withNavContext,\n- type NavContextType,\n- navContextPropType,\n+ NavContext,\n+ type NavAction,\n} from '../../navigation/navigation-context';\nimport { clearThreadsActionType } from '../../navigation/action-types';\n+import { useSelector } from '../../redux/redux-utils';\nexport type DeleteThreadParams = {|\n- threadInfo: ThreadInfo,\n+ +threadInfo: ThreadInfo,\n|};\n+type BaseProps = {|\n+ +navigation: ChatNavigationProp<'DeleteThread'>,\n+ +route: NavigationRoute<'DeleteThread'>,\n+|};\ntype Props = {|\n- navigation: ChatNavigationProp<'DeleteThread'>,\n- route: NavigationRoute<'DeleteThread'>,\n+ ...BaseProps,\n// Redux state\n- threadInfo: ?ThreadInfo,\n- loadingStatus: LoadingStatus,\n- activeTheme: ?GlobalTheme,\n- colors: Colors,\n- styles: typeof styles,\n+ +threadInfo: ?ThreadInfo,\n+ +loadingStatus: LoadingStatus,\n+ +activeTheme: ?GlobalTheme,\n+ +colors: Colors,\n+ +styles: typeof unboundStyles,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- deleteThread: (\n+ +deleteThread: (\nthreadID: string,\ncurrentAccountPassword: string,\n) => Promise<LeaveThreadPayload>,\n// withNavContext\n- navContext: ?NavContextType,\n+ +navDispatch: (action: NavAction) => void,\n|};\ntype State = {|\n- password: string,\n+ +password: string,\n|};\nclass DeleteThread extends React.PureComponent<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- navigate: PropTypes.func.isRequired,\n- setParams: PropTypes.func.isRequired,\n- }).isRequired,\n- route: PropTypes.shape({\n- params: PropTypes.shape({\n- threadInfo: threadInfoPropType.isRequired,\n- }).isRequired,\n- }).isRequired,\n- threadInfo: threadInfoPropType,\n- loadingStatus: loadingStatusPropType.isRequired,\n- activeTheme: globalThemePropType,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- deleteThread: PropTypes.func.isRequired,\n- navContext: navContextPropType,\n- };\nstate = {\npassword: '',\n};\n@@ -198,9 +173,8 @@ class DeleteThread extends React.PureComponent<Props, State> {\nasync deleteThread() {\nconst threadInfo = DeleteThread.getThreadInfo(this.props);\n- const { navContext } = this.props;\n- invariant(navContext, 'navContext should exist in deleteThread');\n- navContext.dispatch({\n+ const { navDispatch } = this.props;\n+ navDispatch({\ntype: clearThreadsActionType,\npayload: { threadIDs: [threadInfo.id] },\n});\n@@ -212,7 +186,7 @@ class DeleteThread extends React.PureComponent<Props, State> {\nconst invalidated = identifyInvalidatedThreads(\nresult.updatesResult.newUpdates,\n);\n- navContext.dispatch({\n+ navDispatch({\ntype: clearThreadsActionType,\npayload: { threadIDs: [...invalidated] },\n});\n@@ -244,7 +218,7 @@ class DeleteThread extends React.PureComponent<Props, State> {\n};\n}\n-const styles = {\n+const unboundStyles = {\ndeleteButton: {\nbackgroundColor: 'redButton',\nborderRadius: 5,\n@@ -298,27 +272,43 @@ const styles = {\ntextAlign: 'center',\n},\n};\n-const stylesSelector = styleSelector(styles);\nconst loadingStatusSelector = createLoadingStatusSelector(\ndeleteThreadActionTypes,\n);\n-export default connect(\n- (\n- state: AppState,\n- ownProps: {\n- route: NavigationRoute<'DeleteThread'>,\n- },\n- ): * => {\n- const threadID = ownProps.route.params.threadInfo.id;\n- return {\n- threadInfo: threadInfoSelector(state)[threadID],\n- loadingStatus: loadingStatusSelector(state),\n- activeTheme: state.globalThemeInfo.activeTheme,\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n- };\n- },\n- { deleteThread },\n-)(withNavContext(DeleteThread));\n+export default React.memo<BaseProps>(function ConnectedDeleteThread(\n+ props: BaseProps,\n+) {\n+ const threadID = props.route.params.threadInfo.id;\n+ const threadInfo = useSelector(\n+ (state) => threadInfoSelector(state)[threadID],\n+ );\n+\n+ const loadingStatus = useSelector(loadingStatusSelector);\n+ const activeTheme = useSelector((state) => state.globalThemeInfo.activeTheme);\n+\n+ const colors = useColors();\n+ const styles = useStyles(unboundStyles);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callDeleteThread = useServerCall(deleteThread);\n+\n+ const navContext = React.useContext(NavContext);\n+ invariant(navContext, 'NavContext should be set in DeleteThread');\n+ const navDispatch = navContext.dispatch;\n+\n+ return (\n+ <DeleteThread\n+ {...props}\n+ threadInfo={threadInfo}\n+ loadingStatus={loadingStatus}\n+ activeTheme={activeTheme}\n+ colors={colors}\n+ styles={styles}\n+ dispatchActionPromise={dispatchActionPromise}\n+ deleteThread={callDeleteThread}\n+ navDispatch={navDispatch}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data-binding in DeleteThread Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D377
129,187
08.11.2020 18:34:34
18,000
6f65d2aa45adb856780477a39d3f39d9f7fc7b9a
[native] Get rid of withNavContext and connectNav Summary: They're no longer used. Going forward, let's use hooks for data binding. I also got rid of `navContextPropType`. Test Plan: Flow Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/navigation/navigation-context.js", "new_path": "native/navigation/navigation-context.js", "diff": "@@ -9,7 +9,6 @@ import type { ChatRouterNavigationAction } from '../chat/chat-router';\nimport type { OverlayRouterNavigationAction } from './overlay-router';\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\nexport type NavAction =\n| CommonAction\n@@ -17,71 +16,10 @@ export type NavAction =\n| ChatRouterNavigationAction\n| OverlayRouterNavigationAction;\nexport type NavContextType = {|\n- state: PossiblyStaleNavigationState,\n- dispatch: (action: NavAction) => void,\n+ +state: PossiblyStaleNavigationState,\n+ +dispatch: (action: NavAction) => void,\n|};\n-const navContextPropType = PropTypes.shape({\n- state: PropTypes.object.isRequired,\n- dispatch: PropTypes.func.isRequired,\n-});\n-\nconst NavContext = React.createContext<?NavContextType>(null);\n-function withNavContext<\n- AllProps: {},\n- ComponentType: React.ComponentType<AllProps>,\n->(\n- Component: ComponentType,\n-): React.ComponentType<\n- $Diff<React.ElementConfig<ComponentType>, { navContext: ?NavContextType }>,\n-> &\n- ComponentType {\n- function NavContextHOC(\n- props: $Diff<\n- React.ElementConfig<ComponentType>,\n- { navContext: ?NavContextType },\n- >,\n- ) {\n- return (\n- <NavContext.Consumer>\n- {(value) => <Component {...props} navContext={value} />}\n- </NavContext.Consumer>\n- );\n- }\n- // $FlowFixMe React.memo typing fixed in later version of Flow\n- return React.memo(NavContextHOC);\n-}\n-\n-function connectNav<\n- AllProps: {},\n- ConnectedProps: AllProps,\n- ComponentType: React.ComponentType<$Exact<AllProps>>,\n->(\n- connectFunc: (\n- navContext: ?NavContextType,\n- ownProps: $Diff<$Exact<AllProps>, $Exact<ConnectedProps>>,\n- ) => $Exact<ConnectedProps>,\n-): (\n- Component: ComponentType,\n-) => React.ComponentType<$Diff<$Exact<AllProps>, $Exact<ConnectedProps>>> &\n- ComponentType {\n- return (Component: ComponentType) => {\n- function NavConnectedComponent(props: {|\n- ...$Diff<React.ElementConfig<ComponentType>, $Exact<ConnectedProps>>,\n- navContext: ?NavContextType,\n- |}) {\n- const { navContext, ...rest } = props;\n- const connectedProps = connectFunc(navContext, rest);\n- return <Component {...rest} {...connectedProps} />;\n- }\n- NavConnectedComponent.displayName = Component.displayName\n- ? `NavConnected(${Component.displayName})`\n- : `NavConnectedComponent`;\n- const MemoizedNavConnectedComponent = React.memo(NavConnectedComponent);\n- // $FlowFixMe React.memo typing fixed in later version of Flow\n- return withNavContext(MemoizedNavConnectedComponent);\n- };\n-}\n-\n-export { NavContext, withNavContext, connectNav, navContextPropType };\n+export { NavContext };\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Get rid of withNavContext and connectNav Summary: They're no longer used. Going forward, let's use hooks for data binding. I also got rid of `navContextPropType`. Test Plan: Flow Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D378
129,187
11.11.2020 19:50:43
18,000
2278756d9de90d94d3072b060596793ce441c13d
[server] Button to show rest of sidebars when there are too many Summary: Introducing `ChatThreadListSeeMoreSidebars`, which will pop up a modal with all of the sidebars. Test Plan: Make sure the button displays where it should, and looks good Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "@@ -34,6 +34,7 @@ import { useColors, useStyles } from '../themes/colors';\nimport { SingleLine } from '../components/single-line.react';\nimport { useMemo } from 'react';\nimport ChatThreadListSidebar from './chat-thread-list-sidebar.react';\n+import ChatThreadListSeeMoreSidebars from './chat-thread-list-see-more-sidebars.react';\ntype Props = {|\n+data: ChatThreadItem,\n@@ -92,19 +93,26 @@ function ChatThreadListItem({\n);\n}, [data.mostRecentMessageInfo, data.threadInfo, styles]);\n- const sidebars = [];\n- for (const sidebarItem of data.sidebars) {\n+ const sidebars = data.sidebars.map((sidebarItem) => {\nif (sidebarItem.type === 'sidebar') {\n- sidebars.push(\n+ return (\n<ChatThreadListSidebar\nthreadInfo={sidebarItem.threadInfo}\nlastUpdatedTime={sidebarItem.lastUpdatedTime}\nonPressItem={onPressItem}\nkey={sidebarItem.threadInfo.id}\n- />,\n+ />\n+ );\n+ } else {\n+ return (\n+ <ChatThreadListSeeMoreSidebars\n+ threadInfo={data.threadInfo}\n+ unread={sidebarItem.unread}\n+ key=\"seeMore\"\n+ />\n);\n}\n- }\n+ });\nconst onPress = React.useCallback(() => {\nonPressItem(data.threadInfo);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/chat/chat-thread-list-see-more-sidebars.react.js", "diff": "+// @flow\n+\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+\n+import * as React from 'react';\n+import { Text } from 'react-native';\n+import Icon from 'react-native-vector-icons/Ionicons';\n+\n+import Button from '../components/button.react';\n+import { useColors, useStyles } from '../themes/colors';\n+\n+type Props = {|\n+ +threadInfo: ThreadInfo,\n+ +unread: boolean,\n+|};\n+function ChatThreadListSeeMoreSidebars(props: Props) {\n+ const onPressButton = React.useCallback(() => {}, []);\n+\n+ const colors = useColors();\n+ const styles = useStyles(unboundStyles);\n+ const unreadStyle = props.unread ? styles.unread : null;\n+ return (\n+ <Button\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={colors.listIosHighlightUnderlay}\n+ iosActiveOpacity={0.85}\n+ style={styles.button}\n+ onPress={onPressButton}\n+ >\n+ <Icon name=\"ios-more\" size={28} style={styles.icon} />\n+ <Text style={[styles.text, unreadStyle]}>See more...</Text>\n+ </Button>\n+ );\n+}\n+\n+const unboundStyles = {\n+ unread: {\n+ color: 'listForegroundLabel',\n+ fontWeight: 'bold',\n+ },\n+ button: {\n+ height: 30,\n+ flexDirection: 'row',\n+ display: 'flex',\n+ marginLeft: 20,\n+ marginRight: 10,\n+ alignItems: 'center',\n+ },\n+ icon: {\n+ paddingLeft: 10,\n+ color: 'listForegroundSecondaryLabel',\n+ width: 35,\n+ },\n+ text: {\n+ color: 'listForegroundSecondaryLabel',\n+ flex: 1,\n+ fontSize: 16,\n+ paddingLeft: 5,\n+ paddingBottom: 2,\n+ },\n+};\n+\n+export default ChatThreadListSeeMoreSidebars;\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-sidebar.react.js", "new_path": "native/chat/chat-thread-list-sidebar.react.js", "diff": "@@ -36,7 +36,6 @@ function ChatThreadListSidebar(props: Props) {\niosHighlightUnderlayColor={colors.listIosHighlightUnderlay}\niosActiveOpacity={0.85}\nstyle={styles.sidebar}\n- key={threadInfo.id}\nonPress={onPress}\n>\n<Icon name=\"align-right\" style={styles.icon} size={24} />\n@@ -57,12 +56,14 @@ const unboundStyles = {\nheight: 30,\nflexDirection: 'row',\ndisplay: 'flex',\n- marginHorizontal: 20,\n+ marginLeft: 20,\n+ marginRight: 10,\nalignItems: 'center',\n},\nicon: {\npaddingLeft: 10,\ncolor: 'listForegroundSecondaryLabel',\n+ width: 35,\n},\nname: {\ncolor: 'listForegroundSecondaryLabel',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Button to show rest of sidebars when there are too many Summary: Introducing `ChatThreadListSeeMoreSidebars`, which will pop up a modal with all of the sidebars. Test Plan: Make sure the button displays where it should, and looks good Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D391
129,187
11.11.2020 21:25:08
18,000
49d7c18b41906106a39225f1d48a9cace745c7e8
[native] Dummy SidebarListModal Summary: Boilerplate for the new modal and code that will navigate to it Test Plan: Flow, make sure the app still works, and make sure the modals get opened when the button is pressed Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "@@ -39,12 +39,14 @@ import ChatThreadListSeeMoreSidebars from './chat-thread-list-see-more-sidebars.\ntype Props = {|\n+data: ChatThreadItem,\n+onPressItem: (threadInfo: ThreadInfo) => void,\n+ +onPressSeeMoreSidebars: (threadInfo: ThreadInfo) => void,\n+onSwipeableWillOpen: (threadInfo: ThreadInfo) => void,\n+currentlyOpenedSwipeableId?: string,\n|};\nfunction ChatThreadListItem({\ndata,\nonPressItem,\n+ onPressSeeMoreSidebars,\nonSwipeableWillOpen,\ncurrentlyOpenedSwipeableId,\n}: Props) {\n@@ -108,6 +110,7 @@ function ChatThreadListItem({\n<ChatThreadListSeeMoreSidebars\nthreadInfo={data.threadInfo}\nunread={sidebarItem.unread}\n+ onPress={onPressSeeMoreSidebars}\nkey=\"seeMore\"\n/>\n);\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-see-more-sidebars.react.js", "new_path": "native/chat/chat-thread-list-see-more-sidebars.react.js", "diff": "@@ -12,9 +12,14 @@ import { useColors, useStyles } from '../themes/colors';\ntype Props = {|\n+threadInfo: ThreadInfo,\n+unread: boolean,\n+ +onPress: (threadInfo: ThreadInfo) => void,\n|};\nfunction ChatThreadListSeeMoreSidebars(props: Props) {\n- const onPressButton = React.useCallback(() => {}, []);\n+ const { onPress, threadInfo } = props;\n+ const onPressButton = React.useCallback(() => onPress(threadInfo), [\n+ onPress,\n+ threadInfo,\n+ ]);\nconst colors = useColors();\nconst styles = useStyles(unboundStyles);\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list.react.js", "new_path": "native/chat/chat-thread-list.react.js", "diff": "@@ -30,6 +30,7 @@ import ChatThreadListItem from './chat-thread-list-item.react';\nimport {\nComposeThreadRouteName,\nMessageListRouteName,\n+ SidebarListModalRouteName,\nHomeChatThreadListRouteName,\nBackgroundChatThreadListRouteName,\ntype NavigationRoute,\n@@ -155,6 +156,7 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n<ChatThreadListItem\ndata={item}\nonPressItem={this.onPressItem}\n+ onPressSeeMoreSidebars={this.onPressSeeMoreSidebars}\nonSwipeableWillOpen={this.onSwipeableWillOpen}\ncurrentlyOpenedSwipeableId={this.state.openedSwipeableId}\n/>\n@@ -303,6 +305,17 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n});\n};\n+ onPressSeeMoreSidebars = (threadInfo: ThreadInfo) => {\n+ this.onChangeSearchText('');\n+ if (this.searchInput) {\n+ this.searchInput.blur();\n+ }\n+ this.props.navigation.navigate({\n+ name: SidebarListModalRouteName,\n+ params: { threadInfo },\n+ });\n+ };\n+\nonSwipeableWillOpen = (threadInfo: ThreadInfo) => {\nthis.setState((state) => ({ ...state, openedSwipeableId: threadInfo.id }));\n};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/chat/sidebar-list-modal.react.js", "diff": "+// @flow\n+\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+\n+export type SidebarListModalParams = {|\n+ +threadInfo: ThreadInfo,\n+|};\n+\n+function SidebarListModal() {\n+ return null;\n+}\n+\n+export default SidebarListModal;\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/root-navigator.react.js", "new_path": "native/navigation/root-navigator.react.js", "diff": "@@ -24,6 +24,7 @@ import {\nColorPickerModalRouteName,\nComposeSubthreadModalRouteName,\nRelationshipUpdateModalRouteName,\n+ SidebarListModalRouteName,\ntype ScreenParamList,\ntype RootParamList,\n} from './route-names';\n@@ -36,6 +37,7 @@ import CustomServerModal from '../more/custom-server-modal.react';\nimport ColorPickerModal from '../chat/settings/color-picker-modal.react';\nimport RelationshipUpdateModal from '../more/relationship-update-modal.react';\nimport ComposeSubthreadModal from '../chat/settings/compose-subthread-modal.react';\n+import SidebarListModal from '../chat/sidebar-list-modal.react';\nimport RootRouter, { type RootRouterNavigationProp } from './root-router';\nimport { RootNavigatorContext } from './root-navigator-context';\n@@ -184,6 +186,11 @@ const RootComponent = () => {\ncomponent={RelationshipUpdateModal}\noptions={modalOverlayScreenOptions}\n/>\n+ <Root.Screen\n+ name={SidebarListModalRouteName}\n+ component={SidebarListModal}\n+ options={modalOverlayScreenOptions}\n+ />\n</Root.Navigator>\n);\n};\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/route-names.js", "new_path": "native/navigation/route-names.js", "diff": "@@ -19,6 +19,7 @@ import type { ComposeThreadParams } from '../chat/compose-thread.react';\nimport type { ThreadSettingsParams } from '../chat/settings/thread-settings.react';\nimport type { DeleteThreadParams } from '../chat/settings/delete-thread.react';\nimport type { MessageListParams } from '../chat/message-list-types';\n+import type { SidebarListModalParams } from '../chat/sidebar-list-modal.react';\nexport const AppRouteName = 'App';\nexport const TabNavigatorRouteName = 'TabNavigator';\n@@ -58,6 +59,7 @@ export const CameraModalRouteName = 'CameraModal';\nexport const FriendListRouteName = 'FriendList';\nexport const BlockListRouteName = 'BlockList';\nexport const RelationshipUpdateModalRouteName = 'RelationshipUpdateModal';\n+export const SidebarListModalRouteName = 'SidebarListModal';\nexport type RootParamList = {|\nLoggedOutModal: void,\n@@ -69,6 +71,7 @@ export type RootParamList = {|\nColorPickerModal: ColorPickerModalParams,\nComposeSubthreadModal: ComposeSubthreadModalParams,\nRelationshipUpdateModal: RelationshipUpdateModalParams,\n+ SidebarListModal: SidebarListModalParams,\n|};\nexport type TooltipModalParamList = {|\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Dummy SidebarListModal Summary: Boilerplate for the new modal and code that will navigate to it Test Plan: Flow, make sure the app still works, and make sure the modals get opened when the button is pressed Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D392
129,183
27.10.2020 13:21:17
-3,600
7f58395749001f632ab06dcff9618f7e6d1cc66f
Add functions to check for admins and replace in codebase Test Plan: Made sure the behaviour is still the same Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/thread-selectors.js", "new_path": "lib/selectors/thread-selectors.js", "diff": "@@ -22,7 +22,6 @@ import _compact from 'lodash/fp/compact';\nimport _filter from 'lodash/fp/filter';\nimport _sortBy from 'lodash/fp/sortBy';\nimport _memoize from 'lodash/memoize';\n-import _find from 'lodash/fp/find';\nimport _orderBy from 'lodash/fp/orderBy';\nconst _mapValuesWithKeys = _mapValues.convert({ cap: false });\nimport invariant from 'invariant';\n@@ -37,6 +36,8 @@ import {\nthreadInfoFromRawThreadInfo,\nthreadHasPermission,\nthreadInChatList,\n+ threadHasAdminRole,\n+ roleIsAdminRole,\n} from '../shared/thread-utils';\nimport { relativeMemberInfoSelectorForMembersOfThread } from './user-selectors';\nimport {\n@@ -287,7 +288,7 @@ const baseOtherUsersButNoOtherAdmins = (threadID: string) =>\nif (!threadInfo) {\nreturn false;\n}\n- if (!_find({ name: 'Admins' })(threadInfo.roles)) {\n+ if (!threadHasAdminRole(threadInfo)) {\nreturn false;\n}\nlet otherUsersExist = false;\n@@ -298,7 +299,7 @@ const baseOtherUsersButNoOtherAdmins = (threadID: string) =>\ncontinue;\n}\notherUsersExist = true;\n- if (threadInfo.roles[role].name === 'Admins') {\n+ if (roleIsAdminRole(threadInfo?.roles[role])) {\notherAdminsExist = true;\nbreak;\n}\n" }, { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -7,6 +7,7 @@ import {\ntype MemberInfo,\ntype ServerThreadInfo,\ntype RelativeMemberInfo,\n+ type RoleInfo,\nthreadTypes,\nthreadPermissions,\n} from '../types/thread-types';\n@@ -14,6 +15,7 @@ import type { UserInfo } from '../types/user-types';\nimport { type UpdateInfo, updateTypes } from '../types/update-types';\nimport tinycolor from 'tinycolor2';\n+import _find from 'lodash/fp/find';\nimport { pluralize } from '../utils/text-utils';\nimport {\n@@ -292,9 +294,24 @@ function usersInThreadInfo(threadInfo: RawThreadInfo | ThreadInfo): string[] {\nreturn [...userIDs];\n}\n-function memberIsAdmin(memberInfo: RelativeMemberInfo, threadInfo: ThreadInfo) {\n- const role = memberInfo.role && threadInfo.roles[memberInfo.role];\n- return role && !role.isDefault && role.name === 'Admins';\n+function memberIsAdmin(\n+ memberInfo: RelativeMemberInfo | MemberInfo,\n+ threadInfo: ThreadInfo | RawThreadInfo,\n+) {\n+ return memberInfo.role && roleIsAdminRole(threadInfo.roles[memberInfo.role]);\n+}\n+\n+function roleIsAdminRole(roleInfo: ?RoleInfo) {\n+ return roleInfo && !roleInfo.isDefault && roleInfo.name === 'Admins';\n+}\n+\n+function threadHasAdminRole(\n+ threadInfo: ?(RawThreadInfo | ThreadInfo | ServerThreadInfo),\n+) {\n+ if (!threadInfo) {\n+ return false;\n+ }\n+ return _find({ name: 'Admins' })(threadInfo.roles);\n}\nfunction identifyInvalidatedThreads(\n@@ -339,6 +356,8 @@ export {\nthreadTypeDescriptions,\nusersInThreadInfo,\nmemberIsAdmin,\n+ roleIsAdminRole,\n+ threadHasAdminRole,\nidentifyInvalidatedThreads,\nemptyItemText,\n};\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings-member-tooltip-modal.react.js", "new_path": "native/chat/settings/thread-settings-member-tooltip-modal.react.js", "diff": "@@ -17,7 +17,7 @@ import {\nchangeThreadMemberRolesActionTypes,\nchangeThreadMemberRoles,\n} from 'lib/actions/thread-actions';\n-import { memberIsAdmin } from 'lib/shared/thread-utils';\n+import { memberIsAdmin, roleIsAdminRole } from 'lib/shared/thread-utils';\nimport {\ncreateTooltip,\n@@ -74,7 +74,7 @@ function onToggleAdmin(\nif (isCurrentlyAdmin && role.isDefault) {\nnewRole = role.id;\nbreak;\n- } else if (!isCurrentlyAdmin && role.name === 'Admins') {\n+ } else if (!isCurrentlyAdmin && roleIsAdminRole(role)) {\nnewRole = role.id;\nbreak;\n}\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -17,14 +17,18 @@ import type { Viewer } from '../session/viewer';\nimport { messageTypes, defaultNumberPerThread } from 'lib/types/message-types';\nimport { userRelationshipStatus } from 'lib/types/relationship-types';\n-import _find from 'lodash/fp/find';\nimport invariant from 'invariant';\nimport { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\nimport { filteredThreadIDs } from 'lib/selectors/calendar-filter-selectors';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\n-import { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n+import {\n+ threadHasAdminRole,\n+ roleIsAdminRole,\n+ viewerIsMember,\n+ threadHasPermission,\n+} from 'lib/shared/thread-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport {\n@@ -231,7 +235,7 @@ async function leaveThread(\n}\nconst viewerID = viewer.userID;\n- if (_find({ name: 'Admins' })(threadInfo.roles)) {\n+ if (threadHasAdminRole(threadInfo)) {\nlet otherUsersExist = false;\nlet otherAdminsExist = false;\nfor (let member of threadInfo.members) {\n@@ -240,7 +244,7 @@ async function leaveThread(\ncontinue;\n}\notherUsersExist = true;\n- if (threadInfo.roles[role].name === 'Admins') {\n+ if (roleIsAdminRole(threadInfo.roles[role])) {\notherAdminsExist = true;\nbreak;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Add functions to check for admins and replace in codebase Test Plan: Made sure the behaviour is still the same Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D338
129,183
05.11.2020 15:03:22
-3,600
f4534979f04c98aabdd8a43f016c287c5e7c314c
[server] Don't allow to send messages in 1-1 chats with blocks Test Plan: Made sure users can't send messages with checks like in D291 Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -10,6 +10,7 @@ import {\ntype ThreadCurrentUserInfo,\ntype RoleInfo,\ntype ServerMemberInfo,\n+ type ThreadPermissionsInfo,\nthreadTypes,\nthreadPermissions,\n} from '../types/thread-types';\n@@ -292,15 +293,7 @@ function getCurrentUser(\n...rawThreadInfo.currentUser,\npermissions: {\n...rawThreadInfo.currentUser.permissions,\n- [threadPermissions.VOICED]: { value: false, source: null },\n- [threadPermissions.EDIT_ENTRIES]: { value: false, source: null },\n- [threadPermissions.EDIT_THREAD]: { value: false, source: null },\n- [threadPermissions.CREATE_SUBTHREADS]: { value: false, source: null },\n- [threadPermissions.CREATE_SIDEBARS]: { value: false, source: null },\n- [threadPermissions.JOIN_THREAD]: { value: false, source: null },\n- [threadPermissions.EDIT_PERMISSIONS]: { value: false, source: null },\n- [threadPermissions.ADD_MEMBERS]: { value: false, source: null },\n- [threadPermissions.REMOVE_MEMBERS]: { value: false, source: null },\n+ ...disabledPermissions,\n},\n};\n}\n@@ -406,6 +399,30 @@ function identifyInvalidatedThreads(\nreturn invalidated;\n}\n+const permissionsDisabledByBlockArray = [\n+ threadPermissions.VOICED,\n+ threadPermissions.EDIT_ENTRIES,\n+ threadPermissions.EDIT_THREAD,\n+ threadPermissions.CREATE_SUBTHREADS,\n+ threadPermissions.CREATE_SIDEBARS,\n+ threadPermissions.JOIN_THREAD,\n+ threadPermissions.EDIT_PERMISSIONS,\n+ threadPermissions.ADD_MEMBERS,\n+ threadPermissions.REMOVE_MEMBERS,\n+];\n+\n+const permissionsDisabledByBlock: Set<ThreadPermission> = new Set(\n+ permissionsDisabledByBlockArray,\n+);\n+\n+const disabledPermissions: ThreadPermissionsInfo = permissionsDisabledByBlockArray.reduce(\n+ (permissions: ThreadPermissionsInfo, permission: string) => ({\n+ ...permissions,\n+ [permission]: { value: false, source: null },\n+ }),\n+ {},\n+);\n+\n// Consider updating itemHeight in native/chat/chat-thread-list.react.js\n// if you change this\nconst emptyItemText =\n@@ -429,6 +446,7 @@ export {\nthreadIsGroupChat,\nthreadIsPending,\nthreadIsPersonalAndPending,\n+ threadIsWithBlockedUserOnly,\nrawThreadInfoFromServerThreadInfo,\nrobotextName,\nthreadInfoFromRawThreadInfo,\n@@ -440,5 +458,6 @@ export {\nroleIsAdminRole,\nthreadHasAdminRole,\nidentifyInvalidatedThreads,\n+ permissionsDisabledByBlock,\nemptyItemText,\n};\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/entry-fetchers.js", "new_path": "server/src/fetchers/entry-fetchers.js", "diff": "@@ -33,6 +33,7 @@ import {\nmergeOrConditions,\n} from '../database/database';\nimport { creationString } from '../utils/idempotent';\n+import { checkIfThreadIsBlocked } from '../fetchers/thread-permission-fetchers';\nasync function fetchEntryInfo(\nviewer: Viewer,\n@@ -163,6 +164,15 @@ async function checkThreadPermissionForEntry(\nif (row.id === null) {\nreturn false;\n}\n+ const threadIsBlocked = await checkIfThreadIsBlocked(\n+ viewer,\n+ row.id.toString(),\n+ permission,\n+ );\n+ if (threadIsBlocked) {\n+ return false;\n+ }\n+\nreturn permissionLookup(row.permissions, permission);\n}\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-permission-fetchers.js", "new_path": "server/src/fetchers/thread-permission-fetchers.js", "diff": "@@ -4,11 +4,17 @@ import type {\nThreadPermission,\nThreadPermissionsBlob,\n} from 'lib/types/thread-types';\n-import { permissionLookup } from 'lib/permissions/thread-permissions';\n-\nimport type { Viewer } from '../session/viewer';\n+import { permissionLookup } from 'lib/permissions/thread-permissions';\n+import {\n+ threadIsWithBlockedUserOnly,\n+ permissionsDisabledByBlock,\n+} from 'lib/shared/thread-utils';\n+\nimport { dbQuery, SQL } from '../database/database';\n+import { fetchKnownUserInfos } from '../fetchers/user-fetchers';\n+import { fetchThreadInfos } from '../fetchers/thread-fetchers';\nasync function fetchThreadPermissionsBlob(\nviewer: Viewer,\n@@ -74,15 +80,76 @@ async function checkThreads(\nFROM memberships\nWHERE thread IN (${threadIDs}) AND user = ${viewer.userID}\n`;\n- const [result] = await dbQuery(query);\n+\n+ const permissionsToCheck = [];\n+ for (const check of checks) {\n+ if (check.check === 'permission') {\n+ permissionsToCheck.push(check.permission);\n+ }\n+ }\n+\n+ const [[result], disabledThreadIDs] = await Promise.all([\n+ dbQuery(query),\n+ checkThreadDisabled(viewer, permissionsToCheck, threadIDs),\n+ ]);\nreturn new Set(\nresult\n- .filter((row) => isThreadValid(row.permissions, row.role, checks))\n+ .filter(\n+ (row) =>\n+ isThreadValid(row.permissions, row.role, checks) &&\n+ !disabledThreadIDs.has(row.thread.toString()),\n+ )\n.map((row) => row.thread.toString()),\n);\n}\n+async function checkThreadDisabled(\n+ viewer: Viewer,\n+ permissionsToCheck: $ReadOnlyArray<ThreadPermission>,\n+ threadIDs: $ReadOnlyArray<string>,\n+) {\n+ const threadIDsWithDisabledPermissions = new Set();\n+\n+ const permissionMightBeDisabled = permissionsToCheck.some((permission) =>\n+ permissionsDisabledByBlock.has(permission),\n+ );\n+ if (!permissionMightBeDisabled) {\n+ return threadIDsWithDisabledPermissions;\n+ }\n+\n+ const [{ threadInfos }, userInfos] = await Promise.all([\n+ fetchThreadInfos(viewer, SQL`t.id IN (${[...threadIDs]})`),\n+ fetchKnownUserInfos(viewer),\n+ ]);\n+\n+ for (const threadID in threadInfos) {\n+ const blockedThread = threadIsWithBlockedUserOnly(\n+ threadInfos[threadID],\n+ viewer.id,\n+ userInfos,\n+ );\n+ if (blockedThread) {\n+ threadIDsWithDisabledPermissions.add(threadID);\n+ }\n+ }\n+ return threadIDsWithDisabledPermissions;\n+}\n+\n+async function checkIfThreadIsBlocked(\n+ viewer: Viewer,\n+ threadID: string,\n+ permission: ThreadPermission,\n+) {\n+ const disabledThreadIDs = await checkThreadDisabled(\n+ viewer,\n+ [permission],\n+ [threadID],\n+ );\n+\n+ return disabledThreadIDs.has(threadID);\n+}\n+\nasync function checkThread(\nviewer: Viewer,\nthreadID: string,\n@@ -98,4 +165,5 @@ export {\nviewerIsMember,\ncheckThreads,\ncheckThread,\n+ checkIfThreadIsBlocked,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Don't allow to send messages in 1-1 chats with blocks Test Plan: Made sure users can't send messages with checks like in D291 Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D308
129,183
10.11.2020 14:51:09
-3,600
c7fce2eb80f7fb42cd9d0171b7e23dc0aa510d10
Handle create_sidebars and create_subthreads permission check Test Plan: Checked if subthreads can be created only when permissions are true Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -12,10 +12,7 @@ import type { Viewer } from '../session/viewer';\nimport invariant from 'invariant';\n-import {\n- generateRandomColor,\n- threadHasPermission,\n-} from 'lib/shared/thread-utils';\n+import { generateRandomColor } from 'lib/shared/thread-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\nimport { hasMinCodeVersion } from 'lib/shared/version-utils';\n@@ -25,6 +22,7 @@ import createIDs from './id-creator';\nimport { createInitialRolesForNewThread } from './role-creator';\nimport { fetchKnownUserInfos } from '../fetchers/user-fetchers';\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\n+import { checkThreadPermission } from '../fetchers/thread-permission-fetchers';\nimport {\nchangeRole,\nrecalculateAllPermissions,\n@@ -67,6 +65,13 @@ async function createThread(\nviewer,\nSQL`t.id = ${parentThreadID}`,\n);\n+ checkPromises.hasParentPermission = checkThreadPermission(\n+ viewer,\n+ parentThreadID,\n+ threadType === threadTypes.SIDEBAR\n+ ? threadPermissions.CREATE_SIDEBARS\n+ : threadPermissions.CREATE_SUBTHREADS,\n+ );\n}\nif (initialMemberIDs) {\ncheckPromises.fetchInitialMembers = fetchKnownUserInfos(\n@@ -74,19 +79,17 @@ async function createThread(\ninitialMemberIDs,\n);\n}\n- const { parentThreadFetch, fetchInitialMembers } = await promiseAll(\n- checkPromises,\n- );\n+ const {\n+ parentThreadFetch,\n+ hasParentPermission,\n+ fetchInitialMembers,\n+ } = await promiseAll(checkPromises);\nlet parentThreadMembers;\nif (parentThreadID) {\ninvariant(parentThreadFetch, 'parentThreadFetch should be set');\nconst parentThreadInfo = parentThreadFetch.threadInfos[parentThreadID];\n- const permission =\n- threadType === threadTypes.SIDEBAR\n- ? threadPermissions.CREATE_SIDEBARS\n- : threadPermissions.CREATE_SUBTHREADS;\n- if (!threadHasPermission(parentThreadInfo, permission)) {\n+ if (!hasParentPermission) {\nthrow new ServerError('invalid_credentials');\n}\nparentThreadMembers = parentThreadInfo.members.map(\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -28,7 +28,6 @@ import {\nthreadHasAdminRole,\nroleIsAdminRole,\nviewerIsMember,\n- threadHasPermission,\n} from 'lib/shared/thread-utils';\nimport { dbQuery, SQL } from '../database/database';\n@@ -417,24 +416,34 @@ async function updateThread(\nlet parentThreadMembers;\nif (nextParentThreadID) {\n- const parentFetchResult = await fetchThreadInfos(\n+ const promises = [\n+ fetchThreadInfos(viewer, SQL`t.id = ${nextParentThreadID}`),\n+ ];\n+\n+ const threadChanged =\n+ nextParentThreadID !== oldParentThreadID ||\n+ nextThreadType !== oldThreadType;\n+ if (threadChanged) {\n+ promises.push(\n+ checkThreadPermission(\nviewer,\n- SQL`t.id = ${nextParentThreadID}`,\n+ nextParentThreadID,\n+ nextThreadType === threadTypes.SIDEBAR\n+ ? threadPermissions.CREATE_SIDEBARS\n+ : threadPermissions.CREATE_SUBTHREADS,\n+ ),\n+ );\n+ }\n+\n+ const [parentFetchResult, hasParentPermission] = await Promise.all(\n+ promises,\n);\n+\nconst parentThreadInfo = parentFetchResult.threadInfos[nextParentThreadID];\nif (!parentThreadInfo) {\nthrow new ServerError('invalid_parameters');\n}\n- if (\n- (nextParentThreadID !== oldParentThreadID ||\n- nextThreadType !== oldThreadType) &&\n- !threadHasPermission(\n- parentThreadInfo,\n- nextThreadType === threadTypes.SIDEBAR\n- ? threadPermissions.CREATE_SIDEBARS\n- : threadPermissions.CREATE_SUBTHREADS,\n- )\n- ) {\n+ if (threadChanged && !hasParentPermission) {\nthrow new ServerError('invalid_parameters');\n}\nparentThreadMembers = parentThreadInfo.members.map(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Handle create_sidebars and create_subthreads permission check Test Plan: Checked if subthreads can be created only when permissions are true Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D387
129,183
10.11.2020 14:52:04
-3,600
3dc0f6c0b7524b2d8828738fc8cc5cf61cdb3d28
Add comment to warn about fetchThreadPermissionsBlob Test Plan: Nothing to test, just comment added Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-permission-fetchers.js", "new_path": "server/src/fetchers/thread-permission-fetchers.js", "diff": "@@ -16,6 +16,11 @@ import { dbQuery, SQL } from '../database/database';\nimport { fetchKnownUserInfos } from '../fetchers/user-fetchers';\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\n+// Note that it's risky to verify permissions by inspecting the blob directly.\n+// There are other factors that can override permissions in the permissions\n+// blob, such as when one user blocks another. It's always better to go through\n+// checkThreads and friends, or by looking at the ThreadInfo through\n+// threadHasPermission.\nasync function fetchThreadPermissionsBlob(\nviewer: Viewer,\nthreadID: string,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Add comment to warn about fetchThreadPermissionsBlob Test Plan: Nothing to test, just comment added Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D388
129,183
10.11.2020 15:11:16
-3,600
6da52fa52b7a05ffec0fc55101585a78a05f5360
Don't allow threadHasPermission check on RawThreadInfo when checking permission that might be disabled Test Plan: Check if behavior is the same for ThreadInfo, error only on disabledPermission and RawThreadInfo Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -20,6 +20,7 @@ import { userRelationshipStatus } from '../types/relationship-types';\nimport tinycolor from 'tinycolor2';\nimport _find from 'lodash/fp/find';\n+import invariant from 'invariant';\nimport { pluralize } from '../utils/text-utils';\nimport {\n@@ -45,6 +46,11 @@ function threadHasPermission(\nthreadInfo: ?(ThreadInfo | RawThreadInfo),\npermission: ThreadPermission,\n): boolean {\n+ invariant(\n+ !permissionsDisabledByBlock.has(permission) || threadInfo?.uiName,\n+ `${permission} can be disabled by a block, but threadHasPermission can't ` +\n+ 'check for a block on RawThreadInfo. Please pass in ThreadInfo instead!',\n+ );\nif (!threadInfo || !threadInfo.currentUser.permissions[permission]) {\nreturn false;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Don't allow threadHasPermission check on RawThreadInfo when checking permission that might be disabled Test Plan: Check if behavior is the same for ThreadInfo, error only on disabledPermission and RawThreadInfo Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D389
129,183
09.11.2020 12:27:21
-3,600
300d299040284045b27c6730179ec7a61ac39705
[web] Don't show buttons for entries when no edit_entries permission Test Plan: Made sure entries from blocked threads are disabled Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/calendar/entry.react.js", "new_path": "web/calendar/entry.react.js", "diff": "@@ -12,7 +12,7 @@ import {\ntype CalendarQuery,\n} from 'lib/types/entry-types';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n-import { threadInfoPropType } from 'lib/types/thread-types';\n+import { threadInfoPropType, threadPermissions } from 'lib/types/thread-types';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { AppState } from '../redux/redux-setup';\nimport type {\n@@ -26,7 +26,7 @@ import invariant from 'invariant';\nimport PropTypes from 'prop-types';\nimport { entryKey } from 'lib/shared/entry-utils';\n-import { colorIsDark } from 'lib/shared/thread-utils';\n+import { colorIsDark, threadHasPermission } from 'lib/shared/thread-utils';\nimport { connect } from 'lib/utils/redux-utils';\nimport {\ncreateEntryActionTypes,\n@@ -210,6 +210,10 @@ class Entry extends React.PureComponent<Props, State> {\n});\nconst style = { backgroundColor: '#' + this.props.threadInfo.color };\nconst loadingIndicatorColor = darkColor ? 'white' : 'black';\n+ const canEditEntry = threadHasPermission(\n+ this.props.threadInfo,\n+ threadPermissions.EDIT_ENTRIES,\n+ );\nreturn (\n<div\nclassName={entryClasses}\n@@ -226,6 +230,7 @@ class Entry extends React.PureComponent<Props, State> {\nonBlur={this.onBlur}\ntabIndex={this.props.tabIndex}\nref={this.textareaRef}\n+ disabled={!canEditEntry}\n/>\n<LoadingIndicator\nstatus={this.state.loadingStatus}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Don't show buttons for entries when no edit_entries permission Test Plan: Made sure entries from blocked threads are disabled Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D380
129,183
10.11.2020 12:10:04
-3,600
797200cfe73811e6e8e4d58ac25173e2078a6246
[native] Don't show buttons for entries when there is no edit_entries permission Test Plan: Checked that in blocked threads entries are disabled Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/calendar/entry.react.js", "new_path": "native/calendar/entry.react.js", "diff": "@@ -10,7 +10,7 @@ import type {\nDeleteEntryResponse,\nCalendarQuery,\n} from 'lib/types/entry-types';\n-import type { ThreadInfo } from 'lib/types/thread-types';\n+import { type ThreadInfo, threadPermissions } from 'lib/types/thread-types';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { LayoutEvent } from '../types/react-native';\nimport type { TabNavigationProp } from '../navigation/app-navigator.react';\n@@ -35,7 +35,7 @@ import Icon from 'react-native-vector-icons/FontAwesome';\nimport tinycolor from 'tinycolor2';\nimport { useDispatch } from 'react-redux';\n-import { colorIsDark } from 'lib/shared/thread-utils';\n+import { colorIsDark, threadHasPermission } from 'lib/shared/thread-utils';\nimport {\ncreateEntryActionTypes,\ncreateEntry,\n@@ -387,10 +387,15 @@ class InternalEntry extends React.Component<Props, State> {\nconst heightStyle = { height: this.state.height };\nconst entryStyle = { backgroundColor: threadColor };\nconst opacity = editing ? 1.0 : 0.6;\n+ const canEditEntry = threadHasPermission(\n+ this.props.threadInfo,\n+ threadPermissions.EDIT_ENTRIES,\n+ );\nreturn (\n<TouchableWithoutFeedback onPress={this.props.onPressWhitespace}>\n<View style={this.props.styles.container}>\n<Button\n+ disabled={!canEditEntry}\nonPress={this.setActive}\nstyle={[this.props.styles.entry, entryStyle]}\nandroidFormat=\"opacity\"\n@@ -450,7 +455,7 @@ class InternalEntry extends React.Component<Props, State> {\n}\n};\n- setActive = () => this.props.makeActive(entryKey(this.props.entryInfo), true);\n+ setActive = () => this.makeActive(true);\ncompleteEdit = () => {\n// This gets called from CalendarInputBar (save button above keyboard),\n@@ -473,7 +478,7 @@ class InternalEntry extends React.Component<Props, State> {\nthis.save();\n}\nthis.guardedSetState({ editing: false });\n- this.props.makeActive(entryKey(this.props.entryInfo), false);\n+ this.makeActive(false);\nthis.props.onConcludeEditMode(this.props.entryInfo);\n};\n@@ -491,6 +496,14 @@ class InternalEntry extends React.Component<Props, State> {\nthis.guardedSetState({ text: newText });\n};\n+ makeActive(active: boolean) {\n+ const { threadInfo } = this.props;\n+ if (!threadHasPermission(threadInfo, threadPermissions.EDIT_ENTRIES)) {\n+ return;\n+ }\n+ this.props.makeActive(entryKey(this.props.entryInfo), active);\n+ }\n+\ndispatchSave(serverID: ?string, newText: string) {\nif (this.currentlySaving === newText) {\nreturn;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Don't show buttons for entries when there is no edit_entries permission Test Plan: Checked that in blocked threads entries are disabled Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D379
129,183
09.11.2020 15:28:31
-3,600
e52c3d9bb756f959cf290c03f5e4bba5379cdb26
Add option to unblock user when relationshipStatus = both_blocked Test Plan: Make sure button is visible and the relationship updates correctly Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/more/relationship-list-item.react.js", "new_path": "native/more/relationship-list-item.react.js", "diff": "@@ -83,6 +83,7 @@ class RelationshipListItem extends React.PureComponent<Props> {\n);\n} else if (\nuserInfo.relationshipStatus === userRelationshipStatus.FRIEND ||\n+ userInfo.relationshipStatus === userRelationshipStatus.BOTH_BLOCKED ||\nuserInfo.relationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER\n) {\neditButton = (\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Add option to unblock user when relationshipStatus = both_blocked Test Plan: Make sure button is visible and the relationship updates correctly Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D381
129,187
13.11.2020 19:15:47
18,000
daa585912c981902ad847c655064b7607c14a188
[lib] Move threadSearchText to thread-utils Summary: (About to use it in `SidebarListModal`) Test Plan: Flow (just moving a function) Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/nav-selectors.js", "new_path": "lib/selectors/nav-selectors.js", "diff": "@@ -12,6 +12,7 @@ import { createSelector } from 'reselect';\nimport { getConfig } from '../utils/config';\nimport SearchIndex from '../shared/search-index';\n+import { threadSearchText } from '../shared/thread-utils';\nfunction timeUntilCalendarRangeExpiration(\nlastUserInteractionCalendar: number,\n@@ -65,26 +66,6 @@ const currentCalendarQuery: (\n},\n);\n-const threadSearchText = (\n- threadInfo: RawThreadInfo,\n- userInfos: { [id: string]: UserInfo },\n-): string => {\n- const searchTextArray = [];\n- if (threadInfo.name) {\n- searchTextArray.push(threadInfo.name);\n- }\n- if (threadInfo.description) {\n- searchTextArray.push(threadInfo.description);\n- }\n- for (let member of threadInfo.members) {\n- const userInfo = userInfos[member.id];\n- if (userInfo && userInfo.username) {\n- searchTextArray.push(userInfo.username);\n- }\n- }\n- return searchTextArray.join(' ');\n-};\n-\nconst threadSearchIndex: (\nstate: BaseAppState<*>,\n) => SearchIndex = createSelector(\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Move threadSearchText to thread-utils Summary: (About to use it in `SidebarListModal`) Test Plan: Flow (just moving a function) Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D399
129,187
13.11.2020 19:16:28
18,000
75fbc146441d0d817fda21b86659ebfd82b8748a
[native] FlatList and search logic for SidebarListModal Summary: This diff handles deciding which `SidebarInfo`s to display in the `SidebarListModal`. Test Plan: Makes sure it loads correctly. Most of the testing was done in concert with the next diff Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/sidebar-list-modal.react.js", "new_path": "native/chat/sidebar-list-modal.react.js", "diff": "// @flow\n-import type { ThreadInfo } from 'lib/types/thread-types';\n+import type { ThreadInfo, SidebarInfo } from 'lib/types/thread-types';\n+import type { RootNavigationProp } from '../navigation/root-navigator.react';\n+import type { NavigationRoute } from '../navigation/route-names';\n+\n+import * as React from 'react';\n+import { TextInput, FlatList, StyleSheet } from 'react-native';\n+\n+import { sidebarInfoSelector } from 'lib/selectors/thread-selectors';\n+import SearchIndex from 'lib/shared/search-index';\n+import { threadSearchText } from 'lib/shared/thread-utils';\n+import sleep from 'lib/utils/sleep';\n+\n+import { useSelector } from '../redux/redux-utils';\n+import Modal from '../components/modal.react';\n+import Search from '../components/search.react';\n+import { useIndicatorStyle } from '../themes/colors';\nexport type SidebarListModalParams = {|\n+threadInfo: ThreadInfo,\n|};\n-function SidebarListModal() {\n+function keyExtractor(sidebarInfo: SidebarInfo) {\n+ return sidebarInfo.threadInfo.id;\n+}\n+function getItemLayout(data: ?$ReadOnlyArray<SidebarInfo>, index: number) {\n+ return { length: 24, offset: 24 * index, index };\n+}\n+\n+type Props = {|\n+ +navigation: RootNavigationProp<'SidebarListModal'>,\n+ +route: NavigationRoute<'SidebarListModal'>,\n+|};\n+function SidebarListModal(props: Props) {\n+ const threadID = props.route.params.threadInfo.id;\n+ const sidebarInfos = useSelector(\n+ (state) => sidebarInfoSelector(state)[threadID] ?? [],\n+ );\n+\n+ const [searchState, setSearchState] = React.useState({\n+ text: '',\n+ results: new Set<string>(),\n+ });\n+\n+ const listData = React.useMemo(() => {\n+ if (!searchState.text) {\n+ return sidebarInfos;\n+ }\n+ return sidebarInfos.filter(({ threadInfo }) =>\n+ searchState.results.has(threadInfo.id),\n+ );\n+ }, [sidebarInfos, searchState]);\n+\n+ const userInfos = useSelector((state) => state.userStore.userInfos);\n+ const searchIndex = React.useMemo(() => {\n+ const index = new SearchIndex();\n+ for (const sidebarInfo of sidebarInfos) {\n+ const { threadInfo } = sidebarInfo;\n+ index.addEntry(threadInfo.id, threadSearchText(threadInfo, userInfos));\n+ }\n+ return index;\n+ }, [sidebarInfos, userInfos]);\n+ React.useEffect(() => {\n+ setSearchState((curState) => ({\n+ ...curState,\n+ results: new Set(searchIndex.getSearchResults(curState.text)),\n+ }));\n+ }, [searchIndex]);\n+\n+ const onChangeSearchText = React.useCallback(\n+ (searchText: string) =>\n+ setSearchState({\n+ text: searchText,\n+ results: new Set(searchIndex.getSearchResults(searchText)),\n+ }),\n+ [searchIndex],\n+ );\n+\n+ const searchTextInputRef = React.useRef();\n+ const setSearchTextInputRef = React.useCallback(\n+ async (textInput: ?React.ElementRef<typeof TextInput>) => {\n+ searchTextInputRef.current = textInput;\n+ if (!textInput) {\n+ return;\n+ }\n+ await sleep(50);\n+ if (searchTextInputRef.current) {\n+ searchTextInputRef.current.focus();\n+ }\n+ },\n+ [],\n+ );\n+\n+ const renderItem = React.useCallback(() => {\nreturn null;\n+ }, []);\n+\n+ const { navigation } = props;\n+ const indicatorStyle = useIndicatorStyle();\n+ return (\n+ <Modal navigation={navigation}>\n+ <Search\n+ searchText={searchState.text}\n+ onChangeText={onChangeSearchText}\n+ containerStyle={styles.search}\n+ placeholder=\"Search sidebars\"\n+ ref={setSearchTextInputRef}\n+ />\n+ <FlatList\n+ data={listData}\n+ renderItem={renderItem}\n+ keyExtractor={keyExtractor}\n+ getItemLayout={getItemLayout}\n+ keyboardShouldPersistTaps=\"handled\"\n+ initialNumToRender={20}\n+ indicatorStyle={indicatorStyle}\n+ />\n+ </Modal>\n+ );\n}\n+const styles = StyleSheet.create({\n+ search: {\n+ marginBottom: 8,\n+ },\n+});\n+\nexport default SidebarListModal;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] FlatList and search logic for SidebarListModal Summary: This diff handles deciding which `SidebarInfo`s to display in the `SidebarListModal`. Test Plan: Makes sure it loads correctly. Most of the testing was done in concert with the next diff Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D400
129,187
14.11.2020 23:57:59
18,000
15dbf67437d48d2d865100c6f33d73d9fe9cb9ae
[native] Update React Navigation libs Summary: I checked all of the `CHANGELOG`s and version notes, and none of these should have breaking changes. Test Plan: Compile & run app, play around a bit Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat.react.js", "new_path": "native/chat/chat.react.js", "diff": "@@ -127,6 +127,7 @@ function ChatNavigator({\nstate={state}\ndescriptors={descriptors}\nnavigation={navigation}\n+ detachInactiveScreens={Platform.OS !== 'ios'}\n/>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js", "new_path": "native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js", "diff": "@@ -1299,6 +1299,7 @@ declare module '@react-navigation/bottom-tabs' {\n+mode?: 'card' | 'modal',\n+headerMode?: 'float' | 'screen' | 'none',\n+keyboardHandlingEnabled?: boolean,\n+ +detachInactiveScreens?: boolean,\n|};\ndeclare export type ExtraStackNavigatorProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js", "new_path": "native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js", "diff": "@@ -1299,6 +1299,7 @@ declare module '@react-navigation/devtools' {\n+mode?: 'card' | 'modal',\n+headerMode?: 'float' | 'screen' | 'none',\n+keyboardHandlingEnabled?: boolean,\n+ +detachInactiveScreens?: boolean,\n|};\ndeclare export type ExtraStackNavigatorProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js", "new_path": "native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js", "diff": "@@ -1299,6 +1299,7 @@ declare module '@react-navigation/material-top-tabs' {\n+mode?: 'card' | 'modal',\n+headerMode?: 'float' | 'screen' | 'none',\n+keyboardHandlingEnabled?: boolean,\n+ +detachInactiveScreens?: boolean,\n|};\ndeclare export type ExtraStackNavigatorProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/flow-typed/npm/@react-navigation/native_v5.x.x.js", "new_path": "native/flow-typed/npm/@react-navigation/native_v5.x.x.js", "diff": "@@ -1299,6 +1299,7 @@ declare module '@react-navigation/native' {\n+mode?: 'card' | 'modal',\n+headerMode?: 'float' | 'screen' | 'none',\n+keyboardHandlingEnabled?: boolean,\n+ +detachInactiveScreens?: boolean,\n|};\ndeclare export type ExtraStackNavigatorProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/flow-typed/npm/@react-navigation/stack_v5.x.x.js", "new_path": "native/flow-typed/npm/@react-navigation/stack_v5.x.x.js", "diff": "@@ -1299,6 +1299,7 @@ declare module '@react-navigation/stack' {\n+mode?: 'card' | 'modal',\n+headerMode?: 'float' | 'screen' | 'none',\n+keyboardHandlingEnabled?: boolean,\n+ +detachInactiveScreens?: boolean,\n|};\ndeclare export type ExtraStackNavigatorProps = {|\n" }, { "change_type": "MODIFY", "old_path": "native/ios/Podfile.lock", "new_path": "native/ios/Podfile.lock", "diff": "@@ -296,8 +296,8 @@ PODS:\n- React\n- react-native-orientation-locker (1.1.6):\n- React\n- - react-native-safe-area-context (3.1.7):\n- - React\n+ - react-native-safe-area-context (3.1.9):\n+ - React-Core\n- react-native-video/Video (5.0.2):\n- React\n- react-native-video/VideoCaching (5.0.2):\n@@ -393,8 +393,8 @@ PODS:\n- React\n- RNReanimated (1.13.0):\n- React\n- - RNScreens (2.9.0):\n- - React\n+ - RNScreens (2.14.0):\n+ - React-Core\n- RNVectorIcons (6.6.0):\n- React\n- SDWebImage (5.9.1):\n@@ -733,7 +733,7 @@ SPEC CHECKSUMS:\nreact-native-netinfo: 6bb847e64f45a2d69c6173741111cfd95c669301\nreact-native-notifications: bb042206ac7eab9323d528c780b3d6fe796c1f5e\nreact-native-orientation-locker: 23918c400376a7043e752c639c122fcf6bce8f1c\n- react-native-safe-area-context: 955ecfce672683b495d9294d2f154a9ad1d9796b\n+ react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94\nreact-native-video: d01ed7ff1e38fa7dcc6c15c94cf505e661b7bfd0\nReact-RCTActionSheet: 53ea72699698b0b47a6421cb1c8b4ab215a774aa\nReact-RCTAnimation: 1befece0b5183c22ae01b966f5583f42e69a83c2\n@@ -758,7 +758,7 @@ SPEC CHECKSUMS:\nRNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38\nRNKeychain: 45dbd50d1ac4bd42c3740f76ffb135abf05746d0\nRNReanimated: 89f5e0a04d1dd52fbf27e7e7030d8f80a646a3fc\n- RNScreens: c526239bbe0e957b988dacc8d75ac94ec9cb19da\n+ RNScreens: 2e278a90eb15092ed261d4f2271e3fc9b60d08d4\nRNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4\nSDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5\nSDWebImageWebPCoder: 947093edd1349d820c40afbd9f42acb6cdecd987\n" }, { "change_type": "MODIFY", "old_path": "native/package.json", "new_path": "native/package.json", "diff": "\"@react-native-community/clipboard\": \"^1.2.3\",\n\"@react-native-community/masked-view\": \"^0.1.10\",\n\"@react-native-community/netinfo\": \"^4.4.0\",\n- \"@react-navigation/bottom-tabs\": \"^5.6.1\",\n- \"@react-navigation/devtools\": \"^5.1.1\",\n- \"@react-navigation/material-top-tabs\": \"^5.2.12\",\n- \"@react-navigation/native\": \"^5.6.1\",\n- \"@react-navigation/stack\": \"^5.6.2\",\n+ \"@react-navigation/bottom-tabs\": \"^5.11.1\",\n+ \"@react-navigation/devtools\": \"^5.1.17\",\n+ \"@react-navigation/material-top-tabs\": \"^5.3.9\",\n+ \"@react-navigation/native\": \"^5.8.9\",\n+ \"@react-navigation/stack\": \"^5.12.6\",\n\"base-64\": \"^0.1.0\",\n\"expo-image-manipulator\": \"^8.2.1\",\n\"expo-media-library\": \"^8.3.0\",\n\"react-native-orientation-locker\": \"^1.1.6\",\n\"react-native-progress\": \"^4.0.3\",\n\"react-native-reanimated\": \"^1.13.0\",\n- \"react-native-safe-area-context\": \"^3.1.7\",\n+ \"react-native-safe-area-context\": \"^3.1.9\",\n\"react-native-safe-area-view\": \"^2.0.0\",\n- \"react-native-screens\": \"^2.9.0\",\n- \"react-native-tab-view\": \"^2.14.4\",\n+ \"react-native-screens\": \"^2.14.0\",\n+ \"react-native-tab-view\": \"^2.15.2\",\n\"react-native-unimodules\": \"^0.9.0\",\n\"react-native-vector-icons\": \"^6.6.0\",\n\"react-native-video\": \"^5.0.2\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "resolved \"https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-4.4.0.tgz#a18eb9ba082b6aca6add004b4a918250ad7d13bc\"\nintegrity sha512-qqNWMOsrDjj/daqV21ID2T8mNUjZD4pdx3PuWyE65gzKh2w+oMnzKb+J0NbLyZPn3wwLwU1+Cpf58A0ff5szjQ==\n-\"@react-navigation/bottom-tabs@^5.6.1\":\n- version \"5.6.1\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/bottom-tabs/-/bottom-tabs-5.6.1.tgz#f4aa23913a0c26ec3dd4dc268cd83e3d0e5f4dc4\"\n- integrity sha512-aAqA4lCaa1x3cEWwEyUJ5hBPpVuv/TR0Q0Y/hkBgI2+h27Xdv9B/ZemMIjMWTNDZTjbYXTsJ41AJbVQnPSVTrg==\n+\"@react-navigation/bottom-tabs@^5.11.1\":\n+ version \"5.11.1\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/bottom-tabs/-/bottom-tabs-5.11.1.tgz#58c4f784d3262f7fb6f3075b41f64e9617054087\"\n+ integrity sha512-fkkFzEIOZzV98sbq2kee/cXNIO3L/2x4cDGP0oIqhXDxser78J0jg08pZqyF6IIq9gPHo5T8vGffvhNBaZoCGw==\ndependencies:\n- color \"^3.1.2\"\n- react-native-iphone-x-helper \"^1.2.1\"\n+ color \"^3.1.3\"\n+ react-native-iphone-x-helper \"^1.3.0\"\n-\"@react-navigation/core@^5.11.1\":\n- version \"5.11.1\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/core/-/core-5.11.1.tgz#c4890910ba3d6332ee6873f0adb3d3d13cf4fa4c\"\n- integrity sha512-zJ/w84msKBhgRR35/tHdY1facxdnN/WP9Ebutnjp/J9ENuv7fHXhYlxX+oIRrMn+/MnbG79RVnYcO/r4lO8OTQ==\n+\"@react-navigation/core@^5.14.3\":\n+ version \"5.14.3\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/core/-/core-5.14.3.tgz#6bbbfe1fb90aa64068fdb69bbb6c55120b7b24f1\"\n+ integrity sha512-l4zCfIfPC4DYuDcluiisaWKg7GO5yAjBrIL0pzEw8bIBj+R6vnZnyG9AWgnwo5fl241DX+1sfgzGEUQgpIJNew==\ndependencies:\n- \"@react-navigation/routers\" \"^5.4.8\"\n+ \"@react-navigation/routers\" \"^5.6.2\"\nescape-string-regexp \"^4.0.0\"\n- nanoid \"^3.1.9\"\n- query-string \"^6.13.1\"\n+ nanoid \"^3.1.15\"\n+ query-string \"^6.13.6\"\nreact-is \"^16.13.0\"\n- use-subscription \"^1.4.0\"\n-\"@react-navigation/devtools@^5.1.1\":\n- version \"5.1.1\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/devtools/-/devtools-5.1.1.tgz#e4fbbf919c9808cefb243c85187fddfd29a2eae3\"\n- integrity sha512-Z/hjKzJGAtrY7fATYEPH4EGuvdG+Ywh1fl8uYgFJGTfv3leDF+fJ4+vRW0k0cp+0LzTsCJQk6NNuUiGenZdp0w==\n+\"@react-navigation/devtools@^5.1.17\":\n+ version \"5.1.17\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/devtools/-/devtools-5.1.17.tgz#1be6bc81a8588bceb36e83648abe10dd724b6b4d\"\n+ integrity sha512-c/lvyagwIDORcFWDjqO9TY7ESRP58kjApf+v7qvh5ReXBbm/gXD5KdzlFyeMCXfkxW9bfH5HXOHL9AkiVzt5oA==\ndependencies:\n- \"@react-navigation/core\" \"^5.11.1\"\n- deep-equal \"^2.0.3\"\n+ \"@react-navigation/core\" \"^5.14.3\"\n+ deep-equal \"^2.0.4\"\n-\"@react-navigation/material-top-tabs@^5.2.12\":\n- version \"5.2.12\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/material-top-tabs/-/material-top-tabs-5.2.12.tgz#a9d1bc6b0446cb37cc24774c6db409ded38beb84\"\n- integrity sha512-q1Rb/yo94+2TAQO29XZVJyWB5xhY2WKEVtXFjbtHGHl3q5ijerBXHkIt7akdkE00z5Jn9Ir5JJAmeyx6uWtVmg==\n+\"@react-navigation/material-top-tabs@^5.3.9\":\n+ version \"5.3.9\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/material-top-tabs/-/material-top-tabs-5.3.9.tgz#8a43c3213313abdc896bf5d59eb447ec67a66593\"\n+ integrity sha512-y7Ny5Emjuo5NsmiXX5mkAn1j160dzYocV+r8H/tiQUfR9cTLRu22jym7eLGpeKM0yzpeT2o2D+kRclom4oxMjg==\ndependencies:\n- color \"^3.1.2\"\n+ color \"^3.1.3\"\n-\"@react-navigation/native@^5.6.1\":\n- version \"5.6.1\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/native/-/native-5.6.1.tgz#a603b921f39fe3fcfcc27232d71b24e80effc1f2\"\n- integrity sha512-jnSNEnuRzqLvG+7QcMthfB8eCZIzAE0Wku7HDgzfjFS2iA7Oa9ugeX/1qdP9heT2Mp0t9BDQ4XX4boJma9Z/xg==\n+\"@react-navigation/native@^5.8.9\":\n+ version \"5.8.9\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/native/-/native-5.8.9.tgz#67ee2afef6af6ef40c425e02264bd25d1530b361\"\n+ integrity sha512-d1oihLxp9UDVsZyvHNcwJfj+LKsEo0m8vEBBV6jhLJAXs1d2DEBzBXGeP907uG+877TK7luh2h79Or4w7/+p+g==\ndependencies:\n- \"@react-navigation/core\" \"^5.11.1\"\n- nanoid \"^3.1.9\"\n+ \"@react-navigation/core\" \"^5.14.3\"\n+ escape-string-regexp \"^4.0.0\"\n+ nanoid \"^3.1.15\"\n-\"@react-navigation/routers@^5.4.8\":\n- version \"5.4.8\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.4.8.tgz#b85ba06b2465bfa031d61167c078c2911219d877\"\n- integrity sha512-7uxC24fgLQdRquxPfL8SZ8zjle5DXdAB56aYL13tH+HAdhO2YxjKVvulzhGUsfcZthMvZ/9psybhn+m4z71dUg==\n+\"@react-navigation/routers@^5.6.2\":\n+ version \"5.6.2\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.6.2.tgz#accc008c3b777f74d998e16cb2ea8e4c1fe8d9aa\"\n+ integrity sha512-XBcDKXS5s4MaHFufN44LtbXqFDH/nUHfHjbwG85fP3k772oRyPRgbnUb2mbw5MFGqORla9T7uymR6Gh6uwIwVw==\ndependencies:\n- nanoid \"^3.1.9\"\n+ nanoid \"^3.1.15\"\n-\"@react-navigation/stack@^5.6.2\":\n- version \"5.6.2\"\n- resolved \"https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.6.2.tgz#d2371f9ffdcf3eee26245697d0947c9722542f38\"\n- integrity sha512-51Aasxg8j2eKxz4mhA0ajJXrhAyJQkk2iiNE511zcqJ3tlfxv/h70Eej3PetnbbHFMOwNsEwc2GjB3OnfQcxjQ==\n+\"@react-navigation/stack@^5.12.6\":\n+ version \"5.12.6\"\n+ resolved \"https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.12.6.tgz#a6f2caf66da78ad2afa80f7a960c36db6b83bcff\"\n+ integrity sha512-pf9AigAIVtCQuCpZAZqBux4kNqQwj98ngvd6JEryFrqTQ1CYsUH6jfpQE7SKyHggVRFSQVMf24aCgwtRixBvjw==\ndependencies:\n- color \"^3.1.2\"\n- react-native-iphone-x-helper \"^1.2.1\"\n+ color \"^3.1.3\"\n+ react-native-iphone-x-helper \"^1.3.0\"\n\"@samverschueren/stream-to-observable@^0.3.0\":\nversion \"0.3.0\"\n@@ -4560,6 +4560,14 @@ cacheable-request@^7.0.1:\nnormalize-url \"^4.1.0\"\nresponselike \"^2.0.0\"\n+call-bind@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.0.tgz#24127054bb3f9bdcb4b1fb82418186072f77b8ce\"\n+ integrity sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==\n+ dependencies:\n+ function-bind \"^1.1.1\"\n+ get-intrinsic \"^1.0.0\"\n+\ncaller-callsite@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134\"\n@@ -4914,6 +4922,14 @@ color-string@^1.5.2, color-string@^1.5.3:\ncolor-name \"^1.0.0\"\nsimple-swizzle \"^0.2.2\"\n+color-string@^1.5.4:\n+ version \"1.5.4\"\n+ resolved \"https://registry.yarnpkg.com/color-string/-/color-string-1.5.4.tgz#dd51cd25cfee953d138fe4002372cc3d0e504cb6\"\n+ integrity sha512-57yF5yt8Xa3czSEW1jfQDE79Idk0+AkN/4KWad6tbdxUmAs3MvjxlWSWD4deYytcRfoZ9nhKyFl1kj5tBvidbw==\n+ dependencies:\n+ color-name \"^1.0.0\"\n+ simple-swizzle \"^0.2.2\"\n+\ncolor-support@^1.1.3:\nversion \"1.1.3\"\nresolved \"https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2\"\n@@ -4927,6 +4943,14 @@ color@^3.0.0, color@^3.1.2:\ncolor-convert \"^1.9.1\"\ncolor-string \"^1.5.2\"\n+color@^3.1.3:\n+ version \"3.1.3\"\n+ resolved \"https://registry.yarnpkg.com/color/-/color-3.1.3.tgz#ca67fb4e7b97d611dcde39eceed422067d91596e\"\n+ integrity sha512-xgXAcTHa2HeFCGLE9Xs/R82hujGtu9Jd9x4NW3T34+OMs7VoPsjwzRczKHvTAHeJwWFwX5j15+MgAppE8ztObQ==\n+ dependencies:\n+ color-convert \"^1.9.1\"\n+ color-string \"^1.5.4\"\n+\ncolorette@^1.0.7:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/colorette/-/colorette-1.1.0.tgz#1f943e5a357fac10b4e0f5aaef3b14cdc1af6ec7\"\n@@ -5673,6 +5697,26 @@ deep-equal@^2.0.3:\nwhich-collection \"^1.0.1\"\nwhich-typed-array \"^1.1.2\"\n+deep-equal@^2.0.4:\n+ version \"2.0.4\"\n+ resolved \"https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.4.tgz#6b0b407a074666033169df3acaf128e1c6f3eab6\"\n+ integrity sha512-BUfaXrVoCfgkOQY/b09QdO9L3XNoF2XH0A3aY9IQwQL/ZjLOe8FQgCNVl1wiolhsFo8kFdO9zdPViCPbmaJA5w==\n+ dependencies:\n+ es-abstract \"^1.18.0-next.1\"\n+ es-get-iterator \"^1.1.0\"\n+ is-arguments \"^1.0.4\"\n+ is-date-object \"^1.0.2\"\n+ is-regex \"^1.1.1\"\n+ isarray \"^2.0.5\"\n+ object-is \"^1.1.3\"\n+ object-keys \"^1.1.1\"\n+ object.assign \"^4.1.1\"\n+ regexp.prototype.flags \"^1.3.0\"\n+ side-channel \"^1.0.3\"\n+ which-boxed-primitive \"^1.0.1\"\n+ which-collection \"^1.0.1\"\n+ which-typed-array \"^1.1.2\"\n+\ndeep-extend@^0.6.0:\nversion \"0.6.0\"\nresolved \"https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac\"\n@@ -6190,6 +6234,24 @@ es-abstract@^1.17.4, es-abstract@^1.17.5:\nstring.prototype.trimend \"^1.0.1\"\nstring.prototype.trimstart \"^1.0.1\"\n+es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1:\n+ version \"1.18.0-next.1\"\n+ resolved \"https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.1.tgz#6e3a0a4bda717e5023ab3b8e90bec36108d22c68\"\n+ integrity sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==\n+ dependencies:\n+ es-to-primitive \"^1.2.1\"\n+ function-bind \"^1.1.1\"\n+ has \"^1.0.3\"\n+ has-symbols \"^1.0.1\"\n+ is-callable \"^1.2.2\"\n+ is-negative-zero \"^2.0.0\"\n+ is-regex \"^1.1.1\"\n+ object-inspect \"^1.8.0\"\n+ object-keys \"^1.1.1\"\n+ object.assign \"^4.1.1\"\n+ string.prototype.trimend \"^1.0.1\"\n+ string.prototype.trimstart \"^1.0.1\"\n+\nes-get-iterator@^1.1.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8\"\n@@ -7345,6 +7407,15 @@ get-caller-file@^2.0.1:\nresolved \"https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e\"\nintegrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==\n+get-intrinsic@^1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.1.tgz#94a9768fcbdd0595a1c9273aacf4c89d075631be\"\n+ integrity sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==\n+ dependencies:\n+ function-bind \"^1.1.1\"\n+ has \"^1.0.3\"\n+ has-symbols \"^1.0.1\"\n+\nget-monorepo-packages@^1.1.0:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/get-monorepo-packages/-/get-monorepo-packages-1.2.0.tgz#3eee88d30b11a5f65955dec6ae331958b2a168e4\"\n@@ -8342,6 +8413,11 @@ is-callable@^1.2.0:\nresolved \"https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb\"\nintegrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==\n+is-callable@^1.2.2:\n+ version \"1.2.2\"\n+ resolved \"https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.2.tgz#c7c6715cd22d4ddb48d3e19970223aceabb080d9\"\n+ integrity sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==\n+\nis-ci@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c\"\n@@ -8498,6 +8574,11 @@ is-nan@^1.2.1:\ndependencies:\ndefine-properties \"^1.1.1\"\n+is-negative-zero@^2.0.0:\n+ version \"2.0.0\"\n+ resolved \"https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461\"\n+ integrity sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=\n+\nis-npm@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d\"\n@@ -8609,6 +8690,13 @@ is-regex@^1.1.0:\ndependencies:\nhas-symbols \"^1.0.1\"\n+is-regex@^1.1.1:\n+ version \"1.1.1\"\n+ resolved \"https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9\"\n+ integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==\n+ dependencies:\n+ has-symbols \"^1.0.1\"\n+\nis-regexp@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069\"\n@@ -10809,10 +10897,10 @@ nan@^2.12.1:\nresolved \"https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c\"\nintegrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==\n-nanoid@^3.1.9:\n- version \"3.1.9\"\n- resolved \"https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.9.tgz#1f148669c70bb2072dc5af0666e46edb6cd31fb2\"\n- integrity sha512-fFiXlFo4Wkuei3i6w9SQI6yuzGRTGi8Z2zZKZpUxv/bQlBi4jtbVPBSNFZHQA9PNjofWqtIa8p+pnsc0kgZrhQ==\n+nanoid@^3.1.15:\n+ version \"3.1.16\"\n+ resolved \"https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.16.tgz#b21f0a7d031196faf75314d7c65d36352beeef64\"\n+ integrity sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w==\nnanomatch@^1.2.9:\nversion \"1.2.13\"\n@@ -11183,6 +11271,11 @@ object-inspect@^1.7.0:\nresolved \"https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67\"\nintegrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==\n+object-inspect@^1.8.0:\n+ version \"1.8.0\"\n+ resolved \"https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0\"\n+ integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==\n+\nobject-is@^1.0.1:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6\"\n@@ -11196,6 +11289,14 @@ object-is@^1.1.2:\ndefine-properties \"^1.1.3\"\nes-abstract \"^1.17.5\"\n+object-is@^1.1.3:\n+ version \"1.1.3\"\n+ resolved \"https://registry.yarnpkg.com/object-is/-/object-is-1.1.3.tgz#2e3b9e65560137455ee3bd62aec4d90a2ea1cc81\"\n+ integrity sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg==\n+ dependencies:\n+ define-properties \"^1.1.3\"\n+ es-abstract \"^1.18.0-next.1\"\n+\nobject-keys@0.5.0:\nversion \"0.5.0\"\nresolved \"https://registry.yarnpkg.com/object-keys/-/object-keys-0.5.0.tgz#09e211f3e00318afc4f592e36e7cdc10d9ad7293\"\n@@ -11223,6 +11324,16 @@ object.assign@^4.1.0:\nhas-symbols \"^1.0.0\"\nobject-keys \"^1.0.11\"\n+object.assign@^4.1.1:\n+ version \"4.1.2\"\n+ resolved \"https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940\"\n+ integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==\n+ dependencies:\n+ call-bind \"^1.0.0\"\n+ define-properties \"^1.1.3\"\n+ has-symbols \"^1.0.1\"\n+ object-keys \"^1.1.1\"\n+\nobject.entries@^1.1.1:\nversion \"1.1.1\"\nresolved \"https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.1.tgz#ee1cf04153de02bb093fec33683900f57ce5399b\"\n@@ -12562,10 +12673,10 @@ query-string@^4.1.0:\nobject-assign \"^4.1.0\"\nstrict-uri-encode \"^1.0.0\"\n-query-string@^6.13.1:\n- version \"6.13.1\"\n- resolved \"https://registry.yarnpkg.com/query-string/-/query-string-6.13.1.tgz#d913ccfce3b4b3a713989fe6d39466d92e71ccad\"\n- integrity sha512-RfoButmcK+yCta1+FuU8REvisx1oEzhMKwhLUNcepQTPGcNMp1sIqjnfCtfnvGSQZQEhaBHvccujtWoUV3TTbA==\n+query-string@^6.13.6:\n+ version \"6.13.7\"\n+ resolved \"https://registry.yarnpkg.com/query-string/-/query-string-6.13.7.tgz#af53802ff6ed56f3345f92d40a056f93681026ee\"\n+ integrity sha512-CsGs8ZYb39zu0WLkeOhe0NMePqgYdAuCqxOYKDR5LVCytDZYMGx3Bb+xypvQvPHVPijRXB0HZNFllCzHRe4gEA==\ndependencies:\ndecode-uri-component \"^0.2.0\"\nsplit-on-first \"^1.0.0\"\n@@ -12795,10 +12906,10 @@ react-native-in-app-message@^1.0.2:\nresolved \"https://registry.yarnpkg.com/react-native-in-app-message/-/react-native-in-app-message-1.0.2.tgz#e971c039bcd0e238306f73fbea43fc866aa94a69\"\nintegrity sha512-dbzC3AMT5CzGafzUu8ifFMd5g6v0Ww5q9oQgw8RRqjMhggoXDipct9BBI9g4tAoUB2xE2axqu2tKC5pnpBnbdQ==\n-react-native-iphone-x-helper@^1.2.1:\n- version \"1.2.1\"\n- resolved \"https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.2.1.tgz#645e2ffbbb49e80844bb4cbbe34a126fda1e6772\"\n- integrity sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ==\n+react-native-iphone-x-helper@^1.3.0:\n+ version \"1.3.1\"\n+ resolved \"https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010\"\n+ integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==\nreact-native-keyboard-input@6.0.1:\nversion \"6.0.1\"\n@@ -12845,10 +12956,10 @@ react-native-reanimated@^1.13.0:\ndependencies:\nfbjs \"^1.0.0\"\n-react-native-safe-area-context@^3.1.7:\n- version \"3.1.7\"\n- resolved \"https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.1.7.tgz#fc9e636dfb168f992a2172d363509ce0611a8403\"\n- integrity sha512-qSyg/pVMwVPgAy8yCvw349Q+uEUhtRBV33eVXHHkfoou1vCChJxI7SmNR47/6M3BLdjWcyc4lcd018Kx+jhQCw==\n+react-native-safe-area-context@^3.1.9:\n+ version \"3.1.9\"\n+ resolved \"https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.1.9.tgz#48864ea976b0fa57142a2cc523e1fd3314e7247e\"\n+ integrity sha512-wmcGbdyE/vBSL5IjDPReoJUEqxkZsywZw5gPwsVUV1NBpw5eTIdnL6Y0uNKHE25Z661moxPHQz6kwAkYQyorxA==\nreact-native-safe-area-view@^2.0.0:\nversion \"2.0.0\"\n@@ -12864,15 +12975,15 @@ react-native-safe-modules@^1.0.0:\ndependencies:\ndedent \"^0.6.0\"\n-react-native-screens@^2.9.0:\n- version \"2.9.0\"\n- resolved \"https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.9.0.tgz#ead2843107ba00fee259aa377582e457c74f1f3b\"\n- integrity sha512-5MaiUD6HA3nzY3JbVI8l3V7pKedtxQF3d8qktTVI0WmWXTI4QzqOU8r8fPVvfKo3MhOXwhWBjr+kQ7DZaIQQeg==\n+react-native-screens@^2.14.0:\n+ version \"2.14.0\"\n+ resolved \"https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.14.0.tgz#2f0534c76e5bd0a95908ca61ec5d1cb7818d5f1e\"\n+ integrity sha512-7EfxpYiJVvlFQNb1NlkEz7JRELVMLNIsrKo8jHq0+vXbDq+UxnAm/dMeYIXi8hY5iwqzk43uNPL8VyGPcLfBGQ==\n-react-native-tab-view@^2.14.4:\n- version \"2.14.4\"\n- resolved \"https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-2.14.4.tgz#740007e62c8723c6813b8c8a05caaaf82c816620\"\n- integrity sha512-oqkCflPFuZwDTbyY2WaN0377akSsmcttuYACR9LT7htZfO/tKR2Z/ynj1tbv2cz2esGuVICoga9cetN1lPimog==\n+react-native-tab-view@^2.15.2:\n+ version \"2.15.2\"\n+ resolved \"https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-2.15.2.tgz#4bc7832d33a119306614efee667509672a7ee64e\"\n+ integrity sha512-2hxLkBnZtEKFDyfvNO5EUywhy3f/EiLOBO8SWqKj4BMBTO0QwnybaPE5MVF00Fhz+VA4+h/iI40Dkrrtq70dGg==\nreact-native-unimodules@^0.9.0:\nversion \"0.9.0\"\n@@ -13994,6 +14105,14 @@ side-channel@^1.0.2:\nes-abstract \"^1.17.0-next.1\"\nobject-inspect \"^1.7.0\"\n+side-channel@^1.0.3:\n+ version \"1.0.3\"\n+ resolved \"https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.3.tgz#cdc46b057550bbab63706210838df5d4c19519c3\"\n+ integrity sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==\n+ dependencies:\n+ es-abstract \"^1.18.0-next.0\"\n+ object-inspect \"^1.8.0\"\n+\nsignal-exit@^3.0.0, signal-exit@^3.0.2:\nversion \"3.0.2\"\nresolved \"https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d\"\n@@ -15451,7 +15570,7 @@ url@^0.11.0:\npunycode \"1.3.2\"\nquerystring \"0.2.0\"\n-use-subscription@^1.0.0, use-subscription@^1.4.0:\n+use-subscription@^1.0.0:\nversion \"1.4.1\"\nresolved \"https://registry.yarnpkg.com/use-subscription/-/use-subscription-1.4.1.tgz#edcbcc220f1adb2dd4fa0b2f61b6cc308e620069\"\nintegrity sha512-7+IIwDG/4JICrWHL/Q/ZPK5yozEnvRm6vHImu0LKwQlmWGKeiF7mbAenLlK/cTNXrTtXHU/SFASQHzB6+oSJMQ==\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Update React Navigation libs Summary: I checked all of the `CHANGELOG`s and version notes, and none of these should have breaking changes. Test Plan: Compile & run app, play around a bit Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D402
129,187
15.11.2020 00:13:01
18,000
42412dcbec5703fca7324a5d498af6952bbbb57b
[native] Update react-native-reanimated and react-native-gesture-handler Summary: I checked version notes and neither of these should have breaking changes. Test Plan: Compile & run app, play around a bit Reviewers: palys-swm Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/ios/Podfile.lock", "new_path": "native/ios/Podfile.lock", "diff": "@@ -387,11 +387,11 @@ PODS:\n- SDWebImageWebPCoder (~> 0.2.3)\n- RNFS (2.15.2):\n- React\n- - RNGestureHandler (1.6.1):\n+ - RNGestureHandler (1.8.0):\n- React\n- RNKeychain (4.0.1):\n- React\n- - RNReanimated (1.13.0):\n+ - RNReanimated (1.13.1):\n- React\n- RNScreens (2.14.0):\n- React-Core\n@@ -755,9 +755,9 @@ SPEC CHECKSUMS:\nRNExitApp: c4e052df2568b43bec8a37c7cd61194d4cfee2c3\nRNFastImage: 9b0c22643872bb7494c8d87bbbb66cc4c0d9e7a2\nRNFS: 54da03c2b7d862c42ea3ca8c7f86f892760a535a\n- RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38\n+ RNGestureHandler: 7a5833d0f788dbd107fbb913e09aa0c1ff333c39\nRNKeychain: 45dbd50d1ac4bd42c3740f76ffb135abf05746d0\n- RNReanimated: 89f5e0a04d1dd52fbf27e7e7030d8f80a646a3fc\n+ RNReanimated: dd8c286ab5dd4ba36d3a7fef8bff7e08711b5476\nRNScreens: 2e278a90eb15092ed261d4f2271e3fc9b60d08d4\nRNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4\nSDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5\n" }, { "change_type": "MODIFY", "old_path": "native/package.json", "new_path": "native/package.json", "diff": "\"react-native-firebase\": \"^5.6.0\",\n\"react-native-floating-action\": \"^1.21.0\",\n\"react-native-fs\": \"2.15.2\",\n- \"react-native-gesture-handler\": \"^1.6.1\",\n+ \"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-notifications\": \"git+https://git@github.com/ashoat/react-native-notifications.git\",\n\"react-native-orientation-locker\": \"^1.1.6\",\n\"react-native-progress\": \"^4.0.3\",\n- \"react-native-reanimated\": \"^1.13.0\",\n+ \"react-native-reanimated\": \"^1.13.1\",\n\"react-native-safe-area-context\": \"^3.1.9\",\n\"react-native-safe-area-view\": \"^2.0.0\",\n\"react-native-screens\": \"^2.14.0\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -12891,13 +12891,13 @@ react-native-fs@2.15.2:\nbase-64 \"^0.1.0\"\nutf8 \"^3.0.0\"\n-react-native-gesture-handler@^1.6.1:\n- version \"1.6.1\"\n- resolved \"https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.6.1.tgz#678e2dce250ed66e93af409759be22cd6375dd17\"\n- integrity sha512-gQgIKhDiYf754yzhhliagLuLupvGb6ZyBdzYzr7aus3Fyi87TLOw63ers+r4kGw0h26oAWTAdHd34JnF4NeL6Q==\n+react-native-gesture-handler@^1.8.0:\n+ version \"1.8.0\"\n+ resolved \"https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.8.0.tgz#18f61f51da50320f938957b0ee79bc58f47449dc\"\n+ integrity sha512-E2FZa0qZ5Bi0Z8Jg4n9DaFomHvedSjwbO2DPmUUHYRy1lH2yxXUpSrqJd6yymu+Efzmjg2+JZzsjFYA2Iq8VEQ==\ndependencies:\n\"@egjs/hammerjs\" \"^2.0.17\"\n- hoist-non-react-statics \"^2.3.1\"\n+ hoist-non-react-statics \"^3.3.0\"\ninvariant \"^2.2.4\"\nprop-types \"^15.7.2\"\n@@ -12949,10 +12949,10 @@ react-native-progress@^4.0.3:\n\"@react-native-community/art\" \"^1.0.3\"\nprop-types \"^15.7.2\"\n-react-native-reanimated@^1.13.0:\n- version \"1.13.0\"\n- resolved \"https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.13.0.tgz#1ee5d27d34bd2cee7dfad4ae9a3673300872c917\"\n- integrity sha512-uadP/0QO+4TCsyPSvzRdl+76NPM7Bp8M25KQLB4Hg3tWBMjhrMrETnzNi33L/OPfmhU+7rceyi0QPe/DxKT5bQ==\n+react-native-reanimated@^1.13.1:\n+ version \"1.13.1\"\n+ resolved \"https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.13.1.tgz#c370c32cc4d447ae896cb029bb9c6a2f7608c5b4\"\n+ integrity sha512-3sF46jts9MbktgIasf0sTM8uhOYO5a5Q3YyQ4X1jjSE82n/fY2nW3XTFsLGfLEpK2ir4XSDhQWVgFHazaXZTww==\ndependencies:\nfbjs \"^1.0.0\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Update react-native-reanimated and react-native-gesture-handler Summary: I checked version notes and neither of these should have breaking changes. Test Plan: Compile & run app, play around a bit Reviewers: palys-swm Reviewed By: palys-swm Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D403
129,191
09.11.2020 13:37:35
-3,600
a1d37df5f2af2a2b0d7e67b2a09a46507e15740c
[native] Add option to choose updates type when creating a thread Test Plan: I created a thread by using thread composer and it was created successfully. I also tested pending thread creation by sending a friend request. Reviewers: ashoat Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -9,6 +9,7 @@ import {\nimport { messageTypes } from 'lib/types/message-types';\nimport { userRelationshipStatus } from 'lib/types/relationship-types';\nimport type { Viewer } from '../session/viewer';\n+import type { UpdatesForCurrentSession } from './update-creator';\nimport invariant from 'invariant';\n@@ -43,6 +44,7 @@ async function createThread(\nviewer: Viewer,\nrequest: NewThreadRequest,\nforceAddMembers?: boolean = false,\n+ updatesForCurrentSession?: UpdatesForCurrentSession = 'return',\n): Promise<NewThreadResponse> {\nif (!viewer.loggedIn) {\nthrow new ServerError('not_logged_in');\n@@ -227,6 +229,7 @@ async function createThread(\nconst { threadInfos, viewerUpdates } = await commitMembershipChangeset(\nviewer,\nchangeset,\n+ { updatesForCurrentSession },\n);\nconst messageDatas = [\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/update-creator.js", "new_path": "server/src/creators/update-creator.js", "diff": "@@ -59,7 +59,7 @@ import {\n} from '../fetchers/user-fetchers';\nimport { channelNameForUpdateTarget, publisher } from '../socket/redis';\n-type UpdatesForCurrentSession =\n+export type UpdatesForCurrentSession =\n// This is the default if no Viewer is passed, or if an isSocket Viewer is\n// passed in. We will broadcast to all valid sessions via Redis and return\n// nothing to the caller, relying on the current session's Redis listener to\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-permission-updaters.js", "new_path": "server/src/updaters/thread-permission-updaters.js", "diff": "@@ -33,7 +33,10 @@ import {\nrawThreadInfosFromServerThreadInfos,\ntype FetchThreadInfosResult,\n} from '../fetchers/thread-fetchers';\n-import { createUpdates } from '../creators/update-creator';\n+import {\n+ createUpdates,\n+ type UpdatesForCurrentSession,\n+} from '../creators/update-creator';\nimport {\nupdateDatasForUserPairs,\nupdateUndirectedRelationships,\n@@ -565,8 +568,15 @@ type ChangesetCommitResult = {|\nasync function commitMembershipChangeset(\nviewer: Viewer,\nchangeset: Changeset,\n- changedThreadIDs?: Set<string> = new Set(),\n+ {\n+ changedThreadIDs = new Set(),\n+ calendarQuery,\n+ updatesForCurrentSession = 'return',\n+ }: {|\n+ changedThreadIDs?: Set<string>,\ncalendarQuery?: ?CalendarQuery,\n+ updatesForCurrentSession?: UpdatesForCurrentSession,\n+ |} = {},\n): Promise<ChangesetCommitResult> {\nif (!viewer.loggedIn) {\nthrow new ServerError('not_logged_in');\n@@ -673,7 +683,7 @@ async function commitMembershipChangeset(\nviewer,\ncalendarQuery,\n...threadInfoFetchResult,\n- updatesForCurrentSession: 'return',\n+ updatesForCurrentSession,\n});\nreturn {\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -543,9 +543,14 @@ async function updateThread(\nconst { threadInfos, viewerUpdates } = await commitMembershipChangeset(\nviewer,\nchangeset,\n+ {\n// This forces an update for this thread,\n// regardless of whether any membership rows are changed\n- Object.keys(sqlUpdate).length > 0 ? new Set([request.threadID]) : new Set(),\n+ changedThreadIDs:\n+ Object.keys(sqlUpdate).length > 0\n+ ? new Set([request.threadID])\n+ : new Set(),\n+ },\n);\nconst time = Date.now();\n@@ -624,12 +629,9 @@ async function joinThread(\n}\nsetJoinsToUnread(changeset.membershipRows, viewer.userID, request.threadID);\n- const membershipResult = await commitMembershipChangeset(\n- viewer,\n- changeset,\n- new Set(),\n+ const membershipResult = await commitMembershipChangeset(viewer, changeset, {\ncalendarQuery,\n- );\n+ });\nconst messageData = {\ntype: messageTypes.JOIN_THREAD,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add option to choose updates type when creating a thread Test Plan: I created a thread by using thread composer and it was created successfully. I also tested pending thread creation by sending a friend request. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D382
129,191
09.11.2020 14:46:42
-3,600
098f2d84fdb23c3999268259e41146a16ddcf96a
[native] Add option to choose updates type when creating a message Test Plan: I tested it in D369: the thread creation message was successfuly delivered. Also creating text message worked as expected. Reviewers: ashoat Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/creators/message-creator.js", "new_path": "server/src/creators/message-creator.js", "diff": "@@ -10,6 +10,7 @@ import { threadPermissions } from 'lib/types/thread-types';\nimport { updateTypes } from 'lib/types/update-types';\nimport { redisMessageTypes } from 'lib/types/redis-types';\nimport type { Viewer } from '../session/viewer';\n+import type { UpdatesForCurrentSession } from './update-creator';\nimport invariant from 'invariant';\n@@ -74,6 +75,7 @@ type LatestMessages = $ReadOnlyArray<{|\nasync function createMessages(\nviewer: Viewer,\nmessageDatas: $ReadOnlyArray<MessageData>,\n+ updatesForCurrentSession?: UpdatesForCurrentSession = 'return',\n): Promise<RawMessageInfo[]> {\nif (messageDatas.length === 0) {\nreturn [];\n@@ -184,6 +186,7 @@ async function createMessages(\nthreadsToMessageIndices,\nsubthreadPermissionsToCheck,\nstripLocalIDs(messageInfos),\n+ updatesForCurrentSession,\n),\n);\n@@ -193,6 +196,10 @@ async function createMessages(\n`;\nawait dbQuery(messageInsertQuery);\n+ if (updatesForCurrentSession !== 'return') {\n+ return [];\n+ }\n+\nreturn shimUnsupportedRawMessageInfos(messageInfos, viewer.platformDetails);\n}\n@@ -205,6 +212,7 @@ async function postMessageSend(\nthreadsToMessageIndices: Map<string, number[]>,\nsubthreadPermissionsToCheck: Set<string>,\nmessageInfos: RawMessageInfo[],\n+ updatesForCurrentSession: UpdatesForCurrentSession,\n) {\nlet joinIndex = 0;\nlet subthreadSelects = '';\n@@ -357,7 +365,7 @@ async function postMessageSend(\nawait Promise.all([\ncreateReadStatusUpdates(latestMessages),\n- redisPublish(viewer, messageInfosPerUser),\n+ redisPublish(viewer, messageInfosPerUser, updatesForCurrentSession),\nupdateLatestMessages(latestMessages),\n]);\n@@ -367,9 +375,12 @@ async function postMessageSend(\nasync function redisPublish(\nviewer: Viewer,\nmessageInfosPerUser: { [userID: string]: $ReadOnlyArray<RawMessageInfo> },\n+ updatesForCurrentSession: UpdatesForCurrentSession,\n) {\n+ const avoidBroadcastingToCurrentSession =\n+ viewer.hasSessionInfo && updatesForCurrentSession !== 'broadcast';\nfor (const userID in messageInfosPerUser) {\n- if (userID === viewer.userID && viewer.hasSessionInfo) {\n+ if (userID === viewer.userID && avoidBroadcastingToCurrentSession) {\ncontinue;\n}\nconst messageInfos = messageInfosPerUser[userID];\n@@ -382,7 +393,7 @@ async function redisPublish(\n);\n}\nconst viewerMessageInfos = messageInfosPerUser[viewer.userID];\n- if (!viewerMessageInfos || !viewer.hasSessionInfo) {\n+ if (!viewerMessageInfos || !avoidBroadcastingToCurrentSession) {\nreturn;\n}\nconst sessionIDs = await fetchOtherSessionsForViewer(viewer);\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/thread-creator.js", "new_path": "server/src/creators/thread-creator.js", "diff": "@@ -256,7 +256,11 @@ async function createThread(\nchildThreadID: id,\n});\n}\n- const newMessageInfos = await createMessages(viewer, messageDatas);\n+ const newMessageInfos = await createMessages(\n+ viewer,\n+ messageDatas,\n+ updatesForCurrentSession,\n+ );\nif (hasMinCodeVersion(viewer.platformDetails, 62)) {\nreturn {\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Add option to choose updates type when creating a message Test Plan: I tested it in D369: the thread creation message was successfuly delivered. Also creating text message worked as expected. Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D383
129,191
05.11.2020 14:50:33
-3,600
cdc63e2d5f79b353c2d801532ee919f53725937f
[native] Use hook for data binding in chat thread list Test Plan: Flow, threads list is displayed correctly, search works as expected Reviewers: ashoat Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list.react.js", "new_path": "native/chat/chat-thread-list.react.js", "diff": "// @flow\n-import type { AppState } from '../redux/redux-setup';\nimport type { ThreadInfo } from 'lib/types/thread-types';\nimport type { TabNavigationProp } from '../navigation/app-navigator.react';\nimport type {\n@@ -11,18 +10,15 @@ import type {\nimport * as React from 'react';\nimport { View, FlatList, Platform, TextInput } from 'react-native';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\n-import PropTypes from 'prop-types';\nimport _sum from 'lodash/fp/sum';\nimport { FloatingAction } from 'react-native-floating-action';\nimport { createSelector } from 'reselect';\nimport invariant from 'invariant';\n-import { threadSearchIndex } from 'lib/selectors/nav-selectors';\n+import { threadSearchIndex as threadSearchIndexSelector } from 'lib/selectors/nav-selectors';\nimport SearchIndex from 'lib/shared/search-index';\n-import { connect } from 'lib/utils/redux-utils';\nimport {\ntype ChatThreadItem,\n- chatThreadItemPropType,\nchatListDataWithNestedSidebars,\n} from 'lib/selectors/chat-selectors';\n@@ -36,12 +32,12 @@ import {\ntype NavigationRoute,\n} from '../navigation/route-names';\nimport {\n- styleSelector,\ntype IndicatorStyle,\n- indicatorStylePropType,\nindicatorStyleSelector,\n+ useStyles,\n} from '../themes/colors';\nimport Search from '../components/search.react';\n+import { useSelector } from '../redux/redux-utils';\nconst floatingActions = [\n{\n@@ -57,40 +53,32 @@ type Item =\n| {| type: 'search', searchText: string |}\n| {| type: 'empty', emptyItem: React.ComponentType<{||}> |};\n-type RouteNames = 'HomeChatThreadList' | 'BackgroundChatThreadList';\n+type BaseProps = {|\n+ +navigation:\n+ | ChatTopTabsNavigationProp<'HomeChatThreadList'>\n+ | ChatTopTabsNavigationProp<'BackgroundChatThreadList'>,\n+ +route:\n+ | NavigationRoute<'HomeChatThreadList'>\n+ | NavigationRoute<'BackgroundChatThreadList'>,\n+ +filterThreads: (threadItem: ThreadInfo) => boolean,\n+ +emptyItem?: React.ComponentType<{||}>,\n+|};\ntype Props = {|\n- navigation: ChatTopTabsNavigationProp<RouteNames>,\n- route: NavigationRoute<RouteNames>,\n- filterThreads: (threadItem: ThreadInfo) => boolean,\n- emptyItem?: React.ComponentType<{||}>,\n+ ...BaseProps,\n// Redux state\n- chatListData: $ReadOnlyArray<ChatThreadItem>,\n- viewerID: ?string,\n- threadSearchIndex: SearchIndex,\n- styles: typeof styles,\n- indicatorStyle: IndicatorStyle,\n+ +chatListData: $ReadOnlyArray<ChatThreadItem>,\n+ +viewerID: ?string,\n+ +threadSearchIndex: SearchIndex,\n+ +styles: typeof unboundStyles,\n+ +indicatorStyle: IndicatorStyle,\n|};\ntype State = {|\n- searchText: string,\n- searchResults: Set<string>,\n- openedSwipeableId: string,\n+ +searchText: string,\n+ +searchResults: Set<string>,\n+ +openedSwipeableId: string,\n|};\ntype PropsAndState = {| ...Props, ...State |};\nclass ChatThreadList extends React.PureComponent<Props, State> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- navigate: PropTypes.func.isRequired,\n- dangerouslyGetParent: PropTypes.func.isRequired,\n- isFocused: PropTypes.func.isRequired,\n- }).isRequired,\n- filterThreads: PropTypes.func.isRequired,\n- emptyItem: PropTypes.elementType,\n- chatListData: PropTypes.arrayOf(chatThreadItemPropType).isRequired,\n- viewerID: PropTypes.string,\n- threadSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- indicatorStyle: indicatorStylePropType.isRequired,\n- };\nstate = {\nsearchText: '',\nsearchResults: new Set(),\n@@ -328,7 +316,7 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n};\n}\n-const styles = {\n+const unboundStyles = {\nicon: {\nfontSize: 28,\n},\n@@ -345,12 +333,26 @@ const styles = {\nbackgroundColor: 'listBackground',\n},\n};\n-const stylesSelector = styleSelector(styles);\n-export default connect((state: AppState) => ({\n- chatListData: chatListDataWithNestedSidebars(state),\n- viewerID: state.currentUserInfo && state.currentUserInfo.id,\n- threadSearchIndex: threadSearchIndex(state),\n- styles: stylesSelector(state),\n- indicatorStyle: indicatorStyleSelector(state),\n-}))(ChatThreadList);\n+export default React.memo<BaseProps>(function ConnectedChatThreadList(\n+ props: BaseProps,\n+) {\n+ const chatListData = useSelector(chatListDataWithNestedSidebars);\n+ const viewerID = useSelector(\n+ (state) => state.currentUserInfo && state.currentUserInfo.id,\n+ );\n+ const threadSearchIndex = useSelector(threadSearchIndexSelector);\n+ const styles = useStyles(unboundStyles);\n+ const indicatorStyle = useSelector(indicatorStyleSelector);\n+\n+ return (\n+ <ChatThreadList\n+ {...props}\n+ chatListData={chatListData}\n+ viewerID={viewerID}\n+ threadSearchIndex={threadSearchIndex}\n+ styles={styles}\n+ indicatorStyle={indicatorStyle}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook for data binding in chat thread list Test Plan: Flow, threads list is displayed correctly, search works as expected Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D370
129,183
17.11.2020 14:01:33
-3,600
f1a24a15f3307436651fd34d491d0f11de99cd75
Stop using getUserSearchResults in RelationshipUpdateModal Test Plan: Made sure block list and friend list still work as before Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/more/relationship-update-modal.react.js", "new_path": "native/more/relationship-update-modal.react.js", "diff": "// @flow\n-import type { GlobalAccountUserInfo, UserInfo } from 'lib/types/user-types';\n+import type {\n+ GlobalAccountUserInfo,\n+ UserInfo,\n+ AccountUserInfo,\n+} from 'lib/types/user-types';\nimport type { UserSearchResult } from 'lib/types/search-types';\nimport {\ntype RelationshipRequest,\n@@ -20,7 +24,6 @@ import invariant from 'invariant';\nimport { searchIndexFromUserInfos } from 'lib/selectors/user-selectors';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\n-import { getUserSearchResults } from 'lib/shared/search-utils';\nimport { values } from 'lib/utils/objects';\nimport { searchUsersActionTypes, searchUsers } from 'lib/actions/user-actions';\nimport {\n@@ -135,12 +138,22 @@ class RelationshipUpdateModal extends React.PureComponent<Props, State> {\n}\nconst searchIndex = searchIndexFromUserInfos(mergedUserInfos);\n- const results = getUserSearchResults(\n- text,\n- mergedUserInfos,\n- searchIndex,\n- excludeUserIDs,\n- );\n+ const results = [];\n+ const appendUserInfo = (userInfo: AccountUserInfo) => {\n+ if (!excludeUserIDs.includes(userInfo.id)) {\n+ results.push(userInfo);\n+ }\n+ };\n+ if (text === '') {\n+ for (const id in mergedUserInfos) {\n+ appendUserInfo(mergedUserInfos[id]);\n+ }\n+ } else {\n+ const ids = searchIndex.getSearchResults(text);\n+ for (const id of ids) {\n+ appendUserInfo(mergedUserInfos[id]);\n+ }\n+ }\nreturn results.map((result) => {\nconst userInfo = userInfos[result.id];\nconst disabledFriends =\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Stop using getUserSearchResults in RelationshipUpdateModal Test Plan: Made sure block list and friend list still work as before Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D413
129,183
16.11.2020 12:17:41
-3,600
c6c900b2ed01ef2ba3e5a959ec08728a46ec50c5
Include all not-blocked users in userInfoSelectorForPotentialMembers Summary: We want to list non-friends with a notice when adding to a thread, so we need to change selector Test Plan: Made sure only blocked users are excluded Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/user-selectors.js", "new_path": "lib/selectors/user-selectors.js", "diff": "@@ -8,7 +8,6 @@ import type {\n} from '../types/user-types';\nimport {\ntype RawThreadInfo,\n- type MemberInfo,\ntype RelativeMemberInfo,\n} from '../types/thread-types';\nimport { userRelationshipStatus } from '../types/relationship-types';\n@@ -17,10 +16,7 @@ import { createSelector } from 'reselect';\nimport _memoize from 'lodash/memoize';\nimport SearchIndex from '../shared/search-index';\n-import {\n- threadActualMembers,\n- memberHasAdminPowers,\n-} from '../shared/thread-utils';\n+import { memberHasAdminPowers } from '../shared/thread-utils';\n// Used for specific message payloads that include an array of user IDs, ie.\n// array of initial users, array of added users\n@@ -110,37 +106,22 @@ const relativeMemberInfoSelectorForMembersOfThread: (\nbaseRelativeMemberInfoSelectorForMembersOfThread,\n);\n-// We're returning users that might be a thread members:\n-// friends and not blocked users in parent thread if it exists\n-const baseUserInfoSelectorForPotentialMembers = (parentThreadID: ?string) =>\n- createSelector(\n+const userInfoSelectorForPotentialMembers: (\n+ state: BaseAppState<*>,\n+) => { [id: string]: AccountUserInfo } = createSelector(\n(state: BaseAppState<*>) => state.userStore.userInfos,\n- (state: BaseAppState<*>) =>\n- state.currentUserInfo && state.currentUserInfo.id,\n- (state: BaseAppState<*>) =>\n- parentThreadID && state.threadStore.threadInfos[parentThreadID]\n- ? state.threadStore.threadInfos[parentThreadID].members\n- : null,\n+ (state: BaseAppState<*>) => state.currentUserInfo && state.currentUserInfo.id,\n(\nuserInfos: { [id: string]: UserInfo },\ncurrentUserID: ?string,\n- parentThreadMembers: ?$ReadOnlyArray<MemberInfo>,\n): { [id: string]: AccountUserInfo } => {\nconst availableUsers = {};\n- const parentThreadMembersIDs = parentThreadMembers\n- ? threadActualMembers(parentThreadMembers)\n- : [];\n-\nfor (const id in userInfos) {\nconst userInfo = userInfos[id];\nconst { relationshipStatus } = userInfo;\n- if (relationshipStatus === userRelationshipStatus.FRIEND) {\n- availableUsers[id] = userInfo;\n- } else if (\n- parentThreadMembersIDs.includes(id) &&\n+ if (\nid !== currentUserID &&\n- relationshipStatus !== userRelationshipStatus.BLOCKED_BY_VIEWER &&\nrelationshipStatus !== userRelationshipStatus.BLOCKED_VIEWER &&\nrelationshipStatus !== userRelationshipStatus.BOTH_BLOCKED\n) {\n@@ -151,12 +132,6 @@ const baseUserInfoSelectorForPotentialMembers = (parentThreadID: ?string) =>\n},\n);\n-const userInfoSelectorForPotentialMembers: (\n- threadID: ?string,\n-) => (state: BaseAppState<*>) => { [id: string]: AccountUserInfo } = _memoize(\n- baseUserInfoSelectorForPotentialMembers,\n-);\n-\nfunction searchIndexFromUserInfos(userInfos: {\n[id: string]: AccountUserInfo,\n}) {\n@@ -167,16 +142,11 @@ function searchIndexFromUserInfos(userInfos: {\nreturn searchIndex;\n}\n-const baseUserSearchIndexForPotentialMembers = (threadID: ?string) =>\n- createSelector(\n- userInfoSelectorForPotentialMembers(threadID),\n- searchIndexFromUserInfos,\n- );\n-\nconst userSearchIndexForPotentialMembers: (\n- threadID: ?string,\n-) => (state: BaseAppState<*>) => SearchIndex = _memoize(\n- baseUserSearchIndexForPotentialMembers,\n+ state: BaseAppState<*>,\n+) => SearchIndex = createSelector(\n+ userInfoSelectorForPotentialMembers,\n+ searchIndexFromUserInfos,\n);\nconst isLoggedIn = (state: BaseAppState<*>) =>\n" }, { "change_type": "MODIFY", "old_path": "native/chat/compose-thread.react.js", "new_path": "native/chat/compose-thread.react.js", "diff": "@@ -503,12 +503,8 @@ export default React.memo<BaseProps>(function ConnectedComposeThread(\nconst loadingStatus = useSelector(\ncreateLoadingStatusSelector(newThreadActionTypes),\n);\n- const otherUserInfos = useSelector(\n- userInfoSelectorForPotentialMembers(parentThreadInfoID),\n- );\n- const userSearchIndex = useSelector(\n- userSearchIndexForPotentialMembers(parentThreadInfoID),\n- );\n+ const otherUserInfos = useSelector(userInfoSelectorForPotentialMembers);\n+ const userSearchIndex = useSelector(userSearchIndexForPotentialMembers);\nconst threadInfos = useSelector(threadInfoSelector);\nconst colors = useColors();\nconst styles = useStyles(unboundStyles);\n" }, { "change_type": "MODIFY", "old_path": "native/chat/settings/add-users-modal.react.js", "new_path": "native/chat/settings/add-users-modal.react.js", "diff": "@@ -338,12 +338,8 @@ export default React.memo<BaseProps>(function ConnectedAddUsersModal(\nconst parentThreadInfo = useSelector((state) =>\nparentThreadID ? threadInfoSelector(state)[parentThreadID] : null,\n);\n- const otherUserInfos = useSelector(\n- userInfoSelectorForPotentialMembers(parentThreadID),\n- );\n- const userSearchIndex = useSelector(\n- userSearchIndexForPotentialMembers(parentThreadID),\n- );\n+ const otherUserInfos = useSelector(userInfoSelectorForPotentialMembers);\n+ const userSearchIndex = useSelector(userSearchIndexForPotentialMembers);\nconst changeThreadSettingsLoadingStatus = useSelector(\ncreateLoadingStatusSelector(changeThreadSettingsActionTypes),\n);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Include all not-blocked users in userInfoSelectorForPotentialMembers Summary: We want to list non-friends with a notice when adding to a thread, so we need to change selector Test Plan: Made sure only blocked users are excluded Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D405
129,183
16.11.2020 15:00:00
-3,600
5bfc42807e9685b0f0f2cb14f25e7c7b57060bfe
[native] Show alert when trying to add non-friend to a thread Test Plan: Checked if alert is displayed only when clicking on non-friends, and for other users behaviour is still the same Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/search-utils.js", "new_path": "lib/shared/search-utils.js", "diff": "@@ -70,15 +70,24 @@ function getPotentialMemberItems(\nif (isMemberOfParentThread) {\nreturn { ...result };\n}\n- let notice;\n+ let notice, alertText;\n+ const userText = result.username;\nif (relationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER) {\nnotice = \"you've blocked this user\";\n+ alertText =\n+ `Before you add ${userText} to this thread, ` +\n+ `you'll need to unblock them and send a friend request. ` +\n+ `You can do this from the Block List and Friend List in the More tab.`;\n} else if (relationshipStatus !== userRelationshipStatus.FRIEND) {\nnotice = 'not friend';\n+ alertText =\n+ `Before you add ${userText} to this thread, ` +\n+ `you'll need to send them a friend request. ` +\n+ `You can do this from the Friend List in the More tab.`;\n} else if (parentThreadInfo) {\nnotice = 'not in parent thread';\n}\n- return { ...result, notice };\n+ return { ...result, notice, alertText };\n},\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "lib/types/user-types.js", "new_path": "lib/types/user-types.js", "diff": "@@ -93,10 +93,11 @@ export type AccountUpdate = {|\n|};\nexport type UserListItem = {|\n- id: string,\n- username: string,\n- disabled?: boolean,\n- notice?: string,\n+ +id: string,\n+ +username: string,\n+ +disabled?: boolean,\n+ +notice?: string,\n+ +alertText?: string,\n|};\nexport const userListItemPropType = PropTypes.shape({\n@@ -104,4 +105,5 @@ export const userListItemPropType = PropTypes.shape({\nusername: PropTypes.string.isRequired,\ndisabled: PropTypes.bool,\nnotice: PropTypes.string,\n+ alertText: PropTypes.string,\n});\n" }, { "change_type": "MODIFY", "old_path": "native/components/user-list-user.react.js", "new_path": "native/components/user-list-user.react.js", "diff": "@@ -6,7 +6,7 @@ import type { AppState } from '../redux/redux-setup';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n-import { Text, Platform } from 'react-native';\n+import { Text, Platform, Alert } from 'react-native';\nimport { connect } from 'lib/utils/redux-utils';\n@@ -67,7 +67,14 @@ class UserListUser extends React.PureComponent<Props> {\n}\nonSelect = () => {\n- this.props.onSelect(this.props.userInfo.id);\n+ const { userInfo } = this.props;\n+ if (!userInfo.alertText) {\n+ this.props.onSelect(userInfo.id);\n+ return;\n+ }\n+ Alert.alert('Not a friend', userInfo.alertText, [{ text: 'OK' }], {\n+ cancelable: true,\n+ });\n};\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Show alert when trying to add non-friend to a thread Test Plan: Checked if alert is displayed only when clicking on non-friends, and for other users behaviour is still the same Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D407
129,191
12.11.2020 17:57:06
-3,600
e1c71c58906b030315619f715be32dac10ce0696
[server][lib] Add update relationship message type Test Plan: Sending and displaying this message was tested in the next diff. I havent tested the notifications... is there any easy way to test them? Reviewers: ashoat Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/message-utils.js", "new_path": "lib/shared/message-utils.js", "diff": "@@ -190,6 +190,21 @@ function robotextForMessageInfo(\n`${creator} restored an event scheduled for ${date}: ` +\n`\"${messageInfo.text}\"`\n);\n+ } else if (messageInfo.type === messageTypes.UPDATE_RELATIONSHIP) {\n+ const target = robotextForUser(messageInfo.target);\n+ if (messageInfo.operation === 'request_sent') {\n+ return `${creator} sent ${target} a friend request`;\n+ } else if (messageInfo.operation === 'request_accepted') {\n+ const targetPossessive = messageInfo.target.isViewer\n+ ? 'your'\n+ : `${target}'s`;\n+ return `${creator} accepted ${targetPossessive} friend request`;\n+ }\n+ invariant(\n+ false,\n+ `Invalid operation ${messageInfo.operation} ` +\n+ `of message with type ${messageInfo.type}`,\n+ );\n} else if (messageInfo.type === messageTypes.UNSUPPORTED) {\nreturn `${creator} ${messageInfo.robotext}`;\n}\n@@ -482,6 +497,28 @@ function createMessageInfo(\nmessageInfo.localID = rawMessageInfo.localID;\n}\nreturn messageInfo;\n+ } else if (rawMessageInfo.type === messageTypes.UPDATE_RELATIONSHIP) {\n+ const target = userInfos[rawMessageInfo.targetID];\n+ if (!target) {\n+ return null;\n+ }\n+ return {\n+ type: messageTypes.UPDATE_RELATIONSHIP,\n+ id: rawMessageInfo.id,\n+ threadID: rawMessageInfo.threadID,\n+ creator: {\n+ id: rawMessageInfo.creatorID,\n+ username: creatorInfo.username,\n+ isViewer: rawMessageInfo.creatorID === viewerID,\n+ },\n+ target: {\n+ id: target.id,\n+ username: target.username,\n+ isViewer: target.id === viewerID,\n+ },\n+ time: rawMessageInfo.time,\n+ operation: rawMessageInfo.operation,\n+ };\n}\ninvariant(false, `we're not aware of messageType ${rawMessageInfo.type}`);\n}\n@@ -574,6 +611,8 @@ function rawMessageInfoFromMessageData(\nreturn ({ ...messageData, id }: RawImagesMessageInfo);\n} else if (messageData.type === messageTypes.MULTIMEDIA) {\nreturn ({ ...messageData, id }: RawMediaMessageInfo);\n+ } else if (messageData.type === messageTypes.UPDATE_RELATIONSHIP) {\n+ return { ...messageData, id };\n} else {\ninvariant(false, `we're not aware of messageType ${messageData.type}`);\n}\n" }, { "change_type": "MODIFY", "old_path": "lib/shared/notif-utils.js", "new_path": "lib/shared/notif-utils.js", "diff": "@@ -424,6 +424,21 @@ function fullNotifTextsForMessageInfo(\ntitle: threadInfo.uiName,\nprefix: userString,\n};\n+ } else if (mostRecentType === messageTypes.UPDATE_RELATIONSHIP) {\n+ const messageInfo = assertSingleMessageInfo(messageInfos);\n+ const prefix = stringForUser(messageInfo.creator);\n+ const title = threadInfo.uiName;\n+ const body =\n+ messageInfo.operation === 'request_sent'\n+ ? 'sent you a friend request'\n+ : 'accepted your friend request';\n+ const merged = `${prefix} ${body}`;\n+ return {\n+ merged,\n+ body,\n+ title,\n+ prefix,\n+ };\n} else {\ninvariant(false, `we're not aware of messageType ${mostRecentType}`);\n}\n" }, { "change_type": "MODIFY", "old_path": "lib/types/message-types.js", "new_path": "lib/types/message-types.js", "diff": "@@ -38,6 +38,7 @@ export const messageTypes = Object.freeze({\nUNSUPPORTED: 13,\nIMAGES: 14,\nMULTIMEDIA: 15,\n+ UPDATE_RELATIONSHIP: 16,\n});\nexport type MessageType = $Values<typeof messageTypes>;\nexport function assertMessageType(ourMessageType: number): MessageType {\n@@ -57,7 +58,8 @@ export function assertMessageType(ourMessageType: number): MessageType {\nourMessageType === 12 ||\nourMessageType === 13 ||\nourMessageType === 14 ||\n- ourMessageType === 15,\n+ ourMessageType === 15 ||\n+ ourMessageType === 16,\n'number is not MessageType enum',\n);\nreturn ourMessageType;\n@@ -231,6 +233,14 @@ export type MediaMessageData = {|\ntime: number,\nmedia: $ReadOnlyArray<Media>,\n|};\n+export type UpdateRelationshipMessageData = {|\n+ +type: 16,\n+ +threadID: string,\n+ +creatorID: string,\n+ +targetID: string,\n+ +time: number,\n+ +operation: 'request_sent' | 'request_accepted',\n+|};\nexport type MessageData =\n| TextMessageData\n| CreateThreadMessageData\n@@ -246,7 +256,8 @@ export type MessageData =\n| DeleteEntryMessageData\n| RestoreEntryMessageData\n| ImagesMessageData\n- | MediaMessageData;\n+ | MediaMessageData\n+ | UpdateRelationshipMessageData;\nexport type MultimediaMessageData = ImagesMessageData | MediaMessageData;\n@@ -318,6 +329,10 @@ type RawRobotextMessageInfo =\n...RestoreEntryMessageData,\nid: string,\n|}\n+ | {|\n+ ...UpdateRelationshipMessageData,\n+ id: string,\n+ |}\n| {|\ntype: 13,\nid: string,\n@@ -484,6 +499,15 @@ export type RobotextMessageInfo =\ntime: number,\nrobotext: string,\nunsupportedMessageInfo: Object,\n+ |}\n+ | {|\n+ +type: 16,\n+ +id: string,\n+ +threadID: string,\n+ +creator: RelativeUserInfo,\n+ +target: RelativeUserInfo,\n+ +time: number,\n+ +operation: 'request_sent' | 'request_accepted',\n|};\nexport type PreviewableMessageInfo =\n| RobotextMessageInfo\n@@ -638,6 +662,15 @@ export const messageInfoPropType = PropTypes.oneOfType([\ntime: PropTypes.number.isRequired,\nmedia: PropTypes.arrayOf(mediaPropType).isRequired,\n}),\n+ PropTypes.exact({\n+ type: PropTypes.oneOf([messageTypes.UPDATE_RELATIONSHIP]).isRequired,\n+ id: PropTypes.string.isRequired,\n+ threadID: PropTypes.string.isRequired,\n+ creator: relativeUserInfoPropType.isRequired,\n+ target: relativeUserInfoPropType.isRequired,\n+ time: PropTypes.number.isRequired,\n+ operation: PropTypes.oneOf(['request_sent', 'request_accepted']),\n+ }),\n]);\nexport type ThreadMessageInfo = {|\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/message-creator.js", "new_path": "server/src/creators/message-creator.js", "diff": "@@ -161,6 +161,11 @@ async function createMessages(\nmediaIDs.push(parseInt(id, 10));\n}\ncontent = JSON.stringify(mediaIDs);\n+ } else if (messageData.type === messageTypes.UPDATE_RELATIONSHIP) {\n+ content = JSON.stringify({\n+ operation: messageData.operation,\n+ targetID: messageData.targetID,\n+ });\n}\nconst creation =\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/message-fetchers.js", "new_path": "server/src/fetchers/message-fetchers.js", "diff": "@@ -366,6 +366,18 @@ function rawMessageInfoFromRows(\nlocalID: localIDFromCreationString(viewer, row.creation),\ntime: row.time,\n});\n+ } else if (type === messageTypes.UPDATE_RELATIONSHIP) {\n+ const row = assertSingleRow(rows);\n+ const content = JSON.parse(row.content);\n+ return {\n+ type: messageTypes.UPDATE_RELATIONSHIP,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ targetID: content.targetID,\n+ operation: content.operation,\n+ };\n} else {\ninvariant(false, `unrecognized messageType ${type}`);\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server][lib] Add update relationship message type Test Plan: Sending and displaying this message was tested in the next diff. I havent tested the notifications... is there any easy way to test them? Reviewers: ashoat Reviewed By: ashoat Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D395
129,187
17.11.2020 18:11:41
18,000
8554b1dab2de0dd57706be5dcb74951d5304d0ba
[native] Use org.squadcal package for ReactNativeFlipper.java Summary: I just noticed I hadn't changed these from the defaults. This change should be a no-op. Test Plan: Compile Android, make sure everything still works Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/android/app/src/debug/java/org/squadcal/ReactNativeFlipper.java", "new_path": "native/android/app/src/debug/java/org/squadcal/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 com.rndiffapp;\n+package org.squadcal;\nimport android.content.Context;\nimport com.facebook.flipper.android.AndroidFlipperClient;\n" }, { "change_type": "MODIFY", "old_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java", "new_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java", "diff": "@@ -89,7 +89,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(\"com.rndiffapp.ReactNativeFlipper\");\n+ Class<?> aClass = Class.forName(\"org.squadcal.ReactNativeFlipper\");\naClass\n.getMethod(\n\"initializeFlipper\",\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use org.squadcal package for ReactNativeFlipper.java Summary: I just noticed I hadn't changed these from the defaults. This change should be a no-op. Test Plan: Compile Android, make sure everything still works Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D419
129,187
18.11.2020 15:47:08
18,000
7c92fe9cc8f970cbb17c112b58d56f3496fdb689
[native] Move waitForInteractions to timers.js Summary: I'm going to introduce an async function equivalent of `requestAnimationFrame`, and I figured it should go in the same file. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/calendar/entry.react.js", "new_path": "native/calendar/entry.react.js", "diff": "@@ -68,7 +68,7 @@ import {\nimport LoadingIndicator from './loading-indicator.react';\nimport { colors, useStyles } from '../themes/colors';\nimport { NavContext } from '../navigation/navigation-context';\n-import { waitForInteractions } from '../utils/interactions';\n+import { waitForInteractions } from '../utils/timers';\nimport Markdown from '../markdown/markdown.react';\nimport { inlineMarkdownRules } from '../markdown/rules.react';\nimport { SingleLine } from '../components/single-line.react';\n" }, { "change_type": "MODIFY", "old_path": "native/calendar/thread-picker-modal.react.js", "new_path": "native/calendar/thread-picker-modal.react.js", "diff": "@@ -18,7 +18,7 @@ import { threadSearchIndex } from 'lib/selectors/nav-selectors';\nimport Modal from '../components/modal.react';\nimport ThreadList from '../components/thread-list.react';\nimport { RootNavigatorContext } from '../navigation/root-navigator-context';\n-import { waitForInteractions } from '../utils/interactions';\n+import { waitForInteractions } from '../utils/timers';\nimport { useSelector } from '../redux/redux-utils';\nexport type ThreadPickerModalParams = {|\n" }, { "change_type": "MODIFY", "old_path": "native/components/clearable-text-input.react.js", "new_path": "native/components/clearable-text-input.react.js", "diff": "@@ -7,7 +7,7 @@ import { TextInput, View, StyleSheet } from 'react-native';\nimport sleep from 'lib/utils/sleep';\n-import { waitForInteractions } from '../utils/interactions';\n+import { waitForInteractions } from '../utils/timers';\nclass ClearableTextInput extends React.PureComponent<ClearableTextInputProps> {\ntextInput: ?React.ElementRef<typeof TextInput>;\n" }, { "change_type": "MODIFY", "old_path": "native/keyboard/keyboard-state-container.react.js", "new_path": "native/keyboard/keyboard-state-container.react.js", "diff": "@@ -15,7 +15,7 @@ import {\n} from './keyboard';\nimport { KeyboardContext } from './keyboard-state';\nimport KeyboardInputHost from './keyboard-input-host.react';\n-import { waitForInteractions } from '../utils/interactions';\n+import { waitForInteractions } from '../utils/timers';\nimport { tabBarAnimationDuration } from '../navigation/tab-bar.react';\ntype Props = {|\n" }, { "change_type": "MODIFY", "old_path": "native/navigation/app-navigator.react.js", "new_path": "native/navigation/app-navigator.react.js", "diff": "@@ -44,7 +44,7 @@ import KeyboardStateContainer from '../keyboard/keyboard-state-container.react';\nimport PushHandler from '../push/push-handler.react';\nimport { getPersistor } from '../redux/persist';\nimport { RootContext } from '../root-context';\n-import { waitForInteractions } from '../utils/interactions';\n+import { waitForInteractions } from '../utils/timers';\nimport { useSelector } from '../redux/redux-utils';\nlet splashScreenHasHidden = false;\n" }, { "change_type": "RENAME", "old_path": "native/utils/interactions.js", "new_path": "native/utils/timers.js", "diff": "" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Move waitForInteractions to timers.js Summary: I'm going to introduce an async function equivalent of `requestAnimationFrame`, and I figured it should go in the same file. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D418
129,183
19.11.2020 09:17:00
-3,600
bd3deb9e2c72e359e14481813fed7cd81bab2a00
Update threadIsWithBlockedUserOnly function Summary: Accept both rawThreadInfo and threadInfo, add optional parameter to check only blocked_by_viewer relationship status Test Plan: Made sure threadIsWithBlockedUserOnly works as before Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/shared/thread-utils.js", "new_path": "lib/shared/thread-utils.js", "diff": "@@ -141,7 +141,9 @@ function threadIsGroupChat(threadInfo: ThreadInfo | RawThreadInfo) {\n);\n}\n-function threadOrParentThreadIsGroupChat(threadInfo: RawThreadInfo) {\n+function threadOrParentThreadIsGroupChat(\n+ threadInfo: RawThreadInfo | ThreadInfo,\n+) {\nreturn threadInfo.members.length > 2;\n}\n@@ -291,7 +293,7 @@ function getCurrentUser(\nviewerID: ?string,\nuserInfos: { [id: string]: UserInfo },\n): ThreadCurrentUserInfo {\n- if (!threadIsWithBlockedUserOnly(rawThreadInfo, viewerID, userInfos)) {\n+ if (!threadFrozenDueToBlock(rawThreadInfo, viewerID, userInfos)) {\nreturn rawThreadInfo.currentUser;\n}\n@@ -305,22 +307,29 @@ function getCurrentUser(\n}\nfunction threadIsWithBlockedUserOnly(\n- rawThreadInfo: RawThreadInfo,\n+ threadInfo: RawThreadInfo | ThreadInfo,\nviewerID: ?string,\nuserInfos: { [id: string]: UserInfo },\n+ checkOnlyViewerBlock?: boolean,\n): boolean {\nif (\n- threadOrParentThreadIsGroupChat(rawThreadInfo) ||\n- threadOrParentThreadHasAdminRole(rawThreadInfo)\n+ threadOrParentThreadIsGroupChat(threadInfo) ||\n+ threadOrParentThreadHasAdminRole(threadInfo)\n) {\nreturn false;\n}\n- const otherUserInfos = rawThreadInfo.members\n+ const otherUserInfos = threadInfo.members\n.filter((threadMember) => threadMember.id !== viewerID)\n.map((threadMember) => userInfos[threadMember.id]);\nconst otherUserRelationshipStatus = otherUserInfos[0]?.relationshipStatus;\n+ if (checkOnlyViewerBlock) {\n+ return (\n+ otherUserRelationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER\n+ );\n+ }\n+\nreturn (\notherUserRelationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER ||\notherUserRelationshipStatus === userRelationshipStatus.BLOCKED_VIEWER ||\n@@ -328,6 +337,22 @@ function threadIsWithBlockedUserOnly(\n);\n}\n+function threadFrozenDueToBlock(\n+ threadInfo: RawThreadInfo | ThreadInfo,\n+ viewerID: ?string,\n+ userInfos: { [id: string]: UserInfo },\n+): boolean {\n+ return threadIsWithBlockedUserOnly(threadInfo, viewerID, userInfos);\n+}\n+\n+function threadFrozenDueToViewerBlock(\n+ threadInfo: RawThreadInfo | ThreadInfo,\n+ viewerID: ?string,\n+ userInfos: { [id: string]: UserInfo },\n+): boolean {\n+ return threadIsWithBlockedUserOnly(threadInfo, viewerID, userInfos, true);\n+}\n+\nfunction rawThreadInfoFromThreadInfo(threadInfo: ThreadInfo): RawThreadInfo {\nreturn {\nid: threadInfo.id,\n@@ -386,7 +411,9 @@ function threadHasAdminRole(\nreturn _find({ name: 'Admins' })(threadInfo.roles);\n}\n-function threadOrParentThreadHasAdminRole(threadInfo: RawThreadInfo) {\n+function threadOrParentThreadHasAdminRole(\n+ threadInfo: RawThreadInfo | ThreadInfo,\n+) {\nreturn (\nthreadInfo.members.filter((member) => memberHasAdminPowers(member)).length >\n0\n@@ -472,7 +499,8 @@ export {\nthreadIsGroupChat,\nthreadIsPending,\nthreadIsPersonalAndPending,\n- threadIsWithBlockedUserOnly,\n+ threadFrozenDueToBlock,\n+ threadFrozenDueToViewerBlock,\nrawThreadInfoFromServerThreadInfo,\nrobotextName,\nthreadInfoFromRawThreadInfo,\n" }, { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-permission-fetchers.js", "new_path": "server/src/fetchers/thread-permission-fetchers.js", "diff": "@@ -8,7 +8,7 @@ import type { Viewer } from '../session/viewer';\nimport { permissionLookup } from 'lib/permissions/thread-permissions';\nimport {\n- threadIsWithBlockedUserOnly,\n+ threadFrozenDueToBlock,\npermissionsDisabledByBlock,\n} from 'lib/shared/thread-utils';\n@@ -129,7 +129,7 @@ async function checkThreadDisabled(\n]);\nfor (const threadID in threadInfos) {\n- const blockedThread = threadIsWithBlockedUserOnly(\n+ const blockedThread = threadFrozenDueToBlock(\nthreadInfos[threadID],\nviewer.id,\nuserInfos,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Update threadIsWithBlockedUserOnly function Summary: Accept both rawThreadInfo and threadInfo, add optional parameter to check only blocked_by_viewer relationship status Test Plan: Made sure threadIsWithBlockedUserOnly works as before Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D421
129,183
19.11.2020 10:09:09
-3,600
689d121957048562a59ec0955399c17ac1a959de
[native] Update notice in a thread when user blocked target Test Plan: Check if in thread with target user blocked new notice is displayed Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -11,6 +11,7 @@ import {\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport { loadingStatusPropType } from 'lib/types/loading-types';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n+import { type UserInfo, userInfoPropType } from 'lib/types/user-types';\nimport {\ntype KeyboardState,\nkeyboardStatePropType,\n@@ -51,7 +52,12 @@ import _throttle from 'lodash/throttle';\nimport { useDispatch } from 'react-redux';\nimport { saveDraftActionType } from 'lib/actions/miscellaneous-action-types';\n-import { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n+import {\n+ threadHasPermission,\n+ viewerIsMember,\n+ threadFrozenDueToViewerBlock,\n+ threadActualMembers,\n+} from 'lib/shared/thread-utils';\nimport { joinThreadActionTypes, joinThread } from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { trimMessage } from 'lib/shared/message-utils';\n@@ -118,6 +124,7 @@ type Props = {|\n+joinThreadLoadingStatus: LoadingStatus,\n+calendarQuery: () => CalendarQuery,\n+nextLocalID: number,\n+ +userInfos: { [id: string]: UserInfo },\n+colors: Colors,\n+styles: typeof unboundStyles,\n// connectNav\n@@ -147,6 +154,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\njoinThreadLoadingStatus: loadingStatusPropType.isRequired,\ncalendarQuery: PropTypes.func.isRequired,\nnextLocalID: PropTypes.number.isRequired,\n+ userInfos: PropTypes.objectOf(userInfoPropType).isRequired,\ncolors: colorsPropType.isRequired,\nstyles: PropTypes.objectOf(PropTypes.object).isRequired,\nkeyboardState: keyboardStatePropType,\n@@ -413,6 +421,19 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nlet content;\nif (threadHasPermission(this.props.threadInfo, threadPermissions.VOICED)) {\ncontent = this.renderInput();\n+ } else if (\n+ threadFrozenDueToViewerBlock(\n+ this.props.threadInfo,\n+ this.props.viewerID,\n+ this.props.userInfos,\n+ ) &&\n+ threadActualMembers(this.props.threadInfo.members).length === 2\n+ ) {\n+ content = (\n+ <Text style={this.props.styles.explanation}>\n+ You can&apos;t send messages to a user that you&apos;ve blocked.\n+ </Text>\n+ );\n} else if (isMember) {\ncontent = (\n<Text style={this.props.styles.explanation}>\n@@ -792,6 +813,7 @@ export default React.memo<BaseProps>(function ConnectedChatInputBar(\n}),\n);\nconst nextLocalID = useSelector((state) => state.nextLocalID);\n+ const userInfos = useSelector((state) => state.userStore.userInfos);\nconst dispatch = useDispatch();\nconst dispatchActionPromise = useDispatchActionPromise();\n@@ -805,6 +827,7 @@ export default React.memo<BaseProps>(function ConnectedChatInputBar(\njoinThreadLoadingStatus={joinThreadLoadingStatus}\ncalendarQuery={calendarQuery}\nnextLocalID={nextLocalID}\n+ userInfos={userInfos}\ncolors={colors}\nstyles={styles}\nisActive={isActive}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Update notice in a thread when user blocked target Test Plan: Check if in thread with target user blocked new notice is displayed Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D422
129,183
19.11.2020 10:12:00
-3,600
809012ff596cc1f643ec64f267f5bb3938f49f28
[web] Update notice in a thread when user blocked target Test Plan: Check if in thread with target user blocked new notice is displayed Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-input-bar.react.js", "new_path": "web/chat/chat-input-bar.react.js", "diff": "@@ -11,6 +11,7 @@ import {\ntype ThreadJoinPayload,\n} from 'lib/types/thread-types';\nimport { messageTypes } from 'lib/types/message-types';\n+import { type UserInfo, userInfoPropType } from 'lib/types/user-types';\nimport {\ninputStatePropType,\ntype InputState,\n@@ -27,7 +28,12 @@ import _difference from 'lodash/fp/difference';\nimport { joinThreadActionTypes, joinThread } from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n+import {\n+ threadHasPermission,\n+ viewerIsMember,\n+ threadFrozenDueToViewerBlock,\n+ threadActualMembers,\n+} from 'lib/shared/thread-utils';\nimport { trimMessage } from 'lib/shared/message-utils';\nimport {\ntype DispatchActionPromise,\n@@ -54,6 +60,7 @@ type Props = {|\n+calendarQuery: () => CalendarQuery,\n+nextLocalID: number,\n+isThreadActive: boolean,\n+ +userInfos: { [id: string]: UserInfo },\n// Redux dispatch functions\n+dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -68,6 +75,7 @@ class ChatInputBar extends React.PureComponent<Props> {\ncalendarQuery: PropTypes.func.isRequired,\nnextLocalID: PropTypes.number.isRequired,\nisThreadActive: PropTypes.bool.isRequired,\n+ userInfos: PropTypes.objectOf(userInfoPropType).isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\njoinThread: PropTypes.func.isRequired,\n};\n@@ -233,6 +241,19 @@ class ChatInputBar extends React.PureComponent<Props> {\n</a>\n</div>\n);\n+ } else if (\n+ threadFrozenDueToViewerBlock(\n+ this.props.threadInfo,\n+ this.props.viewerID,\n+ this.props.userInfos,\n+ ) &&\n+ threadActualMembers(this.props.threadInfo.members).length === 2\n+ ) {\n+ content = (\n+ <span className={css.explanation}>\n+ You can&apos;t send messages to a user that you&apos;ve blocked.\n+ </span>\n+ );\n} else if (isMember) {\ncontent = (\n<span className={css.explanation}>\n@@ -408,6 +429,7 @@ export default React.memo<BaseProps>(function ConnectedChatInputBar(\nconst isThreadActive = useSelector(\n(state) => props.threadInfo.id === state.navInfo.activeChatThreadID,\n);\n+ const userInfos = useSelector((state) => state.userStore.userInfos);\nconst joinThreadLoadingStatus = useSelector(joinThreadLoadingStatusSelector);\nconst calendarQuery = useSelector(nonThreadCalendarQuery);\nconst dispatchActionPromise = useDispatchActionPromise();\n@@ -420,6 +442,7 @@ export default React.memo<BaseProps>(function ConnectedChatInputBar(\ncalendarQuery={calendarQuery}\nnextLocalID={nextLocalID}\nisThreadActive={isThreadActive}\n+ userInfos={userInfos}\ndispatchActionPromise={dispatchActionPromise}\njoinThread={callJoinThread}\n/>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Update notice in a thread when user blocked target Test Plan: Check if in thread with target user blocked new notice is displayed Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D423
129,183
19.11.2020 15:30:11
-3,600
5e90c90c5dc8195e8005332938af1e0b2c1dd245
Rename function Test Plan: Check if everything works Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/fetchers/thread-permission-fetchers.js", "new_path": "server/src/fetchers/thread-permission-fetchers.js", "diff": "@@ -95,7 +95,7 @@ async function checkThreads(\nconst [[result], disabledThreadIDs] = await Promise.all([\ndbQuery(query),\n- checkThreadDisabled(viewer, permissionsToCheck, threadIDs),\n+ checkThreadsFrozen(viewer, permissionsToCheck, threadIDs),\n]);\nreturn new Set(\n@@ -109,7 +109,7 @@ async function checkThreads(\n);\n}\n-async function checkThreadDisabled(\n+async function checkThreadsFrozen(\nviewer: Viewer,\npermissionsToCheck: $ReadOnlyArray<ThreadPermission>,\nthreadIDs: $ReadOnlyArray<string>,\n@@ -146,7 +146,7 @@ async function checkIfThreadIsBlocked(\nthreadID: string,\npermission: ThreadPermission,\n) {\n- const disabledThreadIDs = await checkThreadDisabled(\n+ const disabledThreadIDs = await checkThreadsFrozen(\nviewer,\n[permission],\n[threadID],\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Rename function Test Plan: Check if everything works Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D424
129,183
20.11.2020 08:08:30
-3,600
d52b16828c199563b045e86e4c6bedcc6f0c09f3
[native] Display correct notice when user can't join thread Test Plan: Check if correct notice is displayed Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-input-bar.react.js", "new_path": "native/chat/chat-input-bar.react.js", "diff": "@@ -386,11 +386,12 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nrender() {\nconst isMember = viewerIsMember(this.props.threadInfo);\n+ const canJoin = threadHasPermission(\n+ this.props.threadInfo,\n+ threadPermissions.JOIN_THREAD,\n+ );\nlet joinButton = null;\n- if (\n- !isMember &&\n- threadHasPermission(this.props.threadInfo, threadPermissions.JOIN_THREAD)\n- ) {\n+ if (!isMember && canJoin) {\nlet buttonContent;\nif (this.props.joinThreadLoadingStatus === 'loading') {\nbuttonContent = (\n@@ -452,7 +453,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nconst membersAreVoiced = !!defaultRole.permissions[\nthreadPermissions.VOICED\n];\n- if (membersAreVoiced) {\n+ if (membersAreVoiced && canJoin) {\ncontent = (\n<Text style={this.props.styles.explanation}>\nJoin this thread to send messages.\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Display correct notice when user can't join thread Test Plan: Check if correct notice is displayed Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D426
129,183
20.11.2020 08:09:37
-3,600
1f5460cfbe5cfada8540cf3e215218ce0297ab02
[web] Display correct notice when user can't join thread Test Plan: Check if correct notice is displayed Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-input-bar.react.js", "new_path": "web/chat/chat-input-bar.react.js", "diff": "@@ -172,11 +172,12 @@ class ChatInputBar extends React.PureComponent<Props> {\nrender() {\nconst isMember = viewerIsMember(this.props.threadInfo);\n+ const canJoin = threadHasPermission(\n+ this.props.threadInfo,\n+ threadPermissions.JOIN_THREAD,\n+ );\nlet joinButton = null;\n- if (\n- !isMember &&\n- threadHasPermission(this.props.threadInfo, threadPermissions.JOIN_THREAD)\n- ) {\n+ if (!isMember && canJoin) {\nlet buttonContent;\nif (this.props.joinThreadLoadingStatus === 'loading') {\nbuttonContent = (\n@@ -272,7 +273,7 @@ class ChatInputBar extends React.PureComponent<Props> {\nconst membersAreVoiced = !!defaultRole.permissions[\nthreadPermissions.VOICED\n];\n- if (membersAreVoiced) {\n+ if (membersAreVoiced && canJoin) {\ncontent = (\n<span className={css.explanation}>\nJoin this thread to send messages.\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Display correct notice when user can't join thread Test Plan: Check if correct notice is displayed Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D427
129,187
22.11.2020 21:23:48
18,000
dcb260abe2c7601144b8e19732e55407d2b32bc1
[lib] Include mostRecentNonLocalMessage in SidebarInfo Summary: We'll need this so we can call `updateUnreadStatus` for sidebars, so we can support mark-as-unread through `Swipeable`. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/chat-selectors.js", "new_path": "lib/selectors/chat-selectors.js", "diff": "@@ -34,6 +34,7 @@ import {\nmessageKey,\nrobotextForMessageInfo,\ncreateMessageInfo,\n+ getMostRecentNonLocalMessageID,\n} from '../shared/message-utils';\nimport { threadInfoSelector, sidebarInfoSelector } from './thread-selectors';\nimport { threadInChatList, threadIsTopLevel } from '../shared/thread-utils';\n@@ -70,6 +71,7 @@ const chatThreadItemPropType = PropTypes.exact({\ntype: PropTypes.oneOf(['sidebar']).isRequired,\nthreadInfo: threadInfoPropType.isRequired,\nlastUpdatedTime: PropTypes.number.isRequired,\n+ mostRecentNonLocalMessage: PropTypes.string,\n}),\nPropTypes.exact({\ntype: PropTypes.oneOf(['seeMore']).isRequired,\n@@ -104,14 +106,6 @@ function getMostRecentMessageInfo(\nreturn null;\n}\n-function getMostRecentNonLocalMessage(\n- threadInfo: ThreadInfo,\n- messageStore: MessageStore,\n-): ?string {\n- const thread = messageStore.threads[threadInfo.id];\n- return thread?.messageIDs.find((id) => !id.startsWith('local'));\n-}\n-\nfunction getLastUpdatedTime(\nthreadInfo: ThreadInfo,\nmostRecentMessageInfo: ?MessageInfo,\n@@ -132,7 +126,7 @@ function createChatThreadItem(\nmessageStore,\nmessages,\n);\n- const mostRecentNonLocalMessage = getMostRecentNonLocalMessage(\n+ const mostRecentNonLocalMessage = getMostRecentNonLocalMessageID(\nthreadInfo,\nmessageStore,\n);\n" }, { "change_type": "MODIFY", "old_path": "lib/selectors/thread-selectors.js", "new_path": "lib/selectors/thread-selectors.js", "diff": "@@ -44,6 +44,7 @@ import {\nfilteredThreadIDsSelector,\nincludeDeletedSelector,\n} from './calendar-filter-selectors';\n+import { getMostRecentNonLocalMessageID } from '../shared/message-utils';\ntype ThreadInfoSelectorType = (\nstate: BaseAppState<*>,\n@@ -248,9 +249,14 @@ const sidebarInfoSelector: (\n);\nconst lastUpdatedTime =\nmostRecentRawMessageInfo?.time ?? childThreadInfo.creationTime;\n+ const mostRecentNonLocalMessage = getMostRecentNonLocalMessageID(\n+ childThreadInfo,\n+ messageStore,\n+ );\nsidebarInfos.push({\nthreadInfo: childThreadInfo,\nlastUpdatedTime,\n+ mostRecentNonLocalMessage,\n});\n}\nreturn _orderBy('lastUpdatedTime')('desc')(sidebarInfos);\n" }, { "change_type": "MODIFY", "old_path": "lib/shared/message-utils.js", "new_path": "lib/shared/message-utils.js", "diff": "@@ -17,6 +17,7 @@ import {\ntype MultimediaMessageData,\ntype MediaMessageData,\ntype ImagesMessageData,\n+ type MessageStore,\nmessageTypes,\nmessageTruncationStatus,\n} from '../types/message-types';\n@@ -926,6 +927,14 @@ function createMessageReply(message: string) {\nreturn quotedMessage + '\\n\\n';\n}\n+function getMostRecentNonLocalMessageID(\n+ threadInfo: ThreadInfo,\n+ messageStore: MessageStore,\n+): ?string {\n+ const thread = messageStore.threads[threadInfo.id];\n+ return thread?.messageIDs.find((id) => !id.startsWith('local'));\n+}\n+\nexport {\nmessageKey,\nmessageID,\n@@ -947,4 +956,5 @@ export {\nstripLocalIDs,\ntrimMessage,\ncreateMessageReply,\n+ getMostRecentNonLocalMessageID,\n};\n" }, { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -367,6 +367,7 @@ export type ThreadJoinPayload = {|\nexport type SidebarInfo = {|\n+threadInfo: ThreadInfo,\n+lastUpdatedTime: number,\n+ +mostRecentNonLocalMessage: ?string,\n|};\n// We can show a max of 3 sidebars inline underneath their parent in the chat\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "@@ -97,10 +97,10 @@ function ChatThreadListItem({\nconst sidebars = data.sidebars.map((sidebarItem) => {\nif (sidebarItem.type === 'sidebar') {\n+ const { type, ...sidebarInfo } = sidebarItem;\nreturn (\n<ChatThreadListSidebar\n- threadInfo={sidebarItem.threadInfo}\n- lastUpdatedTime={sidebarItem.lastUpdatedTime}\n+ {...sidebarInfo}\nonPressItem={onPressItem}\nkey={sidebarItem.threadInfo.id}\n/>\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-sidebar.react.js", "new_path": "native/chat/chat-thread-list-sidebar.react.js", "diff": "// @flow\n-import type { ThreadInfo } from 'lib/types/thread-types';\n+import type { ThreadInfo, SidebarInfo } from 'lib/types/thread-types';\nimport type { ViewStyle } from '../types/styles';\nimport * as React from 'react';\n@@ -14,8 +14,7 @@ import Button from '../components/button.react';\nimport { SingleLine } from '../components/single-line.react';\ntype Props = {|\n- +threadInfo: ThreadInfo,\n- +lastUpdatedTime: number,\n+ ...SidebarInfo,\n+onPressItem: (threadInfo: ThreadInfo) => void,\n+style?: ?ViewStyle,\n|};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Include mostRecentNonLocalMessage in SidebarInfo Summary: We'll need this so we can call `updateUnreadStatus` for sidebars, so we can support mark-as-unread through `Swipeable`. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D432
129,187
22.11.2020 21:47:03
18,000
452309d5f106644113594dd87956bba972fa7992
[native] Factor out ChatThreadListItem swipeability into SwipeableThread Summary: I want to extract that functionality so I can use it for sidebars as well. Test Plan: Flow, render the `ChatThreadList`, make sure swipe and mark-as-unread still work Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "@@ -5,25 +5,10 @@ import {\nchatThreadItemPropType,\n} from 'lib/selectors/chat-selectors';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n-import type {\n- SetThreadUnreadStatusPayload,\n- SetThreadUnreadStatusRequest,\n-} from 'lib/types/activity-types';\n-import {\n- useDispatchActionPromise,\n- useServerCall,\n-} from 'lib/utils/action-utils';\n-import {\n- setThreadUnreadStatus,\n- setThreadUnreadStatusActionTypes,\n-} from 'lib/actions/activity-actions';\nimport * as React from 'react';\nimport { Text, View } from 'react-native';\nimport PropTypes from 'prop-types';\n-import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';\n-import Swipeable from '../components/swipeable';\n-import { useNavigation } from '@react-navigation/native';\nimport { shortAbsoluteDate } from 'lib/utils/date-utils';\n@@ -32,9 +17,9 @@ import MessagePreview from './message-preview.react';\nimport ColorSplotch from '../components/color-splotch.react';\nimport { useColors, useStyles } from '../themes/colors';\nimport { SingleLine } from '../components/single-line.react';\n-import { useMemo } from 'react';\nimport ChatThreadListSidebar from './chat-thread-list-sidebar.react';\nimport ChatThreadListSeeMoreSidebars from './chat-thread-list-see-more-sidebars.react';\n+import SwipeableThread from './swipeable-thread.react';\ntype Props = {|\n+data: ChatThreadItem,\n@@ -50,33 +35,8 @@ function ChatThreadListItem({\nonSwipeableWillOpen,\ncurrentlyOpenedSwipeableId,\n}: Props) {\n- const swipeable = React.useRef<?Swipeable>();\n- const navigation = useNavigation();\nconst styles = useStyles(unboundStyles);\nconst colors = useColors();\n- const updateUnreadStatus: (\n- request: SetThreadUnreadStatusRequest,\n- ) => Promise<SetThreadUnreadStatusPayload> = useServerCall(\n- setThreadUnreadStatus,\n- );\n- const dispatchActionPromise = useDispatchActionPromise();\n-\n- React.useEffect(() => {\n- return navigation.addListener('blur', () => {\n- if (swipeable.current) {\n- swipeable.current.close();\n- }\n- });\n- }, [navigation, swipeable]);\n-\n- React.useEffect(() => {\n- if (\n- swipeable.current &&\n- data.threadInfo.id !== currentlyOpenedSwipeableId\n- ) {\n- swipeable.current.close();\n- }\n- }, [currentlyOpenedSwipeableId, swipeable, data.threadInfo.id]);\nconst lastMessage = React.useMemo(() => {\nconst mostRecentMessageInfo = data.mostRecentMessageInfo;\n@@ -121,62 +81,17 @@ function ChatThreadListItem({\nonPressItem(data.threadInfo);\n}, [onPressItem, data.threadInfo]);\n- const onSwipeableRightWillOpen = React.useCallback(() => {\n- onSwipeableWillOpen(data.threadInfo);\n- }, [onSwipeableWillOpen, data.threadInfo]);\n-\nconst lastActivity = shortAbsoluteDate(data.lastUpdatedTime);\nconst unreadStyle = data.threadInfo.currentUser.unread ? styles.unread : null;\n- const swipeableActions = useMemo(() => {\n- const isUnread = data.threadInfo.currentUser.unread;\n- const toggleUnreadStatus = () => {\n- const request = {\n- unread: !isUnread,\n- threadID: data.threadInfo.id,\n- latestMessage: data.mostRecentNonLocalMessage,\n- };\n- dispatchActionPromise(\n- setThreadUnreadStatusActionTypes,\n- updateUnreadStatus(request),\n- undefined,\n- {\n- threadID: data.threadInfo.id,\n- unread: !isUnread,\n- },\n- );\n- if (swipeable.current) {\n- swipeable.current.close();\n- }\n- };\n- return [\n- {\n- key: 'action1',\n- onPress: toggleUnreadStatus,\n- color: isUnread ? colors.redButton : colors.greenButton,\n- content: (\n- <MaterialIcon\n- name={isUnread ? 'email-open-outline' : 'email-mark-as-unread'}\n- size={24}\n- />\n- ),\n- },\n- ];\n- }, [\n- colors,\n- data.threadInfo,\n- data.mostRecentNonLocalMessage,\n- updateUnreadStatus,\n- dispatchActionPromise,\n- ]);\n-\nreturn (\n<>\n- <Swipeable\n- buttonWidth={60}\n- innerRef={swipeable}\n- onSwipeableRightWillOpen={onSwipeableRightWillOpen}\n- rightActions={swipeableActions}\n+ <SwipeableThread\n+ threadInfo={data.threadInfo}\n+ mostRecentNonLocalMessage={data.mostRecentNonLocalMessage}\n+ onSwipeableWillOpen={onSwipeableWillOpen}\n+ currentlyOpenedSwipeableId={currentlyOpenedSwipeableId}\n+ iconSize={24}\n>\n<Button\nonPress={onPress}\n@@ -201,7 +116,7 @@ function ChatThreadListItem({\n</View>\n</View>\n</Button>\n- </Swipeable>\n+ </SwipeableThread>\n{sidebars}\n</>\n);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/chat/swipeable-thread.react.js", "diff": "+// @flow\n+\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+import type {\n+ SetThreadUnreadStatusPayload,\n+ SetThreadUnreadStatusRequest,\n+} from 'lib/types/activity-types';\n+import {\n+ useDispatchActionPromise,\n+ useServerCall,\n+} from 'lib/utils/action-utils';\n+import {\n+ setThreadUnreadStatus,\n+ setThreadUnreadStatusActionTypes,\n+} from 'lib/actions/activity-actions';\n+\n+import * as React from 'react';\n+import { useNavigation } from '@react-navigation/native';\n+import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';\n+\n+import Swipeable from '../components/swipeable';\n+import { useColors } from '../themes/colors';\n+\n+type Props = {|\n+ +threadInfo: ThreadInfo,\n+ +mostRecentNonLocalMessage: ?string,\n+ +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void,\n+ +currentlyOpenedSwipeableId?: string,\n+ +iconSize: number,\n+ +children: React.Node,\n+|};\n+function SwipeableThread(props: Props) {\n+ const swipeable = React.useRef<?Swipeable>();\n+ const navigation = useNavigation();\n+ React.useEffect(() => {\n+ return navigation.addListener('blur', () => {\n+ if (swipeable.current) {\n+ swipeable.current.close();\n+ }\n+ });\n+ }, [navigation, swipeable]);\n+\n+ const { threadInfo, currentlyOpenedSwipeableId } = props;\n+ React.useEffect(() => {\n+ if (swipeable.current && threadInfo.id !== currentlyOpenedSwipeableId) {\n+ swipeable.current.close();\n+ }\n+ }, [currentlyOpenedSwipeableId, swipeable, threadInfo.id]);\n+\n+ const { onSwipeableWillOpen } = props;\n+ const onSwipeableRightWillOpen = React.useCallback(() => {\n+ onSwipeableWillOpen(threadInfo);\n+ }, [onSwipeableWillOpen, threadInfo]);\n+\n+ const colors = useColors();\n+ const { mostRecentNonLocalMessage, iconSize } = props;\n+ const updateUnreadStatus: (\n+ request: SetThreadUnreadStatusRequest,\n+ ) => Promise<SetThreadUnreadStatusPayload> = useServerCall(\n+ setThreadUnreadStatus,\n+ );\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const swipeableActions = React.useMemo(() => {\n+ const isUnread = threadInfo.currentUser.unread;\n+ const toggleUnreadStatus = () => {\n+ const request = {\n+ unread: !isUnread,\n+ threadID: threadInfo.id,\n+ latestMessage: mostRecentNonLocalMessage,\n+ };\n+ dispatchActionPromise(\n+ setThreadUnreadStatusActionTypes,\n+ updateUnreadStatus(request),\n+ undefined,\n+ {\n+ threadID: threadInfo.id,\n+ unread: !isUnread,\n+ },\n+ );\n+ if (swipeable.current) {\n+ swipeable.current.close();\n+ }\n+ };\n+ return [\n+ {\n+ key: 'action1',\n+ onPress: toggleUnreadStatus,\n+ color: isUnread ? colors.redButton : colors.greenButton,\n+ content: (\n+ <MaterialIcon\n+ name={isUnread ? 'email-open-outline' : 'email-mark-as-unread'}\n+ size={iconSize}\n+ />\n+ ),\n+ },\n+ ];\n+ }, [\n+ colors,\n+ threadInfo,\n+ mostRecentNonLocalMessage,\n+ iconSize,\n+ updateUnreadStatus,\n+ dispatchActionPromise,\n+ ]);\n+\n+ return (\n+ <Swipeable\n+ buttonWidth={60}\n+ innerRef={swipeable}\n+ onSwipeableRightWillOpen={onSwipeableRightWillOpen}\n+ rightActions={swipeableActions}\n+ >\n+ {props.children}\n+ </Swipeable>\n+ );\n+}\n+\n+export default SwipeableThread;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Factor out ChatThreadListItem swipeability into SwipeableThread Summary: I want to extract that functionality so I can use it for sidebars as well. Test Plan: Flow, render the `ChatThreadList`, make sure swipe and mark-as-unread still work Reviewers: palys-swm, KatPo Reviewed By: KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D433
129,183
23.11.2020 07:24:31
-3,600
d425cd9f5779e3196a031df8b3a184deee998766
Make user search case-insensitive Test Plan: Check if for a prefix results include users with both upper and lower case username Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/search/users.js", "new_path": "server/src/search/users.js", "diff": "@@ -11,7 +11,7 @@ async function searchForUsers(\nconst sqlQuery = SQL`SELECT id, username FROM users `;\nconst prefix = query.prefix;\nif (prefix) {\n- sqlQuery.append(SQL`WHERE username LIKE ${prefix + '%'} `);\n+ sqlQuery.append(SQL`WHERE LOWER(username) LIKE LOWER(${prefix + '%'}) `);\n}\nsqlQuery.append(SQL`LIMIT 20`);\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Make user search case-insensitive Test Plan: Check if for a prefix results include users with both upper and lower case username Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D435
129,187
23.11.2020 20:07:49
18,000
053cbd705752b2c5fdf4695659063bd3c69dbe35
[native] Extract useMessageListContext from MessageListContainer Summary: We have another place we need to render `MessageListContext.Provider`: `TextMessageTooltipButton`. This is so the `InnerTextMessage` inside has access to Markdown rules. Test Plan: Flow, will test in combination with later diffs Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/message-list-container.react.js", "new_path": "native/chat/message-list-container.react.js", "diff": "@@ -33,8 +33,10 @@ import {\ntype OverlayContextType,\n} from '../navigation/overlay-context';\nimport { useSelector } from '../redux/redux-utils';\n-import { useTextMessageRulesFunc } from '../markdown/rules.react';\n-import { MessageListContext } from './message-list-types';\n+import {\n+ MessageListContext,\n+ useMessageListContext,\n+} from './message-list-types';\nexport type ChatMessageItemWithHeight =\n| {| itemType: 'loader' |}\n@@ -281,15 +283,7 @@ export default React.memo<BaseProps>(function ConnectedMessageListContainer(\nconst styles = useStyles(unboundStyles);\nconst inputState = React.useContext(InputStateContext);\nconst overlayContext = React.useContext(OverlayContext);\n-\n- const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadID);\n- const messageListContext = React.useMemo(\n- () => ({\n- getTextMessageMarkdownRules,\n- }),\n- [getTextMessageMarkdownRules],\n- );\n-\n+ const messageListContext = useMessageListContext(threadID);\nreturn (\n<MessageListContext.Provider value={messageListContext}>\n<MessageListContainer\n" }, { "change_type": "MODIFY", "old_path": "native/chat/message-list-types.js", "new_path": "native/chat/message-list-types.js", "diff": "@@ -7,12 +7,14 @@ import { type UserInfo, userInfoPropType } from 'lib/types/user-types';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\n+import { useTextMessageRulesFunc } from '../markdown/rules.react';\n+\nexport type MessageListParams = {|\nthreadInfo: ThreadInfo,\npendingPersonalThreadUserInfo?: UserInfo,\n|};\n-export const messageListRoutePropType = PropTypes.shape({\n+const messageListRoutePropType = PropTypes.shape({\nkey: PropTypes.string.isRequired,\nparams: PropTypes.shape({\nthreadInfo: threadInfoPropType.isRequired,\n@@ -20,7 +22,7 @@ export const messageListRoutePropType = PropTypes.shape({\n}).isRequired,\n});\n-export const messageListNavPropType = PropTypes.shape({\n+const messageListNavPropType = PropTypes.shape({\nnavigate: PropTypes.func.isRequired,\nsetParams: PropTypes.func.isRequired,\nsetOptions: PropTypes.func.isRequired,\n@@ -33,4 +35,21 @@ export type MessageListContextType = {|\n+getTextMessageMarkdownRules: (useDarkStyle: boolean) => MarkdownRules,\n|};\n-export const MessageListContext = React.createContext<?MessageListContextType>();\n+const MessageListContext = React.createContext<?MessageListContextType>();\n+\n+function useMessageListContext(threadID: string) {\n+ const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadID);\n+ return React.useMemo(\n+ () => ({\n+ getTextMessageMarkdownRules,\n+ }),\n+ [getTextMessageMarkdownRules],\n+ );\n+}\n+\n+export {\n+ messageListRoutePropType,\n+ messageListNavPropType,\n+ MessageListContext,\n+ useMessageListContext,\n+};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Extract useMessageListContext from MessageListContainer Summary: We have another place we need to render `MessageListContext.Provider`: `TextMessageTooltipButton`. This is so the `InnerTextMessage` inside has access to Markdown rules. Test Plan: Flow, will test in combination with later diffs Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D439
129,187
23.11.2020 20:12:33
18,000
95737fe106e3544e5d7b612306e902933cef2767
[native] Set MessageListContext in TextMessageTooltipButton Summary: We need this so `InnerTextMessage` has access to Markdown rules. Test Plan: Bring up `TextMessageTooltipModal` and make sure it looks correct Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/text-message-tooltip-button.react.js", "new_path": "native/chat/text-message-tooltip-button.react.js", "diff": "@@ -9,6 +9,10 @@ import Animated from 'react-native-reanimated';\nimport { InnerTextMessage } from './inner-text-message.react';\nimport { MessageHeader } from './message-header.react';\nimport { useSelector } from '../redux/redux-utils';\n+import {\n+ MessageListContext,\n+ useMessageListContext,\n+} from './message-list-types';\n/* eslint-disable import/no-named-as-default-member */\nconst { Value } = Animated;\n@@ -34,15 +38,18 @@ function TextMessageTooltipButton(props: Props) {\n};\n}, [progress, windowWidth, initialCoordinates]);\n- const { navigation } = props;\nconst { item } = props.route.params;\n+ const threadID = item.threadInfo.id;\n+ const messageListContext = useMessageListContext(threadID);\n+\n+ const { navigation } = props;\nreturn (\n- <>\n+ <MessageListContext.Provider value={messageListContext}>\n<Animated.View style={headerStyle}>\n<MessageHeader item={item} focused={true} display=\"modal\" />\n</Animated.View>\n<InnerTextMessage item={item} onPress={navigation.goBackOnce} />\n- </>\n+ </MessageListContext.Provider>\n);\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Set MessageListContext in TextMessageTooltipButton Summary: We need this so `InnerTextMessage` has access to Markdown rules. Test Plan: Bring up `TextMessageTooltipModal` and make sure it looks correct Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D440
129,183
25.11.2020 15:28:07
-3,600
8901a96cd0c9cfb867a91c952000ac2ab6cb3790
[lib] Introduce userStoreSearchIndex selector Test Plan: Tested in D436 Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/user-selectors.js", "new_path": "lib/selectors/user-selectors.js", "diff": "@@ -157,6 +157,23 @@ const isLoggedIn = (state: BaseAppState<*>) =>\nstate.dataLoaded\n);\n+const userStoreSearchIndex: (\n+ state: BaseAppState<*>,\n+) => SearchIndex = createSelector(\n+ (state: BaseAppState<*>) => state.userStore.userInfos,\n+ (userInfos: UserInfos) => {\n+ const searchIndex = new SearchIndex();\n+ for (const id in userInfos) {\n+ const { username } = userInfos[id];\n+ if (!username) {\n+ continue;\n+ }\n+ searchIndex.addEntry(id, username);\n+ }\n+ return searchIndex;\n+ },\n+);\n+\nexport {\nuserIDsToRelativeUserInfos,\nrelativeMemberInfoSelectorForMembersOfThread,\n@@ -164,4 +181,5 @@ export {\nsearchIndexFromUserInfos,\nuserSearchIndexForPotentialMembers,\nisLoggedIn,\n+ userStoreSearchIndex,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Introduce userStoreSearchIndex selector Test Plan: Tested in D436 Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D443
129,183
26.11.2020 13:19:58
-3,600
8bf12fb18244503c96b285a74171ae88c729f115
[lib] Filter anonymus users out of relationships Test Plan: Flow Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/selectors/relationship-selectors.js", "new_path": "lib/selectors/relationship-selectors.js", "diff": "@@ -20,19 +20,22 @@ const userRelationshipsSelector: (\nconst blocked = [];\nfor (const userID in userInfos) {\nconst userInfo = userInfos[userID];\n- const { relationshipStatus } = userInfo;\n+ const { id, username, relationshipStatus } = userInfo;\n+ if (!username) {\n+ continue;\n+ }\nif (\nrelationshipStatus === userRelationshipStatus.REQUEST_RECEIVED ||\nrelationshipStatus === userRelationshipStatus.REQUEST_SENT\n) {\n- unorderedFriendRequests.push(userInfo);\n+ unorderedFriendRequests.push({ id, username, relationshipStatus });\n} else if (relationshipStatus === userRelationshipStatus.FRIEND) {\n- unorderedFriends.push(userInfo);\n+ unorderedFriends.push({ id, username, relationshipStatus });\n} else if (\nrelationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER ||\nrelationshipStatus === userRelationshipStatus.BOTH_BLOCKED\n) {\n- blocked.push(userInfo);\n+ blocked.push({ id, username, relationshipStatus });\n}\n}\nconst friendRequests = _orderBy('relationshipStatus')('desc')(\n" }, { "change_type": "MODIFY", "old_path": "lib/types/relationship-types.js", "new_path": "lib/types/relationship-types.js", "diff": "// @flow\n-import type { UserInfo } from './user-types';\n+import type { AccountUserInfo } from './user-types';\nimport { values } from '../utils/objects';\n@@ -62,6 +62,6 @@ export type RelationshipErrors = $Shape<{|\n|}>;\nexport type UserRelationships = {|\n- +friends: $ReadOnlyArray<UserInfo>,\n- +blocked: $ReadOnlyArray<UserInfo>,\n+ +friends: $ReadOnlyArray<AccountUserInfo>,\n+ +blocked: $ReadOnlyArray<AccountUserInfo>,\n|};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[lib] Filter anonymus users out of relationships Test Plan: Flow Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D446
129,187
26.11.2020 21:13:28
18,000
9f72a0876b3f7b16bbb244c6181e9bc8cab6119a
[native] Remove PropTypes from ChatThreadListItem Summary: We haven't been using this for function components, and this one in particular hasn't been updated. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "// @flow\n-import {\n- type ChatThreadItem,\n- chatThreadItemPropType,\n-} from 'lib/selectors/chat-selectors';\n+import type { ChatThreadItem } from 'lib/selectors/chat-selectors';\nimport type { ThreadInfo } from 'lib/types/thread-types';\nimport * as React from 'react';\nimport { Text, View } from 'react-native';\n-import PropTypes from 'prop-types';\nimport { shortAbsoluteDate } from 'lib/utils/date-utils';\n@@ -165,11 +161,4 @@ const unboundStyles = {\n},\n};\n-ChatThreadListItem.propTypes = {\n- data: chatThreadItemPropType.isRequired,\n- onPressItem: PropTypes.func.isRequired,\n- onSwipeableWillOpen: PropTypes.func.isRequired,\n- currentlyOpenedSwipeableId: PropTypes.string,\n-};\n-\nexport default ChatThreadListItem;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Remove PropTypes from ChatThreadListItem Summary: We haven't been using this for function components, and this one in particular hasn't been updated. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D450
129,187
27.11.2020 23:59:05
18,000
74ded68b7d054e4d21f95607c33310c901cfa423
[web] Extract ChatThreadListItemMenu Summary: I'll need to reuse this for sidebars. Test Plan: Test menu and mark-as-read/mark-as-unread functionality Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "ADD", "old_path": null, "new_path": "web/chat/chat-thread-list-item-menu.react.js", "diff": "+// @flow\n+\n+import type {\n+ SetThreadUnreadStatusPayload,\n+ SetThreadUnreadStatusRequest,\n+} from 'lib/types/activity-types';\n+import type { ChatThreadItem } from 'lib/selectors/chat-selectors';\n+\n+import * as React from 'react';\n+import classNames from 'classnames';\n+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\n+import { faEllipsisV } from '@fortawesome/free-solid-svg-icons';\n+\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+} from 'lib/utils/action-utils';\n+import {\n+ setThreadUnreadStatusActionTypes,\n+ setThreadUnreadStatus,\n+} from 'lib/actions/activity-actions';\n+\n+import css from './chat-thread-list.css';\n+\n+type Props = {|\n+ +item: ChatThreadItem,\n+|};\n+function ChatThreadListItemMenu(props: Props) {\n+ const [menuVisible, setMenuVisible] = React.useState(false);\n+\n+ const toggleMenu = React.useCallback(() => {\n+ setMenuVisible(!menuVisible);\n+ }, [menuVisible]);\n+\n+ const hideMenu = React.useCallback(() => {\n+ setMenuVisible(false);\n+ }, []);\n+\n+ const { threadInfo, mostRecentNonLocalMessage } = props.item;\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const boundSetThreadUnreadStatus: (\n+ request: SetThreadUnreadStatusRequest,\n+ ) => Promise<SetThreadUnreadStatusPayload> = useServerCall(\n+ setThreadUnreadStatus,\n+ );\n+ const toggleUnreadStatus = React.useCallback(() => {\n+ const { unread } = threadInfo.currentUser;\n+ const request = {\n+ threadID: threadInfo.id,\n+ unread: !unread,\n+ latestMessage: mostRecentNonLocalMessage,\n+ };\n+ dispatchActionPromise(\n+ setThreadUnreadStatusActionTypes,\n+ boundSetThreadUnreadStatus(request),\n+ undefined,\n+ {\n+ threadID: threadInfo.id,\n+ unread: !unread,\n+ },\n+ );\n+ hideMenu();\n+ }, [\n+ threadInfo,\n+ mostRecentNonLocalMessage,\n+ dispatchActionPromise,\n+ hideMenu,\n+ boundSetThreadUnreadStatus,\n+ ]);\n+\n+ const toggleUnreadStatusButtonText = `Mark as ${\n+ threadInfo.currentUser.unread ? 'read' : 'unread'\n+ }`;\n+ return (\n+ <div className={css.menu} onMouseLeave={hideMenu}>\n+ <button onClick={toggleMenu}>\n+ <FontAwesomeIcon icon={faEllipsisV} />\n+ </button>\n+ <div\n+ className={classNames(css.menuContent, {\n+ [css.menuContentVisible]: menuVisible,\n+ })}\n+ >\n+ <ul>\n+ <li>\n+ <button onClick={toggleUnreadStatus}>\n+ {toggleUnreadStatusButtonText}\n+ </button>\n+ </li>\n+ </ul>\n+ </div>\n+ </div>\n+ );\n+}\n+\n+export default ChatThreadListItemMenu;\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "@@ -10,23 +10,16 @@ import {\nnavInfoPropType,\nupdateNavInfoActionType,\n} from '../redux/redux-setup';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\n-import { setThreadUnreadStatusActionTypes } from 'lib/actions/activity-actions';\n-import type {\n- SetThreadUnreadStatusPayload,\n- SetThreadUnreadStatusRequest,\n-} from 'lib/types/activity-types';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n-import { faEllipsisV } from '@fortawesome/free-solid-svg-icons';\n-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { shortAbsoluteDate } from 'lib/utils/date-utils';\nimport css from './chat-thread-list.css';\nimport MessagePreview from './message-preview.react';\n+import ChatThreadListItemMenu from './chat-thread-list-item-menu.react';\ntype Props = {|\n+item: ChatThreadItem,\n@@ -34,26 +27,14 @@ type Props = {|\n+navInfo: NavInfo,\n+timeZone: ?string,\n+dispatch: Dispatch,\n- +dispatchActionPromise: DispatchActionPromise,\n- +setThreadUnreadStatus: (\n- request: SetThreadUnreadStatusRequest,\n- ) => Promise<SetThreadUnreadStatusPayload>,\n|};\n-type State = {|\n- +menuVisible: boolean,\n-|};\n-class ChatThreadListItem extends React.PureComponent<Props, State> {\n+class ChatThreadListItem extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatThreadItemPropType.isRequired,\nactive: PropTypes.bool.isRequired,\nnavInfo: navInfoPropType.isRequired,\ntimeZone: PropTypes.string,\ndispatch: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- setThreadUnreadStatus: PropTypes.func.isRequired,\n- };\n- state: State = {\n- menuVisible: false,\n};\nrender() {\n@@ -84,26 +65,7 @@ class ChatThreadListItem extends React.PureComponent<Props, State> {\n</div>\n</div>\n</a>\n- <div className={css.menu} onMouseLeave={this.hideMenu}>\n- <button onClick={this.toggleMenu}>\n- <FontAwesomeIcon icon={faEllipsisV} />\n- </button>\n- <div\n- className={classNames(css.menuContent, {\n- [css.menuContentVisible]: this.state.menuVisible,\n- })}\n- >\n- <ul>\n- <li>\n- <button onClick={this.toggleUnreadStatus}>\n- {`Mark as ${\n- item.threadInfo.currentUser.unread ? 'read' : 'unread'\n- }`}\n- </button>\n- </li>\n- </ul>\n- </div>\n- </div>\n+ <ChatThreadListItemMenu item={item} />\n</div>\n);\n}\n@@ -118,34 +80,6 @@ class ChatThreadListItem extends React.PureComponent<Props, State> {\n},\n});\n};\n-\n- toggleMenu = () => {\n- this.setState((state) => ({ menuVisible: !state.menuVisible }));\n- };\n-\n- hideMenu = () => {\n- this.setState({ menuVisible: false });\n- };\n-\n- toggleUnreadStatus = () => {\n- const { threadInfo, mostRecentNonLocalMessage } = this.props.item;\n- const isUnread = threadInfo.currentUser.unread;\n- const request = {\n- threadID: threadInfo.id,\n- unread: !isUnread,\n- latestMessage: mostRecentNonLocalMessage,\n- };\n- this.props.dispatchActionPromise(\n- setThreadUnreadStatusActionTypes,\n- this.props.setThreadUnreadStatus(request),\n- undefined,\n- {\n- threadID: threadInfo.id,\n- unread: !threadInfo.currentUser.unread,\n- },\n- );\n- this.hideMenu();\n- };\n}\nexport default ChatThreadListItem;\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list.react.js", "new_path": "web/chat/chat-thread-list.react.js", "diff": "@@ -6,22 +6,12 @@ import {\ntype ChatThreadItem,\nchatThreadItemPropType,\n} from 'lib/selectors/chat-selectors';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n-import type {\n- SetThreadUnreadStatusPayload,\n- SetThreadUnreadStatusRequest,\n-} from 'lib/types/activity-types';\n-import { setThreadUnreadStatus } from 'lib/actions/activity-actions';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { useDispatch } from 'react-redux';\n-import {\n- useDispatchActionPromise,\n- useServerCall,\n-} from 'lib/utils/action-utils';\nimport { webChatListData } from '../selectors/chat-selectors';\nimport { useSelector } from '../redux/redux-utils';\n@@ -39,11 +29,6 @@ type Props = {|\n+timeZone: ?string,\n// Redux dispatch functions\n+dispatch: Dispatch,\n- +dispatchActionPromise: DispatchActionPromise,\n- // async functions that hit server APIs\n- +setThreadUnreadStatus: (\n- request: SetThreadUnreadStatusRequest,\n- ) => Promise<SetThreadUnreadStatusPayload>,\n|};\nclass ChatThreadList extends React.PureComponent<Props> {\nstatic propTypes = {\n@@ -53,8 +38,6 @@ class ChatThreadList extends React.PureComponent<Props> {\nnavInfo: navInfoPropType.isRequired,\ntimeZone: PropTypes.string,\ndispatch: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- setThreadUnreadStatus: PropTypes.func.isRequired,\n};\nrender() {\n@@ -67,8 +50,6 @@ class ChatThreadList extends React.PureComponent<Props> {\nnavInfo={this.props.navInfo}\ntimeZone={this.props.timeZone}\ndispatch={this.props.dispatch}\n- dispatchActionPromise={this.props.dispatchActionPromise}\n- setThreadUnreadStatus={this.props.setThreadUnreadStatus}\nkey={item.threadInfo.id}\n/>\n));\n@@ -89,9 +70,6 @@ export default React.memo<BaseProps>(function ConnectedChatThreadList(\nconst navInfo = useSelector((state) => state.navInfo);\nconst timeZone = useSelector((state) => state.timeZone);\nconst dispatch = useDispatch();\n- const dispatchActionPromise = useDispatchActionPromise();\n- const callSetThreadUnreadStatus = useServerCall(setThreadUnreadStatus);\n-\nreturn (\n<ChatThreadList\n{...props}\n@@ -99,8 +77,6 @@ export default React.memo<BaseProps>(function ConnectedChatThreadList(\nnavInfo={navInfo}\ntimeZone={timeZone}\ndispatch={dispatch}\n- dispatchActionPromise={dispatchActionPromise}\n- setThreadUnreadStatus={callSetThreadUnreadStatus}\n/>\n);\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Extract ChatThreadListItemMenu Summary: I'll need to reuse this for sidebars. Test Plan: Test menu and mark-as-read/mark-as-unread functionality Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D451
129,187
28.11.2020 23:34:28
18,000
e84cb9004cf10754e2e2c2e30ea77d7a5e336948
[web] Use Hook for data-binding in AccountBar Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/account-bar.react.js", "new_path": "web/account-bar.react.js", "diff": "// @flow\n-import type { AppState } from './redux/redux-setup';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { LogOutResult } from 'lib/types/account-types';\n-import {\n- type CurrentUserInfo,\n- currentUserPropType,\n-} from 'lib/types/user-types';\n-import {\n- type PreRequestUserState,\n- preRequestUserStatePropType,\n-} from 'lib/types/session-types';\n+import type { CurrentUserInfo } from 'lib/types/user-types';\n+import type { PreRequestUserState } from 'lib/types/session-types';\nimport * as React from 'react';\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport { logOut, logOutActionTypes } from 'lib/actions/user-actions';\n-import { connect } from 'lib/utils/redux-utils';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+ type DispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport css from './style.css';\nimport LogInModal from './modals/account/log-in-modal.react';\n@@ -26,28 +21,25 @@ import RegisterModal from './modals/account/register-modal.react';\nimport UserSettingsModal from './modals/account/user-settings-modal.react.js';\nimport { UpCaret, DownCaret } from './vectors.react';\nimport { htmlTargetFromEvent } from './vector-utils';\n+import { useSelector } from './redux/redux-utils';\n+type BaseProps = {|\n+ +setModal: (modal: ?React.Node) => void,\n+|};\ntype Props = {|\n- setModal: (modal: ?React.Node) => void,\n+ ...BaseProps,\n// Redux state\n- currentUserInfo: ?CurrentUserInfo,\n- preRequestUserState: PreRequestUserState,\n+ +currentUserInfo: ?CurrentUserInfo,\n+ +preRequestUserState: PreRequestUserState,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,\n+ +logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,\n|};\ntype State = {|\n- expanded: boolean,\n+ +expanded: boolean,\n|};\nclass AccountBar extends React.PureComponent<Props, State> {\n- static propTypes = {\n- setModal: PropTypes.func.isRequired,\n- currentUserInfo: currentUserPropType,\n- preRequestUserState: preRequestUserStatePropType.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- logOut: PropTypes.func.isRequired,\n- };\nstate: State = {\nexpanded: false,\n};\n@@ -193,10 +185,20 @@ class AccountBar extends React.PureComponent<Props, State> {\n};\n}\n-export default connect(\n- (state: AppState) => ({\n- currentUserInfo: state.currentUserInfo,\n- preRequestUserState: preRequestUserStateSelector(state),\n- }),\n- { logOut },\n-)(AccountBar);\n+export default React.memo<BaseProps>(function ConnectedAccountBar(\n+ props: BaseProps,\n+) {\n+ const currentUserInfo = useSelector((state) => state.currentUserInfo);\n+ const preRequestUserState = useSelector(preRequestUserStateSelector);\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const boundLogOut = useServerCall(logOut);\n+ return (\n+ <AccountBar\n+ {...props}\n+ currentUserInfo={currentUserInfo}\n+ preRequestUserState={preRequestUserState}\n+ dispatchActionPromise={dispatchActionPromise}\n+ logOut={boundLogOut}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Use Hook for data-binding in AccountBar Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D452
129,187
29.11.2020 13:59:15
18,000
122e3d1a56a81ab8e2bb02072a73c90eceb2a3fe
[native] Extract SidebarItem Summary: While working on the web side of this, I realized it's weird for `ChatThreadListSidebar` to be handling both the `ChatThreadList` and the `SidebarListModal` use case, especially since it's basically just a conditional branch. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-item.react.js", "new_path": "native/chat/chat-thread-list-item.react.js", "diff": "@@ -22,7 +22,7 @@ type Props = {|\n+onPressItem: (threadInfo: ThreadInfo) => void,\n+onPressSeeMoreSidebars: (threadInfo: ThreadInfo) => void,\n+onSwipeableWillOpen: (threadInfo: ThreadInfo) => void,\n- +currentlyOpenedSwipeableId?: string,\n+ +currentlyOpenedSwipeableId: string,\n|};\nfunction ChatThreadListItem({\ndata,\n@@ -56,7 +56,7 @@ function ChatThreadListItem({\nconst { type, ...sidebarInfo } = sidebarItem;\nreturn (\n<ChatThreadListSidebar\n- {...sidebarInfo}\n+ sidebarInfo={sidebarInfo}\nonPressItem={onPressItem}\nonSwipeableWillOpen={onSwipeableWillOpen}\ncurrentlyOpenedSwipeableId={currentlyOpenedSwipeableId}\n" }, { "change_type": "MODIFY", "old_path": "native/chat/chat-thread-list-sidebar.react.js", "new_path": "native/chat/chat-thread-list-sidebar.react.js", "diff": "// @flow\nimport type { ThreadInfo, SidebarInfo } from 'lib/types/thread-types';\n-import type { ViewStyle } from '../types/styles';\nimport * as React from 'react';\n-import Icon from 'react-native-vector-icons/Entypo';\n-import { Text } from 'react-native';\n-import { shortAbsoluteDate } from 'lib/utils/date-utils';\n-\n-import { useColors, useStyles } from '../themes/colors';\n-import Button from '../components/button.react';\n-import { SingleLine } from '../components/single-line.react';\nimport SwipeableThread from './swipeable-thread.react';\n+import SidebarItem from './sidebar-item.react';\ntype Props = {|\n- ...SidebarInfo,\n+ +sidebarInfo: SidebarInfo,\n+onPressItem: (threadInfo: ThreadInfo) => void,\n- +onSwipeableWillOpen?: (threadInfo: ThreadInfo) => void,\n- +currentlyOpenedSwipeableId?: string,\n- +style?: ?ViewStyle,\n+ +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void,\n+ +currentlyOpenedSwipeableId: string,\n|};\nfunction ChatThreadListSidebar(props: Props) {\n- const { lastUpdatedTime } = props;\n- const lastActivity = shortAbsoluteDate(lastUpdatedTime);\n-\n- const { threadInfo } = props;\n- const styles = useStyles(unboundStyles);\n- const unreadStyle = threadInfo.currentUser.unread ? styles.unread : null;\n-\n- const { onPressItem } = props;\n- const onPress = React.useCallback(() => onPressItem(threadInfo), [\n- threadInfo,\n- onPressItem,\n- ]);\n-\n- const colors = useColors();\n- const sidebar = (\n- <Button\n- iosFormat=\"highlight\"\n- iosHighlightUnderlayColor={colors.listIosHighlightUnderlay}\n- iosActiveOpacity={0.85}\n- style={[styles.sidebar, props.style]}\n- onPress={onPress}\n- >\n- <Icon name=\"align-right\" style={styles.icon} size={24} />\n- <SingleLine style={[styles.name, unreadStyle]}>\n- {threadInfo.uiName}\n- </SingleLine>\n- <Text style={[styles.lastActivity, unreadStyle]}>{lastActivity}</Text>\n- </Button>\n- );\n-\nconst {\n- mostRecentNonLocalMessage,\n+ sidebarInfo,\nonSwipeableWillOpen,\ncurrentlyOpenedSwipeableId,\n+ onPressItem,\n} = props;\n- if (!onSwipeableWillOpen) {\n- return sidebar;\n- }\nreturn (\n<SwipeableThread\n- threadInfo={threadInfo}\n- mostRecentNonLocalMessage={mostRecentNonLocalMessage}\n+ threadInfo={sidebarInfo.threadInfo}\n+ mostRecentNonLocalMessage={sidebarInfo.mostRecentNonLocalMessage}\nonSwipeableWillOpen={onSwipeableWillOpen}\ncurrentlyOpenedSwipeableId={currentlyOpenedSwipeableId}\niconSize={16}\n>\n- {sidebar}\n+ <SidebarItem sidebarInfo={sidebarInfo} onPressItem={onPressItem} />\n</SwipeableThread>\n);\n}\n-const unboundStyles = {\n- unread: {\n- color: 'listForegroundLabel',\n- fontWeight: 'bold',\n- },\n- sidebar: {\n- height: 30,\n- flexDirection: 'row',\n- display: 'flex',\n- marginLeft: 25,\n- marginRight: 10,\n- alignItems: 'center',\n- },\n- icon: {\n- paddingLeft: 5,\n- color: 'listForegroundSecondaryLabel',\n- width: 35,\n- },\n- name: {\n- color: 'listForegroundSecondaryLabel',\n- flex: 1,\n- fontSize: 16,\n- paddingLeft: 5,\n- paddingBottom: 2,\n- },\n- lastActivity: {\n- color: 'listForegroundTertiaryLabel',\n- fontSize: 14,\n- marginLeft: 10,\n- },\n-};\n-\nexport default ChatThreadListSidebar;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "native/chat/sidebar-item.react.js", "diff": "+// @flow\n+\n+import type { ThreadInfo, SidebarInfo } from 'lib/types/thread-types';\n+import type { ViewStyle } from '../types/styles';\n+\n+import * as React from 'react';\n+import { Text } from 'react-native';\n+import Icon from 'react-native-vector-icons/Entypo';\n+\n+import { shortAbsoluteDate } from 'lib/utils/date-utils';\n+\n+import { useColors, useStyles } from '../themes/colors';\n+import Button from '../components/button.react';\n+import { SingleLine } from '../components/single-line.react';\n+\n+type Props = {|\n+ +sidebarInfo: SidebarInfo,\n+ +onPressItem: (threadInfo: ThreadInfo) => void,\n+ +style?: ?ViewStyle,\n+|};\n+function SidebarItem(props: Props) {\n+ const { lastUpdatedTime } = props.sidebarInfo;\n+ const lastActivity = shortAbsoluteDate(lastUpdatedTime);\n+\n+ const { threadInfo } = props.sidebarInfo;\n+ const styles = useStyles(unboundStyles);\n+ const unreadStyle = threadInfo.currentUser.unread ? styles.unread : null;\n+\n+ const { onPressItem } = props;\n+ const onPress = React.useCallback(() => onPressItem(threadInfo), [\n+ threadInfo,\n+ onPressItem,\n+ ]);\n+\n+ const colors = useColors();\n+ return (\n+ <Button\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={colors.listIosHighlightUnderlay}\n+ iosActiveOpacity={0.85}\n+ style={[styles.sidebar, props.style]}\n+ onPress={onPress}\n+ >\n+ <Icon name=\"align-right\" style={styles.icon} size={24} />\n+ <SingleLine style={[styles.name, unreadStyle]}>\n+ {threadInfo.uiName}\n+ </SingleLine>\n+ <Text style={[styles.lastActivity, unreadStyle]}>{lastActivity}</Text>\n+ </Button>\n+ );\n+}\n+\n+const unboundStyles = {\n+ unread: {\n+ color: 'listForegroundLabel',\n+ fontWeight: 'bold',\n+ },\n+ sidebar: {\n+ height: 30,\n+ flexDirection: 'row',\n+ display: 'flex',\n+ marginLeft: 25,\n+ marginRight: 10,\n+ alignItems: 'center',\n+ },\n+ icon: {\n+ paddingLeft: 5,\n+ color: 'listForegroundSecondaryLabel',\n+ width: 35,\n+ },\n+ name: {\n+ color: 'listForegroundSecondaryLabel',\n+ flex: 1,\n+ fontSize: 16,\n+ paddingLeft: 5,\n+ paddingBottom: 2,\n+ },\n+ lastActivity: {\n+ color: 'listForegroundTertiaryLabel',\n+ fontSize: 14,\n+ marginLeft: 10,\n+ },\n+};\n+\n+export default SidebarItem;\n" }, { "change_type": "MODIFY", "old_path": "native/chat/sidebar-list-modal.react.js", "new_path": "native/chat/sidebar-list-modal.react.js", "diff": "@@ -16,7 +16,7 @@ import Modal from '../components/modal.react';\nimport Search from '../components/search.react';\nimport { useIndicatorStyle } from '../themes/colors';\nimport { MessageListRouteName } from '../navigation/route-names';\n-import ChatThreadListSidebar from './chat-thread-list-sidebar.react';\n+import SidebarItem from './sidebar-item.react';\nimport { waitForModalInputFocus } from '../utils/timers';\nexport type SidebarListModalParams = {|\n@@ -117,8 +117,8 @@ function SidebarListModal(props: Props) {\nconst renderItem = React.useCallback(\n(row: { item: SidebarInfo, ... }) => {\nreturn (\n- <ChatThreadListSidebar\n- {...row.item}\n+ <SidebarItem\n+ sidebarInfo={row.item}\nonPressItem={onPressItem}\nstyle={styles.sidebar}\n/>\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Extract SidebarItem Summary: While working on the web side of this, I realized it's weird for `ChatThreadListSidebar` to be handling both the `ChatThreadList` and the `SidebarListModal` use case, especially since it's basically just a conditional branch. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D453
129,187
29.11.2020 14:22:43
18,000
c008921b300e03c12bd610422aec514a6233df43
[web] Convert ChatThreadListItem to Hook Summary: Data-binding was initially in `ChatThreadList`, but I moved it inline into `ChatThreadListItem`. Converted both to function components/Hooks. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "// @flow\n-import {\n- type ChatThreadItem,\n- chatThreadItemPropType,\n-} from 'lib/selectors/chat-selectors';\n-import type { Dispatch } from 'lib/types/redux-types';\n-import {\n- type NavInfo,\n- navInfoPropType,\n- updateNavInfoActionType,\n-} from '../redux/redux-setup';\n+import type { ChatThreadItem } from 'lib/selectors/chat-selectors';\n+import { updateNavInfoActionType } from '../redux/redux-setup';\nimport * as React from 'react';\nimport classNames from 'classnames';\n-import PropTypes from 'prop-types';\n+import { useDispatch } from 'react-redux';\nimport { shortAbsoluteDate } from 'lib/utils/date-utils';\nimport css from './chat-thread-list.css';\nimport MessagePreview from './message-preview.react';\nimport ChatThreadListItemMenu from './chat-thread-list-item-menu.react';\n+import { useSelector } from '../redux/redux-utils';\ntype Props = {|\n+item: ChatThreadItem,\n- +active: boolean,\n- +navInfo: NavInfo,\n- +timeZone: ?string,\n- +dispatch: Dispatch,\n|};\n-class ChatThreadListItem extends React.PureComponent<Props> {\n- static propTypes = {\n- item: chatThreadItemPropType.isRequired,\n- active: PropTypes.bool.isRequired,\n- navInfo: navInfoPropType.isRequired,\n- timeZone: PropTypes.string,\n- dispatch: PropTypes.func.isRequired,\n- };\n+function ChatThreadListItem(props: Props) {\n+ const { item } = props;\n+ const threadID = item.threadInfo.id;\n- render() {\n- const { item, timeZone } = this.props;\n+ const navInfo = useSelector((state) => state.navInfo);\n+ const dispatch = useDispatch();\n+ const onClick = React.useCallback(\n+ (event: SyntheticEvent<HTMLAnchorElement>) => {\n+ event.preventDefault();\n+ dispatch({\n+ type: updateNavInfoActionType,\n+ payload: {\n+ ...navInfo,\n+ activeChatThreadID: threadID,\n+ },\n+ });\n+ },\n+ [dispatch, navInfo, threadID],\n+ );\n+\n+ const timeZone = useSelector((state) => state.timeZone);\nconst lastActivity = shortAbsoluteDate(item.lastUpdatedTime, timeZone);\n+\n+ const active = threadID === navInfo.activeChatThreadID;\n+ const activeStyle = active ? css.activeThread : null;\n+\nconst colorSplotchStyle = { backgroundColor: `#${item.threadInfo.color}` };\nconst unread = item.threadInfo.currentUser.unread;\n- const activeStyle = this.props.active ? css.activeThread : null;\nreturn (\n<div className={classNames(css.thread, activeStyle)}>\n- <a className={css.threadButton} onClick={this.onClick}>\n+ <a className={css.threadButton} onClick={onClick}>\n<div className={css.threadRow}>\n<div className={css.title}>{item.threadInfo.uiName}</div>\n<div className={css.colorSplotch} style={colorSplotchStyle} />\n@@ -70,16 +72,4 @@ class ChatThreadListItem extends React.PureComponent<Props> {\n);\n}\n- onClick = (event: SyntheticEvent<HTMLAnchorElement>) => {\n- event.preventDefault();\n- this.props.dispatch({\n- type: updateNavInfoActionType,\n- payload: {\n- ...this.props.navInfo,\n- activeChatThreadID: this.props.item.threadInfo.id,\n- },\n- });\n- };\n-}\n-\nexport default ChatThreadListItem;\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list.react.js", "new_path": "web/chat/chat-thread-list.react.js", "diff": "// @flow\n-import { type NavInfo, navInfoPropType } from '../redux/redux-setup';\n-import type { Dispatch } from 'lib/types/redux-types';\n-import {\n- type ChatThreadItem,\n- chatThreadItemPropType,\n-} from 'lib/selectors/chat-selectors';\nimport type { ThreadInfo } from 'lib/types/thread-types';\nimport * as React from 'react';\n-import PropTypes from 'prop-types';\n-import { useDispatch } from 'react-redux';\nimport { webChatListData } from '../selectors/chat-selectors';\nimport { useSelector } from '../redux/redux-utils';\nimport ChatThreadListItem from './chat-thread-list-item.react';\n-type BaseProps = {|\n+type Props = {|\n+filterThreads: (threadItem: ThreadInfo) => boolean,\n+emptyItem?: React.ComponentType<{||}>,\n|};\n-type Props = {|\n- ...BaseProps,\n- // Redux state\n- +chatListData: $ReadOnlyArray<ChatThreadItem>,\n- +navInfo: NavInfo,\n- +timeZone: ?string,\n- // Redux dispatch functions\n- +dispatch: Dispatch,\n-|};\n-class ChatThreadList extends React.PureComponent<Props> {\n- static propTypes = {\n- filterThreads: PropTypes.func.isRequired,\n- emptyItem: PropTypes.elementType,\n- chatListData: PropTypes.arrayOf(chatThreadItemPropType).isRequired,\n- navInfo: navInfoPropType.isRequired,\n- timeZone: PropTypes.string,\n- dispatch: PropTypes.func.isRequired,\n- };\n-\n- render() {\n- const threads: React.Node[] = this.props.chatListData\n- .filter((item) => this.props.filterThreads(item.threadInfo))\n+function ChatThreadList(props: Props) {\n+ const { filterThreads, emptyItem } = props;\n+ const chatListData = useSelector(webChatListData);\n+ const listData: React.Node[] = React.useMemo(() => {\n+ const threads = chatListData\n+ .filter((item) => filterThreads(item.threadInfo))\n.map((item) => (\n- <ChatThreadListItem\n- item={item}\n- active={item.threadInfo.id === this.props.navInfo.activeChatThreadID}\n- navInfo={this.props.navInfo}\n- timeZone={this.props.timeZone}\n- dispatch={this.props.dispatch}\n- key={item.threadInfo.id}\n- />\n+ <ChatThreadListItem item={item} key={item.threadInfo.id} />\n));\n-\n- if (threads.length === 0 && this.props.emptyItem) {\n- const EmptyItem = this.props.emptyItem;\n+ if (threads.length === 0 && emptyItem) {\n+ const EmptyItem = emptyItem;\nthreads.push(<EmptyItem />);\n}\n-\n- return <div>{threads}</div>;\n- }\n+ return threads;\n+ }, [chatListData, filterThreads, emptyItem]);\n+ return <div>{listData}</div>;\n}\n-export default React.memo<BaseProps>(function ConnectedChatThreadList(\n- props: BaseProps,\n-) {\n- const chatListData = useSelector(webChatListData);\n- const navInfo = useSelector((state) => state.navInfo);\n- const timeZone = useSelector((state) => state.timeZone);\n- const dispatch = useDispatch();\n- return (\n- <ChatThreadList\n- {...props}\n- chatListData={chatListData}\n- navInfo={navInfo}\n- timeZone={timeZone}\n- dispatch={dispatch}\n- />\n- );\n-});\n+export default ChatThreadList;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Convert ChatThreadListItem to Hook Summary: Data-binding was initially in `ChatThreadList`, but I moved it inline into `ChatThreadListItem`. Converted both to function components/Hooks. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D454
129,183
27.11.2020 12:54:28
-3,600
867326547a6ecea8d39bfe01e5de25b9c10be432
[native] Dismiss keyboard in relationship list Test Plan: Checked if there are no weird effects when some action on relationship list is performed, checked if keyboard gets dismissed Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/more/relationship-list-item.react.js", "new_path": "native/more/relationship-list-item.react.js", "diff": "@@ -41,6 +41,10 @@ import {\nOverlayContext,\ntype OverlayContextType,\n} from '../navigation/overlay-context';\n+import {\n+ type KeyboardState,\n+ KeyboardContext,\n+} from '../keyboard/keyboard-state';\nimport {\nRelationshipListItemTooltipModalRouteName,\nFriendListRouteName,\n@@ -69,6 +73,8 @@ type Props = {|\n+updateRelationships: (request: RelationshipRequest) => Promise<void>,\n// withOverlayContext\n+overlayContext: ?OverlayContextType,\n+ // withKeyboardState\n+ +keyboardState: ?KeyboardState,\n|};\nclass RelationshipListItem extends React.PureComponent<Props> {\neditButton = React.createRef<React.ElementRef<typeof View>>();\n@@ -176,6 +182,10 @@ class RelationshipListItem extends React.PureComponent<Props> {\n}\nonPressEdit = () => {\n+ if (this.props.keyboardState?.dismissKeyboardIfShowing()) {\n+ return;\n+ }\n+\nconst {\neditButton,\nprops: { verticalBounds },\n@@ -305,6 +315,7 @@ export default React.memo<BaseProps>(function ConnectedRelationshipListItem(\nconst dispatchActionPromise = useDispatchActionPromise();\nconst boundUpdateRelationships = useServerCall(updateRelationships);\nconst overlayContext = React.useContext(OverlayContext);\n+ const keyboardState = React.useContext(KeyboardContext);\nreturn (\n<RelationshipListItem\n{...props}\n@@ -314,6 +325,7 @@ export default React.memo<BaseProps>(function ConnectedRelationshipListItem(\ndispatchActionPromise={dispatchActionPromise}\nupdateRelationships={boundUpdateRelationships}\noverlayContext={overlayContext}\n+ keyboardState={keyboardState}\n/>\n);\n});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Dismiss keyboard in relationship list Test Plan: Checked if there are no weird effects when some action on relationship list is performed, checked if keyboard gets dismissed Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D447
129,187
30.11.2020 11:50:19
18,000
45ec538090e763735aa06c401e0fd7d87970bbd2
[native] Update to Summary: New point release, [link](https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0634) to `CHANGELOG`. Test Plan: `yarn cleaninstall`, recompile both iOS and Android, make sure it works Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/ios/Podfile.lock", "new_path": "native/ios/Podfile.lock", "diff": "@@ -28,14 +28,14 @@ PODS:\n- UMPermissionsInterface\n- EXSplashScreen (0.3.1):\n- UMCore\n- - FBLazyVector (0.63.3)\n- - FBReactNativeSpec (0.63.3):\n+ - FBLazyVector (0.63.4)\n+ - FBReactNativeSpec (0.63.4):\n- Folly (= 2020.01.13.00)\n- - RCTRequired (= 0.63.3)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n+ - RCTRequired (= 0.63.4)\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n- Flipper (0.54.0):\n- Flipper-Folly (~> 2.2)\n- Flipper-RSocket (~> 1.1)\n@@ -109,172 +109,172 @@ PODS:\n- OpenSSL-Universal (1.0.2.19):\n- OpenSSL-Universal/Static (= 1.0.2.19)\n- OpenSSL-Universal/Static (1.0.2.19)\n- - RCTRequired (0.63.3)\n- - RCTTypeSafety (0.63.3):\n- - FBLazyVector (= 0.63.3)\n+ - RCTRequired (0.63.4)\n+ - RCTTypeSafety (0.63.4):\n+ - FBLazyVector (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTRequired (= 0.63.3)\n- - React-Core (= 0.63.3)\n- - React (0.63.3):\n- - React-Core (= 0.63.3)\n- - React-Core/DevSupport (= 0.63.3)\n- - React-Core/RCTWebSocket (= 0.63.3)\n- - React-RCTActionSheet (= 0.63.3)\n- - React-RCTAnimation (= 0.63.3)\n- - React-RCTBlob (= 0.63.3)\n- - React-RCTImage (= 0.63.3)\n- - React-RCTLinking (= 0.63.3)\n- - React-RCTNetwork (= 0.63.3)\n- - React-RCTSettings (= 0.63.3)\n- - React-RCTText (= 0.63.3)\n- - React-RCTVibration (= 0.63.3)\n- - React-callinvoker (0.63.3)\n- - React-Core (0.63.3):\n+ - RCTRequired (= 0.63.4)\n+ - React-Core (= 0.63.4)\n+ - React (0.63.4):\n+ - React-Core (= 0.63.4)\n+ - React-Core/DevSupport (= 0.63.4)\n+ - React-Core/RCTWebSocket (= 0.63.4)\n+ - React-RCTActionSheet (= 0.63.4)\n+ - React-RCTAnimation (= 0.63.4)\n+ - React-RCTBlob (= 0.63.4)\n+ - React-RCTImage (= 0.63.4)\n+ - React-RCTLinking (= 0.63.4)\n+ - React-RCTNetwork (= 0.63.4)\n+ - React-RCTSettings (= 0.63.4)\n+ - React-RCTText (= 0.63.4)\n+ - React-RCTVibration (= 0.63.4)\n+ - React-callinvoker (0.63.4)\n+ - React-Core (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- - React-Core/Default (= 0.63.3)\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-Core/Default (= 0.63.4)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/CoreModulesHeaders (0.63.3):\n+ - React-Core/CoreModulesHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/Default (0.63.3):\n+ - React-Core/Default (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/DevSupport (0.63.3):\n+ - React-Core/DevSupport (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- - React-Core/Default (= 0.63.3)\n- - React-Core/RCTWebSocket (= 0.63.3)\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n- - React-jsinspector (= 0.63.3)\n+ - React-Core/Default (= 0.63.4)\n+ - React-Core/RCTWebSocket (= 0.63.4)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n+ - React-jsinspector (= 0.63.4)\n- Yoga\n- - React-Core/RCTActionSheetHeaders (0.63.3):\n+ - React-Core/RCTActionSheetHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTAnimationHeaders (0.63.3):\n+ - React-Core/RCTAnimationHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTBlobHeaders (0.63.3):\n+ - React-Core/RCTBlobHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTImageHeaders (0.63.3):\n+ - React-Core/RCTImageHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTLinkingHeaders (0.63.3):\n+ - React-Core/RCTLinkingHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTNetworkHeaders (0.63.3):\n+ - React-Core/RCTNetworkHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTSettingsHeaders (0.63.3):\n+ - React-Core/RCTSettingsHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTTextHeaders (0.63.3):\n+ - React-Core/RCTTextHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTVibrationHeaders (0.63.3):\n+ - React-Core/RCTVibrationHeaders (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- React-Core/Default\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-Core/RCTWebSocket (0.63.3):\n+ - React-Core/RCTWebSocket (0.63.4):\n- Folly (= 2020.01.13.00)\n- glog\n- - React-Core/Default (= 0.63.3)\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsiexecutor (= 0.63.3)\n+ - React-Core/Default (= 0.63.4)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsiexecutor (= 0.63.4)\n- Yoga\n- - React-CoreModules (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - React-CoreModules (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core/CoreModulesHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-RCTImage (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-cxxreact (0.63.3):\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core/CoreModulesHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-RCTImage (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-cxxreact (0.63.4):\n- boost-for-react-native (= 1.63.0)\n- DoubleConversion\n- Folly (= 2020.01.13.00)\n- glog\n- - React-callinvoker (= 0.63.3)\n- - React-jsinspector (= 0.63.3)\n- - React-jsi (0.63.3):\n+ - React-callinvoker (= 0.63.4)\n+ - React-jsinspector (= 0.63.4)\n+ - React-jsi (0.63.4):\n- boost-for-react-native (= 1.63.0)\n- DoubleConversion\n- Folly (= 2020.01.13.00)\n- glog\n- - React-jsi/Default (= 0.63.3)\n- - React-jsi/Default (0.63.3):\n+ - React-jsi/Default (= 0.63.4)\n+ - React-jsi/Default (0.63.4):\n- boost-for-react-native (= 1.63.0)\n- DoubleConversion\n- Folly (= 2020.01.13.00)\n- glog\n- - React-jsiexecutor (0.63.3):\n+ - React-jsiexecutor (0.63.4):\n- DoubleConversion\n- Folly (= 2020.01.13.00)\n- glog\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-jsinspector (0.63.3)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-jsinspector (0.63.4)\n- react-native-background-upload (5.6.0):\n- React\n- react-native-camera (3.31.0):\n@@ -305,66 +305,66 @@ PODS:\n- React\n- react-native-video/Video\n- SPTPersistentCache (~> 1.1.0)\n- - React-RCTActionSheet (0.63.3):\n- - React-Core/RCTActionSheetHeaders (= 0.63.3)\n- - React-RCTAnimation (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - React-RCTActionSheet (0.63.4):\n+ - React-Core/RCTActionSheetHeaders (= 0.63.4)\n+ - React-RCTAnimation (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core/RCTAnimationHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTBlob (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core/RCTAnimationHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTBlob (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - React-Core/RCTBlobHeaders (= 0.63.3)\n- - React-Core/RCTWebSocket (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-RCTNetwork (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTImage (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - React-Core/RCTBlobHeaders (= 0.63.4)\n+ - React-Core/RCTWebSocket (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-RCTNetwork (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTImage (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core/RCTImageHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - React-RCTNetwork (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTLinking (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n- - React-Core/RCTLinkingHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTNetwork (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core/RCTImageHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - React-RCTNetwork (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTLinking (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n+ - React-Core/RCTLinkingHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTNetwork (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core/RCTNetworkHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTSettings (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core/RCTNetworkHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTSettings (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - RCTTypeSafety (= 0.63.3)\n- - React-Core/RCTSettingsHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - React-RCTText (0.63.3):\n- - React-Core/RCTTextHeaders (= 0.63.3)\n- - React-RCTVibration (0.63.3):\n- - FBReactNativeSpec (= 0.63.3)\n+ - RCTTypeSafety (= 0.63.4)\n+ - React-Core/RCTSettingsHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - React-RCTText (0.63.4):\n+ - React-Core/RCTTextHeaders (= 0.63.4)\n+ - React-RCTVibration (0.63.4):\n+ - FBReactNativeSpec (= 0.63.4)\n- Folly (= 2020.01.13.00)\n- - React-Core/RCTVibrationHeaders (= 0.63.3)\n- - React-jsi (= 0.63.3)\n- - ReactCommon/turbomodule/core (= 0.63.3)\n- - ReactCommon/turbomodule/core (0.63.3):\n+ - React-Core/RCTVibrationHeaders (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n+ - ReactCommon/turbomodule/core (= 0.63.4)\n+ - ReactCommon/turbomodule/core (0.63.4):\n- DoubleConversion\n- Folly (= 2020.01.13.00)\n- glog\n- - React-callinvoker (= 0.63.3)\n- - React-Core (= 0.63.3)\n- - React-cxxreact (= 0.63.3)\n- - React-jsi (= 0.63.3)\n+ - React-callinvoker (= 0.63.4)\n+ - React-Core (= 0.63.4)\n+ - React-cxxreact (= 0.63.4)\n+ - React-jsi (= 0.63.4)\n- ReactNativeART (1.1.2):\n- React\n- ReactNativeDarkMode (0.2.0-rc.1):\n@@ -700,8 +700,8 @@ SPEC CHECKSUMS:\nEXMediaLibrary: 0bf8b552392a0ae3919482c1a0f56def9acbd881\nEXPermissions: 24b97f734ce9172d245a5be38ad9ccfcb6135964\nEXSplashScreen: c4ed5d39cd5dbc1329f8dec720e280276bafa28b\n- FBLazyVector: 878b59e31113e289e275165efbe4b54fa614d43d\n- FBReactNativeSpec: 7da9338acfb98d4ef9e5536805a0704572d33c2f\n+ FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e\n+ FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e\nFlipper: be611d4b742d8c87fbae2ca5f44603a02539e365\nFlipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41\nFlipper-Folly: c12092ea368353b58e992843a990a3225d4533c3\n@@ -716,16 +716,16 @@ SPEC CHECKSUMS:\nlottie-react-native: b123a79529cc732201091f585c62c89bb4747252\nmobile-ffmpeg-min: d5d22dcef5c8ec56f771258f1f5be245d914f193\nOpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355\n- RCTRequired: 48884c74035a0b5b76dbb7a998bd93bcfc5f2047\n- RCTTypeSafety: edf4b618033c2f1c5b7bc3d90d8e085ed95ba2ab\n- React: f36e90f3ceb976546e97df3403e37d226f79d0e3\n- React-callinvoker: 18874f621eb96625df7a24a7dc8d6e07391affcd\n- React-Core: ac3d816b8e3493970153f4aaf0cff18af0bb95e6\n- React-CoreModules: 4016d3a4e518bcfc4f5a51252b5a05692ca6f0e1\n- React-cxxreact: ffc9129013b87cb36cf3f30a86695a3c397b0f99\n- React-jsi: df07aa95b39c5be3e41199921509bfa929ed2b9d\n- React-jsiexecutor: b56c03e61c0dd5f5801255f2160a815f4a53d451\n- React-jsinspector: 8e68ffbfe23880d3ee9bafa8be2777f60b25cbe2\n+ RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e\n+ RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b\n+ React: b0a957a2c44da4113b0c4c9853d8387f8e64e615\n+ React-callinvoker: c3f44dd3cb195b6aa46621fff95ded79d59043fe\n+ React-Core: d3b2a1ac9a2c13c3bcde712d9281fc1c8a5b315b\n+ React-CoreModules: 0581ff36cb797da0943d424f69e7098e43e9be60\n+ React-cxxreact: c1480d4fda5720086c90df537ee7d285d4c57ac3\n+ React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31\n+ React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949\n+ React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a\nreact-native-background-upload: 6e8ba7f41a6308231306bddc88f11da3b74c9de4\nreact-native-camera: b5c8c7a71feecfdd5b39f0dbbf6b64b957ed55f2\nreact-native-ffmpeg: f9a60452aaa5d478aac205b248224994f3bde416\n@@ -735,16 +735,16 @@ SPEC CHECKSUMS:\nreact-native-orientation-locker: 23918c400376a7043e752c639c122fcf6bce8f1c\nreact-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94\nreact-native-video: d01ed7ff1e38fa7dcc6c15c94cf505e661b7bfd0\n- React-RCTActionSheet: 53ea72699698b0b47a6421cb1c8b4ab215a774aa\n- React-RCTAnimation: 1befece0b5183c22ae01b966f5583f42e69a83c2\n- React-RCTBlob: 0b284339cbe4b15705a05e2313a51c6d8b51fa40\n- React-RCTImage: d1756599ebd4dc2cb19d1682fe67c6b976658387\n- React-RCTLinking: 9af0a51c6d6a4dd1674daadafffc6d03033a6d18\n- React-RCTNetwork: 332c83929cc5eae0b3bbca4add1d668e1fc18bda\n- React-RCTSettings: d6953772cfd55f2c68ad72b7ef29efc7ec49f773\n- React-RCTText: 65a6de06a7389098ce24340d1d3556015c38f746\n- React-RCTVibration: 8e9fb25724a0805107fc1acc9075e26f814df454\n- ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3\n+ React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336\n+ React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b\n+ React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0\n+ React-RCTImage: c1b1f2d3f43a4a528c8946d6092384b5c880d2f0\n+ React-RCTLinking: 35ae4ab9dc0410d1fcbdce4d7623194a27214fb2\n+ React-RCTNetwork: 29ec2696f8d8cfff7331fac83d3e893c95ef43ae\n+ React-RCTSettings: 60f0691bba2074ef394f95d4c2265ec284e0a46a\n+ React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c\n+ React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d\n+ ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b\nReactNativeART: c580fba2f7d188d8fa4418ce78db8130654ed10f\nReactNativeDarkMode: 88317ff05ba95fd063dd347ad32f8c4cefd3166c\nReactNativeKeyboardInput: 266ba27a2e9921f5bdc0b4cc30289b2a2f46b157\n@@ -776,7 +776,7 @@ SPEC CHECKSUMS:\nUMReactNativeAdapter: 126da3486c1a1f11945b649d557d6c2ebb9407b2\nUMSensorsInterface: 48941f70175e2975af1a9386c6d6cb16d8126805\nUMTaskManagerInterface: cb890c79c63885504ddc0efd7a7d01481760aca2\n- Yoga: 7d13633d129fd179e01b8953d38d47be90db185a\n+ Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6\nYogaKit: f782866e155069a2cca2517aafea43200b01fd5a\nPODFILE CHECKSUM: 9e67a7c3373805d3742a6685b308d920d73ed027\n" }, { "change_type": "MODIFY", "old_path": "native/package.json", "new_path": "native/package.json", "diff": "\"md5\": \"^2.2.1\",\n\"prop-types\": \"^15.7.2\",\n\"react\": \"16.13.1\",\n- \"react-native\": \"0.63.3\",\n+ \"react-native\": \"0.63.4\",\n\"react-native-background-upload\": \"^5.6.0\",\n\"react-native-camera\": \"^3.31.0\",\n\"react-native-dark-mode\": \"^0.2.0-rc.1\",\n" }, { "change_type": "RENAME", "old_path": "patches/react-native+0.63.3.patch", "new_path": "patches/react-native+0.63.4.patch", "diff": "" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -13033,10 +13033,10 @@ react-native-video@^5.0.2:\nprop-types \"^15.5.10\"\nshaka-player \"^2.4.4\"\n-react-native@0.63.3:\n- version \"0.63.3\"\n- resolved \"https://registry.yarnpkg.com/react-native/-/react-native-0.63.3.tgz#4a7f6540e049ff41810887bbd1125abc4672f3bf\"\n- integrity sha512-71wq13uNo5W8QVQnFlnzZ3AD+XgUBYGhpsxysQFW/hJ8GAt/J5o+Bvhy81FXichp6IBDJDh/JgfHH2gNji8dFA==\n+react-native@0.63.4:\n+ version \"0.63.4\"\n+ resolved \"https://registry.yarnpkg.com/react-native/-/react-native-0.63.4.tgz#2210fdd404c94a5fa6b423c6de86f8e48810ec36\"\n+ integrity sha512-I4kM8kYO2mWEYUFITMcpRulcy4/jd+j9T6PbIzR0FuMcz/xwd+JwHoLPa1HmCesvR1RDOw9o4D+OFLwuXXfmGw==\ndependencies:\n\"@babel/runtime\" \"^7.0.0\"\n\"@react-native-community/cli\" \"^4.10.0\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Update to react-native@0.63.4 Summary: New point release, [link](https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0634) to `CHANGELOG`. Test Plan: `yarn cleaninstall`, recompile both iOS and Android, make sure it works Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D457
129,187
30.11.2020 13:02:23
18,000
a2dbcc477c2ee0d7b5e53b49a72c18e9a55eef64
[web] Extract useOnClickThread/useThreadIsActive from ChatThreadListItem Summary: I want to use these Hooks for sidebars too. Test Plan: Flow Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "// @flow\nimport type { ChatThreadItem } from 'lib/selectors/chat-selectors';\n-import { updateNavInfoActionType } from '../redux/redux-setup';\nimport * as React from 'react';\nimport classNames from 'classnames';\n-import { useDispatch } from 'react-redux';\nimport { shortAbsoluteDate } from 'lib/utils/date-utils';\n@@ -13,6 +11,10 @@ import css from './chat-thread-list.css';\nimport MessagePreview from './message-preview.react';\nimport ChatThreadListItemMenu from './chat-thread-list-item-menu.react';\nimport { useSelector } from '../redux/redux-utils';\n+import {\n+ useOnClickThread,\n+ useThreadIsActive,\n+} from '../selectors/nav-selectors';\ntype Props = {|\n+item: ChatThreadItem,\n@@ -21,26 +23,12 @@ function ChatThreadListItem(props: Props) {\nconst { item } = props;\nconst threadID = item.threadInfo.id;\n- const dispatch = useDispatch();\n- const onClick = React.useCallback(\n- (event: SyntheticEvent<HTMLAnchorElement>) => {\n- event.preventDefault();\n- dispatch({\n- type: updateNavInfoActionType,\n- payload: {\n- activeChatThreadID: threadID,\n- },\n- });\n- },\n- [dispatch, threadID],\n- );\n+ const onClick = useOnClickThread(threadID);\nconst timeZone = useSelector((state) => state.timeZone);\nconst lastActivity = shortAbsoluteDate(item.lastUpdatedTime, timeZone);\n- const active = useSelector(\n- (state) => threadID === state.navInfo.activeChatThreadID,\n- );\n+ const active = useThreadIsActive(threadID);\nconst activeStyle = active ? css.activeThread : null;\nconst colorSplotchStyle = { backgroundColor: `#${item.threadInfo.color}` };\n" }, { "change_type": "MODIFY", "old_path": "web/selectors/nav-selectors.js", "new_path": "web/selectors/nav-selectors.js", "diff": "@@ -4,12 +4,17 @@ import type { AppState } from '../redux/redux-setup';\nimport type { CalendarFilter } from 'lib/types/filter-types';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n+import * as React from 'react';\nimport { createSelector } from 'reselect';\nimport invariant from 'invariant';\n+import { useDispatch } from 'react-redux';\nimport { currentCalendarQuery } from 'lib/selectors/nav-selectors';\nimport { nonThreadCalendarFiltersSelector } from 'lib/selectors/calendar-filter-selectors';\n+import { useSelector } from '../redux/redux-utils';\n+import { updateNavInfoActionType } from '../redux/redux-setup';\n+\nconst dateExtractionRegex = /^([0-9]{4})-([0-9]{2})-[0-9]{2}$/;\nfunction yearExtractor(startDate: string, endDate: string): ?number {\n@@ -113,6 +118,26 @@ const nonThreadCalendarQuery: (\n},\n);\n+function useOnClickThread(threadID: string) {\n+ const dispatch = useDispatch();\n+ return React.useCallback(\n+ (event: SyntheticEvent<HTMLAnchorElement>) => {\n+ event.preventDefault();\n+ dispatch({\n+ type: updateNavInfoActionType,\n+ payload: {\n+ activeChatThreadID: threadID,\n+ },\n+ });\n+ },\n+ [dispatch, threadID],\n+ );\n+}\n+\n+function useThreadIsActive(threadID: string) {\n+ return useSelector((state) => threadID === state.navInfo.activeChatThreadID);\n+}\n+\nexport {\nyearExtractor,\nyearAssertingSelector,\n@@ -121,4 +146,6 @@ export {\nactiveThreadSelector,\nwebCalendarQuery,\nnonThreadCalendarQuery,\n+ useOnClickThread,\n+ useThreadIsActive,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Extract useOnClickThread/useThreadIsActive from ChatThreadListItem Summary: I want to use these Hooks for sidebars too. Test Plan: Flow Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D459
129,187
30.11.2020 13:18:15
18,000
f0f4c6e2eea96a66ca9abb68cb2727eec5d97418
[web] Only bold unread thread titles Summary: This is more consistent with `native` and makes it clearer which threads are unread. Test Plan: Look at the website on my local dev environment Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "@@ -29,15 +29,44 @@ function ChatThreadListItem(props: Props) {\nconst lastActivity = shortAbsoluteDate(item.lastUpdatedTime, timeZone);\nconst active = useThreadIsActive(threadID);\n- const activeStyle = active ? css.activeThread : null;\n+ const containerClassName = React.useMemo(\n+ () =>\n+ classNames({\n+ [css.thread]: true,\n+ [css.activeThread]: active,\n+ }),\n+ [active],\n+ );\n+\n+ const { unread } = item.threadInfo.currentUser;\n+ const titleClassName = React.useMemo(\n+ () =>\n+ classNames({\n+ [css.title]: true,\n+ [css.unread]: unread,\n+ }),\n+ [unread],\n+ );\n+ const lastActivityClassName = React.useMemo(\n+ () =>\n+ classNames({\n+ [css.lastActivity]: true,\n+ [css.unread]: unread,\n+ [css.dark]: !unread,\n+ }),\n+ [unread],\n+ );\n- const colorSplotchStyle = { backgroundColor: `#${item.threadInfo.color}` };\n- const unread = item.threadInfo.currentUser.unread;\n+ const { color } = item.threadInfo;\n+ const colorSplotchStyle = React.useMemo(\n+ () => ({ backgroundColor: `#${color}` }),\n+ [color],\n+ );\nreturn (\n- <div className={classNames(css.thread, activeStyle)}>\n+ <div className={containerClassName}>\n<a className={css.threadButton} onClick={onClick}>\n<div className={css.threadRow}>\n- <div className={css.title}>{item.threadInfo.uiName}</div>\n+ <div className={titleClassName}>{item.threadInfo.uiName}</div>\n<div className={css.colorSplotch} style={colorSplotchStyle} />\n</div>\n<div className={css.threadRow}>\n@@ -45,14 +74,7 @@ function ChatThreadListItem(props: Props) {\nmessageInfo={item.mostRecentMessageInfo}\nthreadInfo={item.threadInfo}\n/>\n- <div\n- className={classNames([\n- css.lastActivity,\n- unread ? css.black : css.dark,\n- ])}\n- >\n- {lastActivity}\n- </div>\n+ <div className={lastActivityClassName}>{lastActivity}</div>\n</div>\n</a>\n<ChatThreadListItemMenu item={item} />\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list.css", "new_path": "web/chat/chat-thread-list.css", "diff": "@@ -10,8 +10,6 @@ div.activeThread {\nbackground-color: #EEEEEE;\n}\ndiv.thread div.title {\n- font-family: 'Open Sans', sans-serif;\n- font-weight: 600;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\n@@ -42,6 +40,10 @@ div.lastMessage {\ntext-overflow: ellipsis;\nflex: 1;\n}\n+div.unread {\n+ color: black;\n+ font-weight: 600;\n+}\n.black {\ncolor: black;\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Only bold unread thread titles Summary: This is more consistent with `native` and makes it clearer which threads are unread. Test Plan: Look at the website on my local dev environment Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D460
129,187
30.11.2020 14:17:01
18,000
444436b71324aea5140f7bfa876b7caf1217c6cb
[web] Show sidebars inline in ChatThreadList Summary: Just like on `native` in this video: Test Plan: Look at the sidebars on my web environment, make sure pressing them brings up the `ChatMessageList` Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "@@ -15,6 +15,7 @@ import {\nuseOnClickThread,\nuseThreadIsActive,\n} from '../selectors/nav-selectors';\n+import ChatThreadListSidebar from './chat-thread-list-sidebar.react';\ntype Props = {|\n+item: ChatThreadItem,\n@@ -62,7 +63,23 @@ function ChatThreadListItem(props: Props) {\n() => ({ backgroundColor: `#${color}` }),\n[color],\n);\n+\n+ const sidebars = item.sidebars.map((sidebarItem) => {\n+ if (sidebarItem.type === 'sidebar') {\n+ const { type, ...sidebarInfo } = sidebarItem;\n+ return (\n+ <ChatThreadListSidebar\n+ sidebarInfo={sidebarInfo}\n+ key={sidebarInfo.threadInfo.id}\n+ />\n+ );\n+ } else {\n+ return null;\n+ }\n+ });\n+\nreturn (\n+ <>\n<div className={containerClassName}>\n<a className={css.threadButton} onClick={onClick}>\n<div className={css.threadRow}>\n@@ -79,6 +96,8 @@ function ChatThreadListItem(props: Props) {\n</a>\n<ChatThreadListItemMenu item={item} />\n</div>\n+ {sidebars}\n+ </>\n);\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "web/chat/chat-thread-list-sidebar.react.js", "diff": "+// @flow\n+\n+import type { SidebarInfo } from 'lib/types/thread-types';\n+\n+import * as React from 'react';\n+import classNames from 'classnames';\n+\n+import css from './chat-thread-list.css';\n+import SidebarItem from './sidebar-item.react';\n+import { useThreadIsActive } from '../selectors/nav-selectors';\n+\n+type Props = {|\n+ +sidebarInfo: SidebarInfo,\n+|};\n+function ChatThreadListSidebar(props: Props) {\n+ const { threadInfo } = props.sidebarInfo;\n+ const threadID = threadInfo.id;\n+ const active = useThreadIsActive(threadID);\n+ const activeStyle = active ? css.activeThread : null;\n+ return (\n+ <div className={classNames(css.thread, css.sidebar, activeStyle)}>\n+ <SidebarItem sidebarInfo={props.sidebarInfo} />\n+ </div>\n+ );\n+}\n+\n+export default ChatThreadListSidebar;\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list.css", "new_path": "web/chat/chat-thread-list.css", "diff": "@@ -10,6 +10,7 @@ div.activeThread {\nbackground-color: #EEEEEE;\n}\ndiv.thread div.title {\n+ font-size: 16px;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\n@@ -30,6 +31,7 @@ div.colorSplotch {\nwidth: 20px;\n}\ndiv.lastActivity {\n+ font-size: 15px;\nwhite-space: nowrap;\n}\n@@ -57,6 +59,25 @@ div.italic {\nfont-style: italic;\n}\n+div.thread div.sidebarTitle {\n+ flex: 1;\n+ font-size: 15px;\n+ white-space: nowrap;\n+ overflow: hidden;\n+ text-overflow: ellipsis;\n+ color: black;\n+ align-self: flex-start;\n+}\n+div.sidebarLastActivity {\n+ white-space: nowrap;\n+ font-size: 14px;\n+}\n+svg.sidebarIcon {\n+ color: black;\n+ padding: 0 6px;\n+ font-size: 20px;\n+}\n+\n.menu {\nposition: relative;\ndisplay: flex;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "web/chat/sidebar-item.react.js", "diff": "+// @flow\n+\n+import type { SidebarInfo } from 'lib/types/thread-types';\n+\n+import * as React from 'react';\n+import classNames from 'classnames';\n+import AlignRightIcon from 'react-entypo-icons/lib/entypo/AlignRight';\n+\n+import { shortAbsoluteDate } from 'lib/utils/date-utils';\n+\n+import css from './chat-thread-list.css';\n+import { useSelector } from '../redux/redux-utils';\n+import { useOnClickThread } from '../selectors/nav-selectors';\n+\n+type Props = {|\n+ +sidebarInfo: SidebarInfo,\n+|};\n+function SidebarItem(props: Props) {\n+ const { threadInfo, lastUpdatedTime } = props.sidebarInfo;\n+ const threadID = threadInfo.id;\n+\n+ const onClick = useOnClickThread(threadID);\n+\n+ const timeZone = useSelector((state) => state.timeZone);\n+ const lastActivity = shortAbsoluteDate(lastUpdatedTime, timeZone);\n+\n+ const { unread } = threadInfo.currentUser;\n+ return (\n+ <a className={css.threadButton} onClick={onClick}>\n+ <div className={css.threadRow}>\n+ <AlignRightIcon className={css.sidebarIcon} />\n+ <div\n+ className={classNames([css.sidebarTitle, unread ? css.unread : null])}\n+ >\n+ {threadInfo.uiName}\n+ </div>\n+ <div\n+ className={classNames([\n+ css.sidebarLastActivity,\n+ unread ? css.black : css.dark,\n+ ])}\n+ >\n+ {lastActivity}\n+ </div>\n+ </div>\n+ </a>\n+ );\n+}\n+\n+export default SidebarItem;\n" }, { "change_type": "MODIFY", "old_path": "web/package.json", "new_path": "web/package.json", "diff": "\"react-dnd\": \"^11.1.3\",\n\"react-dnd-html5-backend\": \"^11.1.3\",\n\"react-dom\": \"16.13.1\",\n+ \"react-entypo-icons\": \"^1.4.1\",\n\"react-feather\": \"^2.0.3\",\n\"react-hot-loader\": \"^4.12.14\",\n\"react-redux\": \"^7.1.1\",\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -12794,6 +12794,11 @@ react-dom@16.13.1:\nprop-types \"^15.6.2\"\nscheduler \"^0.19.1\"\n+react-entypo-icons@^1.4.1:\n+ version \"1.4.1\"\n+ resolved \"https://registry.yarnpkg.com/react-entypo-icons/-/react-entypo-icons-1.4.1.tgz#f7403adeb36d9b2b7e66c6dca7e6ad5baee1fd95\"\n+ integrity sha512-XaFvXW1SqymEn3+rdxHsdoKXeHBjM3BOI1N5gDSyedmy+wGUPeyzDDV0PCS8f8V8d1GWJAwb+0rydfi61aR6wQ==\n+\nreact-feather@^2.0.3:\nversion \"2.0.3\"\nresolved \"https://registry.yarnpkg.com/react-feather/-/react-feather-2.0.3.tgz#1453ff5d8c242f72b8c02846118fbd2d406375ad\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Show sidebars inline in ChatThreadList Summary: Just like on `native` in this video: https://site.ashoat.com/comm/app/demo Test Plan: Look at the sidebars on my web environment, make sure pressing them brings up the `ChatMessageList` Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D461
129,187
30.11.2020 14:37:03
18,000
1104440877258f83a56fbddbd46c9a48c1800e1c
[web] Add ChatThreadListItemMenu to ChatThreadListSidebar Summary: This adds mark-as-read/mark-as-unread functionality for sidebars on web. I also made some minor style changes for the menu that apply outside of sidebars (namely, decreased size). Test Plan: Test mark-as-read and mark-as-unread functionality Reviewers: KatPo, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item-menu.react.js", "new_path": "web/chat/chat-thread-list-item-menu.react.js", "diff": "@@ -4,7 +4,7 @@ import type {\nSetThreadUnreadStatusPayload,\nSetThreadUnreadStatusRequest,\n} from 'lib/types/activity-types';\n-import type { ChatThreadItem } from 'lib/selectors/chat-selectors';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport * as React from 'react';\nimport classNames from 'classnames';\n@@ -23,7 +23,8 @@ import {\nimport css from './chat-thread-list.css';\ntype Props = {|\n- +item: ChatThreadItem,\n+ +threadInfo: ThreadInfo,\n+ +mostRecentNonLocalMessage: ?string,\n|};\nfunction ChatThreadListItemMenu(props: Props) {\nconst [menuVisible, setMenuVisible] = React.useState(false);\n@@ -36,7 +37,7 @@ function ChatThreadListItemMenu(props: Props) {\nsetMenuVisible(false);\n}, []);\n- const { threadInfo, mostRecentNonLocalMessage } = props.item;\n+ const { threadInfo, mostRecentNonLocalMessage } = props;\nconst dispatchActionPromise = useDispatchActionPromise();\nconst boundSetThreadUnreadStatus: (\nrequest: SetThreadUnreadStatusRequest,\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-item.react.js", "new_path": "web/chat/chat-thread-list-item.react.js", "diff": "@@ -94,7 +94,10 @@ function ChatThreadListItem(props: Props) {\n<div className={lastActivityClassName}>{lastActivity}</div>\n</div>\n</a>\n- <ChatThreadListItemMenu item={item} />\n+ <ChatThreadListItemMenu\n+ threadInfo={item.threadInfo}\n+ mostRecentNonLocalMessage={item.mostRecentNonLocalMessage}\n+ />\n</div>\n{sidebars}\n</>\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list-sidebar.react.js", "new_path": "web/chat/chat-thread-list-sidebar.react.js", "diff": "@@ -8,18 +8,23 @@ import classNames from 'classnames';\nimport css from './chat-thread-list.css';\nimport SidebarItem from './sidebar-item.react';\nimport { useThreadIsActive } from '../selectors/nav-selectors';\n+import ChatThreadListItemMenu from './chat-thread-list-item-menu.react';\ntype Props = {|\n+sidebarInfo: SidebarInfo,\n|};\nfunction ChatThreadListSidebar(props: Props) {\n- const { threadInfo } = props.sidebarInfo;\n+ const { threadInfo, mostRecentNonLocalMessage } = props.sidebarInfo;\nconst threadID = threadInfo.id;\nconst active = useThreadIsActive(threadID);\nconst activeStyle = active ? css.activeThread : null;\nreturn (\n<div className={classNames(css.thread, css.sidebar, activeStyle)}>\n<SidebarItem sidebarInfo={props.sidebarInfo} />\n+ <ChatThreadListItemMenu\n+ threadInfo={threadInfo}\n+ mostRecentNonLocalMessage={mostRecentNonLocalMessage}\n+ />\n</div>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "web/chat/chat-thread-list.css", "new_path": "web/chat/chat-thread-list.css", "diff": "@@ -77,6 +77,9 @@ svg.sidebarIcon {\npadding: 0 6px;\nfont-size: 20px;\n}\n+div.sidebar .menu > button svg {\n+ font-size: 16px;\n+}\n.menu {\nposition: relative;\n@@ -93,14 +96,17 @@ svg.sidebarIcon {\n.menu > button:hover {\nbackground-color: #DDDDDD;\n}\n+.menu > button:focus {\n+ outline: none;\n+}\n.menu > button svg {\n- font-size: 26px;\n+ font-size: 20px;\n}\n.menuContent {\ndisplay: none;\nposition: absolute;\n- top: 41px;\n+ top: calc(100% + 1px);\nright: 0;\nz-index: 1;\nwidth: max-content;\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[web] Add ChatThreadListItemMenu to ChatThreadListSidebar Summary: This adds mark-as-read/mark-as-unread functionality for sidebars on web. I also made some minor style changes for the menu that apply outside of sidebars (namely, decreased size). Test Plan: Test mark-as-read and mark-as-unread functionality Reviewers: KatPo, palys-swm Reviewed By: KatPo, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D462
129,187
01.12.2020 15:51:31
18,000
f75ff8eeeb4c8703592763c4451ecb36d684234e
[server] Increase space for Phabricator backups Summary: The Phabricator database is larger than I expected. Currently it takes up 46 MiB for one backup, so I'm increasing the space we have allocated for these backups. Test Plan: #testinprod Reviewers: palys-swm, KatPo Subscribers: KatPo, zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/bash/backup_phabricator.sh", "new_path": "server/bash/backup_phabricator.sh", "diff": "@@ -13,7 +13,7 @@ BACKUP_PATH=/mnt/backup\nBACKUP_USER=squadcal\n# The maximum amount of space to spend on Phabricator backups\n-MAX_DISK_USAGE_KB=51200 # 50 MiB\n+MAX_DISK_USAGE_KB=204800 # 200 MiB\nset -e\n[[ `whoami` = root ]] || exec sudo su -c \"$0\"\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Increase space for Phabricator backups Summary: The Phabricator database is larger than I expected. Currently it takes up 46 MiB for one backup, so I'm increasing the space we have allocated for these backups. Test Plan: #testinprod Reviewers: palys-swm, KatPo Reviewed By: KatPo Subscribers: KatPo, zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D467
129,183
27.11.2020 14:59:36
-3,600
16f1904e6ec28fa5be05284d253a88ea3beeb816
Introduce threadPermissions.LEAVE_THREAD Test Plan: Flow Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "lib/types/thread-types.js", "new_path": "lib/types/thread-types.js", "diff": "@@ -52,6 +52,7 @@ export const threadPermissions = Object.freeze({\nADD_MEMBERS: 'add_members',\nREMOVE_MEMBERS: 'remove_members',\nCHANGE_ROLE: 'change_role',\n+ LEAVE_THREAD: 'leave_thread',\n});\nexport type ThreadPermission = $Values<typeof threadPermissions>;\nexport function assertThreadPermissions(\n@@ -70,7 +71,8 @@ export function assertThreadPermissions(\nourThreadPermissions === 'edit_permissions' ||\nourThreadPermissions === 'add_members' ||\nourThreadPermissions === 'remove_members' ||\n- ourThreadPermissions === 'change_role',\n+ ourThreadPermissions === 'change_role' ||\n+ ourThreadPermissions === 'leave_thread',\n'string is not threadPermissions enum',\n);\nreturn ourThreadPermissions;\n" }, { "change_type": "MODIFY", "old_path": "server/src/creators/role-creator.js", "new_path": "server/src/creators/role-creator.js", "diff": "@@ -92,6 +92,7 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n[threadPermissions.CREATE_SUBTHREADS]: true,\n[threadPermissions.CREATE_SIDEBARS]: true,\n[threadPermissions.ADD_MEMBERS]: true,\n+ [threadPermissions.LEAVE_THREAD]: true,\n};\nconst descendantKnowOf =\nthreadPermissionPrefixes.DESCENDANT + threadPermissions.KNOW_OF;\n@@ -133,6 +134,7 @@ function getRolePermissionBlobsForOrg(): RolePermissionBlobs {\n[threadPermissions.EDIT_PERMISSIONS]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n[threadPermissions.CHANGE_ROLE]: true,\n+ [threadPermissions.LEAVE_THREAD]: true,\n[descendantKnowOf]: true,\n[descendantVisible]: true,\n[descendantJoinThread]: true,\n@@ -165,6 +167,7 @@ function getRolePermissionBlobsForChat(\n[threadPermissions.ADD_MEMBERS]: true,\n[threadPermissions.EDIT_PERMISSIONS]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n+ [threadPermissions.LEAVE_THREAD]: true,\n};\nreturn {\nMembers: memberPermissions,\n@@ -207,6 +210,7 @@ function getRolePermissionBlobsForChat(\n[threadPermissions.ADD_MEMBERS]: true,\n[threadPermissions.EDIT_PERMISSIONS]: true,\n[threadPermissions.REMOVE_MEMBERS]: true,\n+ [threadPermissions.LEAVE_THREAD]: true,\n[openDescendantKnowOf]: true,\n[openDescendantVisible]: true,\n[openDescendantJoinThread]: true,\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
Introduce threadPermissions.LEAVE_THREAD Test Plan: Flow Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D448
129,183
27.11.2020 15:01:47
-3,600
99afe238f30cf1f7386dff73932e1248601a5970
[native] Check threadPermissions.LEAVE_THREAD Test Plan: Check if button is displayed when permission is set Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/thread-settings.react.js", "new_path": "native/chat/settings/thread-settings.react.js", "diff": "@@ -675,7 +675,12 @@ class ThreadSettings extends React.PureComponent<Props, State> {\n});\n}\n- if (viewerIsMember(threadInfo)) {\n+ const canLeaveThread = threadHasPermission(\n+ threadInfo,\n+ threadPermissions.LEAVE_THREAD,\n+ );\n+\n+ if (viewerIsMember(threadInfo) && canLeaveThread) {\nbuttons.push({\nitemType: 'leaveThread',\nkey: 'leaveThread',\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Check threadPermissions.LEAVE_THREAD Test Plan: Check if button is displayed when permission is set Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D449
129,183
30.11.2020 10:14:09
-3,600
2a661a4a47ab6c5f59390d7b9695f784b89b842a
[server] Check threadPermissions.LEAVE_THREAD Test Plan: Check if server throws error on threads with no leave_thread permission and doesn't on those which have it Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-updaters.js", "new_path": "server/src/updaters/thread-updaters.js", "diff": "@@ -226,12 +226,17 @@ async function leaveThread(\nthrow new ServerError('not_logged_in');\n}\n- const fetchThreadResult = await fetchThreadInfos(\n+ const [fetchThreadResult, hasPermission] = await Promise.all([\n+ fetchThreadInfos(viewer, SQL`t.id = ${request.threadID}`),\n+ checkThreadPermission(\nviewer,\n- SQL`t.id = ${request.threadID}`,\n- );\n+ request.threadID,\n+ threadPermissions.LEAVE_THREAD,\n+ ),\n+ ]);\n+\nconst threadInfo = fetchThreadResult.threadInfos[request.threadID];\n- if (!viewerIsMember(threadInfo)) {\n+ if (!viewerIsMember(threadInfo) || !hasPermission) {\nthrow new ServerError('invalid_parameters');\n}\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Check threadPermissions.LEAVE_THREAD Test Plan: Check if server throws error on threads with no leave_thread permission and doesn't on those which have it Reviewers: ashoat, palys-swm Reviewed By: ashoat, palys-swm Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D455
129,183
02.12.2020 09:31:30
-3,600
acbf1b483a7abb3c3622f8747e333e317d4482c7
[server] Extract updateAllThreadPermissions and rename to recalculateAllThreadPermissions Summary: Extracted function to reuse in D466 Test Plan: Flow Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "server/src/scripts/create-sidebar-permissions.js", "new_path": "server/src/scripts/create-sidebar-permissions.js", "diff": "import {\nthreadPermissions,\nthreadPermissionPrefixes,\n- assertThreadType,\n} from 'lib/types/thread-types';\n-import bots from 'lib/facts/bots';\n-\nimport { dbQuery, SQL } from '../database/database';\nimport { endScript } from './utils';\n-import { createScriptViewer } from '../session/scripts';\n-import {\n- recalculateAllPermissions,\n- commitMembershipChangeset,\n-} from '../updaters/thread-permission-updaters';\n+import { recalculateAllThreadPermissions } from '../updaters/thread-permission-updaters';\nasync function main() {\ntry {\nawait createSidebarPermissions();\n- await updateAllThreadPermissions();\n+ await recalculateAllThreadPermissions();\n} catch (e) {\nconsole.warn(e);\n} finally {\n@@ -46,24 +39,4 @@ async function createSidebarPermissions() {\nawait dbQuery(updateAdminRoles);\n}\n-async function updateAllThreadPermissions() {\n- const getAllThreads = SQL`SELECT id, type FROM threads`;\n- const [result] = await dbQuery(getAllThreads);\n-\n- // We handle each thread one-by-one to avoid a situation where a permission\n- // calculation for a child thread, done during a call to\n- // recalculateAllPermissions for the parent thread, can be incorrectly\n- // overriden by a call to recalculateAllPermissions for the child thread. If\n- // the changeset resulting from the parent call isn't committed before the\n- // calculation is done for the child, the calculation done for the child can\n- // be incorrect.\n- const viewer = createScriptViewer(bots.squadbot.userID);\n- for (const row of result) {\n- const threadID = row.id.toString();\n- const threadType = assertThreadType(row.type);\n- const changeset = await recalculateAllPermissions(threadID, threadType);\n- await commitMembershipChangeset(viewer, changeset);\n- }\n-}\n-\nmain();\n" }, { "change_type": "MODIFY", "old_path": "server/src/updaters/thread-permission-updaters.js", "new_path": "server/src/updaters/thread-permission-updaters.js", "diff": "@@ -27,6 +27,7 @@ import {\nimport { sortIDs } from 'lib/shared/relationship-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport { cartesianProduct } from 'lib/utils/array';\n+import bots from 'lib/facts/bots';\nimport {\nfetchServerThreadInfos,\n@@ -44,6 +45,7 @@ import {\nimport { rescindPushNotifs } from '../push/rescind';\nimport { dbQuery, SQL, mergeOrConditions } from '../database/database';\n+import { createScriptViewer } from '../session/scripts';\nexport type MembershipRowToSave = {|\noperation: 'update' | 'join',\n@@ -744,6 +746,26 @@ function getParentThreadRelationshipRowsForNewUsers(\n});\n}\n+async function recalculateAllThreadPermissions() {\n+ const getAllThreads = SQL`SELECT id, type FROM threads`;\n+ const [result] = await dbQuery(getAllThreads);\n+\n+ // We handle each thread one-by-one to avoid a situation where a permission\n+ // calculation for a child thread, done during a call to\n+ // recalculateAllPermissions for the parent thread, can be incorrectly\n+ // overriden by a call to recalculateAllPermissions for the child thread. If\n+ // the changeset resulting from the parent call isn't committed before the\n+ // calculation is done for the child, the calculation done for the child can\n+ // be incorrect.\n+ const viewer = createScriptViewer(bots.squadbot.userID);\n+ for (const row of result) {\n+ const threadID = row.id.toString();\n+ const threadType = assertThreadType(row.type);\n+ const changeset = await recalculateAllPermissions(threadID, threadType);\n+ await commitMembershipChangeset(viewer, changeset);\n+ }\n+}\n+\nexport {\nchangeRole,\nrecalculateAllPermissions,\n@@ -752,4 +774,5 @@ export {\nsetJoinsToUnread,\ngetRelationshipRowsForUsers,\ngetParentThreadRelationshipRowsForNewUsers,\n+ recalculateAllThreadPermissions,\n};\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[server] Extract updateAllThreadPermissions and rename to recalculateAllThreadPermissions Summary: Extracted function to reuse in D466 Test Plan: Flow Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D468
129,183
03.12.2020 12:08:09
-3,600
8c7628f84442c9d74ec84cf420af23a0e60ae00b
[native] Use hook instead of connect functions and HOC in ColorPickerModal Test Plan: Flow Reviewers: ashoat, palys-swm Subscribers: zrebcu411, Adrian
[ { "change_type": "MODIFY", "old_path": "native/chat/settings/color-picker-modal.react.js", "new_path": "native/chat/settings/color-picker-modal.react.js", "diff": "@@ -6,28 +6,24 @@ import {\n} from 'lib/actions/thread-actions';\nimport {\ntype ThreadInfo,\n- threadInfoPropType,\ntype ChangeThreadSettingsPayload,\ntype UpdateThreadRequest,\n} from 'lib/types/thread-types';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\n-import { connect } from 'lib/utils/redux-utils';\n-import PropTypes from 'prop-types';\n+import {\n+ useServerCall,\n+ useDispatchActionPromise,\n+} from 'lib/utils/action-utils';\nimport * as React from 'react';\nimport { TouchableHighlight, Alert } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\n+import { useSelector } from 'react-redux';\nimport ColorPicker from '../../components/color-picker.react';\nimport Modal from '../../components/modal.react';\nimport type { RootNavigationProp } from '../../navigation/root-navigator.react';\nimport type { NavigationRoute } from '../../navigation/route-names';\n-import type { AppState } from '../../redux/redux-setup';\n-import {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\n-} from '../../themes/colors';\n+import { type Colors, useStyles, useColors } from '../../themes/colors';\nexport type ColorPickerModalParams = {|\npresentedFrom: string,\n@@ -36,39 +32,24 @@ export type ColorPickerModalParams = {|\nsetColor: (color: string) => void,\n|};\n+type BaseProps = {|\n+ +navigation: RootNavigationProp<'ColorPickerModal'>,\n+ +route: NavigationRoute<'ColorPickerModal'>,\n+|};\ntype Props = {|\n- navigation: RootNavigationProp<'ColorPickerModal'>,\n- route: NavigationRoute<'ColorPickerModal'>,\n+ ...BaseProps,\n// Redux state\n- colors: Colors,\n- styles: typeof styles,\n- windowWidth: number,\n+ +colors: Colors,\n+ +styles: typeof unboundStyles,\n+ +windowWidth: number,\n// Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n+ +dispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n- changeThreadSettings: (\n+ +changeThreadSettings: (\nrequest: UpdateThreadRequest,\n) => Promise<ChangeThreadSettingsPayload>,\n|};\nclass ColorPickerModal extends React.PureComponent<Props> {\n- static propTypes = {\n- navigation: PropTypes.shape({\n- goBackOnce: PropTypes.func.isRequired,\n- }).isRequired,\n- route: PropTypes.shape({\n- params: PropTypes.shape({\n- color: PropTypes.string.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n- setColor: PropTypes.func.isRequired,\n- }).isRequired,\n- }).isRequired,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- windowWidth: PropTypes.number.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- changeThreadSettings: PropTypes.func.isRequired,\n- };\n-\nrender() {\nconst { color, threadInfo } = this.props.route.params;\n// Based on the assumption we are always in portrait,\n@@ -139,7 +120,7 @@ class ColorPickerModal extends React.PureComponent<Props> {\n};\n}\n-const styles = {\n+const unboundStyles = {\ncloseButton: {\nborderRadius: 3,\nheight: 18,\n@@ -168,13 +149,25 @@ const styles = {\nmarginVertical: 20,\n},\n};\n-const stylesSelector = styleSelector(styles);\n-export default connect(\n- (state: AppState) => ({\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n- windowWidth: state.dimensions.width,\n- }),\n- { changeThreadSettings },\n-)(ColorPickerModal);\n+export default React.memo<BaseProps>(function ConnectedColorPickerModal(\n+ props: BaseProps,\n+) {\n+ const styles = useStyles(unboundStyles);\n+ const colors = useColors();\n+ const windowWidth = useSelector((state) => state.dimensions.width);\n+\n+ const dispatchActionPromise = useDispatchActionPromise();\n+ const callChangeThreadSettings = useServerCall(changeThreadSettings);\n+\n+ return (\n+ <ColorPickerModal\n+ {...props}\n+ styles={styles}\n+ colors={colors}\n+ windowWidth={windowWidth}\n+ dispatchActionPromise={dispatchActionPromise}\n+ changeThreadSettings={callChangeThreadSettings}\n+ />\n+ );\n+});\n" } ]
JavaScript
BSD 3-Clause New or Revised License
comme2e/comm
[native] Use hook instead of connect functions and HOC in ColorPickerModal Test Plan: Flow Reviewers: ashoat, palys-swm Reviewed By: ashoat Subscribers: zrebcu411, Adrian Differential Revision: https://phabricator.ashoat.com/D473