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,187 | 25.03.2018 20:06:55 | 14,400 | 2a6d0bfcc00cc83d5ea16cb18345a18aa62a490f | Prevent duplicate navigate actions on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -17,7 +17,6 @@ import {\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\n-import { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport _sum from 'lodash/fp/sum';\nimport { FloatingAction } from 'react-native-floating-action';\n@@ -25,6 +24,7 @@ import { FloatingAction } from 'react-native-floating-action';\nimport { viewerIsMember } from 'lib/shared/thread-utils';\nimport { threadSearchIndex } from 'lib/selectors/nav-selectors';\nimport SearchIndex from 'lib/shared/search-index';\n+import { connect } from 'lib/utils/redux-utils';\nimport { chatListData } from '../selectors/chat-selectors';\nimport ChatThreadListItem from './chat-thread-list-item.react';\n@@ -34,6 +34,7 @@ import { registerChatScreen } from './chat-screen-registry';\nimport { ComposeThreadRouteName } from './compose-thread.react';\nimport { iosKeyboardOffset } from '../dimensions';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\nconst floatingActions = [{\ntext: 'Compose',\n@@ -50,6 +51,7 @@ type Props = {|\nchatListData: $ReadOnlyArray<ChatThreadItem>,\nviewerID: ?string,\nthreadSearchIndex: SearchIndex,\n+ active: bool,\n|};\ntype State = {|\nlistData: $ReadOnlyArray<Item>,\n@@ -68,6 +70,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nchatListData: PropTypes.arrayOf(chatThreadItemPropType).isRequired,\nviewerID: PropTypes.string,\nthreadSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\n+ active: PropTypes.bool.isRequired,\n};\nstatic navigationOptions = ({ navigation }) => ({\ntitle: 'Threads',\n@@ -265,6 +268,9 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n}\nonPressItem = (threadInfo: ThreadInfo) => {\n+ if (!this.props.active) {\n+ return;\n+ }\nthis.props.navigation.navigate(\nMessageListRouteName,\n{ threadInfo },\n@@ -272,8 +278,10 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n}\ncomposeThread = () => {\n+ if (this.props.active) {\nthis.props.navigation.navigate(ComposeThreadRouteName, {});\n}\n+ }\n}\n@@ -320,11 +328,18 @@ const styles = StyleSheet.create({\n});\nconst ChatThreadListRouteName = 'ChatThreadList';\n-const ChatThreadList = connect((state: AppState): * => ({\n+const ChatThreadList = connect((state: AppState) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\nchatListData: chatListData(state),\nviewerID: state.currentUserInfo && state.currentUserInfo.id,\nthreadSearchIndex: threadSearchIndex(state),\n-}))(InnerChatThreadList);\n+ active: currentChatSubroute.routeName === ChatThreadListRouteName,\n+ };\n+})(InnerChatThreadList);\nexport {\nChatThreadList,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread-button.react.js",
"new_path": "native/chat/compose-thread-button.react.js",
"diff": "// @flow\nimport type { NavigationParams } from 'react-navigation';\n+import type { AppState } from '../redux-setup';\nimport React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport PropTypes from 'prop-types';\n+import { connect } from 'lib/utils/redux-utils';\n+\nimport { ComposeThreadRouteName } from './compose-thread.react';\nimport Button from '../components/button.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\n+import { ChatThreadListRouteName } from './chat-thread-list.react';\ntype Props = {\nnavigate: (\nrouteName: string,\nparams?: NavigationParams,\n) => bool,\n+ // Redux state\n+ chatThreadListActive: bool,\n};\nclass ComposeThreadButton extends React.PureComponent<Props> {\nstatic propTypes = {\nnavigate: PropTypes.func.isRequired,\n+ chatThreadListActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -36,8 +44,10 @@ class ComposeThreadButton extends React.PureComponent<Props> {\n}\nonPress = () => {\n+ if (this.props.chatThreadListActive) {\nthis.props.navigate(ComposeThreadRouteName, {});\n}\n+ }\n}\n@@ -47,4 +57,13 @@ const styles = StyleSheet.create({\n},\n});\n-export default ComposeThreadButton;\n+export default connect((state: AppState) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ chatThreadListActive:\n+ currentChatSubroute.routeName === ChatThreadListRouteName,\n+ };\n+})(ComposeThreadButton);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -68,6 +68,7 @@ import { registerChatScreen } from './chat-screen-registry';\nimport { iosKeyboardOffset } from '../dimensions';\nimport ThreadVisibility from '../components/thread-visibility.react';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\nconst tagInputProps = {\nplaceholder: \"username\",\n@@ -83,6 +84,26 @@ type NavProp =\ncreateButtonDisabled?: bool,\n} } };\n+let queuedPress = false;\n+function setQueuedPress() {\n+ queuedPress = true;\n+}\n+let onPressCreateThread = setQueuedPress;\n+function setOnPressCreateThread(func: ?() => void) {\n+ if (!func) {\n+ onPressCreateThread = setQueuedPress;\n+ return;\n+ }\n+ onPressCreateThread = func;\n+ if (queuedPress) {\n+ onPressCreateThread();\n+ queuedPress = false;\n+ }\n+}\n+function pressCreateThread() {\n+ onPressCreateThread();\n+}\n+\ntype Props = {\nnavigation: NavProp,\n// Redux state\n@@ -91,6 +112,7 @@ type Props = {\notherUserInfos: {[id: string]: AccountUserInfo},\nuserSearchIndex: SearchIndex,\nthreadInfos: {[id: string]: ThreadInfo},\n+ active: bool,\n// Redux dispatch functions\ndispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -123,6 +145,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\notherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\nuserSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\nthreadInfos: PropTypes.objectOf(threadInfoPropType).isRequired,\n+ active: PropTypes.bool.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nnewThread: PropTypes.func.isRequired,\nsearchUsers: PropTypes.func.isRequired,\n@@ -132,7 +155,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nheaderRight: (\n<LinkButton\ntext=\"Create\"\n- onPress={() => navigation.state.params.onPressCreateThread()}\n+ onPress={pressCreateThread}\ndisabled={!!navigation.state.params.createButtonDisabled}\n/>\n),\n@@ -140,6 +163,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n});\nmounted = false;\ntagInput: ?TagInput<AccountUserInfo>;\n+ createThreadPressed = false;\nconstructor(props: Props) {\nsuper(props);\n@@ -177,16 +201,14 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\ncomponentDidMount() {\nthis.mounted = true;\nregisterChatScreen(this.props.navigation.state.key, this);\n+ setOnPressCreateThread(this.onPressCreateThread);\nthis.searchUsers(\"\");\n- this.props.navigation.setParams({\n- onPressCreateThread: this.onPressCreateThread,\n- createButtonDisabled: false,\n- });\n}\ncomponentWillUnmount() {\nthis.mounted = false;\nregisterChatScreen(this.props.navigation.state.key, null);\n+ setOnPressCreateThread(null);\n}\ncanReset = () => false;\n@@ -401,6 +423,10 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nonPressCreateThread = () => {\n+ if (this.createThreadPressed) {\n+ return;\n+ }\n+ this.createThreadPressed = true;\nif (this.state.userInfoInputArray.length === 0) {\nAlert.alert(\n\"Chatting to yourself?\",\n@@ -442,6 +468,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n: null,\n});\n} catch (e) {\n+ this.createThreadPressed = false;\nthis.props.navigation.setParams({ createButtonDisabled: false });\nAlert.alert(\n\"Unknown error\",\n@@ -471,6 +498,9 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nonSelectExistingThread = (threadID: string) => {\n+ if (!this.props.active) {\n+ return;\n+ }\nthis.props.navigation.navigate(\nMessageListRouteName,\n{ threadInfo: this.props.threadInfos[threadID] },\n@@ -548,12 +578,11 @@ const styles = StyleSheet.create({\n},\n});\n-const ComposeThreadRouteName = 'ComposeThread';\n-\nconst loadingStatusSelector\n= createLoadingStatusSelector(newThreadActionTypes);\nregisterFetchKey(searchUsersActionTypes);\n+const ComposeThreadRouteName = 'ComposeThread';\nconst ComposeThread = connect(\n(state: AppState, ownProps: { navigation: NavProp }) => {\nlet parentThreadInfo = null;\n@@ -562,12 +591,17 @@ const ComposeThread = connect(\nparentThreadInfo = threadInfoSelector(state)[parentThreadID];\ninvariant(parentThreadInfo, \"parent thread should exist\");\n}\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\nreturn {\nparentThreadInfo,\nloadingStatus: loadingStatusSelector(state),\notherUserInfos: userInfoSelectorForOtherMembersOfThread(null)(state),\nuserSearchIndex: userSearchIndexForOtherMembersOfThread(null)(state),\nthreadInfos: threadInfoSelector(state),\n+ active: currentChatSubroute.routeName === ComposeThreadRouteName,\n};\n},\n{ newThread, searchUsers },\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list-header-title.react.js",
"new_path": "native/chat/message-list-header-title.react.js",
"diff": "import type { NavigationParams } from 'react-navigation';\nimport type { ThreadInfo } from 'lib/types/thread-types';\nimport { threadInfoPropType } from 'lib/types/thread-types';\n+import type { AppState } from '../redux-setup';\nimport React from 'react';\nimport { View, Text, StyleSheet, Platform } from 'react-native';\n@@ -10,8 +11,12 @@ import PropTypes from 'prop-types';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport { HeaderTitle } from 'react-navigation';\n+import { connect } from 'lib/utils/redux-utils';\n+\nimport Button from '../components/button.react';\nimport { ThreadSettingsRouteName } from './settings/thread-settings.react';\n+import { MessageListRouteName } from './message-list.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\ntype Props = {\nthreadInfo: ThreadInfo,\n@@ -19,12 +24,15 @@ type Props = {\nrouteName: string,\nparams?: NavigationParams,\n) => bool,\n+ // Redux state\n+ messageListActive: bool,\n};\nclass MessageListHeaderTitle extends React.PureComponent<Props> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\n+ messageListActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -65,6 +73,9 @@ class MessageListHeaderTitle extends React.PureComponent<Props> {\n}\nonPress = () => {\n+ if (!this.props.messageListActive) {\n+ return;\n+ }\nthis.props.navigate(\nThreadSettingsRouteName,\n{ threadInfo: this.props.threadInfo },\n@@ -98,4 +109,12 @@ const styles = StyleSheet.create({\n},\n});\n-export default MessageListHeaderTitle;\n+export default connect((state: AppState) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ messageListActive: currentChatSubroute.routeName === MessageListRouteName,\n+ };\n+})(MessageListHeaderTitle);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/compose-subthread-modal.react.js",
"new_path": "native/chat/settings/compose-subthread-modal.react.js",
"diff": "@@ -6,6 +6,7 @@ import {\nvisibilityRules,\n} from 'lib/types/thread-types';\nimport type { NavigationParams } from 'react-navigation';\n+import type { AppState } from '../../redux-setup';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n@@ -20,12 +21,18 @@ import Icon from 'react-native-vector-icons/MaterialIcons';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\nimport { threadTypeDescriptions } from 'lib/shared/thread-utils';\n+import { connect } from 'lib/utils/redux-utils';\nimport { iosKeyboardOffset } from '../../dimensions';\nimport Button from '../../components/button.react';\nimport { ComposeThreadRouteName } from '../compose-thread.react';\nimport KeyboardAvoidingView\nfrom '../../components/keyboard-avoiding-view.react';\n+import { ThreadSettingsRouteName } from './thread-settings.react';\n+import {\n+ assertNavigationRouteNotLeafNode,\n+ getThreadIDFromParams,\n+} from '../../utils/navigation-utils';\ntype Props = {|\nthreadInfo: ThreadInfo,\n@@ -34,6 +41,8 @@ type Props = {|\nparams?: NavigationParams\n) => bool,\ncloseModal: () => void,\n+ // Redux state\n+ threadSettingsActive: bool,\n|};\nclass ComposeSubthreadModal extends React.PureComponent<Props> {\n@@ -41,7 +50,9 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\ncloseModal: PropTypes.func.isRequired,\n+ threadSettingsActive: PropTypes.bool.isRequired,\n};\n+ waitingToNavigate = false;\nrender() {\nconst content = (\n@@ -89,6 +100,10 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\n}\nonPressOpen = () => {\n+ if (!this.props.threadSettingsActive || this.waitingToNavigate) {\n+ return;\n+ }\n+ this.waitingToNavigate = true;\nInteractionManager.runAfterInteractions(() => {\nthis.props.navigate(\nComposeThreadRouteName,\n@@ -97,11 +112,16 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\nvisibilityRules: visibilityRules.CHAT_NESTED_OPEN,\n},\n);\n+ this.waitingToNavigate = false;\n});\nthis.props.closeModal();\n}\nonPressSecret = () => {\n+ if (!this.props.threadSettingsActive || this.waitingToNavigate) {\n+ return;\n+ }\n+ this.waitingToNavigate = true;\nInteractionManager.runAfterInteractions(() => {\nthis.props.navigate(\nComposeThreadRouteName,\n@@ -110,6 +130,7 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\nvisibilityRules: visibilityRules.CHAT_SECRET,\n},\n);\n+ this.waitingToNavigate = false;\n});\nthis.props.closeModal();\n}\n@@ -153,4 +174,16 @@ const styles = StyleSheet.create({\n},\n});\n-export default ComposeSubthreadModal;\n+export default connect(\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ threadSettingsActive:\n+ currentChatSubroute.routeName === ThreadSettingsRouteName &&\n+ getThreadIDFromParams(currentChatSubroute) === ownProps.threadInfo.id,\n+ };\n+ },\n+)(ComposeSubthreadModal);\n"
},
{
"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": "import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\nimport type { NavigationParams } from 'react-navigation';\n+import type { AppState } from '../../redux-setup';\nimport React from 'react';\nimport { Text, StyleSheet, View, Platform } from 'react-native';\nimport PropTypes from 'prop-types';\n+import { connect } from 'lib/utils/redux-utils';\n+\nimport { MessageListRouteName } from '../message-list.react';\nimport Button from '../../components/button.react';\nimport ColorSplotch from '../../components/color-splotch.react';\nimport ThreadVisibility from '../../components/thread-visibility.react';\n+import { ThreadSettingsRouteName } from './thread-settings.react';\n+import { assertNavigationRouteNotLeafNode } from '../../utils/navigation-utils';\ntype Props = {|\nthreadInfo: ThreadInfo,\n@@ -19,6 +24,8 @@ type Props = {|\nparams?: NavigationParams,\n) => bool,\nlastListItem: bool,\n+ // Redux state\n+ threadSettingsActive: bool,\n|};\nclass ThreadSettingsChildThread extends React.PureComponent<Props> {\n@@ -26,6 +33,7 @@ class ThreadSettingsChildThread extends React.PureComponent<Props> {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\nlastListItem: PropTypes.bool.isRequired,\n+ threadSettingsActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -50,6 +58,9 @@ class ThreadSettingsChildThread extends React.PureComponent<Props> {\n}\nonPress = () => {\n+ if (!this.props.threadSettingsActive) {\n+ return;\n+ }\nthis.props.navigate(\nMessageListRouteName,\n{ threadInfo: this.props.threadInfo },\n@@ -90,4 +101,15 @@ const styles = StyleSheet.create({\n},\n});\n-export default ThreadSettingsChildThread;\n+export default connect(\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ threadSettingsActive:\n+ currentChatSubroute.routeName === ThreadSettingsRouteName,\n+ };\n+ },\n+)(ThreadSettingsChildThread);\n"
},
{
"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": "@@ -5,13 +5,21 @@ import {\nthreadInfoPropType,\n} from 'lib/types/thread-types';\nimport type { NavigationParams } from 'react-navigation';\n+import type { AppState } from '../../redux-setup';\nimport React from 'react';\nimport { Text, StyleSheet, View, Platform } from 'react-native';\nimport PropTypes from 'prop-types';\n+import { connect } from 'lib/utils/redux-utils';\n+\nimport Button from '../../components/button.react';\nimport { DeleteThreadRouteName } from './delete-thread.react';\n+import { ThreadSettingsRouteName } from './thread-settings.react';\n+import {\n+ assertNavigationRouteNotLeafNode,\n+ getThreadIDFromParams,\n+} from '../../utils/navigation-utils';\ntype Props = {|\nthreadInfo: ThreadInfo,\n@@ -20,6 +28,8 @@ type Props = {|\nparams?: NavigationParams,\n) => bool,\ncanLeaveThread: bool,\n+ // Redux state\n+ threadSettingsActive: bool,\n|};\nclass ThreadSettingsDeleteThread extends React.PureComponent<Props> {\n@@ -27,6 +37,7 @@ class ThreadSettingsDeleteThread extends React.PureComponent<Props> {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\ncanLeaveThread: PropTypes.bool.isRequired,\n+ threadSettingsActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -46,6 +57,9 @@ class ThreadSettingsDeleteThread extends React.PureComponent<Props> {\n}\nonPress = () => {\n+ if (!this.props.threadSettingsActive) {\n+ return;\n+ }\nthis.props.navigate(\nDeleteThreadRouteName,\n{ threadInfo: this.props.threadInfo },\n@@ -76,4 +90,16 @@ const styles = StyleSheet.create({\n},\n});\n-export default ThreadSettingsDeleteThread;\n+export default connect(\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ threadSettingsActive:\n+ currentChatSubroute.routeName === ThreadSettingsRouteName &&\n+ getThreadIDFromParams(currentChatSubroute) === ownProps.threadInfo.id,\n+ };\n+ },\n+)(ThreadSettingsDeleteThread);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-parent.react.js",
"new_path": "native/chat/settings/thread-settings-parent.react.js",
"diff": "@@ -7,13 +7,18 @@ import type { NavigationParams } from 'react-navigation';\nimport React from 'react';\nimport { Text, StyleSheet, View, Platform } from 'react-native';\n-import { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\n+import { connect } from 'lib/utils/redux-utils';\nimport Button from '../../components/button.react';\nimport { MessageListRouteName } from '../message-list.react';\n+import { ThreadSettingsRouteName } from './thread-settings.react';\n+import {\n+ assertNavigationRouteNotLeafNode,\n+ getThreadIDFromParams,\n+} from '../../utils/navigation-utils';\ntype Props = {|\nthreadInfo: ThreadInfo,\n@@ -23,6 +28,7 @@ type Props = {|\n) => bool,\n// Redux state\nparentThreadInfo?: ?ThreadInfo,\n+ threadSettingsActive: bool,\n|};\nclass ThreadSettingsParent extends React.PureComponent<Props> {\n@@ -30,6 +36,7 @@ class ThreadSettingsParent extends React.PureComponent<Props> {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\nparentThreadInfo: threadInfoPropType,\n+ threadSettingsActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -77,6 +84,9 @@ class ThreadSettingsParent extends React.PureComponent<Props> {\n}\nonPressParentThread = () => {\n+ if (!this.props.threadSettingsActive) {\n+ return;\n+ }\nthis.props.navigate(\nMessageListRouteName,\n{ threadInfo: this.props.parentThreadInfo },\n@@ -119,11 +129,20 @@ const styles = StyleSheet.create({\n});\nexport default connect(\n- (state: AppState, ownProps: { threadInfo: ThreadInfo }): * => {\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\nconst parsedThreadInfos = threadInfoSelector(state);\nconst parentThreadInfo: ?ThreadInfo = ownProps.threadInfo.parentThreadID\n? parsedThreadInfos[ownProps.threadInfo.parentThreadID]\n: null;\n- return { parentThreadInfo };\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ parentThreadInfo,\n+ threadSettingsActive:\n+ currentChatSubroute.routeName === ThreadSettingsRouteName &&\n+ getThreadIDFromParams(currentChatSubroute) === ownProps.threadInfo.id,\n+ };\n},\n)(ThreadSettingsParent);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/thread-settings-button.react.js",
"new_path": "native/chat/thread-settings-button.react.js",
"diff": "import type { NavigationParams } from 'react-navigation';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { AppState } from '../redux-setup';\nimport React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport PropTypes from 'prop-types';\n+import { connect } from 'lib/utils/redux-utils';\n+\nimport { ThreadSettingsRouteName } from './settings/thread-settings.react';\nimport Button from '../components/button.react';\n+import { MessageListRouteName } from './message-list.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\ntype Props = {\nthreadInfo: ThreadInfo,\n@@ -17,12 +22,15 @@ type Props = {\nrouteName: string,\nparams?: NavigationParams,\n) => bool,\n+ // Redux state\n+ messageListActive: bool,\n};\nclass ThreadSettingsButton extends React.PureComponent<Props> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\n+ messageListActive: PropTypes.bool.isRequired,\n};\nrender() {\n@@ -39,6 +47,9 @@ class ThreadSettingsButton extends React.PureComponent<Props> {\n}\nonPress = () => {\n+ if (!this.props.messageListActive) {\n+ return;\n+ }\nthis.props.navigate(\nThreadSettingsRouteName,\n{ threadInfo: this.props.threadInfo },\n@@ -53,4 +64,12 @@ const styles = StyleSheet.create({\n},\n});\n-export default ThreadSettingsButton;\n+export default connect((state: AppState) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+ const currentChatSubroute = chatRoute.routes[chatRoute.index];\n+ return {\n+ messageListActive: currentChatSubroute.routeName === MessageListRouteName,\n+ };\n+})(ThreadSettingsButton);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -44,6 +44,7 @@ import { EditPasswordRouteName } from './edit-password.react';\nimport { DeleteAccountRouteName } from './delete-account.react';\nimport { BuildInfoRouteName} from './build-info.react';\nimport { DevToolsRouteName} from './dev-tools.react';\n+import { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\ntype Props = {\nnavigation: NavigationScreenProp<*>,\n@@ -53,6 +54,7 @@ type Props = {\nemailVerified: ?bool,\ncurrentAsOf: number,\nresendVerificationLoadingStatus: LoadingStatus,\n+ active: bool,\n// Redux dispatch functions\ndispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -70,6 +72,7 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nemailVerified: PropTypes.bool,\ncurrentAsOf: PropTypes.number.isRequired,\nresendVerificationLoadingStatus: loadingStatusPropType.isRequired,\n+ active: PropTypes.bool.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nlogOut: PropTypes.func.isRequired,\nresendVerificationEmail: PropTypes.func.isRequired,\n@@ -271,24 +274,30 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n);\n}\n+ navigateIfActive(routeName: string) {\n+ if (this.props.active) {\n+ this.props.navigation.navigate(routeName);\n+ }\n+ }\n+\nonPressEditEmail = () => {\n- this.props.navigation.navigate(EditEmailRouteName);\n+ this.navigateIfActive(EditEmailRouteName);\n}\nonPressEditPassword = () => {\n- this.props.navigation.navigate(EditPasswordRouteName);\n+ this.navigateIfActive(EditPasswordRouteName);\n}\nonPressDeleteAccount = () => {\n- this.props.navigation.navigate(DeleteAccountRouteName);\n+ this.navigateIfActive(DeleteAccountRouteName);\n}\nonPressBuildInfo = () => {\n- this.props.navigation.navigate(BuildInfoRouteName);\n+ this.navigateIfActive(BuildInfoRouteName);\n}\nonPressDevTools = () => {\n- this.props.navigation.navigate(DevToolsRouteName);\n+ this.navigateIfActive(DevToolsRouteName);\n}\n}\n@@ -418,7 +427,11 @@ const resendVerificationLoadingStatusSelector = createLoadingStatusSelector(\nconst MoreScreenRouteName = 'MoreScreen';\nconst MoreScreen = connect(\n- (state: AppState) => ({\n+ (state: AppState) => {\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(state.navInfo.navigationState.routes[0]);\n+ const moreRoute = assertNavigationRouteNotLeafNode(appRoute.routes[2]);\n+ return {\nusername: state.currentUserInfo && !state.currentUserInfo.anonymous\n? state.currentUserInfo.username\n: undefined,\n@@ -431,7 +444,9 @@ const MoreScreen = connect(\ncurrentAsOf: state.currentAsOf,\nresendVerificationLoadingStatus:\nresendVerificationLoadingStatusSelector(state),\n- }),\n+ active: moreRoute.index === 0,\n+ };\n+ },\n{ logOut, resendVerificationEmail },\n)(InnerMoreScreen);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Prevent duplicate navigate actions on native |
129,187 | 25.03.2018 20:49:03 | 14,400 | 3bc8ead98621de313b4922485b3a931045c17254 | Call onDismiss in Tooltip when it gets closed programmatically | [
{
"change_type": "MODIFY",
"old_path": "native/components/tooltip.react.js",
"new_path": "native/components/tooltip.react.js",
"diff": "@@ -134,6 +134,9 @@ class Tooltip extends React.PureComponent<Props, State> {\n}\ntoggleModal = () => {\n+ if (this.state.isModalOpen) {\n+ this.onDismiss();\n+ }\nthis.setState({ isModalOpen: !this.state.isModalOpen });\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Call onDismiss in Tooltip when it gets closed programmatically |
129,187 | 26.03.2018 11:24:07 | 14,400 | c25f9d6638e368fb5e2ceeba8c1247b1a4ea7d36 | Backoff notif permission alerts | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -21,6 +21,11 @@ import type {\nimport type { RawThreadInfo } from 'lib/types/thread-types';\nimport { rawThreadInfoPropType } from 'lib/types/thread-types';\nimport type { DeviceType } from 'lib/types/device-types';\n+import {\n+ type NotifPermissionAlertInfo,\n+ notifPermissionAlertInfoPropType,\n+ recordNotifPermissionAlertActionType,\n+} from './push/alerts';\nimport React from 'react';\nimport { Provider } from 'react-redux';\n@@ -99,6 +104,7 @@ registerConfig({\n});\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\n+const msInDay = 24 * 60 * 60 * 1000;\ntype NativeDispatch = Dispatch & ((action: NavigationAction) => boolean);\n@@ -114,6 +120,7 @@ type Props = {\ndeviceToken: ?string,\nunreadCount: number,\nrawThreadInfos: {[id: string]: RawThreadInfo},\n+ notifPermissionAlertInfo: NotifPermissionAlertInfo,\n// Redux dispatch functions\ndispatch: NativeDispatch,\ndispatchActionPayload: DispatchActionPayload,\n@@ -144,6 +151,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\ndeviceToken: PropTypes.string,\nunreadCount: PropTypes.number.isRequired,\nrawThreadInfos: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n+ notifPermissionAlertInfo: notifPermissionAlertInfoPropType.isRequired,\ndispatch: PropTypes.func.isRequired,\ndispatchActionPayload: PropTypes.func.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -462,8 +470,29 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nconst deviceType = Platform.OS;\nif (deviceType === \"ios\") {\niosPushPermissionResponseReceived();\n+ if (__DEV__) {\n+ // iOS simulator can't handle notifs\n+ return;\n+ }\n+ }\n+\n+ const alertInfo = this.props.notifPermissionAlertInfo;\n+ if (\n+ (alertInfo.totalAlerts > 3 &&\n+ alertInfo.lastAlertTime > (Date.now() - msInDay)) ||\n+ (alertInfo.totalAlerts > 6 &&\n+ alertInfo.lastAlertTime > (Date.now() - msInDay * 3)) ||\n+ (alertInfo.totalAlerts > 9 &&\n+ alertInfo.lastAlertTime > (Date.now() - msInDay * 7))\n+ ) {\n+ return;\n}\n- if (deviceType === \"ios\" && !__DEV__) {\n+ this.props.dispatchActionPayload(\n+ recordNotifPermissionAlertActionType,\n+ { time: Date.now() },\n+ );\n+\n+ if (deviceType === \"ios\") {\nAlert.alert(\n\"Need notif permissions\",\n\"SquadCal needs notification permissions to keep you in the loop! \" +\n@@ -712,6 +741,7 @@ const ConnectedAppWithNavigationState = connect(\ndeviceToken: state.deviceToken,\nunreadCount: unreadCount(state),\nrawThreadInfos: state.threadInfos,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n};\n},\n{ ping, updateActivity, setDeviceToken },\n"
},
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -103,7 +103,9 @@ export type Action =\n| {|\ntype: \"NOTIFICATION_PRESS\",\npayload: NotificationPressPayload,\n- |} | AndroidNotificationActions;\n+ |}\n+ | AndroidNotificationActions\n+ | {| type: \"RECORD_NOTIF_PERMISSION_ALERT\", time: number |};\nlet tabBarOptions;\nif (Platform.OS === \"android\") {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/push/alerts.js",
"diff": "+// @flow\n+\n+import PropTypes from 'prop-types';\n+\n+export type NotifPermissionAlertInfo = {|\n+ totalAlerts: number,\n+ lastAlertTime: number,\n+|};\n+\n+const notifPermissionAlertInfoPropType = PropTypes.shape({\n+ totalAlerts: PropTypes.number.isRequired,\n+ lastAlertTime: PropTypes.number.isRequired,\n+});\n+\n+const defaultNotifPermissionAlertInfo: NotifPermissionAlertInfo = {\n+ totalAlerts: 0,\n+ lastAlertTime: 0,\n+};\n+\n+const recordNotifPermissionAlertActionType = \"RECORD_NOTIF_PERMISSION_ALERT\";\n+\n+export {\n+ defaultNotifPermissionAlertInfo,\n+ notifPermissionAlertInfoPropType,\n+ recordNotifPermissionAlertActionType,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -7,6 +7,11 @@ import type { CurrentUserInfo, UserInfo } from 'lib/types/user-types';\nimport type { MessageStore } from 'lib/types/message-types';\nimport type { NavInfo } from './navigation-setup';\nimport type { PersistState } from 'redux-persist/src/types';\n+import {\n+ type NotifPermissionAlertInfo,\n+ defaultNotifPermissionAlertInfo,\n+ recordNotifPermissionAlertActionType,\n+} from './push/alerts';\nimport React from 'react';\nimport invariant from 'invariant';\n@@ -62,6 +67,7 @@ export type AppState = {|\nurlPrefix: string,\ncustomServer: ?string,\nthreadIDsToNotifIDs: {[threadID: string]: string[]},\n+ notifPermissionAlertInfo: NotifPermissionAlertInfo,\n_persist: ?PersistState,\n|};\n@@ -89,6 +95,7 @@ const defaultState = ({\nurlPrefix: defaultURLPrefix(),\ncustomServer: natServer,\nthreadIDsToNotifIDs: {},\n+ notifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\n_persist: null,\n}: AppState);\n@@ -113,6 +120,7 @@ function reducer(state: AppState = defaultState, action: *) {\nurlPrefix: state.urlPrefix,\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n_persist: state._persist,\n};\n}\n@@ -140,6 +148,7 @@ function reducer(state: AppState = defaultState, action: *) {\nstate.threadIDsToNotifIDs,\naction.payload,\n),\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n_persist: state._persist,\n};\n} else if (action.type === setCustomServer) {\n@@ -160,6 +169,31 @@ function reducer(state: AppState = defaultState, action: *) {\nurlPrefix: state.urlPrefix,\ncustomServer: action.payload,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ _persist: state._persist,\n+ };\n+ } else if (action.type === recordNotifPermissionAlertActionType) {\n+ return {\n+ navInfo: state.navInfo,\n+ currentUserInfo: state.currentUserInfo,\n+ sessionID: state.sessionID,\n+ entryStore: state.entryStore,\n+ lastUserInteraction: state.lastUserInteraction,\n+ threadInfos: state.threadInfos,\n+ userInfos: state.userInfos,\n+ messageStore: state.messageStore,\n+ drafts: state.drafts,\n+ currentAsOf: state.currentAsOf,\n+ loadingStatuses: state.loadingStatuses,\n+ cookie: state.cookie,\n+ deviceToken: state.deviceToken,\n+ urlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\n+ threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: {\n+ totalAlerts: state.notifPermissionAlertInfo.totalAlerts + 1,\n+ lastAlertTime: action.payload.time,\n+ },\n_persist: state._persist,\n};\n}\n@@ -210,6 +244,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\nurlPrefix: state.urlPrefix,\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n_persist: state._persist,\n};\n}\n@@ -245,6 +280,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\nurlPrefix: state.urlPrefix,\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n_persist: state._persist,\n};\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Backoff notif permission alerts |
129,187 | 26.03.2018 11:37:46 | 14,400 | 143bd07202fdbf90c43a3ad860e5fc4c31d7c1ee | codeVersion -> 4, stateVersion -> 1
Also added a state migrator for `notifPermissionAlertInfo` | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 3\n- versionName \"0.0.3\"\n+ versionCode 4\n+ versionName \"0.0.4\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"3\"\n- android:versionName=\"0.0.3\"\n+ android:versionCode=\"4\"\n+ android:versionName=\"0.0.4\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.3</string>\n+ <string>0.0.4</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>3</string>\n+ <string>4</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "// @flow\n+import type { AppState } from './redux-setup';\n+\nimport storage from 'redux-persist/lib/storage';\nimport { createMigrate } from 'redux-persist';\nimport invariant from 'invariant';\n+import { defaultNotifPermissionAlertInfo } from './push/alerts';\n+\nconst blacklist = __DEV__\n? [\n'sessionID',\n@@ -18,11 +22,10 @@ const blacklist = __DEV__\n];\nconst migrations = {\n- /** example\n- [0]: (state) => ({\n+ [1]: (state: AppState) => ({\n...state,\n- test: \"hello\",\n- }), **/\n+ notifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\n+ }),\n};\nconst persistConfig = {\n@@ -30,11 +33,11 @@ const persistConfig = {\nstorage,\nblacklist,\ndebug: __DEV__,\n- version: 0,\n+ version: 1,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 3;\n+const codeVersion = 4;\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 | codeVersion -> 4, stateVersion -> 1
Also added a state migrator for `notifPermissionAlertInfo` |
129,187 | 26.03.2018 13:34:08 | 14,400 | 752b913b6c70a4b044e2aaaf3971c80dfbe28725 | Don't crash when no message indices for a given thread are specified
Pertaining to `deeaa859ff87cbc7ebba0383ec55542af8611458` | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -339,7 +339,9 @@ async function sendPushNotifsForNewMessages(\n};\nfor (let threadID of preUserPushInfo.threadIDs) {\nconst messageIndices = threadsToMessageIndices.get(threadID);\n- invariant(messageIndices, `indices should exist for thread ${threadID}`);\n+ if (!messageIndices) {\n+ continue;\n+ }\nfor (let messageIndex of messageIndices) {\nconst messageInfo = messageInfos[messageIndex];\nif (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't crash when no message indices for a given thread are specified
Pertaining to `deeaa859ff87cbc7ebba0383ec55542af8611458` |
129,187 | 26.03.2018 14:44:19 | 14,400 | 1f338c72ed7d75822ddd6b7a07cd9224822d965e | Filter out threadInfos without notifiable messages at an earlier point | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -236,6 +236,9 @@ async function sendPushNotifsForNewMessages(\nconst threadConditionClauses = [];\nfor (let pair of threadRestrictions) {\nconst [ threadID, threadRestriction ] = pair;\n+ if (!threadsToMessageIndices.has(threadID)) {\n+ continue;\n+ }\nconst conditions = getSQLConditionsForThreadRestriction(\nthreadID,\nthreadRestriction,\n@@ -339,9 +342,7 @@ async function sendPushNotifsForNewMessages(\n};\nfor (let threadID of preUserPushInfo.threadIDs) {\nconst messageIndices = threadsToMessageIndices.get(threadID);\n- if (!messageIndices) {\n- continue;\n- }\n+ invariant(messageIndices, `indices should exist for thread ${threadID}`);\nfor (let messageIndex of messageIndices) {\nconst messageInfo = messageInfos[messageIndex];\nif (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Filter out threadInfos without notifiable messages at an earlier point |
129,187 | 26.03.2018 15:30:38 | 14,400 | 174ab01a6d412c13e7141c7b1536e57c1b70cbd0 | Avoid querying for valid notifs if there's no notifs to send | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -245,6 +245,9 @@ async function sendPushNotifsForNewMessages(\n);\nthreadConditionClauses.push(mergeAndConditions(conditions));\n}\n+ if (threadConditionClauses.length === 0) {\n+ return;\n+ }\nconst conditionClause = mergeOrConditions(threadConditionClauses);\nlet joinIndex = 0;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Avoid querying for valid notifs if there's no notifs to send |
129,187 | 27.03.2018 10:26:41 | 14,400 | ced9d65e4cfc8cf43c2de4cd9bf9ab6282bb03f1 | Don't clear reset password verification codes upon success
(Will later add a cronjob to clean up the expired ones) | [
{
"change_type": "MODIFY",
"old_path": "server/src/models/verification.js",
"new_path": "server/src/models/verification.js",
"diff": "@@ -92,10 +92,7 @@ async function handleCodeVerificationRequest(\nconst { userID, field } = result;\nif (field === verifyField.EMAIL) {\nconst query = SQL`UPDATE users SET email_verified = 1 WHERE id = ${userID}`;\n- await Promise.all([\n- dbQuery(query),\n- clearVerifyCodes(result),\n- ]);\n+ await dbQuery(query);\nreturn { field: verifyField.EMAIL, userID };\n} else if (field === verifyField.RESET_PASSWORD) {\nconst usernameQuery = SQL`SELECT username FROM users WHERE id = ${userID}`;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't clear reset password verification codes upon success
(Will later add a cronjob to clean up the expired ones) |
129,187 | 27.03.2018 10:27:14 | 14,400 | 2c0c382660fa205b84b5ee8a9411aea6c2cb5abc | If a keyboard event occurs right before the app is foregrounded, trigger it
We'll accept a 500ms delay | [
{
"change_type": "MODIFY",
"old_path": "native/keyboard.js",
"new_path": "native/keyboard.js",
"diff": "@@ -12,10 +12,32 @@ export type KeyboardEvent = {\n},\n};\ntype KeyboardCallback = (event: KeyboardEvent) => void;\n+type IgnoredKeyboardEvent = {|\n+ callback: KeyboardCallback,\n+ event: KeyboardEvent,\n+ time: number,\n+|};\n+// If the app becomes active within 500ms after a keyboard event is triggered,\n+// we will call the relevant keyboard callbacks.\n+const appStateChangeDelay = 500;\nlet currentState = AppState.currentState;\n+let recentIgnoredKeyboardEvents: IgnoredKeyboardEvent[] = [];\nfunction handleAppStateChange(nextAppState: ?string) {\ncurrentState = nextAppState;\n+\n+ const time = Date.now();\n+ const ignoredEvents = recentIgnoredKeyboardEvents;\n+ recentIgnoredKeyboardEvents = [];\n+\n+ if (currentState !== \"active\") {\n+ return;\n+ }\n+ for (let ignoredEvent of ignoredEvents) {\n+ if (ignoredEvent.time + appStateChangeDelay > time) {\n+ ignoredEvent.callback(ignoredEvent.event);\n+ }\n+ }\n}\nlet listenersEnabled = 0;\n@@ -40,6 +62,8 @@ function callCallbackIfAppActive(callback: KeyboardCallback): KeyboardCallback {\nreturn (event: KeyboardEvent) => {\nif (currentState === \"active\") {\ncallback(event);\n+ } else {\n+ recentIgnoredKeyboardEvents.push({ callback, event, time: Date.now() });\n}\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | If a keyboard event occurs right before the app is foregrounded, trigger it
We'll accept a 500ms delay |
129,187 | 27.03.2018 10:54:50 | 14,400 | 942c342d9e580e74d8a4ca8f8aa2c409ad2768e7 | Handle iOS simulator disabled keyboard in LoggedOutModal and VerificationModal | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -136,6 +136,7 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nkeyboardShowListener: ?Object;\nkeyboardHideListener: ?Object;\n+ expectingKeyboardToAppear = false;\nmounted = false;\nnextMode: LoggedOutMode = \"loading\";\n@@ -358,7 +359,10 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nreturn windowHeight - keyboardHeight - textHeight - 20;\n}\n- animateToSecondMode(inputDuration: ?number, realKeyboardHeight: ?number) {\n+ animateToSecondMode(\n+ inputDuration: ?number = null,\n+ realKeyboardHeight: ?number = null,\n+ ) {\nconst duration = inputDuration ? inputDuration : 150;\nif (!realKeyboardHeight) {\nrealKeyboardHeight = this.keyboardHeight;\n@@ -420,6 +424,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\nkeyboardShow = (event: KeyboardEvent) => {\n+ if (this.expectingKeyboardToAppear) {\n+ this.expectingKeyboardToAppear = false;\n+ }\nif (!this.activeKeyboard) {\n// We do this because the Android keyboard can change in height and we\n// don't want to bother moving the panel between those events\n@@ -486,6 +493,15 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\nkeyboardHide = (event: ?KeyboardEvent) => {\n+ if (this.expectingKeyboardToAppear) {\n+ // On the iOS simulator, it's possible to disable the keyboard. In this\n+ // case, when a TextInput's autoFocus would normally cause keyboardShow\n+ // to trigger, keyboardHide is instead triggered. Since the Apple app\n+ // testers seem to use the iOS simulator, we need to support this case.\n+ this.expectingKeyboardToAppear = false;\n+ this.animateToSecondMode();\n+ return;\n+ }\nthis.keyboardHeight = 0;\nthis.activeKeyboard = false;\nif (this.activeAlert) {\n@@ -667,7 +683,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nif (this.activeKeyboard) {\n// If keyboard isn't currently active, keyboardShow will handle the\n// animation. This is so we can run all animations in parallel\n- this.animateToSecondMode(null);\n+ this.animateToSecondMode();\n+ } else if (Platform.OS === \"ios\") {\n+ this.expectingKeyboardToAppear = true;\n}\n}\n@@ -678,7 +696,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nif (this.activeKeyboard) {\n// If keyboard isn't currently active, keyboardShow will handle the\n// animation. This is so we can run all animations in parallel\n- this.animateToSecondMode(null);\n+ this.animateToSecondMode();\n+ } else if (Platform.OS === \"ios\") {\n+ this.expectingKeyboardToAppear = true;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/verification-modal.react.js",
"new_path": "native/account/verification-modal.react.js",
"diff": "@@ -98,6 +98,7 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\ndispatchActionPromise: PropTypes.func.isRequired,\nhandleVerificationCode: PropTypes.func.isRequired,\n};\n+\nstate = {\nmode: \"simple-text\",\npaddingTop: new Animated.Value(\n@@ -109,9 +110,12 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\nresetPasswordPanelOpacityValue: new Animated.Value(0),\nonePasswordSupported: false,\n};\n- activeAlert = false;\n+\nkeyboardShowListener: ?Object;\nkeyboardHideListener: ?Object;\n+ expectingKeyboardToAppear = false;\n+\n+ activeAlert = false;\nactiveKeyboard = false;\nopacityChangeQueued = false;\nkeyboardHeight = 0;\n@@ -251,7 +255,9 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\nif (this.activeKeyboard) {\n// If keyboard isn't currently active, keyboardShow will handle the\n// animation. This is so we can run all animations in parallel\n- this.animateToResetPassword(null);\n+ this.animateToResetPassword();\n+ } else if (Platform.OS === \"ios\") {\n+ this.expectingKeyboardToAppear = true;\n}\n}\n} catch (e) {\n@@ -277,7 +283,7 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\nreturn (windowHeight - containerSize - keyboardHeight) / 2;\n}\n- animateToResetPassword(inputDuration: ?number) {\n+ animateToResetPassword(inputDuration: ?number = null) {\nconst duration = inputDuration ? inputDuration : 150;\nconst animations = [\nAnimated.timing(\n@@ -308,6 +314,9 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\n}\nkeyboardShow = (event: KeyboardEvent) => {\n+ if (this.expectingKeyboardToAppear) {\n+ this.expectingKeyboardToAppear = false;\n+ }\nthis.keyboardHeight = event.endCoordinates.height;\nif (this.activeKeyboard) {\n// We do this because the Android keyboard can change in height and we\n@@ -347,6 +356,15 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\n}\nkeyboardHide = (event: ?KeyboardEvent) => {\n+ if (this.expectingKeyboardToAppear) {\n+ // On the iOS simulator, it's possible to disable the keyboard. In this\n+ // case, when a TextInput's autoFocus would normally cause keyboardShow\n+ // to trigger, keyboardHide is instead triggered. Since the Apple app\n+ // testers seem to use the iOS simulator, we need to support this case.\n+ this.expectingKeyboardToAppear = false;\n+ this.animateToResetPassword();\n+ return;\n+ }\nthis.keyboardHeight = 0;\nthis.activeKeyboard = false;\nif (this.activeAlert) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Handle iOS simulator disabled keyboard in LoggedOutModal and VerificationModal |
129,187 | 27.03.2018 11:20:48 | 14,400 | 994ecef1c8f507e6d2894769df5d8924bcf3f36c | Simplify KeyboardAvoidingView and factor out some logic | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -62,7 +62,6 @@ import ListLoadingIndicator from '../list-loading-indicator.react';\nimport SectionFooter from './section-footer.react';\nimport ThreadPicker from './thread-picker.react';\nimport CalendarInputBar from './calendar-input-bar.react';\n-import { iosKeyboardOffset } from '../dimensions';\nimport {\naddKeyboardShowListener,\naddKeyboardDismissListener,\n@@ -698,12 +697,6 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n</View>\n);\n}\n- const keyboardAvoidingViewBehavior = Platform.OS === \"ios\"\n- ? \"padding\"\n- : undefined;\n- const keyboardVerticalOffset = Platform.OS === \"ios\"\n- ? iosKeyboardOffset\n- : 0;\nreturn (\n<SafeAreaView forceInset={forceInset} style={styles.container}>\n<TextHeightMeasurer\n@@ -712,8 +705,8 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nstyle={entryStyles.text}\n/>\n<KeyboardAvoidingView\n- behavior={keyboardAvoidingViewBehavior}\nstyle={styles.keyboardAvoidingView}\n+ keyboardVerticalOffset={0}\n>\n{loadingIndicator}\n{flatList}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -32,7 +32,6 @@ import { MessageListRouteName } from './message-list.react';\nimport ComposeThreadButton from './compose-thread-button.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport { ComposeThreadRouteName } from './compose-thread.react';\n-import { iosKeyboardOffset } from '../dimensions';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nimport { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\n@@ -245,17 +244,11 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n{floatingAction}\n</React.Fragment>\n);\n- if (Platform.OS === \"ios\") {\nreturn (\n- <KeyboardAvoidingView\n- style={styles.container}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardOffset}\n- >{content}</KeyboardAvoidingView>\n+ <KeyboardAvoidingView style={styles.container}>\n+ {content}\n+ </KeyboardAvoidingView>\n);\n- } else {\n- return <View style={styles.container}>{content}</View>;\n- }\n}\nonChangeSearchText = (searchText: string) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -22,13 +22,7 @@ import type { UserSearchResult } from 'lib/types/search-types';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n-import {\n- View,\n- Text,\n- StyleSheet,\n- Alert,\n- Platform,\n-} from 'react-native';\n+import { View, Text, StyleSheet, Alert } from 'react-native';\nimport invariant from 'invariant';\nimport _flow from 'lodash/fp/flow';\nimport _filter from 'lodash/fp/filter';\n@@ -65,7 +59,6 @@ import ThreadList from '../components/thread-list.react';\nimport LinkButton from '../components/link-button.react';\nimport { MessageListRouteName } from './message-list.react';\nimport { registerChatScreen } from './chat-screen-registry';\n-import { iosKeyboardOffset } from '../dimensions';\nimport ThreadVisibility from '../components/thread-visibility.react';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nimport { assertNavigationRouteNotLeafNode } from '../utils/navigation-utils';\n@@ -349,17 +342,11 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n{existingThreadsSection}\n</React.Fragment>\n);\n- if (Platform.OS === \"ios\") {\nreturn (\n- <KeyboardAvoidingView\n- style={styles.container}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardOffset}\n- >{content}</KeyboardAvoidingView>\n+ <KeyboardAvoidingView style={styles.container}>\n+ {content}\n+ </KeyboardAvoidingView>\n);\n- } else {\n- return <View style={styles.container}>{content}</View>;\n- }\n}\ntagInputRef = (tagInput: ?TagInput<AccountUserInfo>) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -56,7 +56,6 @@ import ListLoadingIndicator from '../list-loading-indicator.react';\nimport MessageListHeaderTitle from './message-list-header-title.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport ThreadSettingsButton from './thread-settings-button.react';\n-import { iosKeyboardOffset } from '../dimensions';\nimport KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\ntype NavProp = NavigationScreenProp<NavigationRoute>\n@@ -451,16 +450,8 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nconst threadInfo = InnerMessageList.getThreadInfo(this.props);\nconst inputBar = <ChatInputBar threadInfo={threadInfo} />;\n- const behavior = Platform.OS === \"ios\" ? \"padding\" : undefined;\n- const keyboardVerticalOffset = Platform.OS === \"ios\"\n- ? iosKeyboardOffset\n- : 0;\nreturn (\n- <KeyboardAvoidingView\n- behavior={behavior}\n- keyboardVerticalOffset={keyboardVerticalOffset}\n- style={styles.container}\n- >\n+ <KeyboardAvoidingView style={styles.container}>\n{textHeightMeasurer}\n<View style={styles.flatListContainer}>\n{flatList}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/compose-subthread-modal.react.js",
"new_path": "native/chat/settings/compose-subthread-modal.react.js",
"diff": "@@ -10,20 +10,13 @@ import type { AppState } from '../../redux-setup';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import {\n- View,\n- StyleSheet,\n- Platform,\n- Text,\n- InteractionManager,\n-} from 'react-native';\n+import { View, StyleSheet, Text, InteractionManager } from 'react-native';\nimport Icon from 'react-native-vector-icons/MaterialIcons';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\nimport { threadTypeDescriptions } from 'lib/shared/thread-utils';\nimport { connect } from 'lib/utils/redux-utils';\n-import { iosKeyboardOffset } from '../../dimensions';\nimport Button from '../../components/button.react';\nimport { ComposeThreadRouteName } from '../compose-thread.react';\nimport KeyboardAvoidingView\n@@ -86,17 +79,11 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\n</Button>\n</View>\n);\n- if (Platform.OS === \"ios\") {\nreturn (\n- <KeyboardAvoidingView\n- style={styles.container}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardOffset}\n- >{content}</KeyboardAvoidingView>\n+ <KeyboardAvoidingView style={styles.container}>\n+ {content}\n+ </KeyboardAvoidingView>\n);\n- } else {\n- return <View style={styles.container}>{content}</View>;\n- }\n}\nonPressOpen = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/keyboard-avoiding-modal.react.js",
"new_path": "native/components/keyboard-avoiding-modal.react.js",
"diff": "@@ -5,10 +5,9 @@ import type {\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\nimport * as React from 'react';\n-import { StyleSheet, View, Platform, ViewPropTypes } from 'react-native';\n+import { StyleSheet, View, ViewPropTypes } from 'react-native';\nimport PropTypes from 'prop-types';\n-import { iosKeyboardOffset } from '../dimensions';\nimport KeyboardAvoidingView from './keyboard-avoiding-view.react';\ntype Props = {|\n@@ -30,21 +29,11 @@ class KeyboardAvoidingModal extends React.PureComponent<Props> {\n{this.props.children}\n</View>\n);\n- if (Platform.OS === \"ios\") {\nreturn (\n<KeyboardAvoidingView\nstyle={[styles.container, this.props.containerStyle]}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardOffset}\n>{content}</KeyboardAvoidingView>\n);\n- } else {\n- return (\n- <View style={[styles.container, this.props.containerStyle]}>\n- {content}\n- </View>\n- );\n- }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/keyboard-avoiding-view.react.js",
"new_path": "native/components/keyboard-avoiding-view.react.js",
"diff": "@@ -15,11 +15,7 @@ import {\n} from 'react-native';\nimport PropTypes from 'prop-types';\n-import {\n- addKeyboardShowListener,\n- addKeyboardDismissListener,\n- removeKeyboardListener,\n-} from '../keyboard';\n+import { iosKeyboardOffset } from '../dimensions';\ntype ViewLayout = {\ny: number,\n@@ -46,9 +42,7 @@ type EmitterSubscription = {\nconst viewRef = 'VIEW';\ntype Props = {|\n- behavior?: 'height' | 'position' | 'padding',\nchildren?: React.Node,\n- contentContainerStyle?: StyleObj,\nstyle?: StyleObj,\nkeyboardVerticalOffset: number,\n|};\n@@ -58,23 +52,21 @@ type State = {|\nclass KeyboardAvoidingView extends React.PureComponent<Props, State> {\nstatic propTypes = {\n- behavior: PropTypes.oneOf(['height', 'position', 'padding']),\nchildren: PropTypes.node,\n- contentContainerStyle: ViewPropTypes.style,\nstyle: ViewPropTypes.style,\nkeyboardVerticalOffset: PropTypes.number.isRequired,\n};\nstatic defaultProps = {\n- keyboardVerticalOffset: 0,\n+ keyboardVerticalOffset: iosKeyboardOffset,\n};\nstate = {\nbottom: 0,\n};\n- subscriptions: EmitterSubscription[] = [];\n+ keyboardSubscription: ?EmitterSubscription = null;\nframe: ?ViewLayout = null;\ncurrentState = AppState.currentState;\n- _relativeKeyboardHeight(keyboardFrame: ScreenRect): number {\n+ relativeKeyboardHeight(keyboardFrame: ScreenRect): number {\nconst frame = this.frame;\nif (!frame || !keyboardFrame) {\nreturn 0;\n@@ -87,7 +79,7 @@ class KeyboardAvoidingView extends React.PureComponent<Props, State> {\nreturn Math.max(frame.y + frame.height - keyboardY, 0);\n}\n- _onKeyboardChange = (event: ?KeyboardChangeEvent) => {\n+ onKeyboardChange = (event: ?KeyboardChangeEvent) => {\nif (this.currentState !== \"active\") {\nreturn;\n}\n@@ -98,7 +90,7 @@ class KeyboardAvoidingView extends React.PureComponent<Props, State> {\n}\nconst { duration, easing, endCoordinates } = event;\n- const height = this._relativeKeyboardHeight(endCoordinates);\n+ const height = this.relativeKeyboardHeight(endCoordinates);\nif (this.state.bottom === height) {\nreturn;\n@@ -116,112 +108,53 @@ class KeyboardAvoidingView extends React.PureComponent<Props, State> {\nthis.setState({ bottom: height });\n}\n- _onLayout = (event: ViewLayoutEvent) => {\n+ onLayout = (event: ViewLayoutEvent) => {\nthis.frame = event.nativeEvent.layout;\n}\n- _handleAppStateChange = (nextAppState: ?string) => {\n+ handleAppStateChange = (nextAppState: ?string) => {\nthis.currentState = nextAppState;\n}\n- componentWillUpdate(nextProps: Props, nextState: State) {\n- if (\n- nextState.bottom === this.state.bottom &&\n- this.props.behavior === 'height' &&\n- nextProps.behavior === 'height'\n- ) {\n- nextState.bottom = 0;\n- }\n- }\n-\ncomponentWillMount() {\n- if (Platform.OS === 'ios') {\n- this.subscriptions = [\n- Keyboard.addListener('keyboardWillChangeFrame', this._onKeyboardChange),\n- ];\n- } else {\n- this.subscriptions = [\n- Keyboard.addListener('keyboardDidHide', this._onKeyboardChange),\n- Keyboard.addListener('keyboardDidShow', this._onKeyboardChange),\n- ];\n+ if (Platform.OS !== 'ios') {\n+ return;\n}\n- AppState.addEventListener('change', this._handleAppStateChange);\n+ this.keyboardSubscription = Keyboard.addListener(\n+ 'keyboardWillChangeFrame',\n+ this.onKeyboardChange,\n+ );\n+ AppState.addEventListener('change', this.handleAppStateChange);\n}\ncomponentWillUnmount() {\n- this.subscriptions.forEach((sub) => sub.remove());\n- AppState.removeEventListener('change', this._handleAppStateChange);\n+ if (Platform.OS !== 'ios') {\n+ return;\n}\n-\n- render() {\n- const { behavior, children, style, ...props } = this.props;\n-\n- switch (behavior) {\n- case 'height':\n- let heightStyle;\n- if (this.frame) {\n- // Note that we only apply a height change when there is keyboard\n- // present, i.e. this.state.bottom is greater than 0. If we remove\n- // that condition, this.frame.height will never go back to its\n- // original value. When height changes, we need to disable flex.\n- heightStyle = {\n- height: this.frame.height - this.state.bottom,\n- flex: 0,\n- };\n+ if (this.keyboardSubscription) {\n+ this.keyboardSubscription.remove();\n+ }\n+ AppState.removeEventListener('change', this.handleAppStateChange);\n}\n- return (\n- <View\n- ref={viewRef}\n- style={[style, heightStyle]}\n- onLayout={this._onLayout}\n- {...props}\n- >\n- {children}\n- </View>\n- );\n- case 'position':\n- const positionStyle = { bottom: this.state.bottom };\n- const { contentContainerStyle } = this.props;\n+ render() {\n+ const { children, style, ...props } = this.props;\n- return (\n- <View\n- ref={viewRef}\n- style={style}\n- onLayout={this._onLayout}\n- {...props}\n- >\n- <View style={[contentContainerStyle, positionStyle]}>\n- {children}\n- </View>\n- </View>\n- );\n+ if (Platform.OS !== \"ios\") {\n+ return <View style={style} {...props}>{children}</View>;\n+ }\n- case 'padding':\nconst paddingStyle = { paddingBottom: this.state.bottom };\nreturn (\n<View\nref={viewRef}\nstyle={[style, paddingStyle]}\n- onLayout={this._onLayout}\n+ onLayout={this.onLayout}\n{...props}\n>\n{children}\n</View>\n);\n-\n- default:\n- return (\n- <View\n- ref={viewRef}\n- onLayout={this._onLayout}\n- style={style}\n- {...props}\n- >\n- {children}\n- </View>\n- );\n- }\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Simplify KeyboardAvoidingView and factor out some logic |
129,187 | 27.03.2018 14:04:33 | 14,400 | 1b711d40c4e0713bf840f8ccf849d1e32123d1bb | Scroll panels in logged out view for tiny phones
Also, don't count keyboard events that don't represent any actual changes | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -14,7 +14,7 @@ import type { AppState } from '../redux-setup';\nimport type { Action } from '../navigation-setup';\nimport type { PingStartingPayload, PingResult } from 'lib/types/ping-types';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n-import type { KeyboardEvent } from '../keyboard';\n+import type { KeyboardEvent, EmitterSubscription } from '../keyboard';\nimport * as React from 'react';\nimport {\n@@ -37,6 +37,7 @@ import OnePassword from 'react-native-onepassword';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport { SafeAreaView } from 'react-navigation';\n+import _isEqual from 'lodash/fp/isEqual';\nimport {\nincludeDispatchActionProps,\n@@ -134,8 +135,8 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\ngesturesEnabled: false,\n};\n- keyboardShowListener: ?Object;\n- keyboardHideListener: ?Object;\n+ keyboardShowListener: ?EmitterSubscription;\n+ keyboardHideListener: ?EmitterSubscription;\nexpectingKeyboardToAppear = false;\nmounted = false;\n@@ -356,7 +357,7 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nif (DeviceInfo.isIPhoneX_deprecated) {\nkeyboardHeight -= 34;\n}\n- return windowHeight - keyboardHeight - textHeight - 20;\n+ return windowHeight - keyboardHeight - textHeight - 15;\n}\nanimateToSecondMode(\n@@ -424,6 +425,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\nkeyboardShow = (event: KeyboardEvent) => {\n+ if (_isEqual(event.startCoordinates)(event.endCoordinates)) {\n+ return;\n+ }\nif (this.expectingKeyboardToAppear) {\nthis.expectingKeyboardToAppear = false;\n}\n@@ -502,6 +506,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nthis.animateToSecondMode();\nreturn;\n}\n+ if (event && _isEqual(event.startCoordinates)(event.endCoordinates)) {\n+ return;\n+ }\nthis.keyboardHeight = 0;\nthis.activeKeyboard = false;\nif (this.activeAlert) {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/panel-components.react.js",
"new_path": "native/account/panel-components.react.js",
"diff": "@@ -5,6 +5,7 @@ import { loadingStatusPropType } from 'lib/types/loading-types';\nimport type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+import type { KeyboardEvent, EmitterSubscription } from '../keyboard';\nimport * as React from 'react';\nimport {\n@@ -13,6 +14,8 @@ import {\nText,\nStyleSheet,\nAnimated,\n+ ScrollView,\n+ LayoutAnimation,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport PropTypes from 'prop-types';\n@@ -20,12 +23,17 @@ import PropTypes from 'prop-types';\nimport Button from '../components/button.react';\nimport OnePasswordButton from '../components/one-password-button.react';\nimport { windowHeight } from '../dimensions';\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\n-type ButtonProps = {\n+type ButtonProps = {|\ntext: string,\nloadingStatus: LoadingStatus,\nonSubmit: () => void,\n-};\n+|};\nclass PanelButton extends React.PureComponent<ButtonProps> {\nstatic propTypes = {\n@@ -67,7 +75,7 @@ class PanelButton extends React.PureComponent<ButtonProps> {\n}\n-function PanelOnePasswordButton(props: { onPress: () => Promise<void> }) {\n+function PanelOnePasswordButton(props: {| onPress: () => Promise<void> |}) {\nreturn (\n<OnePasswordButton\nonPress={props.onPress}\n@@ -76,18 +84,78 @@ function PanelOnePasswordButton(props: { onPress: () => Promise<void> }) {\n);\n}\n-type PanelProps = {\n+type PanelProps = {|\nopacityValue: Animated.Value,\nchildren: React.Node,\nstyle?: StyleObj,\n+|};\n+type PanelState = {|\n+ keyboardHeight: number,\n+|};\n+class Panel extends React.PureComponent<PanelProps, PanelState> {\n+\n+ state = {\n+ keyboardHeight: 0,\n};\n-function Panel(props: PanelProps) {\n- const opacityStyle = { opacity: props.opacityValue };\n- return (\n- <Animated.View style={[styles.container, opacityStyle, props.style]}>\n- {props.children}\n+ keyboardShowListener: ?EmitterSubscription;\n+ keyboardHideListener: ?EmitterSubscription;\n+\n+ componentDidMount() {\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardHandler);\n+ this.keyboardHideListener =\n+ addKeyboardDismissListener(this.keyboardHandler);\n+ }\n+\n+ componentWillUnmount() {\n+ if (this.keyboardShowListener) {\n+ removeKeyboardListener(this.keyboardShowListener);\n+ this.keyboardShowListener = null;\n+ }\n+ if (this.keyboardHideListener) {\n+ removeKeyboardListener(this.keyboardHideListener);\n+ this.keyboardHideListener = null;\n+ }\n+ }\n+\n+ keyboardHandler = (event: KeyboardEvent) => {\n+ const keyboardHeight = windowHeight - event.endCoordinates.screenY;\n+ if (keyboardHeight === this.state.keyboardHeight) {\n+ return;\n+ }\n+ if (event.duration && event.easing) {\n+ LayoutAnimation.configureNext({\n+ duration: event.duration,\n+ update: {\n+ duration: event.duration,\n+ type: LayoutAnimation.Types[event.easing] || 'keyboard',\n+ },\n+ });\n+ }\n+ this.setState({ keyboardHeight });\n+ }\n+\n+ render() {\n+ const opacityStyle = { opacity: this.props.opacityValue };\n+ const content = (\n+ <Animated.View style={[styles.container, opacityStyle, this.props.style]}>\n+ {this.props.children}\n</Animated.View>\n);\n+ if (windowHeight >= 568) {\n+ return content;\n+ }\n+ const scrollViewStyle = {\n+ paddingBottom: 73.5 + this.state.keyboardHeight,\n+ };\n+ return (\n+ <View style={scrollViewStyle}>\n+ <ScrollView bounces={false} keyboardShouldPersistTaps=\"handled\">\n+ {content}\n+ </ScrollView>\n+ </View>\n+ );\n+ }\n+\n}\nconst styles = StyleSheet.create({\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/keyboard-avoiding-view.react.js",
"new_path": "native/components/keyboard-avoiding-view.react.js",
"diff": "import type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+import type { EmitterSubscription } from '../keyboard';\nimport * as React from 'react';\nimport {\n@@ -14,6 +15,7 @@ import {\nAppState,\n} from 'react-native';\nimport PropTypes from 'prop-types';\n+import _isEqual from 'lodash/fp/isEqual';\nimport { iosKeyboardOffset } from '../dimensions';\n@@ -35,9 +37,6 @@ type KeyboardChangeEvent = {\nduration?: number,\neasing?: string,\n};\n-type EmitterSubscription = {\n- +remove: () => void,\n-};\nconst viewRef = 'VIEW';\n@@ -89,6 +88,10 @@ class KeyboardAvoidingView extends React.PureComponent<Props, State> {\nreturn;\n}\n+ if (_isEqual(event.startCoordinates)(event.endCoordinates)) {\n+ return;\n+ }\n+\nconst { duration, easing, endCoordinates } = event;\nconst height = this.relativeKeyboardHeight(endCoordinates);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/keyboard.js",
"new_path": "native/keyboard.js",
"diff": "import { AppState, Keyboard, Platform } from 'react-native';\n-export type KeyboardEvent = {\n- duration: number,\n- endCoordinates: {\n+type Coordinates = {\nwidth: number,\nheight: number,\nscreenX: number,\nscreenY: number,\n- },\n+};\n+export type KeyboardEvent = {\n+ duration: number,\n+ startCoordinates: Coordinates,\n+ endCoordinates: Coordinates,\n};\ntype KeyboardCallback = (event: KeyboardEvent) => void;\ntype IgnoredKeyboardEvent = {|\n@@ -17,6 +19,9 @@ type IgnoredKeyboardEvent = {|\nevent: KeyboardEvent,\ntime: number,\n|};\n+export type EmitterSubscription = {\n+ +remove: () => void,\n+};\n// If the app becomes active within 500ms after a keyboard event is triggered,\n// we will call the relevant keyboard callbacks.\nconst appStateChangeDelay = 500;\n@@ -81,7 +86,7 @@ function addKeyboardDismissListener(callback: KeyboardCallback) {\ncallCallbackIfAppActive(callback),\n);\n}\n-function removeKeyboardListener(listener: { remove: () => void }) {\n+function removeKeyboardListener(listener: EmitterSubscription) {\ndecrementAppStateListeners();\nlistener.remove();\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Scroll panels in logged out view for tiny phones
Also, don't count keyboard events that don't represent any actual changes |
129,187 | 27.03.2018 14:36:15 | 14,400 | f4b79f5d0a3c251005fa8bd9fb8a00163d6890c2 | setActiveAlert(false) on email errors in RegisterPanel | [
{
"change_type": "MODIFY",
"old_path": "native/account/register-panel.react.js",
"new_path": "native/account/register-panel.react.js",
"diff": "@@ -291,6 +291,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n}\nonEmailAlertAcknowledged = () => {\n+ this.props.setActiveAlert(false);\nthis.setState(\n{\nemailInputText: \"\",\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | setActiveAlert(false) on email errors in RegisterPanel |
129,187 | 27.03.2018 17:58:11 | 14,400 | 39966345cc1a2f487d0cb2e97b5d688aa343496c | Lift log in and register state into LoggedOutModal
This way the fields save state if you switch between log-in and register | [
{
"change_type": "MODIFY",
"old_path": "native/account/log-in-panel-container.react.js",
"new_path": "native/account/log-in-panel-container.react.js",
"diff": "// @flow\nimport type { InnerLogInPanel } from './log-in-panel.react';\n+import {\n+ type StateContainer,\n+ stateContainerPropType,\n+} from '../utils/state-container';\n+import type { LogInState } from './log-in-panel.react';\nimport React from 'react';\nimport {\n@@ -27,6 +32,7 @@ type Props = {\nsetActiveAlert: (activeAlert: bool) => void,\nopacityValue: Animated.Value,\nforgotPasswordLinkOpacity: Animated.Value,\n+ logInState: StateContainer<LogInState>,\n};\ntype State = {\npanelTransition: Animated.Value,\n@@ -40,6 +46,7 @@ class LogInPanelContainer extends React.PureComponent<Props, State> {\nsetActiveAlert: PropTypes.func.isRequired,\nopacityValue: PropTypes.object.isRequired,\nforgotPasswordLinkOpacity: PropTypes.object.isRequired,\n+ logInState: stateContainerPropType.isRequired,\n};\nstate = {\npanelTransition: new Animated.Value(0),\n@@ -66,6 +73,7 @@ class LogInPanelContainer extends React.PureComponent<Props, State> {\nopacityValue={this.props.opacityValue}\nonePasswordSupported={this.props.onePasswordSupported}\ninnerRef={this.logInPanelRef}\n+ state={this.props.logInState}\n/>\n</Animated.View>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/log-in-panel.react.js",
"new_path": "native/account/log-in-panel.react.js",
"diff": "@@ -5,6 +5,10 @@ import type { AppState } from '../redux-setup';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { LogInInfo, LogInResult } from 'lib/types/account-types';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n+import {\n+ type StateContainer,\n+ stateContainerPropType,\n+} from '../utils/state-container';\nimport React from 'react';\nimport {\n@@ -43,11 +47,16 @@ import {\n} from './native-credentials';\nimport { getDeviceTokenUpdateRequest } from '../utils/device-token-utils';\n+export type LogInState = {\n+ usernameOrEmailInputText: string,\n+ passwordInputText: string,\n+};\ntype Props = {\nsetActiveAlert: (activeAlert: bool) => void,\nopacityValue: Animated.Value,\nonePasswordSupported: bool,\ninnerRef: (logInPanel: LogInPanel) => void,\n+ state: StateContainer<LogInState>,\n// Redux state\nloadingStatus: LoadingStatus,\ncurrentCalendarQuery: () => CalendarQuery,\n@@ -57,27 +66,20 @@ type Props = {\n// async functions that hit server APIs\nlogIn: (logInInfo: LogInInfo) => Promise<LogInResult>,\n};\n-type State = {\n- usernameOrEmailInputText: string,\n- passwordInputText: string,\n-};\n-class LogInPanel extends React.PureComponent<Props, State> {\n+class LogInPanel extends React.PureComponent<Props> {\nstatic propTypes = {\nsetActiveAlert: PropTypes.func.isRequired,\nopacityValue: PropTypes.object.isRequired,\nonePasswordSupported: PropTypes.bool.isRequired,\ninnerRef: PropTypes.func.isRequired,\n+ state: stateContainerPropType.isRequired,\nloadingStatus: PropTypes.string.isRequired,\ncurrentCalendarQuery: PropTypes.func.isRequired,\ndeviceToken: PropTypes.string,\ndispatchActionPromise: PropTypes.func.isRequired,\nlogIn: PropTypes.func.isRequired,\n};\n- state = {\n- usernameOrEmailInputText: \"\",\n- passwordInputText: \"\",\n- };\nusernameOrEmailInput: ?TextInput;\npasswordInput: ?TextInput;\n@@ -89,7 +91,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nasync attemptToFetchCredentials() {\nconst credentials = await fetchNativeCredentials();\nif (credentials) {\n- this.setState({\n+ this.props.state.setState({\nusernameOrEmailInputText: credentials.username,\npasswordInputText: credentials.password,\n});\n@@ -111,7 +113,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\n<Icon name=\"user\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={styles.input}\n- value={this.state.usernameOrEmailInputText}\n+ value={this.props.state.state.usernameOrEmailInputText}\nonChangeText={this.onChangeUsernameOrEmailInputText}\nplaceholder={usernamePlaceholder}\nautoFocus={true}\n@@ -129,7 +131,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\n<Icon name=\"lock\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={[styles.input, passwordStyle]}\n- value={this.state.passwordInputText}\n+ value={this.props.state.state.passwordInputText}\nonChangeText={this.onChangePasswordInputText}\nplaceholder=\"Password\"\nsecureTextEntry={true}\n@@ -169,18 +171,22 @@ class LogInPanel extends React.PureComponent<Props, State> {\n}\nonChangeUsernameOrEmailInputText = (text: string) => {\n- this.setState({ usernameOrEmailInputText: text });\n+ this.props.state.setState({ usernameOrEmailInputText: text });\n}\nonChangePasswordInputText = (text: string) => {\n- this.setState({ passwordInputText: text });\n+ this.props.state.setState({ passwordInputText: text });\n}\nonSubmit = () => {\nthis.props.setActiveAlert(true);\nif (\n- this.state.usernameOrEmailInputText.search(validUsernameRegex) === -1 &&\n- this.state.usernameOrEmailInputText.search(validEmailRegex) === -1\n+ this.props.state.state.usernameOrEmailInputText.search(\n+ validUsernameRegex,\n+ ) === -1 &&\n+ this.props.state.state.usernameOrEmailInputText.search(\n+ validEmailRegex,\n+ ) === -1\n) {\nAlert.alert(\n\"Invalid username\",\n@@ -205,7 +211,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nonUsernameOrEmailAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\nusernameOrEmailInputText: \"\",\n},\n@@ -221,15 +227,16 @@ class LogInPanel extends React.PureComponent<Props, State> {\ngetDeviceTokenUpdateRequest(this.props.deviceToken);\ntry {\nconst result = await this.props.logIn({\n- usernameOrEmail: this.state.usernameOrEmailInputText,\n- password: this.state.passwordInputText,\n+ usernameOrEmail: this.props.state.state.usernameOrEmailInputText,\n+ password: this.props.state.state.passwordInputText,\ncalendarQuery,\ndeviceTokenUpdateRequest,\n});\nthis.props.setActiveAlert(false);\n+ this.props.state.clearState();\nawait setNativeCredentials({\nusername: result.currentUserInfo.username,\n- password: this.state.passwordInputText,\n+ password: this.props.state.state.passwordInputText,\n});\nreturn result;\n} catch (e) {\n@@ -267,7 +274,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nonPasswordAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\npasswordInputText: \"\",\n},\n@@ -280,7 +287,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nonUnknownErrorAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\nusernameOrEmailInputText: \"\",\npasswordInputText: \"\",\n@@ -295,7 +302,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nonPressOnePassword = async () => {\ntry {\nconst credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n- this.setState({\n+ this.props.state.setState({\nusernameOrEmailInputText: credentials.username,\npasswordInputText: credentials.password,\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -15,6 +15,8 @@ import type { Action } from '../navigation-setup';\nimport type { PingStartingPayload, PingResult } from 'lib/types/ping-types';\nimport type { CalendarQuery } from 'lib/types/entry-types';\nimport type { KeyboardEvent, EmitterSubscription } from '../keyboard';\n+import type { LogInState } from './log-in-panel.react';\n+import type { RegisterState } from './register-panel.react';\nimport * as React from 'react';\nimport {\n@@ -49,6 +51,7 @@ import {\nappStartNativeCredentialsAutoLogIn,\nappStartReduxLoggedInButInvalidCookie,\n} from 'lib/actions/user-actions';\n+import sleep from 'lib/utils/sleep';\nimport {\nwindowHeight,\n@@ -68,6 +71,11 @@ import {\naddKeyboardDismissListener,\nremoveKeyboardListener,\n} from '../keyboard';\n+import {\n+ type SimpleStateSetter,\n+ type StateContainer,\n+ setStateForContainer,\n+} from '../utils/state-container';\nconst forceInset = { top: 'always', bottom: 'always' };\n@@ -96,23 +104,12 @@ type State = {\nforgotPasswordLinkOpacity: Animated.Value,\nbuttonOpacity: Animated.Value,\nonePasswordSupported: bool,\n+ logInState: StateContainer<LogInState>;\n+ registerState: StateContainer<RegisterState>;\n};\nclass InnerLoggedOutModal extends React.PureComponent<Props, State> {\n- state = {\n- mode: \"loading\",\n- panelPaddingTop: new Animated.Value(\n- InnerLoggedOutModal.calculatePanelPaddingTop(\"prompt\", 0),\n- ),\n- footerPaddingTop: new Animated.Value(\n- InnerLoggedOutModal.calculateFooterPaddingTop(0),\n- ),\n- panelOpacity: new Animated.Value(0),\n- forgotPasswordLinkOpacity: new Animated.Value(0),\n- buttonOpacity: new Animated.Value(0),\n- onePasswordSupported: false,\n- };\nstatic propTypes = {\nnavigation: PropTypes.shape({\nnavigate: PropTypes.func.isRequired,\n@@ -150,12 +147,87 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nconstructor(props: Props) {\nsuper(props);\n+ this.determineOnePasswordSupport();\n+\n+ // Man, this is a lot of boilerplate just to containerize some state.\n+ // Mostly due to Flow typing requirements...\n+ const setState = this.setState.bind(this);\n+ const setLogInState = setStateForContainer(\n+ setState,\n+ (change: $Shape<LogInState>) => (fullState: State) => ({\n+ logInState: {\n+ ...fullState.logInState,\n+ state: { ...fullState.logInState.state, ...change },\n+ },\n+ }),\n+ );\n+ const setRegisterState = setStateForContainer(\n+ setState,\n+ (change: $Shape<RegisterState>) => (fullState: State) => ({\n+ registerState: {\n+ ...fullState.registerState,\n+ state: { ...fullState.registerState.state, ...change },\n+ },\n+ }),\n+ );\n+ const initialLogInState = {\n+ usernameOrEmailInputText: \"\",\n+ passwordInputText: \"\",\n+ };\n+ const initialRegisterState = {\n+ usernameInputText: \"\",\n+ emailInputText: \"\",\n+ passwordInputText: \"\",\n+ confirmPasswordInputText: \"\",\n+ };\n+ const clearState = async () => {\n+ await sleep(500);\n+ setState((fullState: State) => ({\n+ logInState: {\n+ ...fullState.logInState,\n+ state: initialLogInState,\n+ },\n+ registerState: {\n+ ...fullState.registerState,\n+ state: initialRegisterState,\n+ },\n+ }));\n+ };\n+\n+ this.state = {\n+ mode: props.rehydrateConcluded ? \"prompt\" : \"loading\",\n+ panelPaddingTop: new Animated.Value(\n+ InnerLoggedOutModal.calculatePanelPaddingTop(\"prompt\", 0),\n+ ),\n+ footerPaddingTop: new Animated.Value(\n+ InnerLoggedOutModal.calculateFooterPaddingTop(0),\n+ ),\n+ panelOpacity: new Animated.Value(0),\n+ forgotPasswordLinkOpacity: new Animated.Value(0),\n+ buttonOpacity: new Animated.Value(props.rehydrateConcluded ? 1 : 0),\n+ onePasswordSupported: false,\n+ logInState: {\n+ state: {\n+ usernameOrEmailInputText: \"\",\n+ passwordInputText: \"\",\n+ },\n+ setState: setLogInState,\n+ clearState,\n+ },\n+ registerState: {\n+ state: {\n+ usernameInputText: \"\",\n+ emailInputText: \"\",\n+ passwordInputText: \"\",\n+ confirmPasswordInputText: \"\",\n+ },\n+ setState: setRegisterState,\n+ clearState,\n+ },\n+ };\nif (props.rehydrateConcluded) {\n- this.state.mode = \"prompt\";\n- this.state.buttonOpacity = new Animated.Value(1);\nthis.nextMode = \"prompt\";\n}\n- this.determineOnePasswordSupport();\n}\nasync determineOnePasswordSupport() {\n@@ -563,6 +635,7 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nsetActiveAlert={this.setActiveAlert}\nopacityValue={this.state.panelOpacity}\nforgotPasswordLinkOpacity={this.state.forgotPasswordLinkOpacity}\n+ logInState={this.state.logInState}\nref={this.logInPanelContainerRef}\n/>\n);\n@@ -572,6 +645,7 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nsetActiveAlert={this.setActiveAlert}\nopacityValue={this.state.panelOpacity}\nonePasswordSupported={this.state.onePasswordSupported}\n+ state={this.state.registerState}\n/>\n);\n} else if (this.state.mode === \"prompt\") {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/register-panel.react.js",
"new_path": "native/account/register-panel.react.js",
"diff": "@@ -4,6 +4,10 @@ import type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { AppState } from '../redux-setup';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { RegisterResult } from 'lib/types/account-types';\n+import {\n+ type StateContainer,\n+ stateContainerPropType,\n+} from '../utils/state-container';\nimport React from 'react';\nimport {\n@@ -35,10 +39,17 @@ import {\n} from './panel-components.react';\nimport { setNativeCredentials } from './native-credentials';\n+export type RegisterState = {\n+ usernameInputText: string,\n+ emailInputText: string,\n+ passwordInputText: string,\n+ confirmPasswordInputText: string,\n+};\ntype Props = {\nsetActiveAlert: (activeAlert: bool) => void,\nopacityValue: Animated.Value,\nonePasswordSupported: bool,\n+ state: StateContainer<RegisterState>,\n// Redux state\nloadingStatus: LoadingStatus,\n// Redux dispatch functions\n@@ -50,28 +61,17 @@ type Props = {\npassword: string,\n) => Promise<RegisterResult>,\n};\n-type State = {\n- usernameInputText: string,\n- emailInputText: string,\n- passwordInputText: string,\n- confirmPasswordInputText: string,\n-};\n-class RegisterPanel extends React.PureComponent<Props, State> {\n+class RegisterPanel extends React.PureComponent<Props> {\nstatic propTypes = {\nsetActiveAlert: PropTypes.func.isRequired,\nopacityValue: PropTypes.object.isRequired,\nonePasswordSupported: PropTypes.bool.isRequired,\n+ state: stateContainerPropType.isRequired,\nloadingStatus: PropTypes.string.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nregister: PropTypes.func.isRequired,\n};\n- state = {\n- usernameInputText: \"\",\n- emailInputText: \"\",\n- passwordInputText: \"\",\n- confirmPasswordInputText: \"\",\n- };\nusernameInput: ?TextInput;\nemailInput: ?TextInput;\npasswordInput: ?TextInput;\n@@ -92,7 +92,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<Icon name=\"user\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={styles.input}\n- value={this.state.usernameInputText}\n+ value={this.props.state.state.usernameInputText}\nonChangeText={this.onChangeUsernameInputText}\nplaceholder=\"Username\"\nautoFocus={true}\n@@ -115,7 +115,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n/>\n<TextInput\nstyle={styles.input}\n- value={this.state.emailInputText}\n+ value={this.props.state.state.emailInputText}\nonChangeText={this.onChangeEmailInputText}\nplaceholder=\"Email address\"\nautoCorrect={false}\n@@ -132,7 +132,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<Icon name=\"lock\" size={22} color=\"#777\" style={styles.icon} />\n<TextInput\nstyle={[styles.input, passwordStyle]}\n- value={this.state.passwordInputText}\n+ value={this.props.state.state.passwordInputText}\nonChangeText={this.onChangePasswordInputText}\nplaceholder=\"Password\"\nsecureTextEntry={true}\n@@ -147,7 +147,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n<View>\n<TextInput\nstyle={styles.input}\n- value={this.state.confirmPasswordInputText}\n+ value={this.props.state.state.confirmPasswordInputText}\nonChangeText={this.onChangeConfirmPasswordInputText}\nplaceholder=\"Confirm password\"\nsecureTextEntry={true}\n@@ -199,24 +199,24 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n}\nonChangeUsernameInputText = (text: string) => {\n- this.setState({ usernameInputText: text });\n+ this.props.state.setState({ usernameInputText: text });\n}\nonChangeEmailInputText = (text: string) => {\n- this.setState({ emailInputText: text });\n+ this.props.state.setState({ emailInputText: text });\n}\nonChangePasswordInputText = (text: string) => {\n- this.setState({ passwordInputText: text });\n+ this.props.state.setState({ passwordInputText: text });\n}\nonChangeConfirmPasswordInputText = (text: string) => {\n- this.setState({ confirmPasswordInputText: text });\n+ this.props.state.setState({ confirmPasswordInputText: text });\n}\nonSubmit = () => {\nthis.props.setActiveAlert(true);\n- if (this.state.passwordInputText === '') {\n+ if (this.props.state.state.passwordInputText === '') {\nAlert.alert(\n\"Empty password\",\n\"Password cannot be empty\",\n@@ -226,7 +226,8 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n{ cancelable: false },\n);\n} else if (\n- this.state.passwordInputText !== this.state.confirmPasswordInputText\n+ this.props.state.state.passwordInputText !==\n+ this.props.state.state.confirmPasswordInputText\n) {\nAlert.alert(\n\"Passwords don't match\",\n@@ -236,7 +237,9 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n],\n{ cancelable: false },\n);\n- } else if (this.state.usernameInputText.search(validUsernameRegex) === -1) {\n+ } else if (\n+ this.props.state.state.usernameInputText.search(validUsernameRegex) === -1\n+ ) {\nAlert.alert(\n\"Invalid username\",\n\"Alphanumeric usernames only\",\n@@ -245,7 +248,9 @@ class RegisterPanel extends React.PureComponent<Props, State> {\n],\n{ cancelable: false },\n);\n- } else if (this.state.emailInputText.search(validEmailRegex) === -1) {\n+ } else if (\n+ this.props.state.state.emailInputText.search(validEmailRegex) === -1\n+ ) {\nAlert.alert(\n\"Invalid email address\",\n\"Valid email addresses only\",\n@@ -265,7 +270,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonPasswordAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\npasswordInputText: \"\",\nconfirmPasswordInputText: \"\",\n@@ -279,7 +284,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonUsernameAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\nusernameInputText: \"\",\n},\n@@ -292,7 +297,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonEmailAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\nemailInputText: \"\",\n},\n@@ -306,14 +311,15 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nasync registerAction() {\ntry {\nconst result = await this.props.register(\n- this.state.usernameInputText,\n- this.state.emailInputText,\n- this.state.passwordInputText,\n+ this.props.state.state.usernameInputText,\n+ this.props.state.state.emailInputText,\n+ this.props.state.state.passwordInputText,\n);\nthis.props.setActiveAlert(false);\n+ this.props.state.clearState();\nawait setNativeCredentials({\nusername: result.currentUserInfo.username,\n- password: this.state.passwordInputText,\n+ password: this.props.state.state.passwordInputText,\n});\nreturn result;\n} catch (e) {\n@@ -351,7 +357,7 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonUnknownErrorAlertAcknowledged = () => {\nthis.props.setActiveAlert(false);\n- this.setState(\n+ this.props.state.setState(\n{\nusernameInputText: \"\",\nemailInputText: \"\",\n@@ -368,12 +374,12 @@ class RegisterPanel extends React.PureComponent<Props, State> {\nonPressOnePassword = async () => {\ntry {\nconst credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n- this.setState({\n+ this.props.state.setState({\nusernameInputText: credentials.username,\npasswordInputText: credentials.password,\nconfirmPasswordInputText: credentials.password,\n});\n- if (this.state.emailInputText) {\n+ if (this.props.state.state.emailInputText) {\nthis.onSubmit();\n} else {\ninvariant(this.emailInput, \"ref should exist\");\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/utils/state-container.js",
"diff": "+// @flow\n+\n+import PropTypes from 'prop-types';\n+\n+export type SimpleStateSetter<S: {}> = (\n+ newState: $Shape<S>,\n+ callback?: () => mixed,\n+) => void;\n+\n+type StateChange<S: {}> = $Shape<S> | S => $Shape<S>;\n+type StateSetter<S: {}> = (\n+ newState: StateChange<S>,\n+ callback?: () => mixed,\n+) => void;\n+\n+export type StateContainer<S: {}> = {\n+ state: S,\n+ setState: SimpleStateSetter<S>,\n+ clearState: () => mixed,\n+};\n+\n+const stateContainerPropType = PropTypes.shape({\n+ state: PropTypes.object.isRequired,\n+ setState: PropTypes.func.isRequired,\n+ clearState: PropTypes.func.isRequired,\n+});\n+\n+function setStateForContainer<FullState: {}, OurContainer: {}>(\n+ setState: StateSetter<FullState>,\n+ reverseSelector: (ourChange: $Shape<OurContainer>) => StateChange<FullState>,\n+): SimpleStateSetter<OurContainer> {\n+ return (\n+ ourChange: $Shape<OurContainer>,\n+ callback?: () => mixed,\n+ ) => setState(reverseSelector(ourChange), callback);\n+}\n+\n+export {\n+ setStateForContainer,\n+ stateContainerPropType,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Lift log in and register state into LoggedOutModal
This way the fields save state if you switch between log-in and register |
129,187 | 27.03.2018 18:54:33 | 14,400 | c48da60a98feaa71648e861286cc24b514854418 | Don't crash when encountering a message referencing a thread client doesn't recognize | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/message-utils.js",
"new_path": "lib/shared/message-utils.js",
"diff": "@@ -192,6 +192,13 @@ function createMessageInfo(\n} else if (rawMessageInfo.type === messageType.CREATE_THREAD) {\nconst initialParentThreadID =\nrawMessageInfo.initialThreadState.parentThreadID;\n+ let parentThreadInfo = null;\n+ if (initialParentThreadID) {\n+ parentThreadInfo = threadInfos[initialParentThreadID];\n+ if (!parentThreadInfo) {\n+ return null;\n+ }\n+ }\nreturn {\ntype: messageType.CREATE_THREAD,\nid: rawMessageInfo.id,\n@@ -204,9 +211,7 @@ function createMessageInfo(\ntime: rawMessageInfo.time,\ninitialThreadState: {\nname: rawMessageInfo.initialThreadState.name,\n- parentThreadInfo: initialParentThreadID\n- ? threadInfos[initialParentThreadID]\n- : null,\n+ parentThreadInfo,\nvisibilityRules: rawMessageInfo.initialThreadState.visibilityRules,\ncolor: rawMessageInfo.initialThreadState.color,\notherMembers: userIDsToRelativeUserInfos(\n@@ -237,6 +242,10 @@ function createMessageInfo(\naddedMembers,\n};\n} else if (rawMessageInfo.type === messageType.CREATE_SUB_THREAD) {\n+ const childThreadInfo = threadInfos[rawMessageInfo.childThreadID];\n+ if (!childThreadInfo) {\n+ return null;\n+ }\nreturn {\ntype: messageType.CREATE_SUB_THREAD,\nid: rawMessageInfo.id,\n@@ -247,7 +256,7 @@ function createMessageInfo(\nisViewer: rawMessageInfo.creatorID === viewerID,\n},\ntime: rawMessageInfo.time,\n- childThreadInfo: threadInfos[rawMessageInfo.childThreadID],\n+ childThreadInfo,\n};\n} else if (rawMessageInfo.type === messageType.CHANGE_SETTINGS) {\nreturn {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/dist/app.build.js",
"new_path": "web/dist/app.build.js",
"diff": "@@ -35864,6 +35864,13 @@ function createMessageInfo(rawMessageInfo, viewerID, userInfos, threadInfos) {\nreturn messageInfo;\n} else if (rawMessageInfo.type === __WEBPACK_IMPORTED_MODULE_0__types_message_types__[\"c\" /* messageType */].CREATE_THREAD) {\nconst initialParentThreadID = rawMessageInfo.initialThreadState.parentThreadID;\n+ let parentThreadInfo = null;\n+ if (initialParentThreadID) {\n+ parentThreadInfo = threadInfos[initialParentThreadID];\n+ if (!parentThreadInfo) {\n+ return null;\n+ }\n+ }\nreturn {\ntype: __WEBPACK_IMPORTED_MODULE_0__types_message_types__[\"c\" /* messageType */].CREATE_THREAD,\nid: rawMessageInfo.id,\n@@ -35876,7 +35883,7 @@ function createMessageInfo(rawMessageInfo, viewerID, userInfos, threadInfos) {\ntime: rawMessageInfo.time,\ninitialThreadState: {\nname: rawMessageInfo.initialThreadState.name,\n- parentThreadInfo: initialParentThreadID ? threadInfos[initialParentThreadID] : null,\n+ parentThreadInfo,\nvisibilityRules: rawMessageInfo.initialThreadState.visibilityRules,\ncolor: rawMessageInfo.initialThreadState.color,\notherMembers: Object(__WEBPACK_IMPORTED_MODULE_4__selectors_user_selectors__[\"b\" /* userIDsToRelativeUserInfos */])(rawMessageInfo.initialThreadState.memberIDs.filter(userID => userID !== rawMessageInfo.creatorID), viewerID, userInfos)\n@@ -35897,6 +35904,10 @@ function createMessageInfo(rawMessageInfo, viewerID, userInfos, threadInfos) {\naddedMembers\n};\n} else if (rawMessageInfo.type === __WEBPACK_IMPORTED_MODULE_0__types_message_types__[\"c\" /* messageType */].CREATE_SUB_THREAD) {\n+ const childThreadInfo = threadInfos[rawMessageInfo.childThreadID];\n+ if (!childThreadInfo) {\n+ return null;\n+ }\nreturn {\ntype: __WEBPACK_IMPORTED_MODULE_0__types_message_types__[\"c\" /* messageType */].CREATE_SUB_THREAD,\nid: rawMessageInfo.id,\n@@ -35907,7 +35918,7 @@ function createMessageInfo(rawMessageInfo, viewerID, userInfos, threadInfos) {\nisViewer: rawMessageInfo.creatorID === viewerID\n},\ntime: rawMessageInfo.time,\n- childThreadInfo: threadInfos[rawMessageInfo.childThreadID]\n+ childThreadInfo\n};\n} else if (rawMessageInfo.type === __WEBPACK_IMPORTED_MODULE_0__types_message_types__[\"c\" /* messageType */].CHANGE_SETTINGS) {\nreturn {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't crash when encountering a message referencing a thread client doesn't recognize |
129,187 | 27.03.2018 21:00:31 | 14,400 | aef6afa6d47f125efbcd1f24b8adfccfcdb6443f | Don't use Modal's onDismiss prop on Android
It only works on iOS apparently. I tried to fix this in but that just introduced a regression on iOS.
Also apparently Flow can handle `setCookieActionType` in the same conditional branch as the rest for `reduceUserInfos`. | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/user-reducer.js",
"new_path": "lib/reducers/user-reducer.js",
"diff": "@@ -87,7 +87,8 @@ function reduceUserInfos(\naction.type === fetchEntriesActionTypes.success ||\naction.type === searchUsersActionTypes.success ||\naction.type === logOutActionTypes.success ||\n- action.type === deleteAccountActionTypes.success\n+ action.type === deleteAccountActionTypes.success ||\n+ action.type === setCookieActionType\n) {\nconst updated = {\n...state,\n@@ -96,14 +97,6 @@ function reduceUserInfos(\nif (!_isEqual(state)(updated)) {\nreturn updated;\n}\n- } else if (action.type === setCookieActionType) {\n- const updated = {\n- ...state,\n- ..._keyBy('id')(action.payload.userInfos),\n- };\n- if (!_isEqual(state)(updated)) {\n- return updated;\n- }\n}\nreturn state;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/tooltip.react.js",
"new_path": "native/components/tooltip.react.js",
"diff": "@@ -15,6 +15,7 @@ import {\nText,\nEasing,\nViewPropTypes,\n+ Platform,\n} from 'react-native';\nimport PropTypes from 'prop-types';\nimport invariant from 'invariant';\n@@ -134,9 +135,6 @@ class Tooltip extends React.PureComponent<Props, State> {\n}\ntoggleModal = () => {\n- if (this.state.isModalOpen) {\n- this.onDismiss();\n- }\nthis.setState({ isModalOpen: !this.state.isModalOpen });\n}\n@@ -153,7 +151,7 @@ class Tooltip extends React.PureComponent<Props, State> {\n}\nonPressItem = (userCallback: () => void) => {\n- if (this.state.isModalOpen) {\n+ if (this.state.isModalOpen && Platform.OS === \"ios\") {\nthis.callOnDismiss = userCallback;\n} else {\nuserCallback();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't use Modal's onDismiss prop on Android
It only works on iOS apparently. I tried to fix this in 3bc8ead98621de313b4922485b3a931045c17254, but that just introduced a regression on iOS.
Also apparently Flow can handle `setCookieActionType` in the same conditional branch as the rest for `reduceUserInfos`. |
129,187 | 28.03.2018 11:45:59 | 14,400 | aca40b0709a197d5fc87dbaf0b5164bb9be69d0d | codeVersion -> 5 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 4\n- versionName \"0.0.4\"\n+ versionCode 5\n+ versionName \"0.0.5\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"4\"\n- android:versionName=\"0.0.4\"\n+ android:versionCode=\"5\"\n+ android:versionName=\"0.0.5\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.4</string>\n+ <string>0.0.5</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>4</string>\n+ <string>5</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -37,7 +37,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 4;\n+const codeVersion = 5;\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 | codeVersion -> 5 |
129,187 | 28.03.2018 15:53:45 | 14,400 | 3083efb45e4e4c96a88fbe8c7f4c2dfcbb691f52 | Use multiple threads on server | [
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -5,6 +5,8 @@ import type { Endpoint } from 'lib/types/endpoints';\nimport express from 'express';\nimport cookieParser from 'cookie-parser';\n+import cluster from 'cluster';\n+import os from 'os';\nimport {\njsonHandler,\n@@ -60,24 +62,6 @@ import urlFacts from '../facts/url';\nconst { baseRoutePath } = urlFacts;\n-const server = express();\n-server.use(express.json({ limit: \"50mb\" }));\n-server.use(cookieParser());\n-\n-const router = express.Router();\n-router.use('/images', express.static('images'));\n-router.use('/fonts', express.static('fonts'));\n-router.use(\n- '/.well-known',\n- express.static(\n- '.well-known',\n- // Necessary for apple-app-site-association file\n- { setHeaders: res => res.setHeader(\"Content-Type\", \"application/json\") },\n- ),\n-);\n-router.use('/compiled', express.static('compiled'));\n-router.use('/', express.static('icons'));\n-\nconst jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'update_activity': updateActivityResponder,\n'update_user_subscription': userSubscriptionUpdateResponder,\n@@ -111,6 +95,31 @@ const jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'create_error_report': errorReportCreationResponder,\n'fetch_error_report_infos': errorReportFetchInfosResponder,\n};\n+\n+if (cluster.isMaster) {\n+ const cpuCount = os.cpus().length;\n+ for (let i = 0; i < cpuCount; i++) {\n+ cluster.fork();\n+ }\n+} else {\n+ const server = express();\n+ server.use(express.json({ limit: \"50mb\" }));\n+ server.use(cookieParser());\n+\n+ const router = express.Router();\n+ router.use('/images', express.static('images'));\n+ router.use('/fonts', express.static('fonts'));\n+ router.use(\n+ '/.well-known',\n+ express.static(\n+ '.well-known',\n+ // Necessary for apple-app-site-association file\n+ { setHeaders: res => res.setHeader(\"Content-Type\", \"application/json\") },\n+ ),\n+ );\n+ router.use('/compiled', express.static('compiled'));\n+ router.use('/', express.static('icons'));\n+\nfor (let endpoint in jsonEndpoints) {\n// $FlowFixMe Flow thinks endpoint is string\nconst responder = jsonEndpoints[endpoint];\n@@ -125,3 +134,4 @@ router.get('*', htmlHandler(websiteResponder));\nserver.use(baseRoutePath, router);\nserver.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use multiple threads on server |
129,187 | 29.03.2018 10:23:48 | 14,400 | 1a94d52708d06ca2bb8cb51ce5d0c05fefd7349b | Restart a cluster worker on crash | [
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -101,6 +101,7 @@ if (cluster.isMaster) {\nfor (let i = 0; i < cpuCount; i++) {\ncluster.fork();\n}\n+ cluster.on('exit', worker => cluster.fork());\n} else {\nconst server = express();\nserver.use(express.json({ limit: \"50mb\" }));\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Restart a cluster worker on crash |
129,187 | 29.03.2018 11:09:02 | 14,400 | 6dd81dea9453cbd5e734022df59b7822a81cc031 | [native] Badge the Chat icon on the tab bar | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/chat-icon.react.js",
"diff": "+// @flow\n+\n+import type { AppState } from '../redux-setup';\n+\n+import React from 'react';\n+import { View, Text, StyleSheet } from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome';\n+import PropTypes from 'prop-types';\n+\n+import { connect } from 'lib/utils/redux-utils';\n+import { unreadCount } from 'lib/selectors/thread-selectors';\n+\n+type Props = {\n+ color: string,\n+ // Redux state\n+ unreadCount: number,\n+};\n+class ChatIcon extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ color: PropTypes.string.isRequired,\n+ unreadCount: PropTypes.number.isRequired,\n+ };\n+\n+ render() {\n+ const icon = (\n+ <Icon\n+ name=\"comments-o\"\n+ style={[styles.icon, { color: this.props.color }]}\n+ />\n+ );\n+ if (!this.props.unreadCount) {\n+ return icon;\n+ }\n+ return (\n+ <View>\n+ {icon}\n+ <View style={styles.badge}>\n+ <Text style={styles.badgeText}>\n+ {this.props.unreadCount}\n+ </Text>\n+ </View>\n+ </View>\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ icon: {\n+ fontSize: 28,\n+ },\n+ badge: {\n+ position: 'absolute',\n+ right: -8,\n+ top: 2,\n+ backgroundColor: 'red',\n+ borderRadius: 9,\n+ width: 18,\n+ height: 18,\n+ justifyContent: 'center',\n+ alignItems: 'center',\n+ },\n+ badgeText: {\n+ color: 'white',\n+ },\n+});\n+\n+export default connect((state: AppState) => ({\n+ unreadCount: unreadCount(state),\n+}))(ChatIcon);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/chat-label.react.js",
"diff": "+// @flow\n+\n+import type { AppState } from '../redux-setup';\n+\n+import React from 'react';\n+import { View, Text, StyleSheet } from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+import { connect } from 'lib/utils/redux-utils';\n+import { unreadCount } from 'lib/selectors/thread-selectors';\n+\n+type Props = {\n+ color: string,\n+ // Redux state\n+ unreadCount: number,\n+};\n+class ChatLabel extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ color: PropTypes.string.isRequired,\n+ unreadCount: PropTypes.number.isRequired,\n+ };\n+\n+ render() {\n+ const text = (\n+ <Text\n+ style={[styles.text, { color: this.props.color }]}\n+ allowFontScaling={true}\n+ >\n+ CHAT\n+ </Text>\n+ );\n+ if (!this.props.unreadCount) {\n+ return text;\n+ }\n+ return (\n+ <View>\n+ {text}\n+ <View style={styles.badge}>\n+ <Text style={styles.badgeText}>\n+ {this.props.unreadCount}\n+ </Text>\n+ </View>\n+ </View>\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ text: {\n+ textAlign: 'center',\n+ fontSize: 13,\n+ margin: 8,\n+ backgroundColor: 'transparent',\n+ },\n+ badge: {\n+ position: 'absolute',\n+ right: -13,\n+ top: 8,\n+ backgroundColor: 'red',\n+ borderRadius: 9,\n+ width: 18,\n+ height: 18,\n+ justifyContent: 'center',\n+ alignItems: 'center',\n+ },\n+ badgeText: {\n+ color: 'white',\n+ paddingBottom: 1,\n+ },\n+});\n+\n+export default connect((state: AppState) => ({\n+ unreadCount: unreadCount(state),\n+}))(ChatLabel);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat.react.js",
"new_path": "native/chat/chat.react.js",
"diff": "import type { NavigationStateRoute } from 'react-navigation';\nimport React from 'react';\n-import { StyleSheet } from 'react-native';\n-import Icon from 'react-native-vector-icons/FontAwesome';\n+import { Platform } from 'react-native';\nimport { StackNavigator } from 'react-navigation';\nimport {\n@@ -22,6 +21,8 @@ import {\nDeleteThread,\nDeleteThreadRouteName,\n} from './settings/delete-thread.react';\n+import ChatIcon from './chat-icon.react';\n+import ChatLabel from './chat-label.react';\nconst Chat = StackNavigator(\n{\n@@ -33,13 +34,10 @@ const Chat = StackNavigator(\n},\n{\nnavigationOptions: ({ navigation }) => ({\n- tabBarLabel: 'Chat',\n- tabBarIcon: ({ tintColor }) => (\n- <Icon\n- name=\"comments-o\"\n- style={[styles.icon, { color: tintColor }]}\n- />\n- ),\n+ tabBarLabel: Platform.OS === \"android\"\n+ ? ({ tintColor }) => <ChatLabel color={tintColor} />\n+ : 'Chat',\n+ tabBarIcon: ({ tintColor }) => <ChatIcon color={tintColor} />,\ntabBarOnPress: ({ scene, jumpToIndex}: {\nscene: { index: number, focused: bool, route: NavigationStateRoute },\njumpToIndex: (index: number) => void,\n@@ -64,12 +62,6 @@ const Chat = StackNavigator(\n},\n);\n-const styles = StyleSheet.create({\n- icon: {\n- fontSize: 28,\n- },\n-});\n-\nconst ChatRouteName = 'Chat';\nexport {\nChat,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Badge the Chat icon on the tab bar |
129,187 | 29.03.2018 11:59:31 | 14,400 | a6d718672772d839996eadf04ee596448547fc0e | [native] Disable scrollsToTop on iOS for Calendar and MessageList | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -679,6 +679,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nkeyboardDismissMode={keyboardDismissMode}\nonMomentumScrollEnd={this.onMomentumScrollEnd}\nonScrollEndDrag={this.onScrollEndDrag}\n+ scrollsToTop={false}\nextraData={this.state.extraData}\nstyle={[styles.flatList, flatListStyle]}\nref={this.flatListRef}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -432,6 +432,7 @@ class InnerMessageList extends React.PureComponent<Props, State> {\ngetItemLayout={this.getItemLayout}\nonViewableItemsChanged={this.onViewableItemsChanged}\nListFooterComponent={footer}\n+ scrollsToTop={false}\nextraData={this.state.focusedMessageKey}\n/>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/tooltip.react.js",
"new_path": "native/components/tooltip.react.js",
"diff": "@@ -353,9 +353,9 @@ class Tooltip extends React.PureComponent<Props, State> {\nwidth: this.state.width,\nheight: this.state.height,\nbackgroundColor: 'transparent',\n- opacity: this.state.buttonComponentOpacity, // At the first frame, the button will be rendered\n- // in the top-left corner. So we dont render it\n- // until its position has been calculated.\n+ // At the first frame, the button will be rendered in the top-left\n+ // corner. So we don't render until the position has been calculated\n+ opacity: this.state.buttonComponentOpacity,\ntransform: [\n{ scale: this.state.buttonComponentContainerScale },\n],\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Disable scrollsToTop on iOS for Calendar and MessageList |
129,187 | 29.03.2018 15:12:39 | 14,400 | 64a566d8ee854556cff80def4e4d2f41704881dc | Don't show exit buttons on crash report until report is sent
Or until the user has waited 10s | [
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "@@ -29,6 +29,7 @@ import {\nsendErrorReportActionTypes,\nsendErrorReport,\n} from 'lib/actions/report-actions';\n+import sleep from 'lib/utils/sleep';\nimport Button from './components/button.react';\nimport { store } from './redux-setup';\n@@ -51,6 +52,7 @@ type Props = {\n};\ntype State = {|\nerrorReportID: ?string,\n+ doneWaiting: bool,\n|};\nclass Crash extends React.PureComponent<Props, State> {\n@@ -67,6 +69,7 @@ class Crash extends React.PureComponent<Props, State> {\nerrorTitle = _shuffle(errorTitles)[0];\nstate = {\nerrorReportID: null,\n+ doneWaiting: false,\n};\ncomponentDidMount() {\n@@ -74,6 +77,13 @@ class Crash extends React.PureComponent<Props, State> {\nsendErrorReportActionTypes,\nthis.sendReport(),\n);\n+ this.timeOut();\n+ }\n+\n+ async timeOut() {\n+ // If it takes more than 10s, give up and let the user exit\n+ await sleep(10000);\n+ this.setState({ doneWaiting: true });\n}\nrender() {\n@@ -81,6 +91,7 @@ class Crash extends React.PureComponent<Props, State> {\n.reverse()\n.map(errorData => errorData.error.message)\n.join(\"\\n\");\n+\nlet crashID;\nif (this.state.errorReportID) {\ncrashID = (\n@@ -98,6 +109,9 @@ class Crash extends React.PureComponent<Props, State> {\n} else {\ncrashID = <ActivityIndicator size=\"small\" />;\n}\n+\n+ const buttonStyle = { opacity: Number(this.state.doneWaiting) };\n+\nreturn (\n<View style={styles.container}>\n<Icon name=\"bug\" size={32} color=\"red\" />\n@@ -117,7 +131,7 @@ class Crash extends React.PureComponent<Props, State> {\n{errorText}\n</Text>\n</ScrollView>\n- <View style={styles.buttons}>\n+ <View style={[styles.buttons, buttonStyle]}>\n<Button onPress={this.onPressKill} style={styles.button}>\n<Text style={styles.buttonText}>Kill the app</Text>\n</Button>\n@@ -142,14 +156,23 @@ class Crash extends React.PureComponent<Props, State> {\ncodeVersion,\nstateVersion: persistConfig.version,\n});\n- this.setState({ errorReportID: result.id });\n+ this.setState({\n+ errorReportID: result.id,\n+ doneWaiting: true,\n+ });\n}\nonPressKill = () => {\n+ if (!this.state.doneWaiting) {\n+ return;\n+ }\nExitApp.exitApp();\n}\nonPressWipe = () => {\n+ if (!this.state.doneWaiting) {\n+ return;\n+ }\ngetPersistor().purge();\nExitApp.exitApp();\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't show exit buttons on crash report until report is sent
Or until the user has waited 10s |
129,187 | 29.03.2018 21:36:58 | 14,400 | 9752fa1cad1f2b68994c254e366bc2d4c3e418c7 | Some additional configuration from Android FCM that may or may not help | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -150,6 +150,7 @@ dependencies {\ncompile project(':react-native-exit-app')\ncompile project(':react-native-fcm')\ncompile 'com.google.firebase:firebase-core:10.0.1'\n+ compile 'com.google.firebase:firebase-messaging:10.0.1'\ncompile project(':react-native-vector-icons')\ncompile project(':react-native-keychain')\ncompile fileTree(include: ['*.jar'], dir: 'libs')\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/MainActivity.java",
"new_path": "native/android/app/src/main/java/org/squadcal/MainActivity.java",
"diff": "@@ -3,6 +3,7 @@ package org.squadcal;\nimport com.facebook.react.ReactActivity;\nimport org.devio.rn.splashscreen.SplashScreen;\nimport android.os.Bundle;\n+import android.content.Intent;\npublic class MainActivity extends ReactActivity {\n@@ -21,4 +22,10 @@ public class MainActivity extends ReactActivity {\nsuper.onCreate(savedInstanceState);\n}\n+ @Override\n+ public void onNewIntent(Intent intent) {\n+ super.onNewIntent(intent);\n+ setIntent(intent);\n+ }\n+\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Some additional configuration from Android FCM that may or may not help |
129,187 | 29.03.2018 21:37:22 | 14,400 | 05595ee9cac7c6081e7ee10564869577a62bbdc9 | An attempt to fix the endCoordinates crash on Android | [
{
"change_type": "MODIFY",
"old_path": "native/account/panel-components.react.js",
"new_path": "native/account/panel-components.react.js",
"diff": "@@ -117,11 +117,17 @@ class Panel extends React.PureComponent<PanelProps, PanelState> {\n}\n}\n- keyboardHandler = (event: KeyboardEvent) => {\n- const keyboardHeight = windowHeight - event.endCoordinates.screenY;\n+ keyboardHandler = (event: ?KeyboardEvent) => {\n+ const keyboardHeight = event\n+ ? windowHeight - event.endCoordinates.screenY\n+ : 0;\nif (keyboardHeight === this.state.keyboardHeight) {\nreturn;\n}\n+ if (!event) {\n+ this.setState({ keyboardHeight });\n+ return;\n+ }\nif (event.duration && event.easing) {\nLayoutAnimation.configureNext({\nduration: event.duration,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -343,11 +343,11 @@ function prepareIOSNotification(\nbadgeOnly: bool,\nunreadCount: number,\n): apn.Notification {\n- const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\nconst uniqueID = uuidv4();\nconst notification = new apn.Notification();\nnotification.topic = \"org.squadcal.app\";\nif (!badgeOnly) {\n+ const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\nnotification.body = notifText;\nnotification.sound = \"default\";\n}\n@@ -370,9 +370,9 @@ function prepareAndroidNotification(\nunreadCount: number,\ndbID: string,\n): Object {\n- const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\nconst data = {};\nif (!badgeOnly) {\n+ const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\ndata.notifBody = notifText;\n}\ndata.badgeCount = unreadCount.toString();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | An attempt to fix the endCoordinates crash on Android |
129,187 | 29.03.2018 21:58:22 | 14,400 | 92b88be90365035a51d2312e1989210f39911e37 | Try custom_notification..... | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -370,16 +370,26 @@ function prepareAndroidNotification(\nunreadCount: number,\ndbID: string,\n): Object {\n- const data = {};\n- if (!badgeOnly) {\n- const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\n- data.notifBody = notifText;\n- }\n- data.badgeCount = unreadCount.toString();\n- data.threadID = threadInfo.id.toString();\n- data.notifID = collapseKey ? collapseKey : dbID;\n+ const notifID = collapseKey ? collapseKey : dbID;\n+ const data = {\n+ badgeCount: unreadCount.toString(),\n+ threadID: threadInfo.id.toString(),\n+ notifID,\n+ };\n+ if (badgeOnly) {\nreturn { data };\n}\n+ return {\n+ custom_notification: JSON.stringify({\n+ body: notifTextForMessageInfo(messageInfos, threadInfo),\n+ id: notifID,\n+ priority: \"high\",\n+ sound: \"default\",\n+ icon: \"notif_icon\",\n+ }),\n+ data,\n+ };\n+}\ntype InvalidToken = {\nuserID: string,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Try custom_notification..... |
129,187 | 29.03.2018 22:06:30 | 14,400 | ae480dd7a8a79d68fa0196e510e0b304a5d2dfe9 | [server] custom_notification has to be within data | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -371,15 +371,15 @@ function prepareAndroidNotification(\ndbID: string,\n): Object {\nconst notifID = collapseKey ? collapseKey : dbID;\n- const data = {\n+ if (badgeOnly) {\n+ return {\nbadgeCount: unreadCount.toString(),\nthreadID: threadInfo.id.toString(),\nnotifID,\n};\n- if (badgeOnly) {\n- return { data };\n}\nreturn {\n+ data: {\ncustom_notification: JSON.stringify({\nbody: notifTextForMessageInfo(messageInfos, threadInfo),\nid: notifID,\n@@ -387,7 +387,10 @@ function prepareAndroidNotification(\nsound: \"default\",\nicon: \"notif_icon\",\n}),\n- data,\n+ badgeCount: unreadCount.toString(),\n+ threadID: threadInfo.id.toString(),\n+ notifID,\n+ }\n};\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] custom_notification has to be within data |
129,187 | 30.03.2018 12:43:02 | 14,400 | 9e6c8ac277816f25a2100c0d60aa95bf3e824b57 | Fix Android notifs when app is closed | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -247,14 +247,20 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\ncomponentDidMount() {\n+ this.mounted = true;\nif (this.props.isForeground) {\nthis.onForeground();\n}\n- this.mounted = true;\n+ if (this.props.rehydrateConcluded) {\n+ this.onInitialAppLoad(this.props);\n+ }\n}\ncomponentWillUnmount() {\nthis.mounted = false;\n+ if (this.props.isForeground) {\n+ this.onBackground();\n+ }\n}\ncomponentWillReceiveProps(nextProps: Props) {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/SplashActivity.java",
"new_path": "native/android/app/src/main/java/org/squadcal/SplashActivity.java",
"diff": "@@ -11,6 +11,8 @@ public class SplashActivity extends AppCompatActivity {\nsuper.onCreate(savedInstanceState);\nIntent intent = new Intent(this, MainActivity.class);\n+ intent.putExtras(this.getIntent());\n+\nstartActivity(intent);\nfinish();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -212,6 +212,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n);\n}\nAppWithNavigationState.updateBadgeCount(this.props.unreadCount);\n+ if (this.props.appLoggedIn) {\n+ this.ensurePushNotifsEnabled();\n+ }\n}\nstatic updateBadgeCount(unreadCount: number) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix Android notifs when app is closed |
129,187 | 30.03.2018 12:50:48 | 14,400 | 9a055e5048ee25bf7a06cc77eb8738af195722cf | [server] Don't return unknown error if a user is missing a hash | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/user-responders.js",
"new_path": "server/src/responders/user-responders.js",
"diff": "@@ -196,7 +196,7 @@ async function logInResponder(\nthrow new ServerError('invalid_parameters');\n}\nconst userRow = userResult[0];\n- if (!bcrypt.compareSync(request.password, userRow.hash)) {\n+ if (!userRow.hash || !bcrypt.compareSync(request.password, userRow.hash)) {\nthrow new ServerError('invalid_credentials');\n}\nconst id = userRow.id.toString();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Don't return unknown error if a user is missing a hash |
129,187 | 30.03.2018 15:48:15 | 14,400 | df31677cf41693cbcbe0854ffc939ec5668ad4f1 | [native] Refine navigation on notif press and new thread | [
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -80,6 +80,7 @@ import {\ngetThreadIDFromParams,\n} from './utils/navigation-utils';\nimport { DeleteThreadRouteName } from './chat/settings/delete-thread.react';\n+import { ComposeThreadRouteName } from './chat/compose-thread.react';\nexport type NavInfo = {|\n...$Exact<BaseNavInfo>,\n@@ -353,7 +354,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nendDate: navInfoState.endDate,\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\n- navigationState: replaceChatStackWithThread(\n+ navigationState: handleNewThread(\nnavInfoState.navigationState,\naction.payload.newThreadInfo,\nstate.currentUserInfo && state.currentUserInfo.id,\n@@ -619,6 +620,40 @@ function filterChatScreensForThreadInfos(\nreturn { ...state, routes: newRootSubRoutes };\n}\n+function handleNewThread(\n+ state: NavigationState,\n+ rawThreadInfo: RawThreadInfo,\n+ viewerID: ?string,\n+ userInfos: {[id: string]: UserInfo},\n+): NavigationState {\n+ const threadInfo = threadInfoFromRawThreadInfo(\n+ rawThreadInfo,\n+ viewerID,\n+ userInfos,\n+ );\n+ const appRoute = assertNavigationRouteNotLeafNode(state.routes[0]);\n+ const chatRoute = assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+\n+ const newChatRoute = removeScreensFromStack(\n+ chatRoute,\n+ (route: NavigationRoute) => route.routeName === ComposeThreadRouteName\n+ ? \"remove\"\n+ : \"break\",\n+ );\n+ newChatRoute.routes.push({\n+ key: 'NewThreadMessageList',\n+ routeName: MessageListRouteName,\n+ params: { threadInfo },\n+ });\n+ newChatRoute.index = newChatRoute.routes.length - 1;\n+\n+ const newAppSubRoutes = [ ...appRoute.routes ];\n+ newAppSubRoutes[1] = newChatRoute;\n+ const newRootSubRoutes = [ ...state.routes ];\n+ newRootSubRoutes[0] = { ...appRoute, routes: newAppSubRoutes };\n+ return { ...state, routes: newRootSubRoutes };\n+}\n+\nfunction replaceChatStackWithThread(\nstate: NavigationState,\nrawThreadInfo: RawThreadInfo,\n@@ -665,18 +700,21 @@ function handleNotificationPress(\nconst currentChatRoute = chatRoute.routes[chatRoute.index];\nif (\ncurrentChatRoute.routeName === MessageListRouteName &&\n- getThreadIDFromParams(currentChatRoute) === payload.rawThreadInfo.id\n+ getThreadIDFromParams(currentChatRoute) === payload.rawThreadInfo.id &&\n+ appRoute.index === 1\n) {\nreturn state;\n}\nif (payload.clearChatRoutes) {\n- return replaceChatStackWithThread(\n+ const newState = replaceChatStackWithThread(\nstate,\npayload.rawThreadInfo,\nviewerID,\nuserInfos,\n);\n+ newState.routes[0] = { ...newState.routes[0], index: 1 };\n+ return newState;\n}\nconst threadInfo = threadInfoFromRawThreadInfo(\n@@ -699,7 +737,7 @@ function handleNotificationPress(\nconst newAppSubRoutes = [ ...appRoute.routes ];\nnewAppSubRoutes[1] = newChatRoute;\nconst newRootSubRoutes = [ ...state.routes ];\n- newRootSubRoutes[0] = { ...appRoute, routes: newAppSubRoutes };\n+ newRootSubRoutes[0] = { ...appRoute, routes: newAppSubRoutes, index: 1 };\nreturn { ...state, routes: newRootSubRoutes };\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Refine navigation on notif press and new thread |
129,187 | 30.03.2018 22:14:05 | 14,400 | 147a82ab58345eb10373b4e4f3c36e96d1e7e64a | [server] Put everything in custom_notification payload on Android | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -386,10 +386,9 @@ function prepareAndroidNotification(\npriority: \"high\",\nsound: \"default\",\nicon: \"notif_icon\",\n+ badgeCount: unreadCount,\n+ threadID: threadInfo.id,\n}),\n- badgeCount: unreadCount.toString(),\n- threadID: threadInfo.id.toString(),\n- notifID,\n}\n};\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Put everything in custom_notification payload on Android |
129,187 | 30.03.2018 22:42:55 | 14,400 | cea239d045f14211070cc3a8bdfe0089058c75b5 | [native] Finally get Android notifs fully working | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -449,7 +449,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nthis.initialAndroidNotifHandled = true;\nconst initialNotif = await FCM.getInitialNotification();\nif (initialNotif) {\n- await this.androidNotificationReceived(initialNotif);\n+ await this.androidNotificationReceived(initialNotif, true);\n}\n}\n@@ -568,48 +568,59 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nnotification.finish(NotificationsIOS.FetchResult.NewData);\n}\n- androidNotificationReceived = async (notification) => {\n- if (notification.badgeCount) {\n- AppWithNavigationState.updateBadgeCount(\n- parseInt(notification.badgeCount),\n- );\n+ androidNotificationReceived = async (\n+ notification,\n+ appOpenedFromNotif = false,\n+ ) => {\n+ if (appOpenedFromNotif) {\n+ const badgeCount = notification.badgeCount;\n+ if (badgeCount === null || badgeCount === undefined) {\n+ console.log(\"Local notification with missing badgeCount received!\");\n+ return;\n}\n- if (\n- notification.notifBody &&\n- this.currentState === \"active\"\n- ) {\n- const threadID = notification.threadID;\n+ // In the appOpenedFromNotif case, the local notif is the only version of\n+ // a notif we get, so we do the badge count update there\n+ AppWithNavigationState.updateBadgeCount(badgeCount);\n+ }\n+\n+ if (notification.custom_notification) {\n+ const customNotification = JSON.parse(notification.custom_notification);\n+ const threadID = customNotification.threadID;\n+ const badgeCount = customNotification.badgeCount;\nif (!threadID) {\n- console.log(\"Notification with missing threadID received!\");\n+ console.log(\"Server notification with missing threadID received!\");\n+ return;\n+ }\n+ if (!badgeCount) {\n+ console.log(\"Local notification with missing badgeCount received!\");\nreturn;\n}\n+\nthis.pingNow();\n+ AppWithNavigationState.updateBadgeCount(badgeCount);\n+\n+ if (this.currentState === \"active\") {\ninvariant(this.inAppNotification, \"should be set\");\nthis.inAppNotification.show({\n- message: notification.notifBody,\n+ message: customNotification.body,\nonPress: () => this.onPressNotificationForThread(threadID, false),\n});\n- } else if (notification.notifBody) {\n- this.pingNow();\n- FCM.presentLocalNotification({\n- id: notification.notifID,\n- body: notification.notifBody,\n- priority: \"high\",\n- sound: \"default\",\n- threadID: notification.threadID,\n- icon: \"notif_icon\",\n- });\n+ } else {\n+ FCM.presentLocalNotification(customNotification);\nthis.props.dispatchActionPayload(\nrecordAndroidNotificationActionType,\n{\n- threadID: notification.threadID,\n- notifID: notification.notifID,\n+ threadID,\n+ notifID: customNotification.id,\n},\n);\n}\n+ }\n+\nif (notification.body) {\nthis.onPressNotificationForThread(notification.threadID, true);\n}\n+\nif (notification.rescind) {\nFCM.removeDeliveredNotification(notification.notifID);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Finally get Android notifs fully working |
129,187 | 30.03.2018 23:33:23 | 14,400 | 3d4c1c3a844521c98c903fac3ac27d7a56262cd7 | [server] Include new RawMessageInfos in notification payloads | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -95,9 +95,6 @@ async function sendPushNotifs(pushInfo: PushInfo) {\nconst existingMessageInfos = notifInfo.existingMessageInfos.map(\nhydrateMessageInfo,\n).filter(Boolean);\n- const allMessageInfos = sortMessageInfoList(\n- [ ...newMessageInfos, ...existingMessageInfos ],\n- );\nconst [ firstNewMessageInfo, ...remainingNewMessageInfos ] =\nnewMessageInfos;\nconst threadID = firstNewMessageInfo.threadID;\n@@ -114,7 +111,8 @@ async function sendPushNotifs(pushInfo: PushInfo) {\nconst delivery = {};\nif (byDeviceType.ios) {\nconst notification = prepareIOSNotification(\n- allMessageInfos,\n+ newMessageInfos,\n+ existingMessageInfos,\nthreadInfo,\nnotifInfo.collapseKey,\nbadgeOnly,\n@@ -126,7 +124,8 @@ async function sendPushNotifs(pushInfo: PushInfo) {\n}\nif (byDeviceType.android) {\nconst notification = prepareAndroidNotification(\n- allMessageInfos,\n+ newMessageInfos,\n+ existingMessageInfos,\nthreadInfo,\nnotifInfo.collapseKey,\nbadgeOnly,\n@@ -337,7 +336,8 @@ function getDevicesByDeviceType(\n}\nfunction prepareIOSNotification(\n- messageInfos: MessageInfo[],\n+ newMessageInfos: MessageInfo[],\n+ existingMessageInfos: MessageInfo[],\nthreadInfo: ThreadInfo,\ncollapseKey: ?string,\nbadgeOnly: bool,\n@@ -347,7 +347,10 @@ function prepareIOSNotification(\nconst notification = new apn.Notification();\nnotification.topic = \"org.squadcal.app\";\nif (!badgeOnly) {\n- const notifText = notifTextForMessageInfo(messageInfos, threadInfo);\n+ const allMessageInfos = sortMessageInfoList(\n+ [ ...newMessageInfos, ...existingMessageInfos ],\n+ );\n+ const notifText = notifTextForMessageInfo(allMessageInfos, threadInfo);\nnotification.body = notifText;\nnotification.sound = \"default\";\n}\n@@ -356,6 +359,7 @@ function prepareIOSNotification(\nnotification.id = uniqueID;\nnotification.payload.id = uniqueID;\nnotification.payload.threadID = threadInfo.id;\n+ notification.messageInfos = JSON.stringify(newMessageInfos);\nif (collapseKey) {\nnotification.collapseId = collapseKey;\n}\n@@ -363,7 +367,8 @@ function prepareIOSNotification(\n}\nfunction prepareAndroidNotification(\n- messageInfos: MessageInfo[],\n+ newMessageInfos: MessageInfo[],\n+ existingMessageInfos: MessageInfo[],\nthreadInfo: ThreadInfo,\ncollapseKey: ?string,\nbadgeOnly: bool,\n@@ -374,20 +379,24 @@ function prepareAndroidNotification(\nif (badgeOnly) {\nreturn {\nbadgeCount: unreadCount.toString(),\n- threadID: threadInfo.id.toString(),\n+ messageInfos: JSON.stringify(newMessageInfos),\nnotifID,\n};\n}\n+ const allMessageInfos = sortMessageInfoList(\n+ [ ...newMessageInfos, ...existingMessageInfos ],\n+ );\nreturn {\ndata: {\ncustom_notification: JSON.stringify({\n- body: notifTextForMessageInfo(messageInfos, threadInfo),\n+ body: notifTextForMessageInfo(allMessageInfos, threadInfo),\nid: notifID,\npriority: \"high\",\nsound: \"default\",\nicon: \"notif_icon\",\nbadgeCount: unreadCount,\nthreadID: threadInfo.id,\n+ messageInfos: newMessageInfos,\n}),\n}\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Include new RawMessageInfos in notification payloads |
129,187 | 30.03.2018 23:43:31 | 14,400 | b53909533e284cd5d9ac790aca6f6369e0c436c5 | [server] Always JSON.stringify notification messageInfos | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -396,7 +396,7 @@ function prepareAndroidNotification(\nicon: \"notif_icon\",\nbadgeCount: unreadCount,\nthreadID: threadInfo.id,\n- messageInfos: newMessageInfos,\n+ messageInfos: JSON.stringify(newMessageInfos),\n}),\n}\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Always JSON.stringify notification messageInfos |
129,187 | 30.03.2018 23:59:18 | 14,400 | 846d222aa4f8dc772e1fa0af63fcb7a8adca62dc | [server] Include RawMessageInfo (not MessageInfo) in notification payloads | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -86,15 +86,24 @@ async function sendPushNotifs(pushInfo: PushInfo) {\nuserInfos,\nthreadInfos,\n);\n- const newMessageInfos = notifInfo.newMessageInfos.map(\n- hydrateMessageInfo,\n- ).filter(Boolean);\n+ const newMessageInfos = [];\n+ const newRawMessageInfos = [];\n+ for (let newRawMessageInfo of notifInfo.newMessageInfos) {\n+ const newMessageInfo = hydrateMessageInfo(newRawMessageInfo);\n+ if (newMessageInfo) {\n+ newMessageInfos.push(newMessageInfo);\n+ newRawMessageInfos.push(newRawMessageInfo);\n+ }\n+ }\nif (newMessageInfos.length === 0) {\ncontinue;\n}\nconst existingMessageInfos = notifInfo.existingMessageInfos.map(\nhydrateMessageInfo,\n).filter(Boolean);\n+ const allMessageInfos = sortMessageInfoList(\n+ [ ...newMessageInfos, ...existingMessageInfos ],\n+ );\nconst [ firstNewMessageInfo, ...remainingNewMessageInfos ] =\nnewMessageInfos;\nconst threadID = firstNewMessageInfo.threadID;\n@@ -111,8 +120,8 @@ async function sendPushNotifs(pushInfo: PushInfo) {\nconst delivery = {};\nif (byDeviceType.ios) {\nconst notification = prepareIOSNotification(\n- newMessageInfos,\n- existingMessageInfos,\n+ allMessageInfos,\n+ newRawMessageInfos,\nthreadInfo,\nnotifInfo.collapseKey,\nbadgeOnly,\n@@ -124,8 +133,8 @@ async function sendPushNotifs(pushInfo: PushInfo) {\n}\nif (byDeviceType.android) {\nconst notification = prepareAndroidNotification(\n- newMessageInfos,\n- existingMessageInfos,\n+ allMessageInfos,\n+ newRawMessageInfos,\nthreadInfo,\nnotifInfo.collapseKey,\nbadgeOnly,\n@@ -336,8 +345,8 @@ function getDevicesByDeviceType(\n}\nfunction prepareIOSNotification(\n- newMessageInfos: MessageInfo[],\n- existingMessageInfos: MessageInfo[],\n+ allMessageInfos: MessageInfo[],\n+ newRawMessageInfos: RawMessageInfo[],\nthreadInfo: ThreadInfo,\ncollapseKey: ?string,\nbadgeOnly: bool,\n@@ -347,9 +356,6 @@ function prepareIOSNotification(\nconst notification = new apn.Notification();\nnotification.topic = \"org.squadcal.app\";\nif (!badgeOnly) {\n- const allMessageInfos = sortMessageInfoList(\n- [ ...newMessageInfos, ...existingMessageInfos ],\n- );\nconst notifText = notifTextForMessageInfo(allMessageInfos, threadInfo);\nnotification.body = notifText;\nnotification.sound = \"default\";\n@@ -359,7 +365,7 @@ function prepareIOSNotification(\nnotification.id = uniqueID;\nnotification.payload.id = uniqueID;\nnotification.payload.threadID = threadInfo.id;\n- notification.messageInfos = JSON.stringify(newMessageInfos);\n+ notification.messageInfos = JSON.stringify(newRawMessageInfos);\nif (collapseKey) {\nnotification.collapseId = collapseKey;\n}\n@@ -367,8 +373,8 @@ function prepareIOSNotification(\n}\nfunction prepareAndroidNotification(\n- newMessageInfos: MessageInfo[],\n- existingMessageInfos: MessageInfo[],\n+ allMessageInfos: MessageInfo[],\n+ newRawMessageInfos: RawMessageInfo[],\nthreadInfo: ThreadInfo,\ncollapseKey: ?string,\nbadgeOnly: bool,\n@@ -379,13 +385,10 @@ function prepareAndroidNotification(\nif (badgeOnly) {\nreturn {\nbadgeCount: unreadCount.toString(),\n- messageInfos: JSON.stringify(newMessageInfos),\n+ messageInfos: JSON.stringify(newRawMessageInfos),\nnotifID,\n};\n}\n- const allMessageInfos = sortMessageInfoList(\n- [ ...newMessageInfos, ...existingMessageInfos ],\n- );\nreturn {\ndata: {\ncustom_notification: JSON.stringify({\n@@ -396,7 +399,7 @@ function prepareAndroidNotification(\nicon: \"notif_icon\",\nbadgeCount: unreadCount,\nthreadID: threadInfo.id,\n- messageInfos: JSON.stringify(newMessageInfos),\n+ messageInfos: JSON.stringify(newRawMessageInfos),\n}),\n}\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Include RawMessageInfo (not MessageInfo) in notification payloads |
129,187 | 31.03.2018 00:07:53 | 14,400 | cccf17ae2d74b6ecdea595f97d2f6ed54ce1aaa4 | [server] Pass iOS messageInfos in notification payload | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -365,7 +365,7 @@ function prepareIOSNotification(\nnotification.id = uniqueID;\nnotification.payload.id = uniqueID;\nnotification.payload.threadID = threadInfo.id;\n- notification.messageInfos = JSON.stringify(newRawMessageInfos);\n+ notification.payload.messageInfos = JSON.stringify(newRawMessageInfos);\nif (collapseKey) {\nnotification.collapseId = collapseKey;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Pass iOS messageInfos in notification payload |
129,187 | 31.03.2018 15:03:03 | 14,400 | 9ad1ad243795eb7691619a2bda055902cc77f83b | [native] Clear path to get to a thread once user intent established
When the user searches for a thread and finds it, or when they try to create a new thread but realize it already exists, try to clear out the path they took to get there from the nav state. | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -130,7 +130,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nif (this.state.searchText) {\nclearSearchInputIcon = (\n<TouchableOpacity\n- onPress={this.onPressClearSearch}\n+ onPress={this.clearSearch}\nactiveOpacity={0.5}\n>\n<Icon\n@@ -256,7 +256,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nthis.setState({ searchText, searchResults: new Set(results) });\n}\n- onPressClearSearch = () => {\n+ clearSearch = () => {\nthis.onChangeSearchText(\"\");\n}\n@@ -264,6 +264,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nif (!this.props.active) {\nreturn;\n}\n+ this.clearSearch();\nthis.props.navigation.navigate(\nMessageListRouteName,\n{ threadInfo },\n"
},
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -747,7 +747,6 @@ export {\nRootNavigator,\ndefaultNavInfo,\nreduceNavInfo,\n- LoggedOutModalRouteName,\n- VerificationModalRouteName,\nAppRouteName,\n+ removeScreensFromStack,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -12,6 +12,7 @@ import {\ndefaultNotifPermissionAlertInfo,\nrecordNotifPermissionAlertActionType,\n} from './push/alerts';\n+import type { NavigationStateRoute, NavigationRoute } from 'react-navigation';\nimport React from 'react';\nimport invariant from 'invariant';\n@@ -28,6 +29,7 @@ import {\nimport baseReducer from 'lib/reducers/master-reducer';\nimport { newSessionID } from 'lib/selectors/session-selectors';\nimport { notificationPressActionType } from 'lib/shared/notif-utils';\n+import { sendMessageActionTypes } from 'lib/actions/message-actions';\nimport { MessageListRouteName } from './chat/message-list.react';\nimport { activeThreadSelector } from './selectors/nav-selectors';\n@@ -36,6 +38,7 @@ import {\nnavigateToAppActionType,\ndefaultNavInfo,\nreduceNavInfo,\n+ removeScreensFromStack,\n} from './navigation-setup';\nimport {\nrecordAndroidNotificationActionType,\n@@ -49,6 +52,12 @@ import {\nnatServer,\nsetCustomServer,\n} from './utils/url-utils';\n+import {\n+ assertNavigationRouteNotLeafNode,\n+ currentLeafRoute,\n+ findRouteIndexWithKey,\n+} from './utils/navigation-utils';\n+import { ComposeThreadRouteName } from './chat/compose-thread.react';\nexport type AppState = {|\nnavInfo: NavInfo,\n@@ -68,6 +77,7 @@ export type AppState = {|\ncustomServer: ?string,\nthreadIDsToNotifIDs: {[threadID: string]: string[]},\nnotifPermissionAlertInfo: NotifPermissionAlertInfo,\n+ messageSentFromRoute: $ReadOnlyArray<string>,\n_persist: ?PersistState,\n|};\n@@ -96,13 +106,66 @@ const defaultState = ({\ncustomServer: natServer,\nthreadIDsToNotifIDs: {},\nnotifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\n+ messageSentFromRoute: [],\n_persist: null,\n}: AppState);\n+function chatRouteFromNavInfo(navInfo: NavInfo): NavigationStateRoute {\n+ const navState = navInfo.navigationState;\n+ const appRoute = assertNavigationRouteNotLeafNode(navState.routes[0]);\n+ return assertNavigationRouteNotLeafNode(appRoute.routes[1]);\n+}\n+\nfunction reducer(state: AppState = defaultState, action: *) {\nconst oldState = state;\n- const navInfo = reduceNavInfo(state, action);\n+ let navInfo = reduceNavInfo(state, action);\n+\nif (navInfo && navInfo !== state.navInfo) {\n+ const chatRoute = chatRouteFromNavInfo(navInfo);\n+ const currentChatSubroute = currentLeafRoute(chatRoute);\n+ if (currentChatSubroute.routeName === ComposeThreadRouteName) {\n+ const oldChatRoute = chatRouteFromNavInfo(state.navInfo);\n+ const oldRouteIndex = findRouteIndexWithKey(\n+ oldChatRoute,\n+ currentChatSubroute.key,\n+ );\n+ const oldNextRoute = oldChatRoute.routes[oldRouteIndex + 1];\n+ if (\n+ oldNextRoute &&\n+ state.messageSentFromRoute.includes(oldNextRoute.key)\n+ ) {\n+ // This indicates that the user went to the compose thread screen, then\n+ // saw that a thread already existed for the people they wanted to\n+ // contact, and sent a message to that thread. We are now about to\n+ // navigate back to that compose thread screen, but instead, since the\n+ // user's intent has ostensibly already been satisfied, we will pop up\n+ // to the screen right before that one.\n+ const newChatRoute = removeScreensFromStack(\n+ chatRoute,\n+ (route: NavigationRoute) => route.key === currentChatSubroute.key\n+ ? \"remove\"\n+ : \"keep\",\n+ );\n+\n+ const appRoute =\n+ assertNavigationRouteNotLeafNode(navInfo.navigationState.routes[0]);\n+ const newAppSubRoutes = [ ...appRoute.routes ];\n+ newAppSubRoutes[1] = newChatRoute;\n+ const newRootSubRoutes = [ ...navInfo.navigationState.routes ];\n+ newRootSubRoutes[0] = { ...appRoute, routes: newAppSubRoutes };\n+ navInfo = {\n+ startDate: navInfo.startDate,\n+ endDate: navInfo.endDate,\n+ home: navInfo.home,\n+ threadID: navInfo.threadID,\n+ navigationState: {\n+ ...navInfo.navigationState,\n+ routes: newRootSubRoutes,\n+ },\n+ };\n+ }\n+ }\n+\nstate = {\nnavInfo,\ncurrentUserInfo: state.currentUserInfo,\n@@ -121,6 +184,7 @@ function reducer(state: AppState = defaultState, action: *) {\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n}\n@@ -149,6 +213,7 @@ function reducer(state: AppState = defaultState, action: *) {\naction.payload,\n),\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n} else if (action.type === setCustomServer) {\n@@ -170,6 +235,7 @@ function reducer(state: AppState = defaultState, action: *) {\ncustomServer: action.payload,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n} else if (action.type === recordNotifPermissionAlertActionType) {\n@@ -194,6 +260,7 @@ function reducer(state: AppState = defaultState, action: *) {\ntotalAlerts: state.notifPermissionAlertInfo.totalAlerts + 1,\nlastAlertTime: action.payload.time,\n},\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n}\n@@ -210,6 +277,35 @@ function reducer(state: AppState = defaultState, action: *) {\n) {\nreturn validateState(oldState, state);\n}\n+ if (action.type === sendMessageActionTypes.started) {\n+ const chatRoute = chatRouteFromNavInfo(state.navInfo);\n+ const currentChatSubroute = currentLeafRoute(chatRoute);\n+ const messageSentFromRoute =\n+ state.messageSentFromRoute.includes(currentChatSubroute.key)\n+ ? state.messageSentFromRoute\n+ : [ ...state.messageSentFromRoute, currentChatSubroute.key];\n+ state = {\n+ navInfo: state.navInfo,\n+ currentUserInfo: state.currentUserInfo,\n+ sessionID: state.sessionID,\n+ entryStore: state.entryStore,\n+ lastUserInteraction: state.lastUserInteraction,\n+ threadInfos: state.threadInfos,\n+ userInfos: state.userInfos,\n+ messageStore: state.messageStore,\n+ drafts: state.drafts,\n+ currentAsOf: state.currentAsOf,\n+ loadingStatuses: state.loadingStatuses,\n+ cookie: state.cookie,\n+ deviceToken: state.deviceToken,\n+ urlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\n+ threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute,\n+ _persist: state._persist,\n+ };\n+ }\nreturn validateState(oldState, baseReducer(state, action));\n}\n@@ -245,6 +341,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n}\n@@ -281,9 +378,40 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n};\n}\n+\n+ const chatRoute = chatRouteFromNavInfo(state.navInfo);\n+ const chatSubrouteKeys = new Set(chatRoute.routes.map(route => route.key));\n+ const messageSentFromRoute = state.messageSentFromRoute.filter(\n+ key => chatSubrouteKeys.has(key),\n+ );\n+ if (messageSentFromRoute.length !== state.messageSentFromRoute.length) {\n+ state = {\n+ navInfo: state.navInfo,\n+ currentUserInfo: state.currentUserInfo,\n+ sessionID: state.sessionID,\n+ entryStore: state.entryStore,\n+ lastUserInteraction: state.lastUserInteraction,\n+ threadInfos: state.threadInfos,\n+ userInfos: state.userInfos,\n+ messageStore: state.messageStore,\n+ drafts: state.drafts,\n+ currentAsOf: state.currentAsOf,\n+ loadingStatuses: state.loadingStatuses,\n+ cookie: state.cookie,\n+ deviceToken: state.deviceToken,\n+ urlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\n+ threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute,\n+ _persist: state._persist,\n+ };\n+ }\n+\nreturn state;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/utils/navigation-utils.js",
"new_path": "native/utils/navigation-utils.js",
"diff": "@@ -5,6 +5,7 @@ import type {\nNavigationStateRoute,\nNavigationRoute,\nNavigationParams,\n+ NavigationState,\n} from 'react-navigation';\nimport invariant from 'invariant';\n@@ -78,7 +79,35 @@ function getThreadIDFromParams(object: { params?: NavigationParams }): string {\nreturn object.params.threadInfo.id;\n}\n+function currentRouteRecurse(state: NavigationRoute): NavigationLeafRoute {\n+ if (state.index) {\n+ const stateRoute = assertNavigationRouteNotLeafNode(state);\n+ return currentRouteRecurse(stateRoute.routes[stateRoute.index]);\n+ } else {\n+ return state;\n+ }\n+}\n+\n+function currentLeafRoute(state: NavigationState): NavigationLeafRoute {\n+ return currentRouteRecurse(state.routes[state.index]);\n+}\n+\n+function findRouteIndexWithKey(\n+ state: NavigationState,\n+ key: string,\n+): ?number {\n+ for (let i = 0; i < state.routes.length; i++) {\n+ const route = state.routes[i];\n+ if (route.key === key) {\n+ return i;\n+ }\n+ }\n+ return null;\n+}\n+\nexport {\nassertNavigationRouteNotLeafNode,\ngetThreadIDFromParams,\n+ currentLeafRoute,\n+ findRouteIndexWithKey,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Clear path to get to a thread once user intent established
When the user searches for a thread and finds it, or when they try to create a new thread but realize it already exists, try to clear out the path they took to get there from the nav state. |
129,187 | 31.03.2018 17:34:01 | 14,400 | 3c1acab5cd06f83d0218aaf652f0f96afbac5150 | [native] Add search bar to ThreadPicker | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/thread-picker.react.js",
"new_path": "native/calendar/thread-picker.react.js",
"diff": "@@ -19,8 +19,11 @@ import {\ncreateLocalEntryActionType,\n} from 'lib/actions/entry-actions';\nimport { includeDispatchActionProps } from 'lib/utils/action-utils';\n+import { threadSearchIndex } from 'lib/selectors/nav-selectors';\n+import SearchIndex from 'lib/shared/search-index';\nimport ThreadList from '../components/thread-list.react';\n+import KeyboardAvoidingModal from '../components/keyboard-avoiding-modal.react';\ntype Props = {\ndateString: ?string,\n@@ -28,6 +31,7 @@ type Props = {\n// Redux state\nonScreenThreadInfos: $ReadOnlyArray<ThreadInfo>,\nviewerID: string,\n+ threadSearchIndex: SearchIndex,\n// Redux dispatch functions\ndispatchActionPayload: DispatchActionPayload,\n};\n@@ -38,21 +42,23 @@ class ThreadPicker extends React.PureComponent<Props> {\nclose: PropTypes.func.isRequired,\nonScreenThreadInfos: PropTypes.arrayOf(threadInfoPropType).isRequired,\nviewerID: PropTypes.string.isRequired,\n+ threadSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\ndispatchActionPayload: PropTypes.func.isRequired,\n};\nrender() {\nreturn (\n- <View style={styles.picker}>\n- <Text style={styles.headerText}>\n- Pick a thread\n- </Text>\n+ <KeyboardAvoidingModal\n+ containerStyle={styles.container}\n+ style={styles.container}\n+ >\n<ThreadList\nthreadInfos={this.props.onScreenThreadInfos}\nonSelect={this.threadPicked}\nitemStyle={styles.threadListItem}\n+ searchIndex={this.props.threadSearchIndex}\n/>\n- </View>\n+ </KeyboardAvoidingModal>\n);\n}\n@@ -69,13 +75,8 @@ class ThreadPicker extends React.PureComponent<Props> {\n}\nconst styles = StyleSheet.create({\n- picker: {\n+ container: {\nflex: 1,\n- padding: 12,\n- borderRadius: 5,\n- backgroundColor: '#EEEEEE',\n- marginHorizontal: 10,\n- marginVertical: 100,\n},\nheaderText: {\nfontSize: 24,\n@@ -97,6 +98,7 @@ export default connect(\nreturn {\nonScreenThreadInfos: onScreenEntryEditableThreadInfos(state),\nviewerID,\n+ threadSearchIndex: threadSearchIndex(state),\n};\n},\nincludeDispatchActionProps,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -125,7 +125,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n);\n}\n- renderSearchBar = () => {\n+ renderSearchBar() {\nlet clearSearchInputIcon = null;\nif (this.state.searchText) {\nclearSearchInputIcon = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/thread-list.react.js",
"new_path": "native/components/thread-list.react.js",
"diff": "import type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n-\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n-import React from 'react';\n+import * as React from 'react';\nimport PropTypes from 'prop-types';\n-import { FlatList, ViewPropTypes, Text } from 'react-native';\n+import {\n+ FlatList,\n+ ViewPropTypes,\n+ View,\n+ Text,\n+ StyleSheet,\n+ TouchableOpacity,\n+ TextInput,\n+ Platform,\n+} from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome';\n+import invariant from 'invariant';\n+\n+import SearchIndex from 'lib/shared/search-index';\nimport ThreadListThread from './thread-list-thread.react';\n-type Props = {\n+type Props = {|\nthreadInfos: $ReadOnlyArray<ThreadInfo>,\nonSelect: (threadID: string) => void,\nitemStyle?: StyleObj,\nitemTextStyle?: StyleObj,\n-};\n-class ThreadList extends React.PureComponent<Props> {\n+ searchIndex?: SearchIndex,\n+|};\n+type State = {|\n+ listData: $ReadOnlyArray<ThreadInfo>,\n+ searchText: string,\n+ searchResults: Set<string>,\n+|};\n+class ThreadList extends React.PureComponent<Props, State> {\nstatic propTypes = {\nthreadInfos: PropTypes.arrayOf(threadInfoPropType).isRequired,\nonSelect: PropTypes.func.isRequired,\nitemStyle: ViewPropTypes.style,\nitemTextStyle: Text.propTypes.style,\n+ searchIndex: PropTypes.instanceOf(SearchIndex),\n};\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ listData: [],\n+ searchText: \"\",\n+ searchResults: new Set(),\n+ };\n+ this.state.listData = ThreadList.listData(props, this.state);\n+ }\n+\n+ componentWillReceiveProps(newProps: Props) {\n+ if (newProps.threadInfos !== this.props.threadInfos) {\n+ this.setState((prevState: State) => ({\n+ listData: ThreadList.listData(newProps, prevState),\n+ }));\n+ }\n+ }\n+\n+ componentWillUpdate(nextProps: Props, nextState: State) {\n+ if (nextState.searchText !== this.state.searchText) {\n+ this.setState((prevState: State) => ({\n+ listData: ThreadList.listData(nextProps, nextState),\n+ }));\n+ }\n+ }\n+\n+ static listData(props: Props, state: State) {\n+ if (!state.searchText) {\n+ return props.threadInfos;\n+ }\n+ return props.threadInfos.filter(\n+ threadInfo => state.searchResults.has(threadInfo.id),\n+ );\n+ }\n+\nrender() {\n+ let searchBar = null;\n+ if (this.props.searchIndex) {\n+ let clearSearchInputIcon = null;\n+ if (this.state.searchText) {\n+ clearSearchInputIcon = (\n+ <TouchableOpacity\n+ onPress={this.clearSearch}\n+ activeOpacity={0.5}\n+ >\n+ <Icon\n+ name=\"times-circle\"\n+ size={18}\n+ color=\"#AAAAAA\"\n+ />\n+ </TouchableOpacity>\n+ );\n+ }\n+ searchBar = (\n+ <View style={styles.searchContainer}>\n+ <View style={styles.search}>\n+ <Icon\n+ name=\"search\"\n+ size={18}\n+ color=\"#AAAAAA\"\n+ style={styles.searchIcon}\n+ />\n+ <TextInput\n+ style={styles.searchInput}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.searchText}\n+ onChangeText={this.onChangeSearchText}\n+ placeholder=\"Search threads\"\n+ placeholderTextColor=\"#AAAAAA\"\n+ returnKeyType=\"go\"\n+ autoFocus={true}\n+ />\n+ {clearSearchInputIcon}\n+ </View>\n+ </View>\n+ );\n+ }\nreturn (\n+ <React.Fragment>\n+ {searchBar}\n<FlatList\n- data={this.props.threadInfos}\n+ data={this.state.listData}\nrenderItem={this.renderItem}\nkeyExtractor={ThreadList.keyExtractor}\ngetItemLayout={ThreadList.getItemLayout}\nkeyboardShouldPersistTaps=\"handled\"\ninitialNumToRender={20}\n/>\n+ </React.Fragment>\n);\n}\n@@ -59,6 +157,42 @@ class ThreadList extends React.PureComponent<Props> {\nreturn { length: 24, offset: 24 * index, index };\n}\n+ onChangeSearchText = (searchText: string) => {\n+ invariant(this.props.searchIndex, \"should be set\");\n+ const results = this.props.searchIndex.getSearchResults(searchText);\n+ this.setState({ searchText, searchResults: new Set(results) });\n+ }\n+\n+ clearSearch = () => {\n+ this.onChangeSearchText(\"\");\n}\n+}\n+\n+const styles = StyleSheet.create({\n+ searchContainer: {\n+ },\n+ searchIcon: {\n+ paddingBottom: Platform.OS === \"android\" ? 0 : 2,\n+ },\n+ search: {\n+ backgroundColor: '#DDDDDD',\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ marginBottom: 8,\n+ paddingLeft: 14,\n+ paddingRight: 12,\n+ paddingTop: Platform.OS === \"android\" ? 1 : 6,\n+ paddingBottom: Platform.OS === \"android\" ? 2 : 6,\n+ borderRadius: 6,\n+ },\n+ searchInput: {\n+ flex: 1,\n+ marginLeft: 8,\n+ fontSize: 16,\n+ padding: 0,\n+ marginVertical: 0,\n+ },\n+});\n+\nexport default ThreadList;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Add search bar to ThreadPicker |
129,187 | 31.03.2018 17:38:41 | 14,400 | f3d50777bd78ddc3020c5471f83692599d36319d | codeVersion -> 6, stateVersion -> 2
Also added a state migrator for `messageSentFromRoute` | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 5\n- versionName \"0.0.5\"\n+ versionCode 6\n+ versionName \"0.0.6\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"5\"\n- android:versionName=\"0.0.5\"\n+ android:versionCode=\"6\"\n+ android:versionName=\"0.0.6\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.5</string>\n+ <string>0.0.6</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>5</string>\n+ <string>6</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -26,6 +26,10 @@ const migrations = {\n...state,\nnotifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\n}),\n+ [2]: (state: AppState) => ({\n+ ...state,\n+ messageSentFromRoute: [],\n+ }),\n};\nconst persistConfig = {\n@@ -33,11 +37,11 @@ const persistConfig = {\nstorage,\nblacklist,\ndebug: __DEV__,\n- version: 1,\n+ version: 2,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 5;\n+const codeVersion = 6;\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 | codeVersion -> 6, stateVersion -> 2
Also added a state migrator for `messageSentFromRoute` |
129,187 | 31.03.2018 20:18:51 | 14,400 | 226e75c9d5584d3dd99263b7d448dd722bab3202 | [native] Delay creation of local entry so keyboard can respond to modal closing
PS this is actually in version 6 | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/thread-picker.react.js",
"new_path": "native/calendar/thread-picker.react.js",
"diff": "@@ -7,7 +7,7 @@ import type { DispatchActionPayload } from 'lib/utils/action-utils';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { View, Text, StyleSheet } from 'react-native';\n+import { View, Text, StyleSheet, Platform } from 'react-native';\nimport { connect } from 'react-redux';\nimport invariant from 'invariant';\n@@ -66,9 +66,12 @@ class ThreadPicker extends React.PureComponent<Props> {\nthis.props.close();\nconst dateString = this.props.dateString;\ninvariant(dateString, \"should be set\");\n- this.props.dispatchActionPayload(\n+ setTimeout(\n+ () => this.props.dispatchActionPayload(\ncreateLocalEntryActionType,\ncreateLocalEntry(threadID, dateString, this.props.viewerID),\n+ ),\n+ Platform.OS === \"android\" ? 500 : 100,\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Delay creation of local entry so keyboard can respond to modal closing
PS this is actually in version 6 |
129,187 | 01.04.2018 12:53:21 | 14,400 | 396388ca7a361223e5108dd6b6e1e9c3603908e7 | [server] Avoid passing React render result to HTML tag
It's stripping newlines from the textarea contents. | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -163,7 +163,7 @@ async function websiteResponder(viewer: Viewer, url: string): Promise<string> {\ntype=\"text/css\"\nhref=\"compiled/prod.build.css\"\n/>`;\n- return html`\n+ let result = html`\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n@@ -200,11 +200,16 @@ async function websiteResponder(viewer: Viewer, url: string): Promise<string> {\n</script>\n</head>\n<body>\n- <div id=\"react-root\">${rendered}</div>\n+ <div id=\"react-root\">\n+ `;\n+ result += rendered;\n+ result += html`\n+ </div>\n<script src=\"${jsURL}\"></script>\n</body>\n</html>\n`;\n+ return result;\n}\ntype BaseURLInfo = {| year: number, month: number, verificationCode: ?string |};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Avoid passing React render result to HTML tag
It's stripping newlines from the textarea contents. |
129,187 | 01.04.2018 20:07:17 | 14,400 | 58da8e37505a2c50b4190f3793ffc8fd7e1cd303 | [native] Blur thread list search input on thread select | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -78,6 +78,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n: null,\nheaderBackTitle: \"Back\",\n});\n+ searchInput: ?TextInput;\nconstructor(props: Props) {\nsuper(props);\n@@ -158,6 +159,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nplaceholder=\"Search threads\"\nplaceholderTextColor=\"#AAAAAA\"\nreturnKeyType=\"go\"\n+ ref={this.searchInputRef}\n/>\n{clearSearchInputIcon}\n</View>\n@@ -165,6 +167,10 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n);\n}\n+ searchInputRef = (searchInput: ?TextInput) => {\n+ this.searchInput = searchInput;\n+ }\n+\nstatic keyExtractor(item: Item) {\nif (item.threadInfo) {\nreturn item.threadInfo.id;\n@@ -265,6 +271,9 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nreturn;\n}\nthis.clearSearch();\n+ if (this.searchInput) {\n+ this.searchInput.blur();\n+ }\nthis.props.navigation.navigate(\nMessageListRouteName,\n{ threadInfo },\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Blur thread list search input on thread select |
129,187 | 01.04.2018 22:49:45 | 14,400 | 9469d0d9ce655ed101787fb79b8dde0fd1f799dd | [server] Add cronjobs to clear expired cookies and verifications | [
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/express_v4.16.x.js",
"new_path": "server/flow-typed/npm/express_v4.16.x.js",
"diff": "-// flow-typed signature: 41a220e96fcef89a09244ac3797039e8\n-// flow-typed version: 9f7cf2ab0c/express_v4.16.x/flow_>=v0.32.x\n+// flow-typed signature: 106bbf49ff0c0b351c95d483d617ffba\n+// flow-typed version: 7fe23c8e85/express_v4.16.x/flow_>=v0.32.x\nimport type { Server } from \"http\";\nimport type { Socket } from \"net\";\n@@ -266,6 +266,20 @@ declare type JsonOptions = {\n) => mixed\n};\n+declare type express$UrlEncodedOptions = {\n+ extended?: boolean,\n+ inflate?: boolean,\n+ limit?: string | number,\n+ parameterLimit?: number,\n+ type?: string | Array<string> | ((req: express$Request) => boolean),\n+ verify?: (\n+ req: express$Request,\n+ res: express$Response,\n+ buf: Buffer,\n+ encoding: string\n+ ) => mixed,\n+}\n+\ndeclare module \"express\" {\ndeclare export type RouterOptions = express$RouterOptions;\ndeclare export type CookieOptions = express$CookieOptions;\n@@ -280,6 +294,7 @@ declare module \"express\" {\n(): express$Application, // If you try to call like a function, it will use this signature\njson: (opts: ?JsonOptions) => express$Middleware,\nstatic: (root: string, options?: Object) => express$Middleware, // `static` property on the function\n- Router: typeof express$Router // `Router` property on the function\n+ Router: typeof express$Router, // `Router` property on the function\n+ urlencoded: (opts: ?express$UrlEncodedOptions) => express$Middleware,\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/lib_vx.x.x.js",
"new_path": "server/flow-typed/npm/lib_vx.x.x.js",
"diff": "-// flow-typed signature: 7f0701b2913a5ef2721905c2e97182bc\n+// flow-typed signature: de35e67401d07949d26660c420d532de\n// flow-typed version: <<STUB>>/lib_v0.0.1/flow_v0.64.0\n/**\n@@ -38,6 +38,10 @@ declare module 'lib/actions/ping-actions' {\ndeclare module.exports: any;\n}\n+declare module 'lib/actions/report-actions' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/actions/thread-actions' {\ndeclare module.exports: any;\n}\n@@ -90,6 +94,10 @@ declare module 'lib/flow-typed/npm/prop-types_v15.x.x' {\ndeclare module.exports: any;\n}\n+declare module 'lib/flow-typed/npm/react-redux_v5.x.x' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/flow-typed/npm/redux_v3.x.x' {\ndeclare module.exports: any;\n}\n@@ -154,6 +162,10 @@ declare module 'lib/reducers/thread-reducer' {\ndeclare module.exports: any;\n}\n+declare module 'lib/reducers/url-prefix-reducer' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/reducers/user-reducer' {\ndeclare module.exports: any;\n}\n@@ -238,6 +250,10 @@ declare module 'lib/types/device-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/endpoints' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/entry-types' {\ndeclare module.exports: any;\n}\n@@ -266,6 +282,10 @@ declare module 'lib/types/redux-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/report-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/search-types' {\ndeclare module.exports: any;\n}\n@@ -298,11 +318,11 @@ declare module 'lib/utils/date-utils' {\ndeclare module.exports: any;\n}\n-declare module 'lib/utils/fetch-json' {\n+declare module 'lib/utils/errors' {\ndeclare module.exports: any;\n}\n-declare module 'lib/utils/fetch-utils' {\n+declare module 'lib/utils/fetch-json' {\ndeclare module.exports: any;\n}\n@@ -314,6 +334,10 @@ declare module 'lib/utils/promises' {\ndeclare module.exports: any;\n}\n+declare module 'lib/utils/redux-utils' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/utils/sleep' {\ndeclare module.exports: any;\n}\n@@ -339,6 +363,9 @@ declare module 'lib/actions/message-actions.js' {\ndeclare module 'lib/actions/ping-actions.js' {\ndeclare module.exports: $Exports<'lib/actions/ping-actions'>;\n}\n+declare module 'lib/actions/report-actions.js' {\n+ declare module.exports: $Exports<'lib/actions/report-actions'>;\n+}\ndeclare module 'lib/actions/thread-actions.js' {\ndeclare module.exports: $Exports<'lib/actions/thread-actions'>;\n}\n@@ -378,6 +405,9 @@ declare module 'lib/flow-typed/npm/lodash_v4.x.x.js' {\ndeclare module 'lib/flow-typed/npm/prop-types_v15.x.x.js' {\ndeclare module.exports: $Exports<'lib/flow-typed/npm/prop-types_v15.x.x'>;\n}\n+declare module 'lib/flow-typed/npm/react-redux_v5.x.x.js' {\n+ declare module.exports: $Exports<'lib/flow-typed/npm/react-redux_v5.x.x'>;\n+}\ndeclare module 'lib/flow-typed/npm/redux_v3.x.x.js' {\ndeclare module.exports: $Exports<'lib/flow-typed/npm/redux_v3.x.x'>;\n}\n@@ -426,6 +456,9 @@ declare module 'lib/reducers/session-reducer.js' {\ndeclare module 'lib/reducers/thread-reducer.js' {\ndeclare module.exports: $Exports<'lib/reducers/thread-reducer'>;\n}\n+declare module 'lib/reducers/url-prefix-reducer.js' {\n+ declare module.exports: $Exports<'lib/reducers/url-prefix-reducer'>;\n+}\ndeclare module 'lib/reducers/user-reducer.js' {\ndeclare module.exports: $Exports<'lib/reducers/user-reducer'>;\n}\n@@ -489,6 +522,9 @@ declare module 'lib/types/activity-types.js' {\ndeclare module 'lib/types/device-types.js' {\ndeclare module.exports: $Exports<'lib/types/device-types'>;\n}\n+declare module 'lib/types/endpoints.js' {\n+ declare module.exports: $Exports<'lib/types/endpoints'>;\n+}\ndeclare module 'lib/types/entry-types.js' {\ndeclare module.exports: $Exports<'lib/types/entry-types'>;\n}\n@@ -510,6 +546,9 @@ declare module 'lib/types/ping-types.js' {\ndeclare module 'lib/types/redux-types.js' {\ndeclare module.exports: $Exports<'lib/types/redux-types'>;\n}\n+declare module 'lib/types/report-types.js' {\n+ declare module.exports: $Exports<'lib/types/report-types'>;\n+}\ndeclare module 'lib/types/search-types.js' {\ndeclare module.exports: $Exports<'lib/types/search-types'>;\n}\n@@ -534,18 +573,21 @@ declare module 'lib/utils/config.js' {\ndeclare module 'lib/utils/date-utils.js' {\ndeclare module.exports: $Exports<'lib/utils/date-utils'>;\n}\n+declare module 'lib/utils/errors.js' {\n+ declare module.exports: $Exports<'lib/utils/errors'>;\n+}\ndeclare module 'lib/utils/fetch-json.js' {\ndeclare module.exports: $Exports<'lib/utils/fetch-json'>;\n}\n-declare module 'lib/utils/fetch-utils.js' {\n- declare module.exports: $Exports<'lib/utils/fetch-utils'>;\n-}\ndeclare module 'lib/utils/local-ids.js' {\ndeclare module.exports: $Exports<'lib/utils/local-ids'>;\n}\ndeclare module 'lib/utils/promises.js' {\ndeclare module.exports: $Exports<'lib/utils/promises'>;\n}\n+declare module 'lib/utils/redux-utils.js' {\n+ declare module.exports: $Exports<'lib/utils/redux-utils'>;\n+}\ndeclare module 'lib/utils/sleep.js' {\ndeclare module.exports: $Exports<'lib/utils/sleep'>;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/flow-typed/npm/node-schedule_vx.x.x.js",
"diff": "+// flow-typed signature: 34987bcbd321b5fd2c6a01ee8e218eb2\n+// flow-typed version: <<STUB>>/node-schedule_v^1.3.0/flow_v0.64.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'node-schedule'\n+ *\n+ * Fill this stub out by replacing all the `any` types.\n+ *\n+ * Once filled out, we encourage you to share your work with the\n+ * community by sending a pull request to:\n+ * https://github.com/flowtype/flow-typed\n+ */\n+\n+declare module 'node-schedule' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+declare module 'node-schedule/lib/schedule' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/cancel-long-running-jobs' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/convenience-method-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/date-convenience-methods-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/es6/job-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/job-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/range-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/recurrence-rule-test' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/schedule-cron-jobs' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'node-schedule/test/start-end-test' {\n+ declare module.exports: any;\n+}\n+\n+// Filename aliases\n+declare module 'node-schedule/lib/schedule.js' {\n+ declare module.exports: $Exports<'node-schedule/lib/schedule'>;\n+}\n+declare module 'node-schedule/test/cancel-long-running-jobs.js' {\n+ declare module.exports: $Exports<'node-schedule/test/cancel-long-running-jobs'>;\n+}\n+declare module 'node-schedule/test/convenience-method-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/convenience-method-test'>;\n+}\n+declare module 'node-schedule/test/date-convenience-methods-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/date-convenience-methods-test'>;\n+}\n+declare module 'node-schedule/test/es6/job-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/es6/job-test'>;\n+}\n+declare module 'node-schedule/test/job-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/job-test'>;\n+}\n+declare module 'node-schedule/test/range-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/range-test'>;\n+}\n+declare module 'node-schedule/test/recurrence-rule-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/recurrence-rule-test'>;\n+}\n+declare module 'node-schedule/test/schedule-cron-jobs.js' {\n+ declare module.exports: $Exports<'node-schedule/test/schedule-cron-jobs'>;\n+}\n+declare module 'node-schedule/test/start-end-test.js' {\n+ declare module.exports: $Exports<'node-schedule/test/start-end-test'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"new_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"diff": "-// flow-typed signature: 59b0c4be0e1408f21e2446be96c79804\n-// flow-typed version: 9092387fd2/react-redux_v5.x.x/flow_>=v0.54.x\n+// flow-typed signature: a2c406bd25fca4586c361574e555202d\n+// flow-typed version: dcd1531faf/react-redux_v5.x.x/flow_>=v0.62.0\nimport type { Dispatch, Store } from \"redux\";\ndeclare module \"react-redux\" {\n+ import type { ComponentType, ElementConfig } from 'react';\n+\n+ declare class Provider<S, A> extends React$Component<{\n+ store: Store<S, A>,\n+ children?: any\n+ }> {}\n+\n+ declare function createProvider(\n+ storeKey?: string,\n+ subKey?: string\n+ ): Provider<*, *>;\n+\n/*\nS = State\n@@ -11,122 +23,76 @@ declare module \"react-redux\" {\nOP = OwnProps\nSP = StateProps\nDP = DispatchProps\n-\n+ MP = Merge props\n+ MDP = Map dispatch to props object\n+ RSP = Returned state props\n+ RDP = Returned dispatch props\n+ RMP = Returned merge props\n+ Com = React Component\n*/\n- declare type MapStateToProps<S, OP: Object, SP: Object> = (\n- state: S,\n- ownProps: OP\n- ) => ((state: S, ownProps: OP) => SP) | SP;\n+ declare type MapStateToProps<SP: Object, RSP: Object> = (state: Object, props: SP) => RSP;\n- declare type MapDispatchToProps<A, OP: Object, DP: Object> =\n- | ((dispatch: Dispatch<A>, ownProps: OP) => DP)\n- | DP;\n+ declare type MapDispatchToProps<A, OP: Object, RDP: Object> = (dispatch: Dispatch<A>, ownProps: OP) => RDP;\n- declare type MergeProps<SP, DP: Object, OP: Object, P: Object> = (\n+ declare type MergeProps<SP: Object, DP: Object, MP: Object, RMP: Object> = (\nstateProps: SP,\ndispatchProps: DP,\n- ownProps: OP\n- ) => P;\n-\n- declare type Context = { store: Store<*, *> };\n-\n- declare type ComponentWithDefaultProps<DP: {}, P: {}, CP: P> = Class<\n- React$Component<CP>\n- > & { defaultProps: DP };\n-\n- declare class ConnectedComponentWithDefaultProps<\n- OP,\n- DP,\n- CP\n- > extends React$Component<OP> {\n- static defaultProps: DP, // <= workaround for https://github.com/facebook/flow/issues/4644\n- static WrappedComponent: Class<React$Component<CP>>,\n- getWrappedInstance(): React$Component<CP>,\n- props: OP,\n- state: void\n- }\n-\n- declare class ConnectedComponent<OP, P> extends React$Component<OP> {\n- static WrappedComponent: Class<React$Component<P>>,\n- getWrappedInstance(): React$Component<P>,\n- props: OP,\n- state: void\n- }\n-\n- declare type ConnectedComponentWithDefaultPropsClass<OP, DP, CP> = Class<\n- ConnectedComponentWithDefaultProps<OP, DP, CP>\n- >;\n-\n- declare type ConnectedComponentClass<OP, P> = Class<\n- ConnectedComponent<OP, P>\n- >;\n-\n- declare type Connector<OP, P> = (<DP: {}, CP: {}>(\n- component: ComponentWithDefaultProps<DP, P, CP>\n- ) => ConnectedComponentWithDefaultPropsClass<OP, DP, CP>) &\n- ((component: React$ComponentType<P>) => ConnectedComponentClass<OP, P>);\n-\n- declare class Provider<S, A> extends React$Component<{\n- store: Store<S, A>,\n- children?: any\n- }> {}\n-\n- declare function createProvider(\n- storeKey?: string,\n- subKey?: string\n- ): Provider<*, *>;\n+ ownProps: MP\n+ ) => RMP;\n- declare type ConnectOptions = {\n+ declare type ConnectOptions<S: Object, OP: Object, RSP: Object, RMP: Object> = {|\npure?: boolean,\n- withRef?: boolean\n- };\n-\n- declare type Null = null | void;\n-\n- declare function connect<A, OP>(\n- ...rest: Array<void> // <= workaround for https://github.com/facebook/flow/issues/2360\n- ): Connector<OP, $Supertype<{ dispatch: Dispatch<A> } & OP>>;\n-\n- declare function connect<A, OP>(\n- mapStateToProps: Null,\n- mapDispatchToProps: Null,\n- mergeProps: Null,\n- options: ConnectOptions\n- ): Connector<OP, $Supertype<{ dispatch: Dispatch<A> } & OP>>;\n-\n- declare function connect<S, A, OP, SP>(\n- mapStateToProps: MapStateToProps<S, OP, SP>,\n- mapDispatchToProps: Null,\n- mergeProps: Null,\n- options?: ConnectOptions\n- ): Connector<OP, $Supertype<SP & { dispatch: Dispatch<A> } & OP>>;\n-\n- declare function connect<A, OP, DP>(\n- mapStateToProps: Null,\n- mapDispatchToProps: MapDispatchToProps<A, OP, DP>,\n- mergeProps: Null,\n- options?: ConnectOptions\n- ): Connector<OP, $Supertype<DP & OP>>;\n-\n- declare function connect<S, A, OP, SP, DP>(\n- mapStateToProps: MapStateToProps<S, OP, SP>,\n- mapDispatchToProps: MapDispatchToProps<A, OP, DP>,\n- mergeProps: Null,\n- options?: ConnectOptions\n- ): Connector<OP, $Supertype<SP & DP & OP>>;\n-\n- declare function connect<S, A, OP, SP, DP, P>(\n- mapStateToProps: MapStateToProps<S, OP, SP>,\n- mapDispatchToProps: Null,\n- mergeProps: MergeProps<SP, DP, OP, P>,\n- options?: ConnectOptions\n- ): Connector<OP, P>;\n-\n- declare function connect<S, A, OP, SP, DP, P>(\n- mapStateToProps: MapStateToProps<S, OP, SP>,\n- mapDispatchToProps: MapDispatchToProps<A, OP, DP>,\n- mergeProps: MergeProps<SP, DP, OP, P>,\n- options?: ConnectOptions\n- ): Connector<OP, P>;\n+ withRef?: boolean,\n+ areStatesEqual?: (next: S, prev: S) => boolean,\n+ areOwnPropsEqual?: (next: OP, prev: OP) => boolean,\n+ areStatePropsEqual?: (next: RSP, prev: RSP) => boolean,\n+ areMergedPropsEqual?: (next: RMP, prev: RMP) => boolean,\n+ storeKey?: string\n+ |};\n+\n+ declare type OmitDispatch<Component> = $Diff<Component, {dispatch: Dispatch<*>}>;\n+\n+ declare function connect<Com: ComponentType<*>, DP: Object, RSP: Object>(\n+ mapStateToProps: MapStateToProps<DP, RSP>,\n+ mapDispatchToProps?: null\n+ ): (component: Com) => ComponentType<$Diff<OmitDispatch<ElementConfig<Com>>, RSP> & DP>;\n+\n+ declare function connect<Com: ComponentType<*>>(\n+ mapStateToProps?: null,\n+ mapDispatchToProps?: null\n+ ): (component: Com) => ComponentType<OmitDispatch<ElementConfig<Com>>>;\n+\n+ declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object>(\n+ mapStateToProps: MapStateToProps<SP, RSP>,\n+ mapDispatchToProps: MapDispatchToProps<A, DP, RDP>\n+ ): (component: Com) => ComponentType<$Diff<$Diff<ElementConfig<Com>, RSP>, RDP> & SP & DP>;\n+\n+ declare function connect<Com: ComponentType<*>, A, OP: Object, DP: Object,PR: Object>(\n+ mapStateToProps?: null,\n+ mapDispatchToProps: MapDispatchToProps<A, OP, DP>\n+ ): (Com) => ComponentType<$Diff<ElementConfig<Com>, DP> & OP>;\n+\n+ declare function connect<Com: ComponentType<*>, MDP: Object>(\n+ mapStateToProps?: null,\n+ mapDispatchToProps: MDP\n+ ): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, MDP>>;\n+\n+ declare function connect<Com: ComponentType<*>, SP: Object, RSP: Object, MDP: Object>(\n+ mapStateToProps: MapStateToProps<SP, RSP>,\n+ mapDispatchToPRops: MDP\n+ ): (component: Com) => ComponentType<$Diff<$Diff<ElementConfig<Com>, RSP>, MDP> & SP>;\n+\n+ declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\n+ mapStateToProps: MapStateToProps<SP, RSP>,\n+ mapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,\n+ mergeProps: MergeProps<RSP, RDP, MP, RMP>\n+ ): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;\n+\n+ declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\n+ mapStateToProps: ?MapStateToProps<SP, RSP>,\n+ mapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,\n+ mergeProps: ?MergeProps<RSP, RDP, MP, RMP>,\n+ options: ConnectOptions<*, SP & DP & MP, RSP, RMP>\n+ ): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/redux_v3.x.x.js",
"new_path": "server/flow-typed/npm/redux_v3.x.x.js",
"diff": "-// flow-typed signature: ec7daead5cb4fec5ab25fedbedef29e8\n-// flow-typed version: 2c04631d20/redux_v3.x.x/flow_>=v0.55.x\n+// flow-typed signature: cca4916b0213065533df8335c3285a4a\n+// flow-typed version: cab04034e7/redux_v3.x.x/flow_>=v0.55.x\ndeclare module 'redux' {\n@@ -27,7 +27,7 @@ declare module 'redux' {\nreplaceReducer(nextReducer: Reducer<S, A>): void\n};\n- declare export type Reducer<S, A> = (state: S, action: A) => S;\n+ declare export type Reducer<S, A> = (state: S | void, action: A) => S;\ndeclare export type CombinedReducer<S, A> = (state: $Shape<S> & {} | void, action: A) => S;\n@@ -43,7 +43,7 @@ declare module 'redux' {\ndeclare export type StoreEnhancer<S, A, D = Dispatch<A>> = (next: StoreCreator<S, A, D>) => StoreCreator<S, A, D>;\ndeclare export function createStore<S, A, D>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;\n- declare export function createStore<S, A, D>(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;\n+ declare export function createStore<S, A, D>(reducer: Reducer<S, A>, preloadedState?: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;\ndeclare export function applyMiddleware<S, A, D>(...middlewares: Array<Middleware<S, A, D>>): StoreEnhancer<S, A, D>;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/package.json",
"new_path": "server/package.json",
"diff": "\"lib\": \"0.0.1\",\n\"lodash\": \"^4.17.5\",\n\"mysql2\": \"^1.5.1\",\n+ \"node-schedule\": \"^1.3.0\",\n\"nodemailer\": \"^4.4.2\",\n\"promise\": \"^8.0.1\",\n\"react\": \"^16.2.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/account-creator.js",
"new_path": "server/src/creators/account-creator.js",
"diff": "@@ -19,7 +19,8 @@ import ashoat from 'lib/facts/ashoat';\nimport { dbQuery, SQL } from '../database';\nimport createIDs from './id-creator';\n-import { createNewUserCookie, deleteCookie } from '../session/cookies';\n+import { createNewUserCookie } from '../session/cookies';\n+import { deleteCookie } from '../deleters/cookie-deleters';\nimport { sendEmailAddressVerificationEmail } from '../emails/verification';\nimport createMessages from './message-creator';\nimport createThread from './thread-creator';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/cron.js",
"diff": "+// @flow\n+\n+import schedule from 'node-schedule';\n+import cluster from 'cluster';\n+\n+import { deleteExpiredCookies } from './deleters/cookie-deleters';\n+import { deleteExpiredVerifications } from './models/verification';\n+\n+if (cluster.isMaster) {\n+ schedule.scheduleJob(\n+ '30 3 * * *',\n+ async () => {\n+ await deleteExpiredCookies();\n+ await deleteExpiredVerifications();\n+ },\n+ );\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/cookie-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL, mergeOrConditions } from '../database';\n+import { fetchDeviceTokensForCookie } from '../fetchers/device-token-fetchers';\n+import { cookieLifetime } from '../session/cookies';\n+\n+async function deleteCookie(cookieID: string): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE c, i\n+ FROM cookies c\n+ LEFT JOIN ids i ON i.id = c.id\n+ WHERE c.id = ${cookieID}\n+ `);\n+}\n+\n+async function deleteCookiesOnLogOut(\n+ userID: string,\n+ cookieID: string,\n+): Promise<void> {\n+ const deviceTokens = await fetchDeviceTokensForCookie(cookieID);\n+\n+ const conditions = [ SQL`c.id = ${cookieID}` ];\n+ if (deviceTokens.ios) {\n+ conditions.push(SQL`c.ios_device_token = ${deviceTokens.ios}`);\n+ }\n+ if (deviceTokens.android) {\n+ conditions.push(SQL`c.android_device_token = ${deviceTokens.android}`);\n+ }\n+\n+ const query = SQL`\n+ DELETE c, i\n+ FROM cookies c\n+ LEFT JOIN ids i ON i.id = c.id\n+ WHERE c.user = ${userID} AND\n+ `;\n+ query.append(mergeOrConditions(conditions));\n+\n+ await dbQuery(query);\n+}\n+\n+async function deleteExpiredCookies(): Promise<void> {\n+ const earliestInvalidLastUpdate = Date.now() - cookieLifetime;\n+ const query = SQL`\n+ DELETE c, i\n+ FROM cookies c\n+ LEFT JOIN ids i ON i.id = c.id\n+ WHERE c.last_update <= ${earliestInvalidLastUpdate}\n+ `;\n+ await dbQuery(query);\n+}\n+\n+export {\n+ deleteCookie,\n+ deleteCookiesOnLogOut,\n+ deleteExpiredCookies,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/models/verification.js",
"new_path": "server/src/models/verification.js",
"diff": "@@ -56,7 +56,7 @@ async function verifyCode(hex: string): Promise<CodeVerification> {\nthrow new ServerError('invalid_code');\n}\n- if (row.creation_time + verifyCodeLifetime < Date.now()) {\n+ if (row.creation_time + verifyCodeLifetime <= Date.now()) {\n// Code is expired. Delete it...\nconst deleteQuery = SQL`\nDELETE v, i\n@@ -110,9 +110,22 @@ async function handleCodeVerificationRequest(\nreturn null;\n}\n+async function deleteExpiredVerifications(): Promise<void> {\n+ const earliestInvalidCreationTime = Date.now() - verifyCodeLifetime;\n+ const query = SQL`\n+ DELETE v, i\n+ FROM verifications v\n+ LEFT JOIN ids i ON i.id = v.id\n+ WHERE v.creation_time <= ${earliestInvalidCreationTime}\n+ `;\n+ await dbQuery(query);\n+}\n+\n+\nexport {\ncreateVerificationCode,\nverifyCode,\nclearVerifyCodes,\nhandleCodeVerificationRequest,\n+ deleteExpiredVerifications,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/user-responders.js",
"new_path": "server/src/responders/user-responders.js",
"diff": "@@ -37,9 +37,11 @@ import { validateInput, tShape } from '../utils/validation-utils';\nimport {\ncreateNewAnonymousCookie,\ncreateNewUserCookie,\n+} from '../session/cookies';\n+import {\ndeleteCookie,\ndeleteCookiesOnLogOut,\n-} from '../session/cookies';\n+} from '../deleters/cookie-deleters';\nimport { deleteAccount } from '../deleters/account-deleters';\nimport createAccount from '../creators/account-creator';\nimport { entryQueryInputValidator } from './entry-responders';\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -59,6 +59,7 @@ import {\nerrorReportDownloadHandler,\n} from './responders/report-responders';\nimport urlFacts from '../facts/url';\n+import './cron';\nconst { baseRoutePath } = urlFacts;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/session/cookies.js",
"new_path": "server/src/session/cookies.js",
"diff": "@@ -12,13 +12,13 @@ import crypto from 'crypto';\nimport { ServerError } from 'lib/utils/errors';\n-import { dbQuery, SQL, mergeOrConditions } from '../database';\n+import { dbQuery, SQL } from '../database';\nimport { Viewer } from './viewer';\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport urlFacts from '../../facts/url';\nimport createIDs from '../creators/id-creator';\nimport { assertSecureRequest } from '../utils/security-utils';\n-import { fetchDeviceTokensForCookie } from '../fetchers/device-token-fetchers';\n+import { deleteCookie } from '../deleters/cookie-deleters';\nconst { baseDomain, basePath, https } = urlFacts;\n@@ -35,6 +35,10 @@ const cookieType = Object.freeze({\n});\ntype CookieType = $Values<typeof cookieType>;\n+function cookieIsExpired(lastUpdate: number) {\n+ return lastUpdate + cookieLifetime <= Date.now();\n+}\n+\ntype FetchViewerResult =\n| {| type: \"valid\", viewer: Viewer |}\n| {| type: \"nonexistant\", cookieName: ?string, source: CookieSource |}\n@@ -64,7 +68,7 @@ async function fetchUserViewer(\nconst cookieRow = result[0];\nif (\n!bcrypt.compareSync(cookiePassword, cookieRow.hash) ||\n- cookieRow.last_update + cookieLifetime <= Date.now()\n+ cookieIsExpired(cookieRow.last_update)\n) {\nreturn {\ntype: \"invalidated\",\n@@ -106,7 +110,7 @@ async function fetchAnonymousViewer(\nconst cookieRow = result[0];\nif (\n!bcrypt.compareSync(cookiePassword, cookieRow.hash) ||\n- cookieRow.last_update + cookieLifetime <= Date.now()\n+ cookieIsExpired(cookieRow.last_update)\n) {\nreturn {\ntype: \"invalidated\",\n@@ -276,40 +280,6 @@ async function createNewAnonymousCookie(): Promise<AnonymousViewerData> {\n};\n}\n-async function deleteCookie(cookieID: string): Promise<void> {\n- await dbQuery(SQL`\n- DELETE c, i\n- FROM cookies c\n- LEFT JOIN ids i ON i.id = c.id\n- WHERE c.id = ${cookieID}\n- `);\n-}\n-\n-async function deleteCookiesOnLogOut(\n- userID: string,\n- cookieID: string,\n-): Promise<void> {\n- const deviceTokens = await fetchDeviceTokensForCookie(cookieID);\n-\n- const conditions = [ SQL`c.id = ${cookieID}` ];\n- if (deviceTokens.ios) {\n- conditions.push(SQL`c.ios_device_token = ${deviceTokens.ios}`);\n- }\n- if (deviceTokens.android) {\n- conditions.push(SQL`c.android_device_token = ${deviceTokens.android}`);\n- }\n-\n- const query = SQL`\n- DELETE c, i\n- FROM cookies c\n- LEFT JOIN ids i ON i.id = c.id\n- WHERE c.user = ${userID} AND\n- `;\n- query.append(mergeOrConditions(conditions));\n-\n- await dbQuery(query);\n-}\n-\nasync function createNewUserCookie(userID: string): Promise<UserViewerData> {\nconst time = Date.now();\nconst cookiePassword = crypto.randomBytes(32).toString('hex');\n@@ -381,12 +351,11 @@ function addCookieToHomeResponse(viewer: Viewer, res: $Response) {\n}\nexport {\n+ cookieLifetime,\ncookieType,\nfetchViewerForJSONRequest,\nfetchViewerForHomeRequest,\ncreateNewAnonymousCookie,\n- deleteCookie,\n- deleteCookiesOnLogOut,\ncreateNewUserCookie,\naddCookieToJSONResponse,\naddCookieToHomeResponse,\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -2349,6 +2349,13 @@ create-react-class@^15.5.2:\nloose-envify \"^1.3.1\"\nobject-assign \"^4.1.1\"\n+cron-parser@^2.4.0:\n+ version \"2.4.5\"\n+ resolved \"https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.4.5.tgz#33629810a4b491004c363f4b6996133bbc22e16f\"\n+ dependencies:\n+ is-nan \"^1.2.1\"\n+ moment-timezone \"^0.5.0\"\n+\ncross-spawn@^5.0.1, cross-spawn@^5.1.0:\nversion \"5.1.0\"\nresolved \"https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449\"\n@@ -2579,7 +2586,7 @@ default-require-extensions@^1.0.0:\ndependencies:\nstrip-bom \"^2.0.0\"\n-define-properties@^1.1.2:\n+define-properties@^1.1.1, define-properties@^1.1.2:\nversion \"1.1.2\"\nresolved \"https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94\"\ndependencies:\n@@ -4562,6 +4569,12 @@ is-installed-globally@^0.1.0:\nglobal-dirs \"^0.1.0\"\nis-path-inside \"^1.0.0\"\n+is-nan@^1.2.1:\n+ version \"1.2.1\"\n+ resolved \"https://registry.yarnpkg.com/is-nan/-/is-nan-1.2.1.tgz#9faf65b6fb6db24b7f5c0628475ea71f988401e2\"\n+ dependencies:\n+ define-properties \"^1.1.1\"\n+\nis-npm@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4\"\n@@ -5516,6 +5529,10 @@ loglevel@^1.4.1:\nversion \"1.6.1\"\nresolved \"https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa\"\n+long-timeout@0.1.1:\n+ version \"0.1.1\"\n+ resolved \"https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.1.1.tgz#9721d788b47e0bcb5a24c2e2bee1a0da55dab514\"\n+\nlong@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28\"\n@@ -5906,6 +5923,16 @@ modelo@^4.2.0:\nversion \"4.2.3\"\nresolved \"https://registry.yarnpkg.com/modelo/-/modelo-4.2.3.tgz#b278588a4db87fc1e5107ae3a277c0876f38d894\"\n+moment-timezone@^0.5.0:\n+ version \"0.5.14\"\n+ resolved \"https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.14.tgz#4eb38ff9538b80108ba467a458f3ed4268ccfcb1\"\n+ dependencies:\n+ moment \">= 2.9.0\"\n+\n+\"moment@>= 2.9.0\":\n+ version \"2.22.0\"\n+ resolved \"https://registry.yarnpkg.com/moment/-/moment-2.22.0.tgz#7921ade01017dd45186e7fee5f424f0b8663a730\"\n+\nmorgan@~1.6.1:\nversion \"1.6.1\"\nresolved \"https://registry.yarnpkg.com/morgan/-/morgan-1.6.1.tgz#5fd818398c6819cba28a7cd6664f292fe1c0bbf2\"\n@@ -6088,6 +6115,14 @@ node-pre-gyp@^0.6.39:\ntar \"^2.2.1\"\ntar-pack \"^3.4.0\"\n+node-schedule@^1.3.0:\n+ version \"1.3.0\"\n+ resolved \"https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.0.tgz#e7a7e816a7f2550d5b170bd106e765db28bdf030\"\n+ dependencies:\n+ cron-parser \"^2.4.0\"\n+ long-timeout \"0.1.1\"\n+ sorted-array-functions \"^1.0.0\"\n+\nnodemailer@^4.4.2:\nversion \"4.4.2\"\nresolved \"https://registry.yarnpkg.com/nodemailer/-/nodemailer-4.4.2.tgz#f215fb88e8a1052f9f93083909e116d2b79fc8de\"\n@@ -8326,6 +8361,10 @@ sort-keys@^1.0.0:\ndependencies:\nis-plain-obj \"^1.0.0\"\n+sorted-array-functions@^1.0.0:\n+ version \"1.1.0\"\n+ resolved \"https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.1.0.tgz#78fe5808ffa1beebac2ce9a22d76039dabc599ff\"\n+\nsource-list-map@^2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Add cronjobs to clear expired cookies and verifications |
129,187 | 02.04.2018 00:04:58 | 14,400 | c73281bd8892d3f2ac9b913bbe79247cedd69dff | [server] Try refining email style | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/reset-password.js",
"new_path": "server/src/emails/reset-password.js",
"diff": "@@ -8,8 +8,9 @@ import { verifyField } from 'lib/types/verify-types';\nimport urlFacts from '../../facts/url';\nimport { createVerificationCode } from '../models/verification';\nimport sendmail from './sendmail';\n+import Template from './template.react';\n-const { Email, Item, Span, A, renderEmail } = ReactHTML;\n+const { Span, A, renderEmail } = ReactHTML;\nconst { baseDomain, basePath } = urlFacts;\nasync function sendPasswordResetEmail(\n@@ -28,14 +29,12 @@ async function sendPasswordResetEmail(\n\"However, if you did issue this request, please visit this link to reset \" +\n\"your password: \";\nconst email = (\n- <Email title={title}>\n- <Item>\n+ <Template title={title}>\n<Span>\n{text}\n<A href={link}>{link}</A>\n</Span>\n- </Item>\n- </Email>\n+ </Template>\n);\nconst html = renderEmail(email);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/emails/template.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react'\n+import ReactHTML from 'react-html-email';\n+\n+const { Email, Box, Item } = ReactHTML;\n+\n+const css = `\n+@media only screen and (max-device-width: 480px) {\n+ font-size: 20px !important;\n+}`.trim();\n+\n+type Props = {|\n+ title: string,\n+ children: React.Node,\n+|};\n+function Template(props: Props) {\n+ return (\n+ <Email title={props.title} headCSS={css}>\n+ <Box>\n+ <Item>\n+ {props.children}\n+ </Item>\n+ </Box>\n+ </Email>\n+ );\n+}\n+\n+export default Template;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/verification.js",
"new_path": "server/src/emails/verification.js",
"diff": "@@ -8,8 +8,9 @@ import { verifyField } from 'lib/types/verify-types';\nimport urlFacts from '../../facts/url';\nimport { createVerificationCode } from '../models/verification';\nimport sendmail from './sendmail';\n+import Template from './template.react';\n-const { Email, Item, Span, A, renderEmail } = ReactHTML;\n+const { Span, A, renderEmail } = ReactHTML;\nconst { baseDomain, basePath } = urlFacts;\nasync function sendEmailAddressVerificationEmail(\n@@ -25,26 +26,22 @@ async function sendEmailAddressVerificationEmail(\nlet action = \"verify your email\";\nif (welcome) {\nwelcomeText = (\n- <Item>\n<Span fontSize={24}>\n{`Welcome to SquadCal, ${username}!`}\n</Span>\n- </Item>\n);\naction = `complete your registration and ${action}`;\n}\nconst title = \"Verify email for SquadCal\";\nconst email = (\n- <Email title={title}>\n+ <Template title={title}>\n{welcomeText}\n- <Item>\n<Span>\n{`Please ${action} by clicking this link: `}\n<A href={link}>{link}</A>\n</Span>\n- </Item>\n- </Email>\n+ </Template>\n);\nconst html = renderEmail(email);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Try refining email style |
129,187 | 02.04.2018 00:11:39 | 14,400 | 8e9127e886188f0008114c89bd44534fccb3a10c | [server] Minor change to React imports to work with Node.js | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/reset-password.js",
"new_path": "server/src/emails/reset-password.js",
"diff": "// @flow\n-import React from 'react'\n+import React from 'react';\nimport ReactHTML from 'react-html-email';\nimport { verifyField } from 'lib/types/verify-types';\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "// @flow\n-import * as React from 'react'\n+import React from 'react';\n+import * as React2 from 'react';\nimport ReactHTML from 'react-html-email';\nconst { Email, Box, Item } = ReactHTML;\n@@ -12,7 +13,7 @@ const css = `\ntype Props = {|\ntitle: string,\n- children: React.Node,\n+ children: React2.Node,\n|};\nfunction Template(props: Props) {\nreturn (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Minor change to React imports to work with Node.js |
129,187 | 02.04.2018 00:16:25 | 14,400 | f883a929ffbba4dbc28eaa2805e15ab317d9cffb | [server] Continue iterating on email style | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/reset-password.js",
"new_path": "server/src/emails/reset-password.js",
"diff": "@@ -10,7 +10,7 @@ import { createVerificationCode } from '../models/verification';\nimport sendmail from './sendmail';\nimport Template from './template.react';\n-const { Span, A, renderEmail } = ReactHTML;\n+const { Item, Span, A, renderEmail } = ReactHTML;\nconst { baseDomain, basePath } = urlFacts;\nasync function sendPasswordResetEmail(\n@@ -30,10 +30,12 @@ async function sendPasswordResetEmail(\n\"your password: \";\nconst email = (\n<Template title={title}>\n+ <Item>\n<Span>\n{text}\n<A href={link}>{link}</A>\n</Span>\n+ </Item>\n</Template>\n);\nconst html = renderEmail(email);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "@@ -4,7 +4,7 @@ import React from 'react';\nimport * as React2 from 'react';\nimport ReactHTML from 'react-html-email';\n-const { Email, Box, Item } = ReactHTML;\n+const { Email, Box } = ReactHTML;\nconst css = `\n@media only screen and (max-device-width: 480px) {\n@@ -19,9 +19,7 @@ function Template(props: Props) {\nreturn (\n<Email title={props.title} headCSS={css}>\n<Box>\n- <Item>\n{props.children}\n- </Item>\n</Box>\n</Email>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/verification.js",
"new_path": "server/src/emails/verification.js",
"diff": "@@ -10,7 +10,7 @@ import { createVerificationCode } from '../models/verification';\nimport sendmail from './sendmail';\nimport Template from './template.react';\n-const { Span, A, renderEmail } = ReactHTML;\n+const { Item, Span, A, renderEmail } = ReactHTML;\nconst { baseDomain, basePath } = urlFacts;\nasync function sendEmailAddressVerificationEmail(\n@@ -26,9 +26,11 @@ async function sendEmailAddressVerificationEmail(\nlet action = \"verify your email\";\nif (welcome) {\nwelcomeText = (\n+ <Item>\n<Span fontSize={24}>\n{`Welcome to SquadCal, ${username}!`}\n</Span>\n+ </Item>\n);\naction = `complete your registration and ${action}`;\n}\n@@ -37,10 +39,12 @@ async function sendEmailAddressVerificationEmail(\nconst email = (\n<Template title={title}>\n{welcomeText}\n+ <Item>\n<Span>\n{`Please ${action} by clicking this link: `}\n<A href={link}>{link}</A>\n</Span>\n+ </Item>\n</Template>\n);\nconst html = renderEmail(email);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Continue iterating on email style |
129,187 | 02.04.2018 00:24:15 | 14,400 | e4123fafd36c6484759bc34692ad50f71d8877f5 | [server] Left-align all emails | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/reset-password.js",
"new_path": "server/src/emails/reset-password.js",
"diff": "@@ -30,7 +30,7 @@ async function sendPasswordResetEmail(\n\"your password: \";\nconst email = (\n<Template title={title}>\n- <Item>\n+ <Item align=\"left\">\n<Span>\n{text}\n<A href={link}>{link}</A>\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/verification.js",
"new_path": "server/src/emails/verification.js",
"diff": "@@ -26,7 +26,7 @@ async function sendEmailAddressVerificationEmail(\nlet action = \"verify your email\";\nif (welcome) {\nwelcomeText = (\n- <Item>\n+ <Item align=\"left\">\n<Span fontSize={24}>\n{`Welcome to SquadCal, ${username}!`}\n</Span>\n@@ -39,7 +39,7 @@ async function sendEmailAddressVerificationEmail(\nconst email = (\n<Template title={title}>\n{welcomeText}\n- <Item>\n+ <Item align=\"left\">\n<Span>\n{`Please ${action} by clicking this link: `}\n<A href={link}>{link}</A>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Left-align all emails |
129,187 | 02.04.2018 00:33:44 | 14,400 | da37237cbcc6c5e59a04aec1824f29a00145794d | [server] Once again try left-aligning all emails | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "@@ -17,8 +17,8 @@ type Props = {|\n|};\nfunction Template(props: Props) {\nreturn (\n- <Email title={props.title} headCSS={css}>\n- <Box>\n+ <Email title={props.title} headCSS={css} align=\"left\">\n+ <Box align=\"left\">\n{props.children}\n</Box>\n</Email>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Once again try left-aligning all emails |
129,187 | 02.04.2018 00:40:30 | 14,400 | 41a5d8c1c6097e139b8a08b08709094d73287601 | [server] Continue trying to left-align all emails | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "@@ -17,7 +17,7 @@ type Props = {|\n|};\nfunction Template(props: Props) {\nreturn (\n- <Email title={props.title} headCSS={css} align=\"left\">\n+ <Email title={props.title} headCSS={css} align=\"left\" width=\"100%\">\n<Box align=\"left\">\n{props.children}\n</Box>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Continue trying to left-align all emails |
129,187 | 02.04.2018 00:44:47 | 14,400 | b9ea8315e2f74a02acebf6ebf4be3cd1fe597701 | [server] Try to add some padding to emails | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "@@ -18,7 +18,7 @@ type Props = {|\nfunction Template(props: Props) {\nreturn (\n<Email title={props.title} headCSS={css} align=\"left\" width=\"100%\">\n- <Box align=\"left\">\n+ <Box align=\"left\" cellSpacing={20}>\n{props.children}\n</Box>\n</Email>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Try to add some padding to emails |
129,187 | 02.04.2018 00:48:39 | 14,400 | 956a6bfc5d253aa6d22d95085cf8e2d562aa926c | [server] Try a more moderate padding on emails | [
{
"change_type": "MODIFY",
"old_path": "server/src/emails/template.react.js",
"new_path": "server/src/emails/template.react.js",
"diff": "@@ -18,7 +18,7 @@ type Props = {|\nfunction Template(props: Props) {\nreturn (\n<Email title={props.title} headCSS={css} align=\"left\" width=\"100%\">\n- <Box align=\"left\" cellSpacing={20}>\n+ <Box align=\"left\" cellSpacing={10}>\n{props.children}\n</Box>\n</Email>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Try a more moderate padding on emails |
129,187 | 02.04.2018 13:48:17 | 14,400 | 0e05a6eae330e835095e76d7a7e4a5dc343bfd6f | [native] Don't show CalendarInputBar while ThreadPicker is open | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar-input-bar.react.js",
"new_path": "native/calendar/calendar-input-bar.react.js",
"diff": "import React from 'react';\nimport { View, StyleSheet, Text } from 'react-native';\n+import PropTypes from 'prop-types';\nimport Button from '../components/button.react';\nimport {\n@@ -12,12 +13,17 @@ import {\ntype Props = {|\nonSave: () => void,\n+ disabled: bool,\n|};\ntype State = {|\nkeyboardActive: bool,\n|};\nclass CalendarInputBar extends React.PureComponent<Props, State> {\n+ static propTypes = {\n+ onSave: PropTypes.func.isRequired,\n+ disabled: PropTypes.bool.isRequired,\n+ };\nstate = {\nkeyboardActive: false,\n};\n@@ -51,7 +57,7 @@ class CalendarInputBar extends React.PureComponent<Props, State> {\n}\nrender() {\n- const inactiveStyle = this.state.keyboardActive\n+ const inactiveStyle = this.state.keyboardActive && !this.props.disabled\n? undefined\n: styles.inactiveContainer;\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -711,7 +711,10 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n>\n{loadingIndicator}\n{flatList}\n- <CalendarInputBar onSave={this.onSaveEntry} />\n+ <CalendarInputBar\n+ onSave={this.onSaveEntry}\n+ disabled={this.state.threadPickerOpen}\n+ />\n</KeyboardAvoidingView>\n<Modal\nisVisible={this.state.threadPickerOpen}\n@@ -992,6 +995,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nclosePicker = () => {\n+ LayoutAnimation.easeInEaseOut();\nthis.setState({ threadPickerOpen: false });\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Don't show CalendarInputBar while ThreadPicker is open |
129,187 | 02.04.2018 14:17:15 | 14,400 | c084be227436b98f9ed1af87b57f2991e4822100 | [server] Add deleteInaccessibleThreads to cron
Deletes threads with no membership rows, which indicates that nobody can ever actually see them again. Actually, legacy thread types can always be seen, but they are soon to be deprecated, so that's not particularly relevant. Plus all of them have at least one membership row now anyways. | [
{
"change_type": "MODIFY",
"old_path": "server/src/cron.js",
"new_path": "server/src/cron.js",
"diff": "@@ -5,13 +5,16 @@ import cluster from 'cluster';\nimport { deleteExpiredCookies } from './deleters/cookie-deleters';\nimport { deleteExpiredVerifications } from './models/verification';\n+import { deleteInaccessibleThreads } from './deleters/thread-deleters';\nif (cluster.isMaster) {\nschedule.scheduleJob(\n'30 3 * * *',\nasync () => {\n+ // Do everything one at a time to reduce load since we're in no hurry\nawait deleteExpiredCookies();\nawait deleteExpiredVerifications();\n+ await deleteInaccessibleThreads();\n},\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/account-deleters.js",
"new_path": "server/src/deleters/account-deleters.js",
"diff": "@@ -31,8 +31,7 @@ async function deleteAccount(\nthrow new ServerError('invalid_credentials');\n}\n- // TODO figure out what to do with threads this account admins\n- // TODO delete orphaned threads\n+ // TODO: if this results in any orphaned orgs, convert them to chats\nconst deletionQuery = SQL`\nDELETE u, iu, v, iv, c, ic, m, f, n, ino\nFROM users u\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/thread-deleters.js",
"new_path": "server/src/deleters/thread-deleters.js",
"diff": "@@ -46,7 +46,7 @@ async function deleteThread(\n// TODO delete all descendant threads as well\nconst query = SQL`\n- DELETE t, ic, d, id, e, ie, re, ir, mm, r, ms, im, f, n, ino\n+ DELETE t, ic, d, id, e, ie, re, ire, mm, r, ms, im, f, n, ino\nFROM threads t\nLEFT JOIN ids ic ON ic.id = t.id\nLEFT JOIN days d ON d.thread = t.id\n@@ -54,9 +54,10 @@ async function deleteThread(\nLEFT JOIN entries e ON e.day = d.id\nLEFT JOIN ids ie ON ie.id = e.id\nLEFT JOIN revisions re ON re.entry = e.id\n- LEFT JOIN ids ir ON ir.id = re.id\n+ LEFT JOIN ids ire ON ire.id = re.id\nLEFT JOIN memberships mm ON mm.thread = t.id\nLEFT JOIN roles r ON r.thread = t.id\n+ LEFT JOIN ids ir ON r.thread = t.id\nLEFT JOIN messages ms ON ms.thread = t.id\nLEFT JOIN ids im ON im.id = ms.id\nLEFT JOIN focused f ON f.thread = t.id\n@@ -70,7 +71,30 @@ async function deleteThread(\nreturn { threadInfos };\n}\n+async function deleteInaccessibleThreads(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE t, i, d, id, e, ie, re, ire, r, ir, ms, im, f, n, ino\n+ FROM threads t\n+ LEFT JOIN ids i ON i.id = t.id\n+ LEFT JOIN memberships m ON m.thread = t.id\n+ LEFT JOIN days d ON d.thread = t.id\n+ LEFT JOIN ids id ON id.id = d.id\n+ LEFT JOIN entries e ON e.day = d.id\n+ LEFT JOIN ids ie ON ie.id = e.id\n+ LEFT JOIN revisions re ON re.entry = e.id\n+ LEFT JOIN ids ire ON ire.id = re.id\n+ LEFT JOIN roles r ON r.thread = t.id\n+ LEFT JOIN ids ir ON r.thread = t.id\n+ LEFT JOIN messages ms ON ms.thread = t.id\n+ LEFT JOIN ids im ON im.id = ms.id\n+ LEFT JOIN focused f ON f.thread = t.id\n+ LEFT JOIN notifications n ON n.thread = t.id\n+ LEFT JOIN ids ino ON ino.id = n.id\n+ WHERE m.thread IS NULL\n+ `);\n+}\n+\nexport {\ndeleteThread,\n+ deleteInaccessibleThreads,\n};\n-\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Add deleteInaccessibleThreads to cron
Deletes threads with no membership rows, which indicates that nobody can ever actually see them again. Actually, legacy thread types can always be seen, but they are soon to be deprecated, so that's not particularly relevant. Plus all of them have at least one membership row now anyways. |
129,187 | 02.04.2018 14:55:58 | 14,400 | 6a35f83edf536bcd53cc9ae8624ef99f2fe5e64a | [server] Delete a bunch of orphaned rows from DB in cronjob | [
{
"change_type": "MODIFY",
"old_path": "server/src/cron.js",
"new_path": "server/src/cron.js",
"diff": "@@ -6,15 +6,32 @@ import cluster from 'cluster';\nimport { deleteExpiredCookies } from './deleters/cookie-deleters';\nimport { deleteExpiredVerifications } from './models/verification';\nimport { deleteInaccessibleThreads } from './deleters/thread-deleters';\n+import { deleteOrphanedDays } from './deleters/day-deleters';\n+import { deleteOrphanedMemberships } from './deleters/membership-deleters';\n+import { deleteOrphanedEntries } from './deleters/entry-deleters';\n+import { deleteOrphanedRevisions } from './deleters/revision-deleters';\n+import { deleteOrphanedRoles } from './deleters/role-deleters';\n+import { deleteOrphanedMessages } from './deleters/message-deleters';\n+import { deleteOrphanedFocused } from './deleters/activity-deleters';\n+import { deleteOrphanedNotifs } from './deleters/notif-deleters';\nif (cluster.isMaster) {\nschedule.scheduleJob(\n'30 3 * * *',\nasync () => {\n- // Do everything one at a time to reduce load since we're in no hurry\n+ // Do everything one at a time to reduce load since we're in no hurry,\n+ // and since some queries depend on previous ones.\nawait deleteExpiredCookies();\nawait deleteExpiredVerifications();\nawait deleteInaccessibleThreads();\n+ await deleteOrphanedMemberships();\n+ await deleteOrphanedDays();\n+ await deleteOrphanedEntries();\n+ await deleteOrphanedRevisions();\n+ await deleteOrphanedRoles();\n+ await deleteOrphanedMessages();\n+ await deleteOrphanedFocused();\n+ await deleteOrphanedNotifs();\n},\n);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/activity-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedFocused(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE f\n+ FROM focused f\n+ LEFT JOIN threads t ON t.id = f.thread\n+ WHERE t.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedFocused,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/day-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedDays(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE d, i\n+ FROM days d\n+ LEFT JOIN ids i ON i.id = d.id\n+ LEFT JOIN entries e ON e.day = d.id\n+ LEFT JOIN threads t ON t.id = d.thread\n+ WHERE e.day IS NULL OR t.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedDays,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/entry-deleters.js",
"new_path": "server/src/deleters/entry-deleters.js",
"diff": "@@ -181,7 +181,18 @@ async function restoreEntry(\nreturn { entryInfo, newMessageInfos };\n}\n+async function deleteOrphanedEntries(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE e, i\n+ FROM entries e\n+ LEFT JOIN ids i ON i.id = e.id\n+ LEFT JOIN days d ON d.id = e.day\n+ WHERE d.id IS NULL\n+ `);\n+}\n+\nexport {\ndeleteEntry,\nrestoreEntry,\n+ deleteOrphanedEntries,\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/membership-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedMemberships(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE m\n+ FROM memberships m\n+ LEFT JOIN threads t ON t.id = m.thread\n+ WHERE t.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedMemberships,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/message-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedMessages(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE m, i\n+ FROM messages m\n+ LEFT JOIN ids i ON i.id = m.id\n+ LEFT JOIN threads t ON t.id = m.thread\n+ WHERE t.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedMessages,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/notif-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedNotifs(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE n, i\n+ FROM notifications n\n+ LEFT JOIN ids i ON i.id = n.id\n+ LEFT JOIN threads t ON t.id = n.thread\n+ WHERE t.id IS NULL AND n.rescinded = 1\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedNotifs,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/revision-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedRevisions(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE r, i\n+ FROM revisions r\n+ LEFT JOIN ids i ON i.id = r.id\n+ LEFT JOIN entries e ON e.id = r.entry\n+ WHERE e.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedRevisions,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/role-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteOrphanedRoles(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE r, i\n+ FROM roles r\n+ LEFT JOIN ids i ON i.id = r.id\n+ LEFT JOIN threads t ON t.id = r.thread\n+ WHERE t.id IS NULL\n+ `);\n+}\n+\n+export {\n+ deleteOrphanedRoles,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/thread-deleters.js",
"new_path": "server/src/deleters/thread-deleters.js",
"diff": "@@ -44,7 +44,7 @@ async function deleteThread(\nthrow new ServerError('invalid_credentials');\n}\n- // TODO delete all descendant threads as well\n+ // TODO: if org, delete all descendant threads as well. make sure to warn user\nconst query = SQL`\nDELETE t, ic, d, id, e, ie, re, ire, mm, r, ms, im, f, n, ino\nFROM threads t\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Delete a bunch of orphaned rows from DB in cronjob |
129,187 | 02.04.2018 15:52:26 | 14,400 | 496b5a6d78b135bdbfa2aa6f77d3b957dbbefa6d | [server] Rescind all notifs when thread is deleted | [
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/thread-deleters.js",
"new_path": "server/src/deleters/thread-deleters.js",
"diff": "@@ -16,6 +16,7 @@ import {\ncheckThreadPermission,\nfetchThreadInfos,\n} from '../fetchers/thread-fetchers';\n+import { rescindPushNotifs } from '../push/rescind';\nasync function deleteThread(\nviewer: Viewer,\n@@ -44,6 +45,8 @@ async function deleteThread(\nthrow new ServerError('invalid_credentials');\n}\n+ await rescindPushNotifs(SQL`n.thread = ${threadDeletionRequest.threadID}`);\n+\n// TODO: if org, delete all descendant threads as well. make sure to warn user\nconst query = SQL`\nDELETE t, ic, d, id, e, ie, re, ire, mm, r, ms, im, f, n, ino\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/push/rescind.js",
"new_path": "server/src/push/rescind.js",
"diff": "import apn from 'apn';\n-import { dbQuery, SQL } from '../database';\n-import { apnPush, fcmPush, getUnreadCounts } from './utils';\n+import { dbQuery, SQL, SQLStatement } from '../database';\n+import { apnPush, fcmPush } from './utils';\n-async function rescindPushNotifs(\n- userID: string,\n- threadIDs: $ReadOnlyArray<string>,\n-) {\n+async function rescindPushNotifs(condition: SQLStatement) {\nconst fetchQuery = SQL`\n- SELECT id, delivery, collapse_key\n- FROM notifications\n- WHERE user = ${userID} AND thread IN (${threadIDs})\n- AND rescinded = 0\n+ SELECT n.id, n.delivery, n.collapse_key, COUNT(m.thread) AS unread_count\n+ FROM notifications n\n+ LEFT JOIN memberships m ON m.user = n.user AND m.unread = 1 AND m.role != 0\n+ WHERE n.rescinded = 0 AND\n`;\n- const [ [ fetchResult ], unreadCounts ] = await Promise.all([\n- dbQuery(fetchQuery),\n- getUnreadCounts([ userID ]),\n- ]);\n+ fetchQuery.append(condition);\n+ fetchQuery.append(SQL` GROUP BY n.id, m.user`);\n+ const [ fetchResult ] = await dbQuery(fetchQuery);\nconst promises = [];\nconst rescindedIDs = [];\n@@ -26,7 +22,7 @@ async function rescindPushNotifs(\nif (row.delivery.iosID) {\nconst notification = new apn.Notification();\nnotification.contentAvailable = true;\n- notification.badge = unreadCounts[userID];\n+ notification.badge = row.unread_count;\nnotification.topic = \"org.squadcal.app\";\nnotification.payload = {\nmanagedAps: {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -81,10 +81,10 @@ async function activityUpdater(\nAND thread IN (${focusedThreadIDs})\nAND user = ${localViewer.userID}\n`));\n- promises.push(rescindPushNotifs(\n- localViewer.userID,\n- focusedThreadIDs,\n- ));\n+ const rescindCondition = SQL`\n+ n.user = ${localViewer.userID} AND n.thread IN (${focusedThreadIDs})\n+ `;\n+ promises.push(rescindPushNotifs(rescindCondition));\n}\nconst [ resetToUnread ] = await Promise.all([\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Rescind all notifs when thread is deleted |
129,187 | 03.04.2018 11:19:01 | 14,400 | ed81ebbd931e4136a1880363d0cb021c2044cb4c | [lib] Reduce unnecessary renders by avoiding changes in reducers | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/entry-reducer.js",
"new_path": "lib/reducers/entry-reducer.js",
"diff": "@@ -94,13 +94,13 @@ function mergeNewEntryInfos(\nconst serverID = rawEntryInfo.id;\ninvariant(serverID, \"new entryInfos should have serverID\");\nconst currentEntryInfo = currentEntryInfos[serverID];\n- const newEntryInfo = {\n+ let newEntryInfo;\n+ if (currentEntryInfo && currentEntryInfo.localID) {\n+ newEntryInfo = {\nid: serverID,\n// Try to preserve localIDs. This is because we use them as React\n// keys and changing React keys leads to loss of component state.\n- localID: currentEntryInfo && currentEntryInfo.localID\n- ? currentEntryInfo.localID\n- : undefined,\n+ localID: currentEntryInfo.localID,\nthreadID: rawEntryInfo.threadID,\ntext: rawEntryInfo.text,\nyear: rawEntryInfo.year,\n@@ -110,6 +110,20 @@ function mergeNewEntryInfos(\ncreatorID: rawEntryInfo.creatorID,\ndeleted: rawEntryInfo.deleted,\n};\n+ } else {\n+ newEntryInfo = {\n+ id: serverID,\n+ threadID: rawEntryInfo.threadID,\n+ text: rawEntryInfo.text,\n+ year: rawEntryInfo.year,\n+ month: rawEntryInfo.month,\n+ day: rawEntryInfo.day,\n+ creationTime: rawEntryInfo.creationTime,\n+ creatorID: rawEntryInfo.creatorID,\n+ deleted: rawEntryInfo.deleted,\n+ };\n+ }\n+\nif (_isEqual(currentEntryInfo)(newEntryInfo)) {\nmergedEntryInfos[serverID] = currentEntryInfo;\ncontinue;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/thread-reducer.js",
"new_path": "lib/reducers/thread-reducer.js",
"diff": "@@ -87,13 +87,18 @@ export default function reduceThreadInfos(\n// To make sure the unread status doesn't update from a stale ping\n// result, we check if there actually are any new messages for this\n// threadInfo.\n- newThreadInfos[threadID] = {\n+ const potentiallyNewThreadInfo = {\n...newThreadInfo,\ncurrentUser: {\n...newThreadInfo.currentUser,\nunread: false,\n},\n};\n+ if (_isEqual(currentThreadInfo)(potentiallyNewThreadInfo)) {\n+ newThreadInfos[threadID] = currentThreadInfo;\n+ } else {\n+ newThreadInfos[threadID] = potentiallyNewThreadInfo;\n+ }\n} else {\nnewThreadInfos[threadID] = newThreadInfo;\n}\n@@ -112,6 +117,9 @@ export default function reduceThreadInfos(\nconst currentThreadInfo = state[threadID];\nnewThreadInfos[threadID] = currentThreadInfo;\n}\n+ if (_isEqual(state)(newThreadInfos)) {\n+ return state;\n+ }\nreturn newThreadInfos;\n} else if (\naction.type === changeThreadSettingsActionTypes.success ||\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/action-utils.js",
"new_path": "lib/utils/action-utils.js",
"diff": "@@ -19,6 +19,8 @@ import type { Endpoint } from '../types/endpoints';\nimport invariant from 'invariant';\nimport _mapValues from 'lodash/fp/mapValues';\n+import { createSelector } from 'reselect';\n+import _memoize from 'lodash/memoize';\nimport fetchJSON from './fetch-json';\nimport { getConfig } from './config';\n@@ -366,6 +368,14 @@ function bindCookieAndUtilsIntoFetchJSON(\n});\n}\n+type ActionFunc = (fetchJSON: FetchJSON, ...rest: $FlowFixMe) => Promise<*>;\n+type BindServerCallsParams = {\n+ dispatch: Dispatch,\n+ cookie: ?string,\n+ urlPrefix: string,\n+ deviceToken: ?string,\n+};\n+\n// All server calls needs to include some information from the Redux state\n// (namely, the cookie). This information is used deep in the server call,\n// at the point where fetchJSON is called. We don't want to bother propagating\n@@ -374,13 +384,18 @@ function bindCookieAndUtilsIntoFetchJSON(\n// onto fetchJSON within react-redux's connect's mapStateToProps function, and\n// then pass that \"bound\" fetchJSON that no longer needs the cookie as a\n// parameter on to the server call.\n-function bindCookieAndUtilsIntoServerCall<P>(\n- actionFunc: (fetchJSON: FetchJSON, ...rest: $FlowFixMe) => Promise<P>,\n+const baseCreateBoundServerCallsSelector = (actionFunc: ActionFunc) => {\n+ return createSelector(\n+ (state: BindServerCallsParams) => state.dispatch,\n+ (state: BindServerCallsParams) => state.cookie,\n+ (state: BindServerCallsParams) => state.urlPrefix,\n+ (state: BindServerCallsParams) => state.deviceToken,\n+ (\ndispatch: Dispatch,\ncookie: ?string,\nurlPrefix: string,\ndeviceToken: ?string,\n-): (...rest: $FlowFixMe) => Promise<P> {\n+ ) => {\nconst boundFetchJSON = bindCookieAndUtilsIntoFetchJSON(\ndispatch,\ncookie,\n@@ -390,7 +405,10 @@ function bindCookieAndUtilsIntoServerCall<P>(\nreturn (async (...rest: $FlowFixMe) => {\nreturn await actionFunc(boundFetchJSON, ...rest);\n});\n+ },\n+ );\n}\n+const createBoundServerCallsSelector = _memoize(baseCreateBoundServerCallsSelector);\ntype ServerCall = (fetchJSON: FetchJSON, ...rest: $FlowFixMe) => Promise<any>;\nexport type ServerCalls = {[name: string]: ServerCall};\n@@ -406,13 +424,12 @@ function bindServerCalls(serverCalls: ServerCalls) {\nconst { cookie, urlPrefix, deviceToken } = stateProps;\nconst boundServerCalls = _mapValues(\n(serverCall: (fetchJSON: FetchJSON, ...rest: any) => Promise<any>) =>\n- bindCookieAndUtilsIntoServerCall(\n- serverCall,\n+ createBoundServerCallsSelector(serverCall)({\ndispatch,\ncookie,\nurlPrefix,\ndeviceToken,\n- ),\n+ }),\n)(serverCalls);\nreturn {\n...ownProps,\n@@ -427,6 +444,6 @@ export {\nsetCookieActionType,\nincludeDispatchActionProps,\nfetchNewCookieFromNativeCredentials,\n- bindCookieAndUtilsIntoServerCall,\n+ createBoundServerCallsSelector,\nbindServerCalls,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -47,7 +47,7 @@ import _isEqual from 'lodash/fp/isEqual';\nimport {\nincludeDispatchActionProps,\nfetchNewCookieFromNativeCredentials,\n- bindCookieAndUtilsIntoServerCall,\n+ createBoundServerCallsSelector,\n} from 'lib/utils/action-utils';\nimport { pingActionTypes, ping } from 'lib/actions/ping-actions';\nimport {\n@@ -84,6 +84,7 @@ import {\nconst forceInset = { top: 'always', bottom: 'always' };\nlet initialAppLoad = true;\n+const boundPingSelector = createBoundServerCallsSelector(ping);\ntype LoggedOutMode = \"loading\" | \"prompt\" | \"log-in\" | \"register\";\ntype Props = {\n@@ -355,13 +356,12 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\nstatic dispatchPing(props: Props, cookie: ?string, urlPrefix: string) {\n- const boundPing = bindCookieAndUtilsIntoServerCall(\n- ping,\n- props.dispatch,\n+ const boundPing = boundPingSelector({\n+ dispatch: props.dispatch,\ncookie,\nurlPrefix,\n- props.deviceToken,\n- );\n+ deviceToken: props.deviceToken,\n+ });\nconst startingPayload = props.pingStartingPayload();\nconst actionInput = props.pingActionInput(startingPayload);\nprops.dispatchActionPromise(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Reduce unnecessary renders by avoiding changes in reducers |
129,187 | 03.04.2018 13:32:57 | 14,400 | 1819a6673d854f8bfe089f218274f81df921c5b4 | [lib] Undo change that got rid of nav reducer! | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/master-reducer.js",
"new_path": "lib/reducers/master-reducer.js",
"diff": "@@ -26,10 +26,9 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\n// NavInfo has to be handled differently because of the covariance\n// (see comment about \"+\" in redux-types.js)\nconst baseNavInfo = reduceBaseNavInfo(state.navInfo, action);\n- //const navInfo = baseNavInfo === state.navInfo\n- // ? state.navInfo\n- // : { ...state.navInfo, ...baseNavInfo };\n- const navInfo = state.navInfo;\n+ const navInfo = baseNavInfo === state.navInfo\n+ ? state.navInfo\n+ : { ...state.navInfo, ...baseNavInfo };\nconst entryStore = reduceEntryInfos(state.entryStore, action);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal.xcodeproj/xcshareddata/xcschemes/SquadCal.xcscheme",
"new_path": "native/ios/SquadCal.xcodeproj/xcshareddata/xcschemes/SquadCal.xcscheme",
"diff": "buildConfiguration = \"Debug\"\nselectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\nselectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n- language = \"\"\nshouldUseLaunchSchemeArgsEnv = \"YES\">\n<Testables>\n<TestableReference\nbuildConfiguration = \"Debug\"\nselectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\nselectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n- language = \"\"\nlaunchStyle = \"0\"\nuseCustomWorkingDirectory = \"NO\"\nignoresPersistentStateOnLaunch = \"NO\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Undo change that got rid of nav reducer! |
129,187 | 03.04.2018 13:49:41 | 14,400 | c57d8c8f54fe2c9c0aa24dcdb7e17ccc4e945b32 | [server] Add temporary logging statements in updateUnreadStatus | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -200,6 +200,8 @@ async function updateUnreadStatus(\nthreadConditionClauses.push(mergeAndConditions(conditions));\n}\nconst conditionClause = mergeOrConditions(threadConditionClauses);\n+ console.log(threadRestrictions);\n+ console.log(conditionClause);\nconst subthreadJoins = [];\nfor (let pair of joinSubthreads) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Add temporary logging statements in updateUnreadStatus |
129,187 | 03.04.2018 13:59:36 | 14,400 | 8d260be127e81e9b690c730ab25ea0515ea92a30 | [server] Add temporary logging statements in possiblyResetThreadsToUnread | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -200,8 +200,6 @@ async function updateUnreadStatus(\nthreadConditionClauses.push(mergeAndConditions(conditions));\n}\nconst conditionClause = mergeOrConditions(threadConditionClauses);\n- console.log(threadRestrictions);\n- console.log(conditionClause);\nconst subthreadJoins = [];\nfor (let pair of joinSubthreads) {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -147,6 +147,7 @@ async function possiblyResetThreadsToUnread(\nconst threadID = row.thread.toString();\nconst serverLatestMessage = row.latest_message.toString();\nconst clientLatestMessage = unfocusedThreadLatestMessages.get(threadID);\n+ console.log(clientLatestMessage);\nif (clientLatestMessage !== serverLatestMessage) {\nresetToUnread.push(threadID);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Add temporary logging statements in possiblyResetThreadsToUnread |
129,187 | 03.04.2018 14:03:37 | 14,400 | d23234ac09e8b1b6d35810ae0a96ec4882337660 | [server] Don't reset thread to unread if latest message is local
When navigating away from a thread, don't assume the client missed a message when their most recent message is local. | [
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -147,8 +147,10 @@ async function possiblyResetThreadsToUnread(\nconst threadID = row.thread.toString();\nconst serverLatestMessage = row.latest_message.toString();\nconst clientLatestMessage = unfocusedThreadLatestMessages.get(threadID);\n- console.log(clientLatestMessage);\n- if (clientLatestMessage !== serverLatestMessage) {\n+ if (\n+ !clientLatestMessage.startsWith(\"local\") &&\n+ clientLatestMessage !== serverLatestMessage\n+ ) {\nresetToUnread.push(threadID);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Don't reset thread to unread if latest message is local
When navigating away from a thread, don't assume the client missed a message when their most recent message is local. |
129,187 | 05.04.2018 11:06:01 | 14,400 | a5ac1e3d03ccbf50f2571d5a262fea577d28e3ac | [server] Clean up expired updates in cronjob | [
{
"change_type": "MODIFY",
"old_path": "server/src/cron.js",
"new_path": "server/src/cron.js",
"diff": "@@ -14,6 +14,7 @@ import { deleteOrphanedRoles } from './deleters/role-deleters';\nimport { deleteOrphanedMessages } from './deleters/message-deleters';\nimport { deleteOrphanedFocused } from './deleters/activity-deleters';\nimport { deleteOrphanedNotifs } from './deleters/notif-deleters';\n+import { deleteExpiredUpdates } from './deleters/update-deleters';\nif (cluster.isMaster) {\nschedule.scheduleJob(\n@@ -32,6 +33,7 @@ if (cluster.isMaster) {\nawait deleteOrphanedMessages();\nawait deleteOrphanedFocused();\nawait deleteOrphanedNotifs();\n+ await deleteExpiredUpdates();\n},\n);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/update-deleters.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function deleteExpiredUpdates(): Promise<void> {\n+ await dbQuery(SQL`\n+ DELETE u, i\n+ FROM updates u\n+ LEFT JOIN ids i ON i.id = u.id\n+ LEFT JOIN (\n+ SELECT u.id AS user,\n+ COALESCE(MIN(c.last_update), 99999999999999) AS oldest_last_update\n+ FROM cookies c\n+ RIGHT JOIN users u ON u.id = c.user\n+ GROUP BY u.id\n+ ) o ON o.user = u.user\n+ WHERE u.time < o.oldest_last_update\n+ `);\n+}\n+\n+export {\n+ deleteExpiredUpdates,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Clean up expired updates in cronjob |
129,187 | 05.04.2018 11:11:46 | 14,400 | 6536f0de3fd150e1bf0800c503430060ff9f1e0a | [lib] Invalidate all existing userInfos when cookie changes | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/user-reducer.js",
"new_path": "lib/reducers/user-reducer.js",
"diff": "@@ -86,9 +86,6 @@ function reduceUserInfos(\naction: BaseAction,\n) {\nif (\n- action.type === logInActionTypes.success ||\n- action.type === registerActionTypes.success ||\n- action.type === resetPasswordActionTypes.success ||\naction.type === pingActionTypes.success ||\naction.type === joinThreadActionTypes.success ||\naction.type === fetchMessagesBeforeCursorActionTypes.success ||\n@@ -97,16 +94,25 @@ function reduceUserInfos(\naction.type === fetchEntriesAndAppendRangeActionTypes.success ||\naction.type === fetchEntriesActionTypes.success ||\naction.type === searchUsersActionTypes.success ||\n+ (action.type === setCookieActionType &&\n+ !action.payload.cookieInvalidated)\n+ ) {\n+ const newUserInfos = _keyBy('id')(action.payload.userInfos);\n+ const updated = { ...state, ...newUserInfos };\n+ if (!_isEqual(state)(updated)) {\n+ return updated;\n+ }\n+ } else if (\n+ action.type === logInActionTypes.success ||\n+ action.type === registerActionTypes.success ||\n+ action.type === resetPasswordActionTypes.success ||\naction.type === logOutActionTypes.success ||\naction.type === deleteAccountActionTypes.success ||\naction.type === setCookieActionType\n) {\n- const updated = {\n- ...state,\n- ..._keyBy('id')(action.payload.userInfos),\n- };\n- if (!_isEqual(state)(updated)) {\n- return updated;\n+ const newUserInfos = _keyBy('id')(action.payload.userInfos);\n+ if (!_isEqual(state)(newUserInfos)) {\n+ return newUserInfos;\n}\n}\nreturn state;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Invalidate all existing userInfos when cookie changes |
129,187 | 05.04.2018 11:33:36 | 14,400 | e864cb90714e53df5511eb692fb334c31b9c53c9 | [server] Create updates for all users when a user deletes their account | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/update-utils.js",
"new_path": "lib/shared/update-utils.js",
"diff": "// @flow\n-import type { UpdateInfo } from '../types/update-types';\n+import {\n+ type UpdateInfo,\n+ type UpdateData,\n+ updateType,\n+} from '../types/update-types';\nimport _maxBy from 'lodash/fp/maxBy';\n+import invariant from 'invariant';\nfunction mostRecentUpdateTimestamp(\nupdateInfos: UpdateInfo[],\n@@ -14,6 +19,23 @@ function mostRecentUpdateTimestamp(\nreturn _maxBy('time')(updateInfos).time;\n}\n+function updateInfoFromUpdateData(\n+ updateData: UpdateData,\n+ id: string,\n+): UpdateInfo {\n+ if (updateData.type === updateType.DELETE_ACCOUNT) {\n+ return {\n+ type: updateType.DELETE_ACCOUNT,\n+ id,\n+ time: updateData.time,\n+ deletedUserID: updateData.deletedUserID,\n+ };\n+ } else {\n+ invariant(false, `unrecognized updateType ${updateData.type}`);\n+ }\n+}\n+\nexport {\nmostRecentUpdateTimestamp,\n+ updateInfoFromUpdateData,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/update-types.js",
"new_path": "lib/types/update-types.js",
"diff": "@@ -16,13 +16,21 @@ export function assertUpdateType(\nreturn ourUpdateType;\n}\n-export type DeleteAccountUpdateInfo = {|\n+export type AccountDeletionUpdateData = {|\n+ type: 0,\n+ userID: string,\n+ time: number,\n+ deletedUserID: string,\n+|};\n+export type UpdateData = AccountDeletionUpdateData;\n+\n+export type AccountDeletionUpdateInfo = {|\ntype: 0,\nid: string,\ntime: number,\ndeletedUserID: string,\n|};\n-export type UpdateInfo = DeleteAccountUpdateInfo;\n+export type UpdateInfo = AccountDeletionUpdateInfo;\nexport type UpdatesResult = {|\ncurrentAsOf: number,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -35,7 +35,7 @@ type ThreadRestriction = {|\n// Does not do permission checks! (checkThreadPermission)\nasync function createMessages(\n- messageDatas: MessageData[],\n+ messageDatas: $ReadOnlyArray<MessageData>,\n): Promise<RawMessageInfo[]> {\nif (messageDatas.length === 0) {\nreturn [];\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/creators/update-creator.js",
"diff": "+// @flow\n+\n+import {\n+ type UpdateInfo,\n+ type UpdateData,\n+ updateType,\n+} from 'lib/types/update-types';\n+\n+import { updateInfoFromUpdateData } from 'lib/shared/update-utils';\n+\n+import { dbQuery, SQL } from '../database';\n+import createIDs from './id-creator';\n+\n+async function createUpdates(\n+ updateDatas: $ReadOnlyArray<UpdateData>,\n+): Promise<UpdateInfo[]> {\n+ if (updateDatas.length === 0) {\n+ return [];\n+ }\n+ const ids = await createIDs(\"updates\", updateDatas.length);\n+\n+ const updateInfos: UpdateInfo[] = [];\n+ const insertRows = [];\n+ for (let i = 0; i < updateDatas.length; i++) {\n+ const updateData = updateDatas[i];\n+ updateInfos.push(updateInfoFromUpdateData(updateData, ids[i]));\n+\n+ let content;\n+ if (updateData.type === updateType.DELETE_ACCOUNT) {\n+ content = JSON.stringify({ deletedUserID: updateData.deletedUserID });\n+ }\n+ insertRows.push([\n+ ids[i],\n+ updateData.userID,\n+ updateData.type,\n+ content,\n+ updateData.time,\n+ ]);\n+ }\n+\n+ const insertQuery = SQL`\n+ INSERT INTO updates(id, user, type, content, time)\n+ VALUES ${insertRows}\n+ `;\n+ await dbQuery(insertQuery);\n+\n+ return updateInfos;\n+}\n+\n+export {\n+ createUpdates,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/account-deleters.js",
"new_path": "server/src/deleters/account-deleters.js",
"diff": "@@ -5,6 +5,7 @@ import type {\nDeleteAccountRequest,\n} from 'lib/types/account-types';\nimport type { Viewer } from '../session/viewer';\n+import { updateType } from 'lib/types/update-types';\nimport bcrypt from 'twin-bcrypt';\n@@ -12,6 +13,8 @@ import { ServerError } from 'lib/utils/errors';\nimport { dbQuery, SQL } from '../database';\nimport { createNewAnonymousCookie } from '../session/cookies';\n+import { fetchAllUserIDs } from '../fetchers/user-fetchers';\n+import { createUpdates } from '../creators/update-creator';\nasync function deleteAccount(\nviewer: Viewer,\n@@ -32,6 +35,7 @@ async function deleteAccount(\n}\n// TODO: if this results in any orphaned orgs, convert them to chats\n+ const deletedUserID = viewer.userID;\nconst deletionQuery = SQL`\nDELETE u, iu, v, iv, c, ic, m, f, n, ino\nFROM users u\n@@ -44,14 +48,17 @@ async function deleteAccount(\nLEFT JOIN focused f ON f.user = u.id\nLEFT JOIN notifications n ON n.user = u.id\nLEFT JOIN ids ino ON ino.id = n.id\n- WHERE u.id = ${viewer.userID}\n+ WHERE u.id = ${deletedUserID}\n`;\n- const [ anonymousViewerData ] = await Promise.all([\n+ const [ anonymousViewerData, allUserIDs ] = await Promise.all([\ncreateNewAnonymousCookie(),\n+ fetchAllUserIDs(),\ndbQuery(deletionQuery),\n]);\nviewer.setNewCookie(anonymousViewerData);\n+ sendAccountDeletionUpdates(deletedUserID, allUserIDs);\n+\nreturn {\ncurrentUserInfo: {\nid: viewer.id,\n@@ -60,6 +67,20 @@ async function deleteAccount(\n};\n}\n+async function sendAccountDeletionUpdates(\n+ deletedUserID: string,\n+ allUserIDs: $ReadOnlyArray<string>,\n+): Promise<void> {\n+ const time = Date.now();\n+ const updateDatas = allUserIDs.map(userID => ({\n+ type: updateType.DELETE_ACCOUNT,\n+ userID,\n+ time,\n+ deletedUserID,\n+ }));\n+ await createUpdates(updateDatas);\n+}\n+\nexport {\ndeleteAccount,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/user-fetchers.js",
"new_path": "server/src/fetchers/user-fetchers.js",
"diff": "@@ -89,9 +89,16 @@ async function fetchCurrentUserInfo(\n};\n}\n+async function fetchAllUserIDs(): Promise<string[]> {\n+ const query = SQL`SELECT id FROM users`;\n+ const [ result ] = await dbQuery(query);\n+ return result.map(row => row.id.toString());\n+}\n+\nexport {\nfetchUserInfos,\nverifyUserIDs,\nverifyUserOrCookieIDs,\nfetchCurrentUserInfo,\n+ fetchAllUserIDs,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Create updates for all users when a user deletes their account |
129,187 | 05.04.2018 11:53:24 | 14,400 | a893c901c545bf07b31fc54e50603cce48caf31e | [lib] Add logic to reduceUserInfos to handle updateType.DELETE_ACCOUNT | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/user-reducer.js",
"new_path": "lib/reducers/user-reducer.js",
"diff": "import type { BaseAction } from '../types/redux-types';\nimport type { CurrentUserInfo, UserInfo } from '../types/user-types';\n+import { updateType } from '../types/update-types';\nimport invariant from 'invariant';\nimport _keyBy from 'lodash/fp/keyBy';\n@@ -86,7 +87,6 @@ function reduceUserInfos(\naction: BaseAction,\n) {\nif (\n- action.type === pingActionTypes.success ||\naction.type === joinThreadActionTypes.success ||\naction.type === fetchMessagesBeforeCursorActionTypes.success ||\naction.type === fetchMostRecentMessagesActionTypes.success ||\n@@ -114,6 +114,25 @@ function reduceUserInfos(\nif (!_isEqual(state)(newUserInfos)) {\nreturn newUserInfos;\n}\n+ } else if (action.type === pingActionTypes.success) {\n+ const prevCurrentUserInfo = action.payload.prevState.currentUserInfo;\n+ // If user has changed since ping started, don't do anything\n+ if (\n+ !prevCurrentUserInfo ||\n+ action.payload.currentUserInfo.id !== prevCurrentUserInfo.id\n+ ) {\n+ return state;\n+ }\n+ const newUserInfos = _keyBy('id')(action.payload.userInfos);\n+ const updated = { ...state, ...newUserInfos };\n+ for (let update of action.payload.updatesResult.newUpdates) {\n+ if (update.type === updateType.DELETE_ACCOUNT) {\n+ delete updated[update.deletedUserID];\n+ }\n+ }\n+ if (!_isEqual(state)(updated)) {\n+ return updated;\n+ }\n}\nreturn state;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add logic to reduceUserInfos to handle updateType.DELETE_ACCOUNT |
129,187 | 05.04.2018 14:07:13 | 14,400 | 523779a2d5e14b25288476caa695261866c0ce9d | [server] Still return `serverTime` from ping responder for older clients | [
{
"change_type": "MODIFY",
"old_path": "lib/types/ping-types.js",
"new_path": "lib/types/ping-types.js",
"diff": "@@ -28,6 +28,7 @@ export type PingResponse = {|\nrawMessageInfos: RawMessageInfo[],\ntruncationStatuses: MessageTruncationStatuses,\nmessagesCurrentAsOf: number,\n+ serverTime: number,\nrawEntryInfos: $ReadOnlyArray<RawEntryInfo>,\nuserInfos: $ReadOnlyArray<UserInfo>,\nupdatesResult?: UpdatesResult,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -30,7 +30,7 @@ const migrations = {\n...state,\nmessageSentFromRoute: [],\n}),\n- [3]: (state: AppState) => ({\n+ [3]: (state: Object) => ({\ncurrentUserInfo: state.currentUserInfo,\nentryStore: state.entryStore,\nthreadInfos: state.threadInfos,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -108,15 +108,17 @@ async function pingResponder(\n...threadsResult.userInfos,\n});\n+ const messagesCurrentAsOf = mostRecentMessageTimestamp(\n+ messagesResult.rawMessageInfos,\n+ clientMessagesCurrentAsOf,\n+ );\nconst response: PingResponse = {\nthreadInfos: threadsResult.threadInfos,\ncurrentUserInfo,\nrawMessageInfos: messagesResult.rawMessageInfos,\ntruncationStatuses: messagesResult.truncationStatuses,\n- messagesCurrentAsOf: mostRecentMessageTimestamp(\n- messagesResult.rawMessageInfos,\n- clientMessagesCurrentAsOf,\n- ),\n+ messagesCurrentAsOf,\n+ serverTime: messagesCurrentAsOf,\nrawEntryInfos: entriesResult.rawEntryInfos,\nuserInfos,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Still return `serverTime` from ping responder for older clients |
129,187 | 05.04.2018 20:22:34 | 14,400 | ab90d225e4bdb8e45206c5f8aeb5d508f438e001 | [seerver] Call rescindPushNotifs after deleting thread
So that the `unread_count` is correct. We also don't need to `await` for it. | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/notif-utils.js",
"new_path": "lib/shared/notif-utils.js",
"diff": "@@ -312,10 +312,10 @@ function strippedRobotextForMessageInfo(\nreturn robotextToRawString(threadMadeExplicit);\n}\n+const joinResult = (...keys: (string | number)[]) => keys.join(\"|\");\nfunction notifCollapseKeyForRawMessageInfo(\nrawMessageInfo: RawMessageInfo,\n): ?string {\n- const joinResult = (...keys: (string | number)[]) => keys.join(\"|\");\nif (\nrawMessageInfo.type === messageType.ADD_MEMBERS ||\nrawMessageInfo.type === messageType.REMOVE_MEMBERS\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/thread-deleters.js",
"new_path": "server/src/deleters/thread-deleters.js",
"diff": "@@ -45,8 +45,6 @@ async function deleteThread(\nthrow new ServerError('invalid_credentials');\n}\n- await rescindPushNotifs(SQL`n.thread = ${threadDeletionRequest.threadID}`);\n-\n// TODO: if org, delete all descendant threads as well. make sure to warn user\nconst query = SQL`\nDELETE t, ic, d, id, e, ie, re, ire, mm, r, ms, im, f, n, ino\n@@ -70,6 +68,8 @@ async function deleteThread(\n`;\nawait dbQuery(query);\n+ rescindPushNotifs(SQL`n.thread = ${threadDeletionRequest.threadID}`);\n+\nconst { threadInfos } = await fetchThreadInfos(viewer);\nreturn { threadInfos };\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [seerver] Call rescindPushNotifs after deleting thread
So that the `unread_count` is correct. We also don't need to `await` for it. |
129,187 | 05.04.2018 22:16:38 | 14,400 | 90b55a48879347148a9ce3b768822d94f21f8a0c | [server] Call rescindPushNotifs *before* deleting thread
But make sure the unread count is correct. | [
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/thread-deleters.js",
"new_path": "server/src/deleters/thread-deleters.js",
"diff": "@@ -45,6 +45,11 @@ async function deleteThread(\nthrow new ServerError('invalid_credentials');\n}\n+ await rescindPushNotifs(\n+ SQL`n.thread = ${threadDeletionRequest.threadID}`,\n+ SQL`IF(m.thread = ${threadDeletionRequest.threadID}, NULL, 1)`,\n+ );\n+\n// TODO: if org, delete all descendant threads as well. make sure to warn user\nconst query = SQL`\nDELETE t, ic, d, id, e, ie, re, ire, mm, r, ms, im, f, n, ino\n@@ -68,8 +73,6 @@ async function deleteThread(\n`;\nawait dbQuery(query);\n- rescindPushNotifs(SQL`n.thread = ${threadDeletionRequest.threadID}`);\n-\nconst { threadInfos } = await fetchThreadInfos(viewer);\nreturn { threadInfos };\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/push/rescind.js",
"new_path": "server/src/push/rescind.js",
"diff": "@@ -5,14 +5,21 @@ import apn from 'apn';\nimport { dbQuery, SQL, SQLStatement } from '../database';\nimport { apnPush, fcmPush } from './utils';\n-async function rescindPushNotifs(condition: SQLStatement) {\n+async function rescindPushNotifs(\n+ notifCondition: SQLStatement,\n+ inputCountCondition?: SQLStatement,\n+) {\nconst fetchQuery = SQL`\n- SELECT n.id, n.delivery, n.collapse_key, COUNT(m.thread) AS unread_count\n+ SELECT n.id, n.delivery, n.collapse_key, COUNT(\n+ `;\n+ fetchQuery.append(inputCountCondition ? inputCountCondition : SQL`m.thread`);\n+ fetchQuery.append(SQL`\n+ ) AS unread_count\nFROM notifications n\nLEFT JOIN memberships m ON m.user = n.user AND m.unread = 1 AND m.role != 0\nWHERE n.rescinded = 0 AND\n`;\n- fetchQuery.append(condition);\n+ fetchQuery.append(notifCondition);\nfetchQuery.append(SQL` GROUP BY n.id, m.user`);\nconst [ fetchResult ] = await dbQuery(fetchQuery);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Call rescindPushNotifs *before* deleting thread
But make sure the unread count is correct. |
129,187 | 05.04.2018 22:21:04 | 14,400 | c9986c81f9d4fc17e94e6f35f191a73726f4dca7 | [server] Fix typo in last commit! | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/rescind.js",
"new_path": "server/src/push/rescind.js",
"diff": "@@ -18,7 +18,7 @@ async function rescindPushNotifs(\nFROM notifications n\nLEFT JOIN memberships m ON m.user = n.user AND m.unread = 1 AND m.role != 0\nWHERE n.rescinded = 0 AND\n- `;\n+ `);\nfetchQuery.append(notifCondition);\nfetchQuery.append(SQL` GROUP BY n.id, m.user`);\nconst [ fetchResult ] = await dbQuery(fetchQuery);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Fix typo in last commit! |
129,187 | 05.04.2018 23:34:02 | 14,400 | bb3bde4c6a5c8ef9f492a530b6cce2f88a629510 | [server] Update Android notification rescind format | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/rescind.js",
"new_path": "server/src/push/rescind.js",
"diff": "@@ -46,8 +46,11 @@ async function rescindPushNotifs(\nif (row.delivery.androidID) {\nconst notification = {\ndata: {\n+ badge: row.unread_count.toString(),\n+ custom_notification: JSON.stringify({\nrescind: \"true\",\nnotifID: row.collapse_key ? row.collapse_key : row.id.toString(),\n+ }),\n},\n};\npromises.push(fcmPush(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Update Android notification rescind format |
129,187 | 05.04.2018 23:48:04 | 14,400 | 4da0023b96e15b72f0085f5c9e1ccd31d9853d0e | [native] Use my forked version of react-native-fcm
Enables rescinding notifs while app is closed. | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"react\": \"^16.2.0\",\n\"react-native\": \"^0.52.0\",\n\"react-native-exit-app\": \"^1.0.0\",\n- \"react-native-fcm\": \"^11.2.0\",\n+ \"react-native-fcm\": \"git+https://git@github.com/ashoat/react-native-fcm.git\",\n\"react-native-floating-action\": \"^1.9.0\",\n\"react-native-hyperlink\": \"git+https://git@github.com/ashoat/react-native-hyperlink.git#both\",\n\"react-native-in-app-notification\": \"^2.1.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -7470,9 +7470,9 @@ react-native-exit-app@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/react-native-exit-app/-/react-native-exit-app-1.0.0.tgz#a2fbb121d902e6967cd8a365fe8453e5c4bc3172\"\n-react-native-fcm@^11.2.0:\n- version \"11.3.1\"\n- resolved \"https://registry.yarnpkg.com/react-native-fcm/-/react-native-fcm-11.3.1.tgz#eae59deb3972d19fdd8d8b52da18984377276e84\"\n+\"react-native-fcm@git+https://git@github.com/ashoat/react-native-fcm.git\":\n+ version \"14.1.3\"\n+ resolved \"git+https://git@github.com/ashoat/react-native-fcm.git#44d03fc615be26c7e7ac9ab4a9a7569a81325bba\"\nreact-native-floating-action@^1.9.0:\nversion \"1.10.1\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Use my forked version of react-native-fcm
Enables rescinding notifs while app is closed. |
129,187 | 05.04.2018 23:49:55 | 14,400 | 9b364ba9f98672df30d53dbf5ad598209fa6db44 | [native] codeVersion -> 7 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 6\n- versionName \"0.0.6\"\n+ versionCode 7\n+ versionName \"0.0.7\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"6\"\n- android:versionName=\"0.0.6\"\n+ android:versionCode=\"7\"\n+ android:versionName=\"0.0.7\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.6</string>\n+ <string>0.0.7</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>6</string>\n+ <string>7</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -61,7 +61,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 6;\n+const codeVersion = 7;\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 -> 7 |
129,187 | 06.04.2018 00:20:19 | 14,400 | bd3bcf9ff9b1eccb8f724a943db7598a582167d3 | [server] Explicitly list default exports in react-redux libdef | [
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"new_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"diff": "-// flow-typed signature: a2c406bd25fca4586c361574e555202d\n-// flow-typed version: dcd1531faf/react-redux_v5.x.x/flow_>=v0.62.0\n-\nimport type { Dispatch, Store } from \"redux\";\ndeclare module \"react-redux\" {\nimport type { ComponentType, ElementConfig } from 'react';\n- declare class Provider<S, A> extends React$Component<{\n+ declare export class Provider<S, A> extends React$Component<{\nstore: Store<S, A>,\nchildren?: any\n}> {}\n- declare function createProvider(\n+ declare export function createProvider(\nstoreKey?: string,\nsubKey?: string\n): Provider<*, *>;\n@@ -53,46 +50,52 @@ declare module \"react-redux\" {\ndeclare type OmitDispatch<Component> = $Diff<Component, {dispatch: Dispatch<*>}>;\n- declare function connect<Com: ComponentType<*>, DP: Object, RSP: Object>(\n+ declare export function connect<Com: ComponentType<*>, DP: Object, RSP: Object>(\nmapStateToProps: MapStateToProps<DP, RSP>,\nmapDispatchToProps?: null\n): (component: Com) => ComponentType<$Diff<OmitDispatch<ElementConfig<Com>>, RSP> & DP>;\n- declare function connect<Com: ComponentType<*>>(\n+ declare export function connect<Com: ComponentType<*>>(\nmapStateToProps?: null,\nmapDispatchToProps?: null\n): (component: Com) => ComponentType<OmitDispatch<ElementConfig<Com>>>;\n- declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object>(\n+ declare export function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object>(\nmapStateToProps: MapStateToProps<SP, RSP>,\nmapDispatchToProps: MapDispatchToProps<A, DP, RDP>\n): (component: Com) => ComponentType<$Diff<$Diff<ElementConfig<Com>, RSP>, RDP> & SP & DP>;\n- declare function connect<Com: ComponentType<*>, A, OP: Object, DP: Object,PR: Object>(\n+ declare export function connect<Com: ComponentType<*>, A, OP: Object, DP: Object,PR: Object>(\nmapStateToProps?: null,\nmapDispatchToProps: MapDispatchToProps<A, OP, DP>\n): (Com) => ComponentType<$Diff<ElementConfig<Com>, DP> & OP>;\n- declare function connect<Com: ComponentType<*>, MDP: Object>(\n+ declare export function connect<Com: ComponentType<*>, MDP: Object>(\nmapStateToProps?: null,\nmapDispatchToProps: MDP\n): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, MDP>>;\n- declare function connect<Com: ComponentType<*>, SP: Object, RSP: Object, MDP: Object>(\n+ declare export function connect<Com: ComponentType<*>, SP: Object, RSP: Object, MDP: Object>(\nmapStateToProps: MapStateToProps<SP, RSP>,\nmapDispatchToPRops: MDP\n): (component: Com) => ComponentType<$Diff<$Diff<ElementConfig<Com>, RSP>, MDP> & SP>;\n- declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\n+ declare export function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\nmapStateToProps: MapStateToProps<SP, RSP>,\nmapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,\nmergeProps: MergeProps<RSP, RDP, MP, RMP>\n): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;\n- declare function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\n+ declare export function connect<Com: ComponentType<*>, A, DP: Object, SP: Object, RSP: Object, RDP: Object, MP: Object, RMP: Object>(\nmapStateToProps: ?MapStateToProps<SP, RSP>,\nmapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,\nmergeProps: ?MergeProps<RSP, RDP, MP, RMP>,\noptions: ConnectOptions<*, SP & DP & MP, RSP, RMP>\n): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;\n+\n+ declare export default {\n+ Provider: typeof Provider,\n+ createProvider: typeof createProvider,\n+ connect: typeof connect,\n+ };\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Explicitly list default exports in react-redux libdef |
129,187 | 06.04.2018 10:28:25 | 14,400 | 9008b35982066af416e2611d5aa130010a9bbf5b | [server] Don't treat 0 timestamp the same as null in ping responder | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -37,9 +37,12 @@ async function pingResponder(\nvalidateInput(pingRequestInputValidator, request);\nlet clientMessagesCurrentAsOf;\n- if (request.messagesCurrentAsOf) {\n+ if (\n+ request.messagesCurrentAsOf !== null &&\n+ request.messagesCurrentAsOf !== undefined\n+ ) {\nclientMessagesCurrentAsOf = request.messagesCurrentAsOf;\n- } else if (request.lastPing) {\n+ } else if (request.lastPing !== null && request.lastPing !== undefined) {\nclientMessagesCurrentAsOf = request.lastPing;\n}\nif (!clientMessagesCurrentAsOf) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Don't treat 0 timestamp the same as null in ping responder |
129,187 | 06.04.2018 10:35:53 | 14,400 | e5301a26385e839d2c420fb4cf51c9050f16d6c9 | [server] Consider 0 timestamp valid in ping responder | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -45,7 +45,10 @@ async function pingResponder(\n} else if (request.lastPing !== null && request.lastPing !== undefined) {\nclientMessagesCurrentAsOf = request.lastPing;\n}\n- if (!clientMessagesCurrentAsOf) {\n+ if (\n+ clientMessagesCurrentAsOf === null ||\n+ clientMessagesCurrentAsOf === undefined\n+ ) {\nthrow new ServerError('invalid_parameters');\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Consider 0 timestamp valid in ping responder |
129,187 | 06.04.2018 16:14:37 | 14,400 | 052db9166e9e7f26ca06584bbcdfa928f7d32465 | Further refinements to Android notifications | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -591,40 +591,33 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nnotification,\nappOpenedFromNotif = false,\n) => {\n- const badgeCount = notification.badgeCount;\n- if (appOpenedFromNotif) {\n- if (badgeCount === null || badgeCount === undefined) {\n- console.log(\"Local notification with missing badgeCount received!\");\n- return;\n- }\n- // In the appOpenedFromNotif case, the local notif is the only version of\n- // a notif we get, so we do the badge count update here, as well as the\n- // Redux action to integrate the new RawMessageInfos into the state.\n- AppWithNavigationState.updateBadgeCount(badgeCount);\n- this.saveMessageInfos(notification.messageInfos);\n- } else if (badgeCount && !notification.body) {\n- // If it's a badgeOnly notif, the badgeCount is delivered directly in the\n- // data payload. However, it's a string, due to weird Google restrictions.\n- AppWithNavigationState.updateBadgeCount(parseInt(badgeCount));\n- // Namely, that top-level fields must be strings, so we JSON.parse here.\n+ if (\n+ notification.messageInfos &&\n+ (appOpenedFromNotif ||\n+ (!notification.custom_notification && !notification.body))\n+ ) {\nthis.saveMessageInfos(notification.messageInfos);\n}\n+ if (notification.body) {\n+ this.onPressNotificationForThread(notification.threadID, true);\n+ return;\n+ }\n+\nif (notification.custom_notification) {\nconst customNotification = JSON.parse(notification.custom_notification);\n+ if (customNotification.rescind === \"true\") {\n+ // These are handled by the native layer\n+ return;\n+ }\n+\nconst threadID = customNotification.threadID;\n- const customBadgeCount = customNotification.badgeCount;\nif (!threadID) {\nconsole.log(\"Server notification with missing threadID received!\");\nreturn;\n}\n- if (!customBadgeCount) {\n- console.log(\"Local notification with missing badgeCount received!\");\n- return;\n- }\nthis.pingNow();\n- AppWithNavigationState.updateBadgeCount(customBadgeCount);\nthis.saveMessageInfos(customNotification.messageInfos);\nif (this.currentState === \"active\") {\n@@ -644,14 +637,6 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n);\n}\n}\n-\n- if (notification.body) {\n- this.onPressNotificationForThread(notification.threadID, true);\n- }\n-\n- if (notification.rescind) {\n- FCM.removeDeliveredNotification(notification.notifID);\n- }\n}\nping = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -231,7 +231,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nactions={floatingActions}\noverrideWithAction\nonPressItem={this.composeThread}\n- buttonColor=\"#66AA66\"\n+ color=\"#66AA66\"\n/>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -384,22 +384,26 @@ function prepareAndroidNotification(\nconst notifID = collapseKey ? collapseKey : dbID;\nif (badgeOnly) {\nreturn {\n- badgeCount: unreadCount.toString(),\n+ data: {\n+ badge: unreadCount.toString(),\nmessageInfos: JSON.stringify(newRawMessageInfos),\nnotifID,\n+ },\n};\n}\nreturn {\ndata: {\n+ badge: unreadCount.toString(),\ncustom_notification: JSON.stringify({\nbody: notifTextForMessageInfo(allMessageInfos, threadInfo),\n+ badgeCount: unreadCount, // TODO: remove this\nid: notifID,\npriority: \"high\",\nsound: \"default\",\nicon: \"notif_icon\",\n- badgeCount: unreadCount,\nthreadID: threadInfo.id,\nmessageInfos: JSON.stringify(newRawMessageInfos),\n+ click_action: \"fcm.ACTION.HELLO\",\n}),\n}\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Further refinements to Android notifications |
129,187 | 07.04.2018 22:43:50 | 14,400 | d1f945d21aad6745c418dec4fa1c79e98d6ea216 | [server] Catch duplicate row error in activityUpdater | [
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -63,17 +63,7 @@ async function activityUpdater(\nconst promises = [];\nif (focusedThreadIDs.length > 0) {\n- const time = Date.now();\n- const focusedInsertRows = focusedThreadIDs.map(threadID => [\n- localViewer.userID,\n- localViewer.cookieID,\n- threadID,\n- time,\n- ]);\n- promises.push(dbQuery(SQL`\n- INSERT INTO focused (user, cookie, thread, time)\n- VALUES ${focusedInsertRows}\n- `));\n+ promises.push(insertFocusedRows(localViewer, focusedThreadIDs));\npromises.push(dbQuery(SQL`\nUPDATE memberships\nSET unread = 0\n@@ -99,6 +89,29 @@ async function activityUpdater(\nreturn { unfocusedToUnread: resetToUnread };\n}\n+async function insertFocusedRows(\n+ viewer: Viewer,\n+ threadIDs: $ReadOnlyArray<string>,\n+): Promise<void> {\n+ const time = Date.now();\n+ const focusedInsertRows = threadIDs.map(threadID => [\n+ viewer.userID,\n+ viewer.cookieID,\n+ threadID,\n+ time,\n+ ]);\n+ try {\n+ await dbQuery(SQL`\n+ INSERT INTO focused (user, cookie, thread, time)\n+ VALUES ${focusedInsertRows}\n+ `);\n+ } catch (e) {\n+ if (e.code !== \"ER_DUP_ENTRY\") {\n+ throw e;\n+ }\n+ }\n+}\n+\n// To protect against a possible race condition, we reset the thread to unread\n// if the latest message ID on the client at the time that focus was dropped\n// is no longer the latest message ID.\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Catch duplicate row error in activityUpdater |
129,187 | 07.04.2018 22:49:15 | 14,400 | 145081bb552aac585435b474277c134b991f3f4e | [native] codeVersion -> 8
This one will be an Android-only release. | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 7\n- versionName \"0.0.7\"\n+ versionCode 8\n+ versionName \"0.0.8\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"7\"\n- android:versionName=\"0.0.7\"\n+ android:versionCode=\"8\"\n+ android:versionName=\"0.0.8\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.7</string>\n+ <string>0.0.8</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>7</string>\n+ <string>8</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -61,7 +61,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 7;\n+const codeVersion = 8;\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 -> 8
This one will be an Android-only release. |
129,187 | 09.04.2018 10:34:08 | 14,400 | 4342002e049e64b08bce2a64d358065bd8f5de39 | [native] Reintroduce rescinding notifs locally on Android
When the user navigates to a thread, we rescind all notifs corresponding to that thread. | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -587,19 +587,35 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nnotification.finish(NotificationsIOS.FetchResult.NewData);\n}\n+ // This function gets called when:\n+ // - The app is open (either foreground or background) and a notif is\n+ // received. In this case, notification has a custom_notification property.\n+ // custom_notification can have either a new notif or a payload indicating a\n+ // notif should be rescinded. In both cases, the native side will handle\n+ // presenting or rescinding the notif.\n+ // - The app is open and a notif is pressed. In this case, notification has a\n+ // body property.\n+ // - The app is closed and a notif is pressed. This is possible because when\n+ // the app is closed and a notif is recevied, the native side will boot up\n+ // to process it. However, in this case, this function does not get\n+ // triggered when the notif is received - only when it is pressed.\nandroidNotificationReceived = async (\nnotification,\nappOpenedFromNotif = false,\n) => {\n- if (\n- notification.messageInfos &&\n- (appOpenedFromNotif ||\n- (!notification.custom_notification && !notification.body))\n- ) {\n+ if (appOpenedFromNotif && notification.messageInfos) {\n+ // This indicates that while the app was closed (not backgrounded), a\n+ // notif was delivered to the native side, which presented a local notif.\n+ // The local notif was then pressed, opening the app and triggering here.\n+ // Normally, this callback is called initially when the local notif is\n+ // generated, and at that point the MessageInfos get saved. But in the\n+ // case of a notif press opening the app, that doesn't happen, so we'll\n+ // save the notifs here.\nthis.saveMessageInfos(notification.messageInfos);\n}\nif (notification.body) {\n+ // This indicates that we're being called because a notif was pressed\nthis.onPressNotificationForThread(notification.threadID, true);\nreturn;\n}\n@@ -607,7 +623,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (notification.custom_notification) {\nconst customNotification = JSON.parse(notification.custom_notification);\nif (customNotification.rescind === \"true\") {\n- // These are handled by the native layer\n+ // We have nothing to do on the JS thread in the case of a rescind\nreturn;\n}\n@@ -617,16 +633,25 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nreturn;\n}\n+ // We are here because notif was received, but hasn't been pressed yet. We\n+ // will preemptively dispatch a ping to fetch any missing info, and\n+ // integrate whatever MessageInfos were delivered into our Redux state.\nthis.pingNow();\nthis.saveMessageInfos(customNotification.messageInfos);\nif (this.currentState === \"active\") {\n+ // In the case where the app is in the foreground, we will show an\n+ // in-app notif\ninvariant(this.inAppNotification, \"should be set\");\nthis.inAppNotification.show({\nmessage: customNotification.body,\nonPress: () => this.onPressNotificationForThread(threadID, false),\n});\n} else {\n+ // We keep track of what notifs have been rendered for a given thread so\n+ // that we can clear them immediately (without waiting for the rescind)\n+ // when the user navigates to that thread. Since we can't do this while\n+ // the app is closed, we rely on the rescind notif in that case.\nthis.props.dispatchActionPayload(\nrecordAndroidNotificationActionType,\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "native/push/android.js",
"new_path": "native/push/android.js",
"diff": "@@ -35,14 +35,24 @@ function reduceThreadIDsToNotifIDs(\naction: AndroidNotificationActions,\n): {[threadID: string]: string[]} {\nif (action.type === recordAndroidNotificationActionType) {\n+ const existingNotifIDs = state[action.payload.threadID];\n+ let set;\n+ if (existingNotifIDs) {\n+ set = new Set([...existingNotifIDs, action.payload.notifID]);\n+ } else {\n+ set = new Set([action.payload.notifID]);\n+ }\nreturn {\n...state,\n- [action.payload.threadID]: [\n- ...state[action.payload.threadID],\n- action.payload.notifID,\n- ],\n+ [action.payload.threadID]: [...set],\n};\n} else if (action.type === clearAndroidNotificationActionType) {\n+ if (!state[action.payload.threadID]) {\n+ return state;\n+ }\n+ for (let notifID of state[action.payload.threadID]) {\n+ FCM.removeDeliveredNotification(notifID);\n+ }\nreturn {\n...state,\n[action.payload.threadID]: [],\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -211,7 +211,7 @@ function reducer(state: AppState = defaultState, action: *) {\ncustomServer: state.customServer,\nthreadIDsToNotifIDs: reduceThreadIDsToNotifIDs(\nstate.threadIDsToNotifIDs,\n- action.payload,\n+ action,\n),\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Reintroduce rescinding notifs locally on Android
When the user navigates to a thread, we rescind all notifs corresponding to that thread. |
129,187 | 09.04.2018 10:46:57 | 14,400 | c42ec600bfe7f233bdfd2f7fac77c5a7702ed110 | [server] Use weak comparison to check APNs error code | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/utils.js",
"new_path": "server/src/push/utils.js",
"diff": "@@ -28,7 +28,7 @@ async function apnPush(\nconst invalidTokens = [];\nfor (let error of result.failed) {\nerrors.push(error);\n- if (error.status === apnTokenInvalidationErrorCode) {\n+ if (error.status == apnTokenInvalidationErrorCode) {\ninvalidTokens.push(error.device);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Use weak comparison to check APNs error code |
129,187 | 09.04.2018 11:56:15 | 14,400 | 0e15303e6ce748547491e75a29fee7fbc781a70f | [server] visibility_rules -> type | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -194,7 +194,7 @@ async function updateUnreadStatus(\ncondition.append(SQL`.permissions, ${knowOfExtractString}) IS TRUE `);\ncondition.append(SQL`OR st`);\ncondition.append(index);\n- condition.append(SQL`.visibility_rules = ${visibilityRules.OPEN})`);\n+ condition.append(SQL`.type = ${visibilityRules.OPEN})`);\nconditions.push(condition);\n}\nthreadConditionClauses.push(mergeAndConditions(conditions));\n@@ -220,7 +220,7 @@ async function updateUnreadStatus(\nSET m.unread = 1\nWHERE m.role != 0 AND f.user IS NULL AND (\nJSON_EXTRACT(m.permissions, ${visibleExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n) AND\n`);\nquery.append(conditionClause);\n@@ -258,7 +258,7 @@ async function sendPushNotifsForNewMessages(\nsubthreadSelects += `\n,\nstm${index}.permissions AS subthread${subthread}_permissions,\n- st${index}.visibility_rules AS subthread${subthread}_visibility_rules,\n+ st${index}.type AS subthread${subthread}_type,\nstm${index}.role AS subthread${subthread}_role\n`;\nsubthreadJoins.push(subthreadJoin(index, subthread));\n@@ -283,7 +283,7 @@ async function sendPushNotifsForNewMessages(\nWHERE m.role != 0 AND c.user IS NOT NULL AND f.user IS NULL AND\n(\nJSON_EXTRACT(m.permissions, ${visibleExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n) AND\n`);\nquery.append(conditionClause);\n@@ -306,7 +306,7 @@ async function sendPushNotifsForNewMessages(\nconst permissionsInfo = {\npermissions: row[`subthread${subthread}_permissions`],\nvisibilityRules: assertVisibilityRules(\n- row[`subthread${subthread}_visibility_rules`],\n+ row[`subthread${subthread}_type`],\n),\n};\nconst isSubthreadMember = !!row[`subthread${subthread}_role`];\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/entry-fetchers.js",
"new_path": "server/src/fetchers/entry-fetchers.js",
"diff": "@@ -42,7 +42,7 @@ async function fetchEntryInfos(\nWHERE\n(\nJSON_EXTRACT(m.permissions, ${visPermissionExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n)\nAND d.date BETWEEN ${entryQuery.startDate} AND ${entryQuery.endDate}\n`;\n@@ -85,7 +85,7 @@ async function checkThreadPermissionForEntry(\n): Promise<bool> {\nconst viewerID = viewer.id;\nconst query = SQL`\n- SELECT m.permissions, t.visibility_rules\n+ SELECT m.permissions, t.type\nFROM entries e\nLEFT JOIN days d ON d.id = e.day\nLEFT JOIN threads t ON t.id = d.thread\n@@ -98,12 +98,12 @@ async function checkThreadPermissionForEntry(\nreturn false;\n}\nconst row = result[0];\n- if (row.visibility_rules === null) {\n+ if (row.type === null) {\nreturn false;\n}\nconst permissionsInfo = {\npermissions: row.permissions,\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\n};\nreturn permissionHelper(permissionsInfo, permission);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/message-fetchers.js",
"new_path": "server/src/fetchers/message-fetchers.js",
"diff": "@@ -91,7 +91,7 @@ async function fetchCollapsableNotifs(\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type,\nu.username AS creator, m.user AS creatorID,\nstm.permissions AS subthread_permissions,\n- st.visibility_rules AS subthread_visibility_rules,\n+ st.type AS subthread_type,\nn.user, n.collapse_key\nFROM notifications n\nLEFT JOIN messages m ON m.id = n.message\n@@ -106,7 +106,7 @@ async function fetchCollapsableNotifs(\nWHERE\n(\nJSON_EXTRACT(mm.permissions, ${visPermissionExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n)\nAND n.rescinded = 0\nAND\n@@ -172,7 +172,7 @@ function rawMessageInfoFromRow(row: Object): ?RawMessageInfo {\n} else if (type === messageType.CREATE_SUB_THREAD) {\nconst subthreadPermissionInfo = {\npermissions: row.subthread_permissions,\n- visibilityRules: assertVisibilityRules(row.subthread_visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.subthread_type),\n};\nif (!permissionHelper(subthreadPermissionInfo, threadPermissions.KNOW_OF)) {\nreturn null;\n@@ -302,15 +302,14 @@ async function fetchMessageInfos(\nconst query = SQL`\nSELECT * FROM (\nSELECT x.id, x.content, x.time, x.type, x.user AS creatorID,\n- u.username AS creator, x.subthread_permissions,\n- x.subthread_visibility_rules,\n+ u.username AS creator, x.subthread_permissions, x.subthread_type,\n@num := if(@thread = x.thread, @num + 1, 1) AS number,\n@thread := x.thread AS threadID\nFROM (SELECT @num := 0, @thread := '') init\nJOIN (\nSELECT m.id, m.thread, m.user, m.content, m.time, m.type,\nstm.permissions AS subthread_permissions,\n- st.visibility_rules AS subthread_visibility_rules\n+ st.type AS subthread_type\nFROM messages m\nLEFT JOIN threads t ON t.id = m.thread\nLEFT JOIN memberships mm\n@@ -322,7 +321,7 @@ async function fetchMessageInfos(\nWHERE\n(\nJSON_EXTRACT(mm.permissions, ${visibleExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n)\nAND\n`;\n@@ -450,8 +449,7 @@ async function fetchMessageInfosSince(\nconst query = SQL`\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type,\nu.username AS creator, m.user AS creatorID,\n- stm.permissions AS subthread_permissions,\n- st.visibility_rules AS subthread_visibility_rules\n+ stm.permissions AS subthread_permissions, st.type AS subthread_type\nFROM messages m\nLEFT JOIN threads t ON t.id = m.thread\nLEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}\n@@ -463,7 +461,7 @@ async function fetchMessageInfosSince(\nWHERE\n(\nJSON_EXTRACT(mm.permissions, ${visibleExtractString}) IS TRUE\n- OR t.visibility_rules = ${visibilityRules.OPEN}\n+ OR t.type = ${visibilityRules.OPEN}\n)\nAND m.time > ${currentAsOf}\nAND\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/thread-fetchers.js",
"new_path": "server/src/fetchers/thread-fetchers.js",
"diff": "@@ -34,7 +34,7 @@ async function fetchServerThreadInfos(\nconst query = SQL`\nSELECT t.id, t.name, t.parent_thread_id, t.color, t.description,\n- t.visibility_rules, t.creation_time, t.default_role, r.id AS role,\n+ t.type, t.creation_time, t.default_role, r.id AS role,\nr.name AS role_name, r.permissions AS role_permissions, m.user,\nm.permissions, m.subscription, m.unread, u.username\nFROM threads t\n@@ -58,7 +58,7 @@ async function fetchServerThreadInfos(\nid: threadID,\nname: row.name ? row.name : \"\",\ndescription: row.description ? row.description : \"\",\n- visibilityRules: row.visibility_rules,\n+ visibilityRules: row.type,\ncolor: row.color,\ncreationTime: row.creation_time,\nparentThreadID: row.parent_thread_id\n@@ -82,7 +82,7 @@ async function fetchServerThreadInfos(\nconst allPermissions = getAllThreadPermissions(\n{\npermissions: row.permissions,\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\n},\nthreadID,\n);\n@@ -175,7 +175,7 @@ async function fetchThreadPermissionsInfo(\n): Promise<?PermissionsInfo> {\nconst viewerID = viewer.id;\nconst query = SQL`\n- SELECT t.visibility_rules, m.permissions\n+ SELECT t.type, m.permissions\nFROM threads t\nLEFT JOIN memberships m ON m.thread = t.id AND m.user = ${viewerID}\nWHERE t.id = ${threadID}\n@@ -188,7 +188,7 @@ async function fetchThreadPermissionsInfo(\nconst row = result[0];\nreturn {\npermissions: row.permissions,\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -148,7 +148,7 @@ async function possiblyResetThreadsToUnread(\nWHERE m.thread IN (${unreadCandidates}) AND\n(\nm.type != ${messageType.CREATE_SUB_THREAD} OR\n- st.visibility_rules = ${visibilityRules.OPEN} OR\n+ st.type = ${visibilityRules.OPEN} OR\nJSON_EXTRACT(stm.permissions, ${knowOfExtractString}) IS TRUE\n)\nGROUP BY m.thread\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-permission-updaters.js",
"new_path": "server/src/updaters/thread-permission-updaters.js",
"diff": "@@ -151,9 +151,7 @@ async function changeRoleThreadQuery(\nrole: string | 0 | null,\n): Promise<?RoleThreadResult> {\nif (role === 0) {\n- const query = SQL`\n- SELECT visibility_rules FROM threads WHERE id = ${threadID}\n- `;\n+ const query = SQL`SELECT type FROM threads WHERE id = ${threadID}`;\nconst [ result ] = await dbQuery(query);\nif (result.length === 0) {\nreturn null;\n@@ -161,12 +159,12 @@ async function changeRoleThreadQuery(\nconst row = result[0];\nreturn {\nroleColumnValue: \"0\",\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\nrolePermissions: null,\n};\n} else if (role !== null) {\nconst query = SQL`\n- SELECT t.visibility_rules, r.permissions\n+ SELECT t.type, r.permissions\nFROM threads t\nLEFT JOIN roles r ON r.id = ${role}\nWHERE t.id = ${threadID}\n@@ -178,12 +176,12 @@ async function changeRoleThreadQuery(\nconst row = result[0];\nreturn {\nroleColumnValue: role,\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\nrolePermissions: row.permissions,\n};\n} else {\nconst query = SQL`\n- SELECT t.visibility_rules, t.default_role, r.permissions\n+ SELECT t.type, t.default_role, r.permissions\nFROM threads t\nLEFT JOIN roles r ON r.id = t.default_role\nWHERE t.id = ${threadID}\n@@ -195,7 +193,7 @@ async function changeRoleThreadQuery(\nconst row = result[0];\nreturn {\nroleColumnValue: row.default_role.toString(),\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\nrolePermissions: row.permissions,\n};\n}\n@@ -216,7 +214,7 @@ async function updateDescendantPermissions(\nconst userIDs = [...usersToPermissionsFromParent.keys()];\nconst query = SQL`\n- SELECT t.id, m.user, t.visibility_rules,\n+ SELECT t.id, m.user, t.type,\nr.permissions AS role_permissions, m.permissions,\nm.permissions_for_children, m.role\nFROM threads t\n@@ -231,7 +229,7 @@ async function updateDescendantPermissions(\nconst threadID = row.id.toString();\nif (!childThreadInfos.has(threadID)) {\nchildThreadInfos.set(threadID, {\n- visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ visibilityRules: assertVisibilityRules(row.type),\nuserInfos: new Map(),\n});\n}\n@@ -304,14 +302,14 @@ async function updateDescendantPermissions(\n}\n// Unlike changeRole and others, this doesn't just create a MembershipChangeset.\n-// It mutates the threads table by setting the visibility_rules column.\n+// It mutates the threads table by setting the type column.\n// Caller still needs to save the resultant MembershipChangeset.\nasync function recalculateAllPermissions(\nthreadID: string,\nnewVisRules: VisibilityRules,\n): Promise<MembershipChangeset> {\nconst updateQuery = SQL`\n- UPDATE threads SET visibility_rules = ${newVisRules} WHERE id = ${threadID}\n+ UPDATE threads SET type = ${newVisRules} WHERE id = ${threadID}\n`;\nconst selectQuery = SQL`\nSELECT m.user, m.role, m.permissions, m.permissions_for_children,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-updaters.js",
"new_path": "server/src/updaters/thread-updaters.js",
"diff": "@@ -338,7 +338,7 @@ async function updateThread(\nsqlUpdate.hash = null;\n}\nchangedFields.visibilityRules = visRules;\n- sqlUpdate.visibility_rules = visRules;\n+ sqlUpdate.type = visRules;\n}\nconst unverifiedNewMemberIDs = request.changes.newMemberIDs;\n@@ -354,9 +354,9 @@ async function updateThread(\n// Two unrelated purposes for this query:\n// - get hash for viewer password check (users table)\n- // - get current value of visibility_rules, parent_thread_id (threads table)\n+ // - get current value of type, parent_thread_id (threads table)\nconst validationQuery = SQL`\n- SELECT u.hash, t.visibility_rules, t.parent_thread_id\n+ SELECT u.hash, t.type, t.parent_thread_id\nFROM users u\nLEFT JOIN threads t ON t.id = ${request.threadID}\nWHERE u.id = ${viewer.userID}\n@@ -382,7 +382,7 @@ async function updateThread(\nif (\nvalidationResult.length === 0 ||\n- validationResult[0].visibility_rules === null\n+ validationResult[0].type === null\n) {\nthrow new ServerError('internal_error');\n}\n@@ -403,7 +403,7 @@ async function updateThread(\n}\nif (\nsqlUpdate.parent_thread_id ||\n- sqlUpdate.visibility_rules ||\n+ sqlUpdate.type ||\nsqlUpdate.hash\n) {\nconst canEditPermissions = permissionHelper(\n@@ -430,7 +430,7 @@ async function updateThread(\n}\n}\n- const oldVisRules = assertVisibilityRules(validationRow.visibility_rules);\n+ const oldVisRules = assertVisibilityRules(validationRow.type);\nconst oldParentThreadID = validationRow.parentThreadID\n? validationRow.parentThreadID.toString()\n: null;\n@@ -577,7 +577,7 @@ async function joinThread(\nrequest: ThreadJoinRequest,\n): Promise<ThreadJoinResult> {\nconst threadQuery = SQL`\n- SELECT visibility_rules, hash FROM threads WHERE id = ${request.threadID}\n+ SELECT type, hash FROM threads WHERE id = ${request.threadID}\n`;\nconst [ isMember, hasPermission, [ threadResult ] ] = await Promise.all([\nviewerIsMember(viewer, request.threadID),\n@@ -594,7 +594,7 @@ async function joinThread(\nconst threadRow = threadResult[0];\n// You can only be added to these visibility types if you know the password\n- const visRules = assertVisibilityRules(threadRow.visibility_rules);\n+ const visRules = assertVisibilityRules(threadRow.type);\nif (\nvisRules === visibilityRules.CLOSED ||\nvisRules === visibilityRules.SECRET\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] visibility_rules -> type |
129,187 | 09.04.2018 15:07:17 | 14,400 | 57d8c29d90a754b52934d6cde29ffe222f74f0f5 | [native] Don't update badge count until first ping results comes in
We end up updating the badge count with stale data otherwise. This also avoids an issue on iOS where notifs get preemptively rescinded. (On iOS, setting badge count to 0 clears all notifs.) | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -127,6 +127,7 @@ type Props = {\nunreadCount: number,\nrawThreadInfos: {[id: string]: RawThreadInfo},\nnotifPermissionAlertInfo: NotifPermissionAlertInfo,\n+ lastPingTime: number,\n// Redux dispatch functions\ndispatch: NativeDispatch,\ndispatchActionPayload: DispatchActionPayload,\n@@ -155,6 +156,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nunreadCount: PropTypes.number.isRequired,\nrawThreadInfos: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\nnotifPermissionAlertInfo: notifPermissionAlertInfoPropType.isRequired,\n+ lastPingTime: PropTypes.number.isRequired,\ndispatch: PropTypes.func.isRequired,\ndispatchActionPayload: PropTypes.func.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -169,6 +171,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nandroidRefreshTokenListener: ?Object = null;\ninitialAndroidNotifHandled = false;\nopenThreadOnceReceived: Set<string> = new Set();\n+ updateBadgeCountAfterNextPing = true;\ncomponentDidMount() {\nif (Platform.OS === \"android\") {\n@@ -213,7 +216,6 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nthis.registerPushPermissionsAndHandleInitialNotif,\n);\n}\n- AppWithNavigationState.updateBadgeCount(this.props.unreadCount);\nif (this.props.appLoggedIn) {\nthis.ensurePushNotifsEnabled();\n}\n@@ -338,7 +340,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (this.props.activeThread) {\nAppWithNavigationState.clearNotifsOfThread(this.props);\n}\n- AppWithNavigationState.updateBadgeCount(this.props.unreadCount);\n+ this.updateBadgeCountAfterNextPing = true;\n} else if (\nlastState === \"active\" &&\nthis.currentState &&\n@@ -379,11 +381,17 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (justLoggedIn) {\nthis.ensurePushNotifsEnabled();\n}\n+\nconst nextActiveThread = nextProps.activeThread;\nif (nextActiveThread && nextActiveThread !== this.props.activeThread) {\nAppWithNavigationState.clearNotifsOfThread(nextProps);\n}\n- if (nextProps.unreadCount !== this.props.unreadCount) {\n+ if (\n+ nextProps.unreadCount !== this.props.unreadCount ||\n+ (nextProps.lastPingTime !== this.props.lastPingTime &&\n+ this.updateBadgeCountAfterNextPing)\n+ ) {\n+ this.updateBadgeCountAfterNextPing = false;\nAppWithNavigationState.updateBadgeCount(nextProps.unreadCount);\n}\nfor (let threadID of this.openThreadOnceReceived) {\n@@ -784,6 +792,7 @@ const ConnectedAppWithNavigationState = connect(\nunreadCount: unreadCount(state),\nrawThreadInfos: state.threadInfos,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ lastPingTime: state.lastPingTime,\n};\n},\n{ ping, updateActivity, setDeviceToken },\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -50,6 +50,10 @@ const migrations = {\nmessageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n}),\n+ [4]: (state: AppState) => ({\n+ ...state,\n+ lastPingTime: 0,\n+ }),\n};\nconst persistConfig = {\n@@ -57,7 +61,7 @@ const persistConfig = {\nstorage,\nblacklist,\ndebug: __DEV__,\n- version: 3,\n+ version: 4,\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -30,6 +30,7 @@ import baseReducer from 'lib/reducers/master-reducer';\nimport { newSessionID } from 'lib/selectors/session-selectors';\nimport { notificationPressActionType } from 'lib/shared/notif-utils';\nimport { sendMessageActionTypes } from 'lib/actions/message-actions';\n+import { pingActionTypes } from 'lib/actions/ping-actions';\nimport { MessageListRouteName } from './chat/message-list.react';\nimport { activeThreadSelector } from './selectors/nav-selectors';\n@@ -78,6 +79,7 @@ export type AppState = {|\nthreadIDsToNotifIDs: {[threadID: string]: string[]},\nnotifPermissionAlertInfo: NotifPermissionAlertInfo,\nmessageSentFromRoute: $ReadOnlyArray<string>,\n+ lastPingTime: number,\n_persist: ?PersistState,\n|};\n@@ -108,6 +110,7 @@ const defaultState = ({\nthreadIDsToNotifIDs: {},\nnotifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\nmessageSentFromRoute: [],\n+ lastPingTime: 0,\n_persist: null,\n}: AppState);\n@@ -186,6 +189,7 @@ function reducer(state: AppState = defaultState, action: *) {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n}\n@@ -215,6 +219,7 @@ function reducer(state: AppState = defaultState, action: *) {\n),\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n} else if (action.type === setCustomServer) {\n@@ -237,6 +242,7 @@ function reducer(state: AppState = defaultState, action: *) {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n} else if (action.type === recordNotifPermissionAlertActionType) {\n@@ -262,6 +268,7 @@ function reducer(state: AppState = defaultState, action: *) {\nlastAlertTime: action.payload.time,\n},\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n}\n@@ -304,6 +311,31 @@ function reducer(state: AppState = defaultState, action: *) {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n+ _persist: state._persist,\n+ };\n+ }\n+ if (action.type === pingActionTypes.success) {\n+ state = {\n+ navInfo: state.navInfo,\n+ currentUserInfo: state.currentUserInfo,\n+ sessionID: state.sessionID,\n+ entryStore: state.entryStore,\n+ lastUserInteraction: state.lastUserInteraction,\n+ threadInfos: state.threadInfos,\n+ userInfos: state.userInfos,\n+ messageStore: state.messageStore,\n+ drafts: state.drafts,\n+ updatesCurrentAsOf: state.updatesCurrentAsOf,\n+ loadingStatuses: state.loadingStatuses,\n+ cookie: state.cookie,\n+ deviceToken: state.deviceToken,\n+ urlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\n+ threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ notifPermissionAlertInfo: state.notifPermissionAlertInfo,\n+ messageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: Date.now(),\n_persist: state._persist,\n};\n}\n@@ -343,6 +375,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n}\n@@ -381,6 +414,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n}\n@@ -410,6 +444,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute,\n+ lastPingTime: state.lastPingTime,\n_persist: state._persist,\n};\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Don't update badge count until first ping results comes in
We end up updating the badge count with stale data otherwise. This also avoids an issue on iOS where notifs get preemptively rescinded. (On iOS, setting badge count to 0 clears all notifs.) |
129,187 | 09.04.2018 22:56:30 | 14,400 | 29e06e3eb771bbb3e1628674ad0b1d7de762fa68 | [server] Don't crash when getting visibilityRules in NewThreadRequest | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/thread-responders.js",
"new_path": "server/src/responders/thread-responders.js",
"diff": "@@ -18,6 +18,8 @@ import type { Viewer } from '../session/viewer';\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/errors';\n+\nimport {\nvalidateInput,\ntShape,\n@@ -100,6 +102,7 @@ const updateThreadRequestInputValidator = tShape({\nthreadID: t.String,\nchanges: tShape({\ntype: t.maybe(tNumEnum(assertThreadType)),\n+ visibilityRules: t.maybe(tNumEnum(assertThreadType)),\nname: t.maybe(t.String),\ndescription: t.maybe(t.String),\ncolor: t.maybe(tColor),\n@@ -114,13 +117,51 @@ async function threadUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<ChangeThreadSettingsResult> {\n- const request: UpdateThreadRequest = input;\n- validateInput(updateThreadRequestInputValidator, request);\n+ validateInput(updateThreadRequestInputValidator, input);\n+ let request;\n+ if (\n+ input.changes.visibilityRules !== null &&\n+ input.changes.visibilityRules !== undefined &&\n+ (input.changes.type === null ||\n+ input.changes.type === undefined)\n+ ) {\n+ request = ({\n+ ...input,\n+ changes: {\n+ type: input.changes.visibilityRules,\n+ name: input.changes.name,\n+ description: input.changes.description,\n+ color: input.changes.color,\n+ password: input.changes.password,\n+ parentThreadID: input.changes.parentThreadID,\n+ newMemberIDs: input.changes.newMemberIDs,\n+ },\n+ }: UpdateThreadRequest);\n+ } else if (\n+ input.changes.visibilityRules !== null &&\n+ input.changes.visibilityRules !== undefined\n+ ) {\n+ request = ({\n+ ...input,\n+ changes: {\n+ type: input.changes.type,\n+ name: input.changes.name,\n+ description: input.changes.description,\n+ color: input.changes.color,\n+ password: input.changes.password,\n+ parentThreadID: input.changes.parentThreadID,\n+ newMemberIDs: input.changes.newMemberIDs,\n+ },\n+ }: UpdateThreadRequest);\n+ } else {\n+ request = (input: UpdateThreadRequest);\n+ }\nreturn await updateThread(viewer, request);\n}\nconst newThreadRequestInputValidator = tShape({\n- type: tNumEnum(assertThreadType),\n+ type: t.maybe(tNumEnum(assertThreadType)),\n+ visibilityRules: t.maybe(tNumEnum(assertThreadType)),\nname: t.maybe(t.String),\ndescription: t.maybe(t.String),\ncolor: t.maybe(tColor),\n@@ -132,8 +173,27 @@ async function threadCreationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<NewThreadResult> {\n- const request: NewThreadRequest = input;\n- validateInput(newThreadRequestInputValidator, request);\n+ validateInput(newThreadRequestInputValidator, input);\n+ let request;\n+ if (\n+ (input.visibilityRules === null ||\n+ input.visibilityRules === undefined) &&\n+ (input.type === null || input.type === undefined)\n+ ) {\n+ throw new ServerError('invalid_parameters');\n+ } else if (input.type === null || input.type === undefined) {\n+ request = ({\n+ type: input.visibilityRules,\n+ name: input.name,\n+ description: input.description,\n+ color: input.color,\n+ password: input.password,\n+ parentThreadID: input.parentThreadID,\n+ initialMemberIDs: input.initialMemberIDs,\n+ }: NewThreadRequest);\n+ } else {\n+ request = (input: NewThreadRequest);\n+ }\nreturn await createThread(viewer, request);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Don't crash when getting visibilityRules in NewThreadRequest |
129,187 | 09.04.2018 23:34:02 | 14,400 | c1941d702d751c8f744e5aba978734bad4d9a2b8 | [server] Attempt to bring back visibilityRules for older clients | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -153,6 +153,7 @@ function rawThreadInfoFromServerThreadInfo(\nreturn {\nid: serverThreadInfo.id,\ntype: serverThreadInfo.type,\n+ visibilityRules: serverThreadInfo.type,\nname: serverThreadInfo.name,\ndescription: serverThreadInfo.description,\ncolor: serverThreadInfo.color,\n@@ -188,6 +189,7 @@ function rawThreadInfoFromThreadInfo(threadInfo: ThreadInfo): RawThreadInfo {\nreturn {\nid: threadInfo.id,\ntype: threadInfo.type,\n+ visibilityRules: threadInfo.type,\nname: threadInfo.name,\ndescription: threadInfo.description,\ncolor: threadInfo.color,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/thread-types.js",
"new_path": "lib/types/thread-types.js",
"diff": "@@ -139,6 +139,7 @@ export type ThreadCurrentUserInfo = {|\nexport type RawThreadInfo = {|\nid: string,\ntype: ThreadType,\n+ visibilityRules: ThreadType,\nname: ?string,\ndescription: ?string,\ncolor: string, // hex, without \"#\" or \"0x\"\n@@ -226,6 +227,7 @@ export type ServerMemberInfo = {|\nexport type ServerThreadInfo = {|\nid: string,\ntype: ThreadType,\n+ visibilityRules: ThreadType,\nname: ?string,\ndescription: ?string,\ncolor: string, // hex, without \"#\" or \"0x\"\n"
},
{
"change_type": "ADD",
"old_path": "server/images/background.png",
"new_path": "server/images/background.png",
"diff": "Binary files /dev/null and b/server/images/background.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/thread-creator.js",
"new_path": "server/src/creators/thread-creator.js",
"diff": "@@ -216,6 +216,7 @@ async function createThread(\nnewThreadInfo: {\nid,\ntype: threadType,\n+ visibilityRules: threadType,\nname,\ndescription,\ncolor,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/thread-fetchers.js",
"new_path": "server/src/fetchers/thread-fetchers.js",
"diff": "@@ -55,6 +55,7 @@ async function fetchServerThreadInfos(\nthreadInfos[threadID] = {\nid: threadID,\ntype: row.type,\n+ visibilityRules: row.type,\nname: row.name ? row.name : \"\",\ndescription: row.description ? row.description : \"\",\ncolor: row.color,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Attempt to bring back visibilityRules for older clients |
129,187 | 10.04.2018 15:24:20 | 14,400 | 9c297a32ba00a735795de47ffdf78811541104f2 | [web] Move Modal into header to avoid having distinct stacking contexts | [
{
"change_type": "MODIFY",
"old_path": "web/app.react.js",
"new_path": "web/app.react.js",
"diff": "@@ -274,12 +274,12 @@ class App extends React.PureComponent<Props, State> {\n</Link>\n</h2>\n</div>\n+ {this.state.currentModal}\n</header>\n<Calendar\nsetModal={this.setModal}\nclearModal={this.clearModal}\n/>\n- {this.state.currentModal}\n</div>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/dist/app.build.js",
"new_path": "web/dist/app.build.js",
"diff": "@@ -27514,13 +27514,13 @@ class App extends __WEBPACK_IMPORTED_MODULE_2_react__[\"PureComponent\"] {\n'>'\n)\n)\n- )\n+ ),\n+ this.state.currentModal\n),\n__WEBPACK_IMPORTED_MODULE_2_react__[\"createElement\"](__WEBPACK_IMPORTED_MODULE_21__calendar_calendar_react__[\"a\" /* default */], {\nsetModal: this.setModal,\nclearModal: this.clearModal\n- }),\n- this.state.currentModal\n+ })\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Move Modal into header to avoid having distinct stacking contexts |
129,187 | 12.04.2018 11:04:43 | 14,400 | b4d18ce81f1864a1598b2339db62ee5d7c2bd6de | Move platform awareness to lib | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/user-actions.js",
"new_path": "lib/actions/user-actions.js",
"diff": "@@ -22,6 +22,7 @@ import type {\nimport type { UserSearchResult } from '../types/search-types';\nimport threadWatcher from '../shared/thread-watcher';\n+import { getConfig } from '../utils/config';\nconst logOutActionTypes = Object.freeze({\nstarted: \"LOG_OUT_STARTED\",\n@@ -65,7 +66,10 @@ async function register(\nfetchJSON: FetchJSON,\nregisterInfo: RegisterInfo,\n): Promise<RegisterResult> {\n- const response = await fetchJSON('create_account', registerInfo);\n+ const response = await fetchJSON(\n+ 'create_account',\n+ { ...registerInfo, platform: getConfig().platform },\n+ );\nreturn {\ncurrentUserInfo: {\nid: response.id,\n@@ -110,8 +114,14 @@ async function logIn(\nlogInInfo: LogInInfo,\n): Promise<LogInResult> {\nconst watchedIDs = threadWatcher.getWatchedIDs();\n- const request = { ...logInInfo, watchedIDs };\n- const response = await fetchJSON('log_in', request);\n+ const response = await fetchJSON(\n+ 'log_in',\n+ {\n+ ...logInInfo,\n+ watchedIDs,\n+ platform: getConfig().platform,\n+ },\n+ );\nconst userInfos = mergeUserInfos(\nresponse.userInfos,\n@@ -154,8 +164,14 @@ async function resetPassword(\nupdatePasswordInfo: UpdatePasswordInfo,\n): Promise<LogInResult> {\nconst watchedIDs = threadWatcher.getWatchedIDs();\n- const request = { ...updatePasswordInfo, watchedIDs };\n- const response = await fetchJSON('update_password', request);\n+ const response = await fetchJSON(\n+ 'update_password',\n+ {\n+ ...updatePasswordInfo,\n+ watchedIDs,\n+ platform: getConfig().platform,\n+ },\n+ );\nconst userInfos = mergeUserInfos(\nresponse.user_infos,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/account-types.js",
"new_path": "lib/types/account-types.js",
"diff": "@@ -37,7 +37,6 @@ export type RegisterInfo = {|\nusername: string,\nemail: string,\npassword: string,\n- platform: Platform,\n|};\nexport type RegisterRequest = {|\n@@ -81,7 +80,6 @@ export type LogInInfo = {|\npassword: string,\ncalendarQuery?: ?CalendarQuery,\ndeviceTokenUpdateRequest?: ?DeviceTokenUpdateRequest,\n- platform: Platform,\n|};\nexport type LogInRequest = {|\n@@ -117,7 +115,6 @@ export type UpdatePasswordInfo = {|\npassword: string,\ncalendarQuery?: ?CalendarQuery,\ndeviceTokenUpdateRequest?: ?DeviceTokenUpdateRequest,\n- platform: Platform,\n|};\nexport type UpdatePasswordRequest = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/config.js",
"new_path": "lib/utils/config.js",
"diff": "// @flow\n-import invariant from 'invariant';\nimport type { FetchJSON } from './fetch-json';\nimport type { DispatchRecoveryAttempt } from './action-utils';\n+import type { Platform } from '../types/device-types';\n+\n+import invariant from 'invariant';\nexport type Config = {\nresolveInvalidatedCookie: ?((\n@@ -13,6 +15,7 @@ export type Config = {\ngetNewCookie: ?((response: Object) => Promise<?string>),\nsetCookieOnRequest: bool,\ncalendarRangeInactivityLimit: ?number,\n+ platform: Platform,\n};\nlet registeredConfig: ?Config = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/log-in-panel.react.js",
"new_path": "native/account/log-in-panel.react.js",
"diff": "@@ -17,7 +17,6 @@ import {\nAlert,\nKeyboard,\nAnimated,\n- Platform,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport invariant from 'invariant';\n@@ -232,7 +231,6 @@ class LogInPanel extends React.PureComponent<Props> {\npassword: this.props.state.state.passwordInputText,\ncalendarQuery,\ndeviceTokenUpdateRequest,\n- platform: Platform.OS,\n});\nthis.props.setActiveAlert(false);\nawait setNativeCredentials({\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/native-credentials.js",
"new_path": "native/account/native-credentials.js",
"diff": "@@ -233,7 +233,6 @@ async function resolveInvalidatedCookie(\nusernameOrEmail: keychainCredentials.username,\npassword: keychainCredentials.password,\ndeviceTokenUpdateRequest,\n- platform: Platform.OS,\n},\n),\n);\n@@ -251,7 +250,6 @@ async function resolveInvalidatedCookie(\nusernameOrEmail: sharedWebCredentials.username,\npassword: sharedWebCredentials.password,\ndeviceTokenUpdateRequest,\n- platform: Platform.OS,\n},\n),\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/register-panel.react.js",
"new_path": "native/account/register-panel.react.js",
"diff": "@@ -310,7 +310,6 @@ class RegisterPanel extends React.PureComponent<Props> {\nusername: this.props.state.state.usernameInputText,\nemail: this.props.state.state.emailInputText,\npassword: this.props.state.state.passwordInputText,\n- platform: Platform.OS,\n});\nthis.props.setActiveAlert(false);\nawait setNativeCredentials({\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/reset-password-panel.react.js",
"new_path": "native/account/reset-password-panel.react.js",
"diff": "@@ -14,7 +14,6 @@ import {\nKeyboard,\nView,\nText,\n- Platform,\n} from 'react-native';\nimport invariant from 'invariant';\nimport OnePassword from 'react-native-onepassword';\n@@ -215,7 +214,6 @@ class ResetPasswordPanel extends React.PureComponent<Props, State> {\npassword: this.state.passwordInputText,\ncalendarQuery,\ndeviceTokenUpdateRequest,\n- platform: Platform.OS,\n});\nthis.props.setActiveAlert(false);\nthis.props.onSuccess();\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -109,6 +109,7 @@ registerConfig({\n},\nsetCookieOnRequest: true,\ncalendarRangeInactivityLimit: sessionInactivityLimit,\n+ platform: Platform.OS,\n});\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/account/log-in-modal.react.js",
"new_path": "web/modals/account/log-in-modal.react.js",
"diff": "@@ -171,7 +171,6 @@ class LogInModal extends React.PureComponent<Props, State> {\nconst result = await this.props.logIn({\nusernameOrEmail: this.state.usernameOrEmail,\npassword: this.state.password,\n- platform: \"web\",\n});\nthis.props.onClose();\nreturn result;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/account/register-modal.react.js",
"new_path": "web/modals/account/register-modal.react.js",
"diff": "@@ -233,7 +233,6 @@ class RegisterModal extends React.PureComponent<Props, State> {\nusername: this.state.username,\nemail: this.state.email,\npassword: this.state.password,\n- platform: \"web\",\n});\nthis.props.setModal(<VerifyEmailModal onClose={this.props.onClose} />);\nreturn result;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/account/reset-password-modal.react.js",
"new_path": "web/modals/account/reset-password-modal.react.js",
"diff": "@@ -167,7 +167,6 @@ class ResetPasswordModal extends React.PureComponent<Props, State> {\nconst response = await this.props.resetPassword({\ncode: this.props.verifyCode,\npassword: this.state.password,\n- platform: \"web\",\n});\nthis.props.onSuccess();\nreturn response;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/script.js",
"new_path": "web/script.js",
"diff": "@@ -35,6 +35,7 @@ registerConfig({\nsetCookieOnRequest: false,\n// Never reset the calendar range\ncalendarRangeInactivityLimit: null,\n+ platform: \"web\",\n});\ndeclare var preloadedState: AppState;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move platform awareness to lib |
129,187 | 12.04.2018 22:10:13 | 14,400 | b3e1e5278a224dfd72e88dd345ad95f98c5b682a | [server] ios_device_token, android_device_token -> device_token | [
{
"change_type": "MODIFY",
"old_path": "lib/types/device-types.js",
"new_path": "lib/types/device-types.js",
"diff": "@@ -7,8 +7,3 @@ export type DeviceTokenUpdateRequest = {|\ndeviceType: DeviceType,\ndeviceToken: string,\n|};\n-\n-export type DeviceTokens = {|\n- ios?: ?string,\n- android?: ?string,\n-|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "@@ -270,14 +270,13 @@ async function sendPushNotifsForNewMessages(\nconst time = earliestTimeConsideredCurrent();\nconst visibleExtractString = `$.${threadPermissions.VISIBLE}.value`;\nconst query = SQL`\n- SELECT m.user, m.thread, c.ios_device_token, c.android_device_token\n+ SELECT m.user, m.thread, c.platform, c.device_token\n`;\nquery.append(subthreadSelects);\nquery.append(SQL`\nFROM memberships m\nLEFT JOIN threads t ON t.id = m.thread\n- LEFT JOIN cookies c ON c.user = m.user\n- AND (c.ios_device_token IS NOT NULL OR c.android_device_token IS NOT NULL)\n+ LEFT JOIN cookies c ON c.user = m.user AND c.device_token IS NOT NULL\nLEFT JOIN focused f ON f.user = m.user AND f.thread = m.thread\nAND f.time > ${time}\n`);\n@@ -296,8 +295,8 @@ async function sendPushNotifsForNewMessages(\nfor (let row of result) {\nconst userID = row.user.toString();\nconst threadID = row.thread.toString();\n- const iosDeviceToken = row.ios_device_token;\n- const androidDeviceToken = row.android_device_token;\n+ const deviceToken = row.device_token;\n+ const platform = row.platform;\nlet preUserPushInfo = prePushInfo.get(userID);\nif (!preUserPushInfo) {\npreUserPushInfo = {\n@@ -322,15 +321,10 @@ async function sendPushNotifsForNewMessages(\n}\n}\n}\n- if (iosDeviceToken) {\n- preUserPushInfo.devices.set(iosDeviceToken, {\n- deviceType: \"ios\",\n- deviceToken: iosDeviceToken,\n- });\n- } else if (androidDeviceToken) {\n- preUserPushInfo.devices.set(androidDeviceToken, {\n- deviceType: \"android\",\n- deviceToken: androidDeviceToken,\n+ if (deviceToken) {\n+ preUserPushInfo.devices.set(deviceToken, {\n+ deviceType: platform,\n+ deviceToken,\n});\n}\npreUserPushInfo.threadIDs.add(threadID);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/deleters/cookie-deleters.js",
"new_path": "server/src/deleters/cookie-deleters.js",
"diff": "@@ -17,14 +17,11 @@ async function deleteCookiesOnLogOut(\nuserID: string,\ncookieID: string,\n): Promise<void> {\n- const deviceTokens = await fetchDeviceTokensForCookie(cookieID);\n+ const deviceToken = await fetchDeviceTokensForCookie(cookieID);\nconst conditions = [ SQL`c.id = ${cookieID}` ];\n- if (deviceTokens.ios) {\n- conditions.push(SQL`c.ios_device_token = ${deviceTokens.ios}`);\n- }\n- if (deviceTokens.android) {\n- conditions.push(SQL`c.android_device_token = ${deviceTokens.android}`);\n+ if (deviceToken) {\n+ conditions.push(SQL`c.device_token = ${deviceToken}`);\n}\nconst query = SQL`\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/device-token-fetchers.js",
"new_path": "server/src/fetchers/device-token-fetchers.js",
"diff": "// @flow\n-import type { DeviceTokens } from 'lib/types/device-types';\n-\nimport { ServerError } from 'lib/utils/errors';\nimport { dbQuery, SQL } from '../database';\nasync function fetchDeviceTokensForCookie(\ncookieID: string,\n-): Promise<DeviceTokens> {\n+): Promise<?string> {\nconst query = SQL`\n- SELECT ios_device_token, android_device_token\n+ SELECT device_token\nFROM cookies\nWHERE id = ${cookieID}\n`;\n@@ -19,10 +17,7 @@ async function fetchDeviceTokensForCookie(\nthrow new ServerError('invalid_cookie');\n}\nconst row = result[0];\n- return {\n- ios: row.ios_device_token,\n- android: row.android_device_token,\n- };\n+ return row.device_token;\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -420,7 +420,7 @@ type InvalidToken = {\nasync function removeInvalidTokens(invalidTokens: InvalidToken[]) {\nconst query = SQL`\nUPDATE cookies\n- SET android_device_token = NULL, ios_device_token = NULL\n+ SET device_token = NULL\nWHERE\n`;\n@@ -429,12 +429,12 @@ async function removeInvalidTokens(invalidTokens: InvalidToken[]) {\nconst deviceConditions = [];\nif (invalidTokenUser.fcmTokens && invalidTokenUser.fcmTokens.length > 0) {\ndeviceConditions.push(\n- SQL`android_device_token IN (${invalidTokenUser.fcmTokens})`,\n+ SQL`device_token IN (${invalidTokenUser.fcmTokens})`,\n);\n}\nif (invalidTokenUser.apnTokens && invalidTokenUser.apnTokens.length > 0) {\ndeviceConditions.push(\n- SQL`ios_device_token IN (${invalidTokenUser.apnTokens})`,\n+ SQL`device_token IN (${invalidTokenUser.apnTokens})`,\n);\n}\nconst statement = SQL`(user = ${invalidTokenUser.userID} AND `;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/session/cookies.js",
"new_path": "server/src/session/cookies.js",
"diff": "@@ -4,7 +4,7 @@ import type { $Response, $Request } from 'express';\nimport type { UserInfo, CurrentUserInfo } from 'lib/types/user-types';\nimport type { RawThreadInfo } from 'lib/types/thread-types';\nimport type { ViewerData, AnonymousViewerData, UserViewerData } from './viewer';\n-import type { DeviceTokens, Platform } from 'lib/types/device-types';\n+import type { Platform } from 'lib/types/device-types';\nimport bcrypt from 'twin-bcrypt';\nimport url from 'url';\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/device-token-updaters.js",
"new_path": "server/src/updaters/device-token-updaters.js",
"diff": "@@ -9,13 +9,11 @@ async function deviceTokenUpdater(\nviewer: Viewer,\nupdate: DeviceTokenUpdateRequest,\n): Promise<void> {\n- const column = update.deviceType === \"ios\"\n- ? \"ios_device_token\"\n- : \"android_device_token\";\n- const cookieID = viewer.cookieID;\n- const query = SQL`UPDATE cookies SET `;\n- query.append(column);\n- query.append(SQL` = ${update.deviceToken} WHERE id = ${cookieID}`);\n+ const query = SQL`\n+ UPDATE cookies\n+ SET device_token = ${update.deviceToken}, platform = ${update.deviceType}\n+ WHERE id = ${viewer.cookieID}\n+ `;\nawait dbQuery(query);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] ios_device_token, android_device_token -> device_token |
129,187 | 19.04.2018 16:42:42 | 25,200 | e20fafe4b7bb7cea044efb5e608d13d36b361e20 | [web] Fix splash screen for mobile browsers | [
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -1191,25 +1191,29 @@ div.splash-container {\ndiv.splash-header-container {\nposition: fixed;\ntop: 0;\n- width: 100%;\n+ left: 0;\n+ right: 0;\nheight: 790px;\nheight: 61px;\nz-index: 3;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n+ padding: 0 10px;\n}\ndiv.splash-top-container {\nposition: fixed;\ntop: 61px;\n- width: 100%;\n- height: 729px;\n+ left: 0;\n+ right: 0;\n+ height: 100%;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n+ background-repeat-y: repeat;\n}\ndiv.splash-top {\n- width: 1024px;\n+ max-width: 1024px;\nmargin: 0 auto;\n}\ndiv.splash-header-contents {\n@@ -1287,11 +1291,10 @@ div.splash-header-overscroll {\ntop: 100%;\nleft: 0;\nright: 0;\n- height: 250px;\n+ height: 1000px;\nbackground-color: white;\n}\ndiv.splash-prompt {\n- width: 1024px;\nmargin: 0 auto;\ndisplay: flex;\nflex-direction: column;\n@@ -1301,11 +1304,13 @@ p.splash-prompt-header {\ncolor: #282828;\nfont-size: 21px;\npadding-top: 25px;\n+ text-align: center;\n}\np.splash-prompt-description {\ncolor: #282828;\nfont-size: 18px;\npadding-top: 9px;\n+ text-align: center;\n}\ndiv.splash-request-access-container {\nmargin: 25px;\n@@ -1432,3 +1437,12 @@ div.custom-select select:focus {\nbackground-image: url(../images/background@2x.png);\n}\n}\n+\n+@media (hover: none) {\n+ div.splash-header-container, div.splash-top-container, div.splash-bottom {\n+ background-attachment: initial;\n+ }\n+ div.splash-top-container {\n+ background-position-y: -61px;\n+ }\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix splash screen for mobile browsers |
129,187 | 23.04.2018 16:38:13 | 25,200 | b66a2aa127a8a16823758a1a60429a592369c80e | [server] Bring back support for clients sending `closing` ActivityUpdate
This does nothing, but old clients are still sending it and causing crashes. | [
{
"change_type": "MODIFY",
"old_path": "lib/types/activity-types.js",
"new_path": "lib/types/activity-types.js",
"diff": "export type ActivityUpdate =\n| {| focus: true, threadID: string |}\n- | {| focus: false, threadID: string, latestMessage: ?string |};\n+ | {| focus: false, threadID: string, latestMessage: ?string |}\n+ | {| closing: true |};\nexport type UpdateActivityRequest = {|\nupdates: $ReadOnlyArray<ActivityUpdate>,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/activity-responders.js",
"new_path": "server/src/responders/activity-responders.js",
"diff": "@@ -22,6 +22,9 @@ const inputValidator = tShape({\nthreadID: t.String,\nlatestMessage: t.maybe(t.String),\n}),\n+ tShape({\n+ closing: tBool(true),\n+ }),\n])),\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -30,6 +30,10 @@ async function activityUpdater(\nconst unverifiedThreadIDs = new Set();\nconst focusUpdatesByThreadID = new Map();\nfor (let activityUpdate of request.updates) {\n+ if (activityUpdate.closing) {\n+ // This was deprecated, but old clients are still sending it\n+ continue;\n+ }\nconst threadID = activityUpdate.threadID;\nunverifiedThreadIDs.add(threadID);\nfocusUpdatesByThreadID.set(threadID, activityUpdate);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Bring back support for clients sending `closing` ActivityUpdate
This does nothing, but old clients are still sending it and causing crashes. |
129,187 | 23.04.2018 16:58:34 | 25,200 | 86c973c3aa4ea2002dbb60fed5aa182979debd62 | [server] Wipe APNs device token on BadDeviceToken | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/utils.js",
"new_path": "server/src/push/utils.js",
"diff": "@@ -17,6 +17,8 @@ const fcmTokenInvalidationErrors = new Set([\n\"messaging/invalid-registration-token\",\n]);\nconst apnTokenInvalidationErrorCode = 410;\n+const apnBadRequestErrorCode = 400;\n+const apnBadTokenErrorString = \"BadDeviceToken\";\nasync function apnPush(\nnotification: apn.Notification,\n@@ -28,7 +30,11 @@ async function apnPush(\nconst invalidTokens = [];\nfor (let error of result.failed) {\nerrors.push(error);\n- if (error.status == apnTokenInvalidationErrorCode) {\n+ if (\n+ error.status == apnTokenInvalidationErrorCode ||\n+ (error.status == apnBadRequestErrorCode &&\n+ error.response.reason === apnBadTokenErrorString)\n+ ) {\ninvalidTokens.push(error.device);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Wipe APNs device token on BadDeviceToken |
129,187 | 23.04.2018 19:14:14 | 25,200 | e25339cb808774b6965bd2833d78c09c04dac123 | ServerRequest and ClientResponse for when server is missing device token | [
{
"change_type": "MODIFY",
"old_path": "lib/selectors/ping-selectors.js",
"new_path": "lib/selectors/ping-selectors.js",
"diff": "@@ -45,6 +45,7 @@ const pingActionInput = createSelector(\n(state: BaseAppState<*>) => state.messageStore.currentAsOf,\n(state: BaseAppState<*>) => state.updatesCurrentAsOf,\n(state: BaseAppState<*>) => state.activeServerRequests,\n+ (state: BaseAppState<*>) => state.deviceToken,\n(\nthreadInfos: {[id: string]: RawThreadInfo},\nentryInfos: {[id: string]: RawEntryInfo},\n@@ -52,6 +53,7 @@ const pingActionInput = createSelector(\nmessagesCurrentAsOf: number,\nupdatesCurrentAsOf: number,\nactiveServerRequests: $ReadOnlyArray<ServerRequest>,\n+ deviceToken: ?string,\n): (startingPayload: PingStartingPayload) => PingActionInput => {\nconst clientResponses = [];\nfor (let serverRequest of activeServerRequests) {\n@@ -60,6 +62,14 @@ const pingActionInput = createSelector(\ntype: serverRequestTypes.PLATFORM,\nplatform: getConfig().platform,\n});\n+ } else if (\n+ serverRequest.type === serverRequestTypes.DEVICE_TOKEN &&\n+ deviceToken !== null && deviceToken !== undefined\n+ ) {\n+ clientResponses.push({\n+ type: serverRequestTypes.DEVICE_TOKEN,\n+ deviceToken,\n+ });\n}\n}\nreturn (startingPayload: PingStartingPayload) => ({\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/device-types.js",
"new_path": "lib/types/device-types.js",
"diff": "@@ -5,8 +5,12 @@ import invariant from 'invariant';\nexport type DeviceType = \"ios\" | \"android\";\nexport type Platform = DeviceType | \"web\";\n+export function isDeviceType(platform: ?string) {\n+ return platform === \"ios\" || platform === \"android\";\n+}\n+\nexport function assertDeviceType(\n- deviceType: string,\n+ deviceType: ?string,\n): DeviceType {\ninvariant(\ndeviceType === \"ios\" || deviceType === \"android\",\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/request-types.js",
"new_path": "lib/types/request-types.js",
"diff": "import type { Platform } from './device-types';\nimport invariant from 'invariant';\n+import PropTypes from 'prop-types';\n// \"Server requests\" are requests for information that the server delivers to\n// clients. Clients then respond to those requests with a \"client response\".\nexport const serverRequestTypes = Object.freeze({\nPLATFORM: 0,\n+ DEVICE_TOKEN: 1,\n});\nexport type ServerRequestType = $Values<typeof serverRequestTypes>;\nexport function assertServerRequestType(\nserverRequestType: number,\n): ServerRequestType {\ninvariant(\n- serverRequestType === 0,\n+ serverRequestType === 0 ||\n+ serverRequestType === 1,\n\"number is not ServerRequestType enum\",\n);\nreturn serverRequestType;\n@@ -28,5 +31,26 @@ export type PlatformClientResponse = {|\nplatform: Platform,\n|};\n-export type ServerRequest = PlatformServerRequest;\n-export type ClientResponse = PlatformClientResponse;\n+export type DeviceTokenServerRequest = {|\n+ type: 1,\n+|};\n+export type DeviceTokenClientResponse = {|\n+ type: 1,\n+ deviceToken: string,\n+|};\n+\n+export const serverRequestPropType = PropTypes.oneOfType([\n+ PropTypes.shape({\n+ type: PropTypes.oneOf([ serverRequestTypes.PLATFORM ]).isRequired,\n+ }),\n+ PropTypes.shape({\n+ type: PropTypes.oneOf([ serverRequestTypes.DEVICE_TOKEN ]).isRequired,\n+ }),\n+]);\n+\n+export type ServerRequest =\n+ | PlatformServerRequest\n+ | DeviceTokenServerRequest;\n+export type ClientResponse =\n+ | PlatformClientResponse\n+ | DeviceTokenClientResponse;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -32,6 +32,11 @@ import {\nrecordNotifPermissionAlertActionType,\n} from './push/alerts';\nimport type { RawMessageInfo } from 'lib/types/message-types';\n+import {\n+ type ServerRequest,\n+ serverRequestPropType,\n+ serverRequestTypes,\n+} from 'lib/types/request-types';\nimport React from 'react';\nimport { Provider } from 'react-redux';\n@@ -138,6 +143,7 @@ type Props = {\npingTimestamps: PingTimestamps,\nsessionTimeLeft: () => number,\nnextSessionID: () => ?string,\n+ activeServerRequests: $ReadOnlyArray<ServerRequest>,\n// Redux dispatch functions\ndispatch: NativeDispatch,\ndispatchActionPayload: DispatchActionPayload,\n@@ -170,6 +176,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\npingTimestamps: pingTimestampsPropType.isRequired,\nsessionTimeLeft: PropTypes.func.isRequired,\nnextSessionID: PropTypes.func.isRequired,\n+ activeServerRequests: PropTypes.arrayOf(serverRequestPropType).isRequired,\ndispatch: PropTypes.func.isRequired,\ndispatchActionPayload: PropTypes.func.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -490,6 +497,25 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nbreak;\n}\n}\n+\n+ if (\n+ AppWithNavigationState.serverRequestsHasDeviceTokenRequest(\n+ nextProps.activeServerRequests,\n+ ) &&\n+ !AppWithNavigationState.serverRequestsHasDeviceTokenRequest(\n+ this.props.activeServerRequests,\n+ )\n+ ) {\n+ this.ensurePushNotifsEnabled();\n+ }\n+ }\n+\n+ static serverRequestsHasDeviceTokenRequest(\n+ requests: $ReadOnlyArray<ServerRequest>,\n+ ) {\n+ return requests.some(\n+ request => request.type === serverRequestTypes.DEVICE_TOKEN,\n+ );\n}\nasync ensurePushNotifsEnabled() {\n@@ -862,6 +888,7 @@ const ConnectedAppWithNavigationState = connect(\npingTimestamps: state.pingTimestamps,\nsessionTimeLeft: sessionTimeLeft(state),\nnextSessionID: nextSessionID(state),\n+ activeServerRequests: state.activeServerRequests,\ncookie: state.cookie,\n};\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -4,6 +4,7 @@ import type { PingRequest, PingResponse } from 'lib/types/ping-types';\nimport { defaultNumberPerThread } from 'lib/types/message-types';\nimport type { Viewer } from '../session/viewer';\nimport { serverRequestTypes } from 'lib/types/request-types';\n+import { isDeviceType, assertDeviceType } from 'lib/types/device-types';\nimport t from 'tcomb';\nimport invariant from 'invariant';\n@@ -21,6 +22,7 @@ import { updateActivityTime } from '../updaters/activity-updaters';\nimport { fetchCurrentUserInfo } from '../fetchers/user-fetchers';\nimport { fetchUpdateInfos } from '../fetchers/update-fetchers';\nimport { recordDeliveredUpdate, setCookiePlatform } from '../session/cookies';\n+import { deviceTokenUpdater } from '../updaters/device-token-updaters';\nconst pingRequestInputValidator = tShape({\ncalendarQuery: entryQueryInputValidator,\n@@ -79,6 +81,8 @@ async function pingResponder(\nconst clientResponsePromises = [];\nlet viewerMissingPlatform = !viewer.platform;\n+ let viewerMissingDeviceToken =\n+ isDeviceType(viewer.platform) && viewer.loggedIn && !viewer.deviceToken;\nif (request.clientResponses) {\nfor (let clientResponse of request.clientResponses) {\nif (clientResponse.type === serverRequestTypes.PLATFORM) {\n@@ -87,6 +91,15 @@ async function pingResponder(\nclientResponse.platform,\n));\nviewerMissingPlatform = false;\n+ } else if (clientResponse.type === serverRequestTypes.DEVICE_TOKEN) {\n+ clientResponsePromises.push(deviceTokenUpdater(\n+ viewer,\n+ {\n+ deviceToken: clientResponse.deviceToken,\n+ deviceType: assertDeviceType(viewer.platform),\n+ },\n+ ));\n+ viewerMissingDeviceToken = false;\n}\n}\n}\n@@ -158,11 +171,18 @@ async function pingResponder(\nif (updatesResult) {\nresponse.updatesResult = updatesResult;\n}\n+\n+ const serverRequests = [];\nif (viewerMissingPlatform) {\n- response.serverRequests = [\n- { type: serverRequestTypes.PLATFORM },\n- ];\n+ serverRequests.push({ type: serverRequestTypes.PLATFORM });\n}\n+ if (viewerMissingDeviceToken) {\n+ serverRequests.push({ type: serverRequestTypes.DEVICE_TOKEN });\n+ }\n+ if (serverRequests.length > 0) {\n+ response.serverRequests = serverRequests;\n+ }\n+\nreturn response;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/session/cookies.js",
"new_path": "server/src/session/cookies.js",
"diff": "@@ -59,7 +59,8 @@ async function fetchUserViewer(\nreturn { type: \"nonexistant\", cookieName: cookieType.USER, source };\n}\nconst query = SQL`\n- SELECT hash, user, last_used, platform FROM cookies\n+ SELECT hash, user, last_used, platform, device_token\n+ FROM cookies\nWHERE id = ${cookieID} AND user IS NOT NULL\n`;\nconst [ result ] = await dbQuery(query);\n@@ -85,6 +86,7 @@ async function fetchUserViewer(\nloggedIn: true,\nid: userID,\nplatform: cookieRow.platform,\n+ deviceToken: cookieRow.device_token,\nuserID,\ncookieID,\ncookiePassword,\n@@ -103,7 +105,8 @@ async function fetchAnonymousViewer(\nreturn { type: \"nonexistant\", cookieName: cookieType.ANONYMOUS, source };\n}\nconst query = SQL`\n- SELECT last_used, hash, platform FROM cookies\n+ SELECT last_used, hash, platform, device_token\n+ FROM cookies\nWHERE id = ${cookieID} AND user IS NULL\n`;\nconst [ result ] = await dbQuery(query);\n@@ -128,6 +131,7 @@ async function fetchAnonymousViewer(\nloggedIn: false,\nid: cookieID,\nplatform: cookieRow.platform,\n+ deviceToken: cookieRow.device_token,\ncookieID,\ncookiePassword,\n},\n@@ -291,6 +295,7 @@ async function createNewAnonymousCookie(\nloggedIn: false,\nid,\nplatform,\n+ deviceToken: null,\ncookieID: id,\ncookiePassword,\ninsertionTime: time,\n@@ -318,6 +323,7 @@ async function createNewUserCookie(\nloggedIn: true,\nid: userID,\nplatform,\n+ deviceToken: null,\nuserID,\ncookieID,\ncookiePassword,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/session/viewer.js",
"new_path": "server/src/session/viewer.js",
"diff": "@@ -9,6 +9,7 @@ export type UserViewerData = {|\n+loggedIn: true,\n+id: string,\n+platform: ?Platform,\n+ +deviceToken: ?string,\n+userID: string,\n+cookieID: string,\n+cookiePassword: string,\n@@ -19,6 +20,7 @@ export type AnonymousViewerData = {|\n+loggedIn: false,\n+id: string,\n+platform: ?Platform,\n+ +deviceToken: ?string,\n+cookieID: string,\n+cookiePassword: string,\n+insertionTime?: ?number,\n@@ -97,6 +99,10 @@ class Viewer {\nreturn this.data.platform;\n}\n+ get deviceToken(): ?string {\n+ return this.data.deviceToken;\n+ }\n+\n}\nexport {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | ServerRequest and ClientResponse for when server is missing device token |
129,187 | 24.04.2018 01:06:33 | 14,400 | e5a896dd7bbf24a07f03a63d57fdbd7f9440d596 | [server] Forgot to add new DEVICE_TOKEN server request to input validator | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -38,6 +38,13 @@ const pingRequestInputValidator = tShape({\n),\nplatform: tPlatform,\n}),\n+ tShape({\n+ type: t.irreducible(\n+ 'serverRequestTypes.DEVICE_TOKEN',\n+ x => x === serverRequestTypes.DEVICE_TOKEN,\n+ ),\n+ deviceToken: t.String,\n+ }),\n)),\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Forgot to add new DEVICE_TOKEN server request to input validator |
129,187 | 24.04.2018 01:12:13 | 14,400 | 8cb7d137cd9f4d6be6cb3defbfd95cafe1acf016 | [server] Forgot the t.union operator in the last commit | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -30,7 +30,7 @@ const pingRequestInputValidator = tShape({\nmessagesCurrentAsOf: t.maybe(t.Number),\nupdatesCurrentAsOf: t.maybe(t.Number),\nwatchedIDs: t.list(t.String),\n- clientResponses: t.maybe(t.list(\n+ clientResponses: t.maybe(t.list(t.union([\ntShape({\ntype: t.irreducible(\n'serverRequestTypes.PLATFORM',\n@@ -45,7 +45,7 @@ const pingRequestInputValidator = tShape({\n),\ndeviceToken: t.String,\n}),\n- )),\n+ ]))),\n});\nasync function pingResponder(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Forgot the t.union operator in the last commit |
129,187 | 25.04.2018 01:33:26 | 14,400 | f5c43d77c2bc2d1ac73e8d610690d640e6ea81ab | [native] codeVersion -> 9 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 8\n- versionName \"0.0.8\"\n+ versionCode 9\n+ versionName \"0.0.9\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"8\"\n- android:versionName=\"0.0.8\"\n+ android:versionCode=\"9\"\n+ android:versionName=\"0.0.9\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.8</string>\n+ <string>0.0.9</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>8</string>\n+ <string>9</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -67,7 +67,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 8;\n+const codeVersion = 9;\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 -> 9 |
129,187 | 25.04.2018 10:52:27 | 14,400 | 36bdea9cac5121e1a5746e569d1786dc5d4ffe6e | [native] Hyperlink in RobotextMessage | [
{
"change_type": "MODIFY",
"old_path": "native/chat/robotext-message.react.js",
"new_path": "native/chat/robotext-message.react.js",
"diff": "@@ -11,11 +11,12 @@ import React from 'react';\nimport {\nText,\nStyleSheet,\n- View,\n+ TouchableWithoutFeedback,\n} from 'react-native';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\n+import Hyperlink from 'react-native-hyperlink';\nimport { messageKey, robotextToRawString } from 'lib/shared/message-utils';\nimport { includeDispatchActionProps } from 'lib/utils/action-utils';\n@@ -60,13 +61,9 @@ class RobotextMessage extends React.PureComponent<Props> {\nrender() {\nreturn (\n- <View\n- onStartShouldSetResponder={this.onStartShouldSetResponder}\n- onResponderGrant={this.onResponderGrant}\n- onResponderTerminationRequest={this.onResponderTerminationRequest}\n- >\n+ <TouchableWithoutFeedback onPress={this.onPress}>\n{this.linkedRobotext()}\n- </View>\n+ </TouchableWithoutFeedback>\n);\n}\n@@ -96,25 +93,23 @@ class RobotextMessage extends React.PureComponent<Props> {\nif (entityType === \"t\" && id !== this.props.item.messageInfo.threadID) {\ntextParts.push(<ThreadEntity key={id} id={id} name={rawText} />);\n- continue;\n} else if (entityType === \"c\") {\ntextParts.push(<ColorEntity key={id} color={rawText} />);\n- continue;\n- }\n-\n+ } else {\ntextParts.push(rawText);\n}\n- return <Text style={styles.robotext}>{textParts}</Text>;\n+ }\n+ return (\n+ <Hyperlink linkDefault={true} linkStyle={styles.link}>\n+ <Text style={styles.robotext}>{textParts}</Text>\n+ </Hyperlink>\n+ );\n}\n- onStartShouldSetResponder = () => true;\n-\n- onResponderGrant = () => {\n+ onPress = () => {\nthis.props.toggleFocus(messageKey(this.props.item.messageInfo));\n}\n- onResponderTerminationRequest = () => true;\n-\n}\ntype InnerThreadEntityProps = {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Hyperlink in RobotextMessage |
129,187 | 25.04.2018 11:19:52 | 14,400 | 5eccadd0367b6381202a9be8a44f9cd35c62d16f | [native] Fix up calendar session reset logic | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -183,6 +183,8 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nflatList: ?FlatList<CalendarItemWithHeight> = null;\ntextHeights: ?Map<string, number> = null;\ncurrentState: ?string = NativeAppState.currentState;\n+ lastForegrounded = 0;\n+ lastSessionReset = 0;\nloadingFromScroll = false;\ncurrentScrollPosition: ?number = null;\n// We don't always want an extraData update to trigger a state update, so we\n@@ -261,18 +263,25 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nhandleAppStateChange = (nextAppState: ?string) => {\n- // If upon foregrounding we find the session expired we scroll to today\nconst lastState = this.currentState;\nthis.currentState = nextAppState;\nif (\n- lastState &&\n- lastState.match(/inactive|background/) &&\n- this.currentState === \"active\" &&\n- this.props.sessionExpired() &&\n- !this.props.tabActive &&\n- this.flatList\n+ !lastState ||\n+ !lastState.match(/inactive|background/) ||\n+ this.currentState !== \"active\"\n) {\n- this.scrollToToday();\n+ // We're only handling foregrounding here\n+ return;\n+ }\n+ if (Date.now() - this.lastSessionReset < 500) {\n+ // If the session got reset right before this callback triggered, that\n+ // indicates we should reset the scroll position\n+ this.lastSessionReset = 0;\n+ this.scrollToToday(false);\n+ } else {\n+ // Otherwise, it's possible that the session is about to get reset. We\n+ // record a timestamp here so we can scrollToToday there.\n+ this.lastForegrounded = Date.now();\n}\n}\n@@ -355,13 +364,23 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\n}\n- // If the sessionID gets reset and the user isn't looking we scroll to today\nif (\nnextProps.sessionID !== this.props.sessionID &&\n- !nextProps.tabActive &&\nthis.flatList\n) {\n+ if (!nextProps.tabActive) {\n+ // If the sessionID gets reset and the user isn't looking we reset\nthis.scrollToToday();\n+ } else if (Date.now() - this.lastForegrounded < 500) {\n+ // If the app got foregrounded right before the session got reset, that\n+ // indicates we should reset the scroll position\n+ this.lastForegrounded = 0;\n+ this.scrollToToday(false);\n+ } else {\n+ // Otherwise, it's possible that the foreground callback is about to get\n+ // triggered. We record a timestamp here so we can scrollToToday there.\n+ this.lastSessionReset = Date.now();\n+ }\n}\nconst lastLDWH = this.state.listDataWithHeights;\n@@ -529,7 +548,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nthis.setState({ listDataWithHeights });\n}\n- scrollToToday = (animated: ?bool = undefined) => {\n+ scrollToToday(animated: ?bool = undefined) {\nif (animated === undefined) {\nanimated = this.props.tabActive;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix up calendar session reset logic |
129,187 | 25.04.2018 11:58:58 | 14,400 | 9411b02b0dc98b00b059fc1c14abd2f8ffef128c | [native] Make emoji-only messages have a larger font | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/shared/emojis.js",
"diff": "+// @flow\n+\n+const onlyEmojiRegex = /^(\\uD83C\\uDFF4\\uDB40\\uDC67\\uDB40\\uDC62(?:\\uDB40\\uDC65\\uDB40\\uDC6E\\uDB40\\uDC67|\\uDB40\\uDC77\\uDB40\\uDC6C\\uDB40\\uDC73|\\uDB40\\uDC73\\uDB40\\uDC63\\uDB40\\uDC74)\\uDB40\\uDC7F|\\uD83D\\uDC69\\u200D\\uD83D\\uDC69\\u200D(?:\\uD83D\\uDC66\\u200D\\uD83D\\uDC66|\\uD83D\\uDC67\\u200D(?:\\uD83D[\\uDC66\\uDC67]))|\\uD83D\\uDC68(?:\\u200D(?:\\u2764\\uFE0F\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83D\\uDC68|(?:\\uD83D[\\uDC68\\uDC69])\\u200D(?:\\uD83D\\uDC66\\u200D\\uD83D\\uDC66|\\uD83D\\uDC67\\u200D(?:\\uD83D[\\uDC66\\uDC67]))|\\uD83D\\uDC66\\u200D\\uD83D\\uDC66|\\uD83D\\uDC67\\u200D(?:\\uD83D[\\uDC66\\uDC67])|[\\u2695\\u2696\\u2708]\\uFE0F|\\uD83C[\\uDF3E\\uDF73\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D[\\u2695\\u2696\\u2708]\\uFE0F|(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D(?:\\uD83C[\\uDF3E\\uDF73\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]))|\\uD83D\\uDC69\\u200D(?:\\u2764\\uFE0F\\u200D(?:\\uD83D\\uDC8B\\u200D(?:\\uD83D[\\uDC68\\uDC69])|\\uD83D[\\uDC68\\uDC69])|\\uD83C[\\uDF3E\\uDF73\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83D\\uDC69\\u200D\\uD83D\\uDC66\\u200D\\uD83D\\uDC66|(?:\\uD83D\\uDC41\\uFE0F\\u200D\\uD83D\\uDDE8|\\uD83D\\uDC69(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D[\\u2695\\u2696\\u2708]|(?:(?:\\u26F9|\\uD83C[\\uDFCB\\uDFCC]|\\uD83D\\uDD75)\\uFE0F|\\uD83D\\uDC6F|\\uD83E[\\uDD3C\\uDDDE\\uDDDF])\\u200D[\\u2640\\u2642]|(?:\\u26F9|\\uD83C[\\uDFCB\\uDFCC]|\\uD83D\\uDD75)(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D[\\u2640\\u2642]|(?:\\uD83C[\\uDFC3\\uDFC4\\uDFCA]|\\uD83D[\\uDC6E\\uDC71\\uDC73\\uDC77\\uDC81\\uDC82\\uDC86\\uDC87\\uDE45-\\uDE47\\uDE4B\\uDE4D\\uDE4E\\uDEA3\\uDEB4-\\uDEB6]|\\uD83E[\\uDD26\\uDD37-\\uDD39\\uDD3D\\uDD3E\\uDDD6-\\uDDDD])(?:(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D[\\u2640\\u2642]|\\u200D[\\u2640\\u2642])|\\uD83D\\uDC69\\u200D[\\u2695\\u2696\\u2708])\\uFE0F|\\uD83D\\uDC69\\u200D\\uD83D\\uDC67\\u200D(?:\\uD83D[\\uDC66\\uDC67])|\\uD83D\\uDC69\\u200D\\uD83D\\uDC69\\u200D(?:\\uD83D[\\uDC66\\uDC67])|\\uD83D\\uDC68(?:\\u200D(?:(?:\\uD83D[\\uDC68\\uDC69])\\u200D(?:\\uD83D[\\uDC66\\uDC67])|\\uD83D[\\uDC66\\uDC67])|\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C\\uDFF3\\uFE0F\\u200D\\uD83C\\uDF08|\\uD83D\\uDC69\\u200D\\uD83D\\uDC67|\\uD83D\\uDC69(?:\\uD83C[\\uDFFB-\\uDFFF])\\u200D(?:\\uD83C[\\uDF3E\\uDF73\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83D\\uDC69\\u200D\\uD83D\\uDC66|\\uD83C\\uDDF4\\uD83C\\uDDF2|\\uD83C\\uDDFD\\uD83C\\uDDF0|\\uD83C\\uDDF6\\uD83C\\uDDE6|\\uD83D\\uDC69(?:\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C\\uDDFC(?:\\uD83C[\\uDDEB\\uDDF8])|\\uD83C\\uDDEB(?:\\uD83C[\\uDDEE-\\uDDF0\\uDDF2\\uDDF4\\uDDF7])|\\uD83C\\uDDE9(?:\\uD83C[\\uDDEA\\uDDEC\\uDDEF\\uDDF0\\uDDF2\\uDDF4\\uDDFF])|\\uD83C\\uDDE7(?:\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEF\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9\\uDDFB\\uDDFC\\uDDFE\\uDDFF])|\\uD83C\\uDDF1(?:\\uD83C[\\uDDE6-\\uDDE8\\uDDEE\\uDDF0\\uDDF7-\\uDDFB\\uDDFE])|\\uD83C\\uDDFE(?:\\uD83C[\\uDDEA\\uDDF9])|\\uD83C\\uDDF9(?:\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDED\\uDDEF-\\uDDF4\\uDDF7\\uDDF9\\uDDFB\\uDDFC\\uDDFF])|\\uD83C\\uDDF5(?:\\uD83C[\\uDDE6\\uDDEA-\\uDDED\\uDDF0-\\uDDF3\\uDDF7-\\uDDF9\\uDDFC\\uDDFE])|\\uD83C\\uDDEF(?:\\uD83C[\\uDDEA\\uDDF2\\uDDF4\\uDDF5])|\\uD83C\\uDDED(?:\\uD83C[\\uDDF0\\uDDF2\\uDDF3\\uDDF7\\uDDF9\\uDDFA])|\\uD83C\\uDDEE(?:\\uD83C[\\uDDE8-\\uDDEA\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9])|\\uD83C\\uDDFB(?:\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDEE\\uDDF3\\uDDFA])|\\uD83C\\uDDEC(?:\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEE\\uDDF1-\\uDDF3\\uDDF5-\\uDDFA\\uDDFC\\uDDFE])|\\uD83C\\uDDF7(?:\\uD83C[\\uDDEA\\uDDF4\\uDDF8\\uDDFA\\uDDFC])|\\uD83C\\uDDEA(?:\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDED\\uDDF7-\\uDDFA])|\\uD83C\\uDDFA(?:\\uD83C[\\uDDE6\\uDDEC\\uDDF2\\uDDF3\\uDDF8\\uDDFE\\uDDFF])|\\uD83C\\uDDE8(?:\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDEE\\uDDF0-\\uDDF5\\uDDF7\\uDDFA-\\uDDFF])|\\uD83C\\uDDE6(?:\\uD83C[\\uDDE8-\\uDDEC\\uDDEE\\uDDF1\\uDDF2\\uDDF4\\uDDF6-\\uDDFA\\uDDFC\\uDDFD\\uDDFF])|[#\\*0-9]\\uFE0F\\u20E3|\\uD83C\\uDDF8(?:\\uD83C[\\uDDE6-\\uDDEA\\uDDEC-\\uDDF4\\uDDF7-\\uDDF9\\uDDFB\\uDDFD-\\uDDFF])|\\uD83C\\uDDFF(?:\\uD83C[\\uDDE6\\uDDF2\\uDDFC])|\\uD83C\\uDDF0(?:\\uD83C[\\uDDEA\\uDDEC-\\uDDEE\\uDDF2\\uDDF3\\uDDF5\\uDDF7\\uDDFC\\uDDFE\\uDDFF])|\\uD83C\\uDDF3(?:\\uD83C[\\uDDE6\\uDDE8\\uDDEA-\\uDDEC\\uDDEE\\uDDF1\\uDDF4\\uDDF5\\uDDF7\\uDDFA\\uDDFF])|\\uD83C\\uDDF2(?:\\uD83C[\\uDDE6\\uDDE8-\\uDDED\\uDDF0-\\uDDFF])|(?:\\uD83C[\\uDFC3\\uDFC4\\uDFCA]|\\uD83D[\\uDC6E\\uDC71\\uDC73\\uDC77\\uDC81\\uDC82\\uDC86\\uDC87\\uDE45-\\uDE47\\uDE4B\\uDE4D\\uDE4E\\uDEA3\\uDEB4-\\uDEB6]|\\uD83E[\\uDD26\\uDD37-\\uDD39\\uDD3D\\uDD3E\\uDDD6-\\uDDDD])(?:\\uD83C[\\uDFFB-\\uDFFF])|(?:\\u26F9|\\uD83C[\\uDFCB\\uDFCC]|\\uD83D\\uDD75)(?:\\uD83C[\\uDFFB-\\uDFFF])|(?:[\\u261D\\u270A-\\u270D]|\\uD83C[\\uDF85\\uDFC2\\uDFC7]|\\uD83D[\\uDC42\\uDC43\\uDC46-\\uDC50\\uDC66\\uDC67\\uDC70\\uDC72\\uDC74-\\uDC76\\uDC78\\uDC7C\\uDC83\\uDC85\\uDCAA\\uDD74\\uDD7A\\uDD90\\uDD95\\uDD96\\uDE4C\\uDE4F\\uDEC0\\uDECC]|\\uD83E[\\uDD18-\\uDD1C\\uDD1E\\uDD1F\\uDD30-\\uDD36\\uDDD1-\\uDDD5])(?:\\uD83C[\\uDFFB-\\uDFFF])|(?:[\\u261D\\u26F9\\u270A-\\u270D]|\\uD83C[\\uDF85\\uDFC2-\\uDFC4\\uDFC7\\uDFCA-\\uDFCC]|\\uD83D[\\uDC42\\uDC43\\uDC46-\\uDC50\\uDC66-\\uDC69\\uDC6E\\uDC70-\\uDC78\\uDC7C\\uDC81-\\uDC83\\uDC85-\\uDC87\\uDCAA\\uDD74\\uDD75\\uDD7A\\uDD90\\uDD95\\uDD96\\uDE45-\\uDE47\\uDE4B-\\uDE4F\\uDEA3\\uDEB4-\\uDEB6\\uDEC0\\uDECC]|\\uD83E[\\uDD18-\\uDD1C\\uDD1E\\uDD1F\\uDD26\\uDD30-\\uDD39\\uDD3D\\uDD3E\\uDDD1-\\uDDDD])(?:\\uD83C[\\uDFFB-\\uDFFF])?|(?:[\\u231A\\u231B\\u23E9-\\u23EC\\u23F0\\u23F3\\u25FD\\u25FE\\u2614\\u2615\\u2648-\\u2653\\u267F\\u2693\\u26A1\\u26AA\\u26AB\\u26BD\\u26BE\\u26C4\\u26C5\\u26CE\\u26D4\\u26EA\\u26F2\\u26F3\\u26F5\\u26FA\\u26FD\\u2705\\u270A\\u270B\\u2728\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2795-\\u2797\\u27B0\\u27BF\\u2B1B\\u2B1C\\u2B50\\u2B55]|\\uD83C[\\uDC04\\uDCCF\\uDD8E\\uDD91-\\uDD9A\\uDDE6-\\uDDFF\\uDE01\\uDE1A\\uDE2F\\uDE32-\\uDE36\\uDE38-\\uDE3A\\uDE50\\uDE51\\uDF00-\\uDF20\\uDF2D-\\uDF35\\uDF37-\\uDF7C\\uDF7E-\\uDF93\\uDFA0-\\uDFCA\\uDFCF-\\uDFD3\\uDFE0-\\uDFF0\\uDFF4\\uDFF8-\\uDFFF]|\\uD83D[\\uDC00-\\uDC3E\\uDC40\\uDC42-\\uDCFC\\uDCFF-\\uDD3D\\uDD4B-\\uDD4E\\uDD50-\\uDD67\\uDD7A\\uDD95\\uDD96\\uDDA4\\uDDFB-\\uDE4F\\uDE80-\\uDEC5\\uDECC\\uDED0-\\uDED2\\uDEEB\\uDEEC\\uDEF4-\\uDEF8]|\\uD83E[\\uDD10-\\uDD3A\\uDD3C-\\uDD3E\\uDD40-\\uDD45\\uDD47-\\uDD4C\\uDD50-\\uDD6B\\uDD80-\\uDD97\\uDDC0\\uDDD0-\\uDDE6])|(?:[#\\*0-9\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u23CF\\u23E9-\\u23F3\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB-\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614\\u2615\\u2618\\u261D\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267F\\u2692-\\u2697\\u2699\\u269B\\u269C\\u26A0\\u26A1\\u26AA\\u26AB\\u26B0\\u26B1\\u26BD\\u26BE\\u26C4\\u26C5\\u26C8\\u26CE\\u26CF\\u26D1\\u26D3\\u26D4\\u26E9\\u26EA\\u26F0-\\u26F5\\u26F7-\\u26FA\\u26FD\\u2702\\u2705\\u2708-\\u270D\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2728\\u2733\\u2734\\u2744\\u2747\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2763\\u2764\\u2795-\\u2797\\u27A1\\u27B0\\u27BF\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B50\\u2B55\\u3030\\u303D\\u3297\\u3299]|\\uD83C[\\uDC04\\uDCCF\\uDD70\\uDD71\\uDD7E\\uDD7F\\uDD8E\\uDD91-\\uDD9A\\uDDE6-\\uDDFF\\uDE01\\uDE02\\uDE1A\\uDE2F\\uDE32-\\uDE3A\\uDE50\\uDE51\\uDF00-\\uDF21\\uDF24-\\uDF93\\uDF96\\uDF97\\uDF99-\\uDF9B\\uDF9E-\\uDFF0\\uDFF3-\\uDFF5\\uDFF7-\\uDFFF]|\\uD83D[\\uDC00-\\uDCFD\\uDCFF-\\uDD3D\\uDD49-\\uDD4E\\uDD50-\\uDD67\\uDD6F\\uDD70\\uDD73-\\uDD7A\\uDD87\\uDD8A-\\uDD8D\\uDD90\\uDD95\\uDD96\\uDDA4\\uDDA5\\uDDA8\\uDDB1\\uDDB2\\uDDBC\\uDDC2-\\uDDC4\\uDDD1-\\uDDD3\\uDDDC-\\uDDDE\\uDDE1\\uDDE3\\uDDE8\\uDDEF\\uDDF3\\uDDFA-\\uDE4F\\uDE80-\\uDEC5\\uDECB-\\uDED2\\uDEE0-\\uDEE5\\uDEE9\\uDEEB\\uDEEC\\uDEF0\\uDEF3-\\uDEF8]|\\uD83E[\\uDD10-\\uDD3A\\uDD3C-\\uDD3E\\uDD40-\\uDD45\\uDD47-\\uDD4C\\uDD50-\\uDD6B\\uDD80-\\uDD97\\uDDC0\\uDDD0-\\uDDE6])\\uFE0F)+$/;\n+\n+export {\n+ onlyEmojiRegex,\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -46,6 +46,7 @@ import threadWatcher from 'lib/shared/thread-watcher';\nimport { viewerIsMember } from 'lib/shared/thread-utils';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\n+import { onlyEmojiRegex } from 'lib/shared/emojis';\nimport { messageListData } from '../selectors/chat-selectors';\nimport { Message, messageItemHeight } from './message.react';\n@@ -196,10 +197,13 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n}\nconst messageInfo = item.messageInfo;\nif (messageInfo.type === messageTypes.TEXT) {\n+ const style = onlyEmojiRegex.test(messageInfo.text)\n+ ? styles.emojiOnlyText\n+ : styles.text;\ntextToMeasure.push({\nid: messageKey(messageInfo),\ntext: messageInfo.text,\n- style: styles.text,\n+ style,\n});\n} else {\ninvariant(\n@@ -410,12 +414,6 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n}\nrender() {\n- const textHeightMeasurer = (\n- <TextHeightMeasurer\n- textToMeasure={this.state.textToMeasure}\n- allHeightsMeasuredCallback={this.allHeightsMeasured}\n- />\n- );\nconst listDataWithHeights = this.state.listDataWithHeights;\nlet flatList = null;\nif (listDataWithHeights) {\n@@ -452,7 +450,10 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nreturn (\n<KeyboardAvoidingView style={styles.container}>\n- {textHeightMeasurer}\n+ <TextHeightMeasurer\n+ textToMeasure={this.state.textToMeasure}\n+ allHeightsMeasuredCallback={this.allHeightsMeasured}\n+ />\n<View style={styles.flatListContainer}>\n{flatList}\n</View>\n@@ -539,6 +540,12 @@ const styles = StyleSheet.create({\nfontSize: 18,\nfontFamily: 'Arial',\n},\n+ emojiOnlyText: {\n+ left: 24,\n+ right: 24,\n+ fontSize: 36,\n+ fontFamily: 'Arial',\n+ },\nrobotext: {\nleft: 24,\nright: 24,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/text-message.react.js",
"new_path": "native/chat/text-message.react.js",
"diff": "@@ -22,6 +22,7 @@ import Hyperlink from 'react-native-hyperlink';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport { messageKey } from 'lib/shared/message-utils';\nimport { stringForUser } from 'lib/shared/user-utils';\n+import { onlyEmojiRegex } from 'lib/shared/emojis';\nimport Tooltip from '../components/tooltip.react';\n@@ -78,17 +79,17 @@ class TextMessage extends React.PureComponent<Props> {\nconst isViewer = this.props.item.messageInfo.creator.isViewer;\nlet containerStyle = null,\nmessageStyle = {},\n- textStyle = {};\n+ textCustomStyle = {};\nlet darkColor = false;\nif (isViewer) {\ncontainerStyle = { alignSelf: 'flex-end' };\nmessageStyle.backgroundColor = `#${this.props.threadInfo.color}`;\ndarkColor = colorIsDark(this.props.threadInfo.color);\n- textStyle.color = darkColor ? 'white' : 'black';\n+ textCustomStyle.color = darkColor ? 'white' : 'black';\n} else {\ncontainerStyle = { alignSelf: 'flex-start' };\nmessageStyle.backgroundColor = \"#DDDDDDBB\";\n- textStyle.color = 'black';\n+ textCustomStyle.color = 'black';\n}\nlet authorName = null;\nif (!isViewer && this.props.item.startsCluster) {\n@@ -111,7 +112,7 @@ class TextMessage extends React.PureComponent<Props> {\nmessageStyle.backgroundColor =\nColor(messageStyle.backgroundColor).darken(0.15).hex();\n}\n- textStyle.height = this.props.item.textHeight;\n+ textCustomStyle.height = this.props.item.textHeight;\ninvariant(\nthis.props.item.messageInfo.type === messageTypes.TEXT,\n@@ -120,13 +121,16 @@ class TextMessage extends React.PureComponent<Props> {\nconst text = this.props.item.messageInfo.text;\nconst linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\n+ const textStyle = onlyEmojiRegex.test(text)\n+ ? styles.emojiOnlyText\n+ : styles.text;\nconst content = (\n<View style={[styles.message, messageStyle]}>\n<Hyperlink linkDefault={true} linkStyle={linkStyle}>\n<Text\nonPress={this.onPress}\nonLongPress={this.onPress}\n- style={[styles.text, textStyle]}\n+ style={[textStyle, textCustomStyle]}\n>{text}</Text>\n</Hyperlink>\n</View>\n@@ -189,6 +193,10 @@ const styles = StyleSheet.create({\nfontSize: 18,\nfontFamily: 'Arial',\n},\n+ emojiOnlyText: {\n+ fontSize: 36,\n+ fontFamily: 'Arial',\n+ },\nmessage: {\noverflow: 'hidden',\npaddingVertical: 6,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Make emoji-only messages have a larger font |
129,187 | 25.04.2018 14:34:29 | 14,400 | 2b7fc09cd18b853fcc65e095788e374734271a33 | [server] Display old thread name in thread name change notif | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -29,6 +29,7 @@ import {\nrawThreadInfoFromServerThreadInfo,\nthreadInfoFromRawThreadInfo,\n} from 'lib/shared/thread-utils';\n+import { promiseAll } from 'lib/utils/promises';\nimport { dbQuery, SQL, mergeOrConditions } from '../database';\nimport { apnPush, fcmPush, getUnreadCounts } from './utils';\n@@ -240,6 +241,7 @@ async function fetchInfos(pushInfo: PushInfo) {\nconst collapsableNotifsResult = await fetchCollapsableNotifs(pushInfo);\nconst threadIDs = new Set();\n+ const threadWithChangedNamesToMessages = new Map();\nconst addThreadIDsFromMessageInfos = (rawMessageInfo: RawMessageInfo) => {\nthreadIDs.add(rawMessageInfo.threadID);\nif (\n@@ -260,18 +262,74 @@ async function fetchInfos(pushInfo: PushInfo) {\n}\nfor (let rawMessageInfo of notifInfo.newMessageInfos) {\naddThreadIDsFromMessageInfos(rawMessageInfo);\n+ if (\n+ rawMessageInfo.type === messageTypes.CHANGE_SETTINGS &&\n+ rawMessageInfo.field === \"name\"\n+ ) {\n+ const threadID = rawMessageInfo.threadID;\n+ const messages = threadWithChangedNamesToMessages.get(threadID);\n+ if (messages) {\n+ messages.push(rawMessageInfo.id);\n+ } else {\n+ threadWithChangedNamesToMessages.set(threadID, [rawMessageInfo.id]);\n+ }\n+ }\n+ }\n+ }\n}\n+\n+ const promises = {};\n+ promises.threadResult =\n+ fetchServerThreadInfos(SQL`t.id IN (${[...threadIDs]})`);\n+ if (threadWithChangedNamesToMessages.size > 0) {\n+ const typesThatAffectName = [\n+ messageTypes.CHANGE_SETTINGS,\n+ messageTypes.CREATE_THREAD,\n+ ];\n+ const oldNameQuery = SQL`\n+ SELECT IF(\n+ JSON_TYPE(JSON_EXTRACT(m.content, \"$.name\")) = 'NULL',\n+ \"\",\n+ JSON_UNQUOTE(JSON_EXTRACT(m.content, \"$.name\"))\n+ ) AS name, m.thread\n+ FROM (\n+ SELECT MAX(id) AS id\n+ FROM messages\n+ WHERE type IN (${typesThatAffectName})\n+ AND JSON_EXTRACT(content, \"$.name\") IS NOT NULL\n+ AND`;\n+ const threadClauses = [];\n+ for (let [threadID, messages] of threadWithChangedNamesToMessages) {\n+ threadClauses.push(\n+ SQL`(thread = ${threadID} AND id NOT IN (${messages}))`,\n+ );\n}\n+ oldNameQuery.append(mergeOrConditions(threadClauses));\n+ oldNameQuery.append(SQL`\n+ GROUP BY thread\n+ ) x\n+ LEFT JOIN messages m ON m.id = x.id\n+ `);\n+ promises.oldNames = dbQuery(oldNameQuery);\n}\n+ const { threadResult, oldNames } = await promiseAll(promises);\n// These threadInfos won't have currentUser set\n- const { threadInfos: serverThreadInfos, userInfos: threadUserInfos } =\n- await fetchServerThreadInfos(SQL`t.id IN (${[...threadIDs]})`);\n+ const { threadInfos: serverThreadInfos, userInfos: threadUserInfos }\n+ = threadResult;\nconst mergedUserInfos = {\n...collapsableNotifsResult.userInfos,\n...threadUserInfos,\n};\n+ if (oldNames) {\n+ const [ result ] = oldNames;\n+ for (let row of result) {\n+ const threadID = row.thread.toString();\n+ serverThreadInfos[threadID].name = row.name;\n+ }\n+ }\n+\nconst userInfos = await fetchMissingUserInfos(\nmergedUserInfos,\nusersToCollapsableNotifInfo,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Display old thread name in thread name change notif |
129,187 | 25.04.2018 14:43:05 | 14,400 | 9cf9009575158c4d0dbedd5905285abdd7ec703c | [server] When collapsing two name change notifs, use the original name | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/send.js",
"new_path": "server/src/push/send.js",
"diff": "@@ -243,7 +243,8 @@ async function fetchInfos(pushInfo: PushInfo) {\nconst threadIDs = new Set();\nconst threadWithChangedNamesToMessages = new Map();\nconst addThreadIDsFromMessageInfos = (rawMessageInfo: RawMessageInfo) => {\n- threadIDs.add(rawMessageInfo.threadID);\n+ const threadID = rawMessageInfo.threadID;\n+ threadIDs.add(threadID);\nif (\nrawMessageInfo.type === messageTypes.CREATE_THREAD &&\nrawMessageInfo.initialThreadState.parentThreadID\n@@ -252,21 +253,10 @@ async function fetchInfos(pushInfo: PushInfo) {\n} else if (rawMessageInfo.type === messageTypes.CREATE_SUB_THREAD) {\nthreadIDs.add(rawMessageInfo.childThreadID);\n}\n- };\n- const usersToCollapsableNotifInfo =\n- collapsableNotifsResult.usersToCollapsableNotifInfo;\n- for (let userID in usersToCollapsableNotifInfo) {\n- for (let notifInfo of usersToCollapsableNotifInfo[userID]) {\n- for (let rawMessageInfo of notifInfo.existingMessageInfos) {\n- addThreadIDsFromMessageInfos(rawMessageInfo);\n- }\n- for (let rawMessageInfo of notifInfo.newMessageInfos) {\n- addThreadIDsFromMessageInfos(rawMessageInfo);\nif (\nrawMessageInfo.type === messageTypes.CHANGE_SETTINGS &&\nrawMessageInfo.field === \"name\"\n) {\n- const threadID = rawMessageInfo.threadID;\nconst messages = threadWithChangedNamesToMessages.get(threadID);\nif (messages) {\nmessages.push(rawMessageInfo.id);\n@@ -274,6 +264,16 @@ async function fetchInfos(pushInfo: PushInfo) {\nthreadWithChangedNamesToMessages.set(threadID, [rawMessageInfo.id]);\n}\n}\n+ };\n+ const usersToCollapsableNotifInfo =\n+ collapsableNotifsResult.usersToCollapsableNotifInfo;\n+ for (let userID in usersToCollapsableNotifInfo) {\n+ for (let notifInfo of usersToCollapsableNotifInfo[userID]) {\n+ for (let rawMessageInfo of notifInfo.existingMessageInfos) {\n+ addThreadIDsFromMessageInfos(rawMessageInfo);\n+ }\n+ for (let rawMessageInfo of notifInfo.newMessageInfos) {\n+ addThreadIDsFromMessageInfos(rawMessageInfo);\n}\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] When collapsing two name change notifs, use the original name |
129,187 | 26.04.2018 11:21:02 | 14,400 | a6ef225395f9d2fae00c3a43f1f1d6d3e08c788b | [native] Account for potential lag between setTimeout in pingNow and PING_STARTED | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -341,10 +341,13 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nreturn false;\n}\nconst lastPingStart = props.pingTimestamps.lastStarted;\n- const timeUntilNextPing = lastPingStart + pingFrequency - Date.now();\n- if (this.pingCounter === 0 && lastPingStart < Date.now() - pingFrequency) {\n+ const now = Date.now();\n+ // We add 10 to the timing check below to account for potential lag between\n+ // the setTimeout call in pingNow and when PING_STARTED gets processed by\n+ // the reducer\n+ if (this.pingCounter === 0 && lastPingStart < now - pingFrequency + 10) {\nreturn true;\n- } else if (lastPingStart < Date.now() - pingFrequency * 10) {\n+ } else if (lastPingStart < now - pingFrequency * 10) {\n// It seems we have encountered some error state where ping isn't firing\nthis.pingCounter = 0;\nreturn true;\n@@ -356,7 +359,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nconst appState = inputAppState ? inputAppState : this.currentState;\nconst props = inputProps ? inputProps : this.props;\nif (this.shouldDispatchPing(props, appState)) {\n- this.pingNow(inputProps);\n+ this.pingNow(props);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Account for potential lag between setTimeout in pingNow and PING_STARTED |
129,187 | 26.04.2018 11:57:18 | 14,400 | 7e94dbb8cc408841ee566cc3a2020058cc813ffe | [native] codeVersion -> 10 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 9\n- versionName \"0.0.9\"\n+ versionCode 10\n+ versionName \"0.0.10\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"9\"\n- android:versionName=\"0.0.9\"\n+ android:versionCode=\"10\"\n+ android:versionName=\"0.0.10\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.9</string>\n+ <string>0.0.10</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>9</string>\n+ <string>10</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -67,7 +67,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 9;\n+const codeVersion = 10;\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 -> 10 |
129,187 | 26.04.2018 12:13:27 | 14,400 | 9119e7d2a15e70e69d45163f3786ce93922e667e | [native] codeVersion -> 11
Something is going wrong with Apple's upload process and they think I need some sort of permissions. I'm going to try again without any changes, and then probably add the weird permission things and increment `codeVersion` to 12 sadly. | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -109,8 +109,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion 16\ntargetSdkVersion 22\n- versionCode 10\n- versionName \"0.0.10\"\n+ versionCode 11\n+ versionName \"0.0.11\"\nndk {\nabiFilters \"armeabi-v7a\", \"x86\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"10\"\n- android:versionName=\"0.0.10\"\n+ android:versionCode=\"11\"\n+ android:versionName=\"0.0.11\"\n>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.10</string>\n+ <string>0.0.11</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>10</string>\n+ <string>11</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -67,7 +67,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 10;\n+const codeVersion = 11;\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 -> 11
Something is going wrong with Apple's upload process and they think I need some sort of permissions. I'm going to try again without any changes, and then probably add the weird permission things and increment `codeVersion` to 12 sadly. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.