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 | 12.02.2018 14:33:28 | 18,000 | 695cc5fd952eceb30a2de7d9ef01d6f97f876c2c | First actual version of more tab | [
{
"change_type": "MODIFY",
"old_path": "native/components/button.react.js",
"new_path": "native/components/button.react.js",
"diff": "@@ -18,7 +18,7 @@ import PropTypes from 'prop-types';\nconst ANDROID_VERSION_LOLLIPOP = 21;\ntype Props = {\n- onPress: () => void,\n+ onPress: () => *,\ndisabled?: bool,\nstyle?: StyleObj,\n// style and topStyle just get merged in most cases. The separation only\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | First actual version of more tab |
129,187 | 12.02.2018 14:48:16 | 18,000 | 0fa219c0df0eccd8890cf1848652f2f1ab66e283 | Add a StackNavigator for More | [
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -59,7 +59,8 @@ import {\nChatRouteName,\n} from './chat/chat.react';\nimport { ChatThreadListRouteName } from './chat/chat-thread-list.react';\n-import More from './more/more.react';\n+import { MoreRouteName, More } from './more/more.react';\n+import { MoreScreenRouteName } from './more/more-screen.react';\nimport {\nLoggedOutModal,\nLoggedOutModalRouteName,\n@@ -104,7 +105,7 @@ const AppNavigator = TabNavigator(\n{\n[CalendarRouteName]: { screen: Calendar },\n[ChatRouteName]: { screen: Chat },\n- More: { screen: More },\n+ [MoreRouteName]: { screen: More },\n},\n{\ninitialRouteName: CalendarRouteName,\n@@ -207,7 +208,14 @@ const defaultNavigationState = {\n{ key: 'ChatThreadList', routeName: ChatThreadListRouteName },\n],\n},\n- { key: 'More', routeName: 'More' },\n+ {\n+ key: 'More',\n+ routeName: MoreRouteName,\n+ index: 0,\n+ routes: [\n+ { key: 'MoreScreen', routeName: MoreScreenRouteName },\n+ ],\n+ },\n],\n},\n{ key: 'LoggedOutModal', routeName: LoggedOutModalRouteName },\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add a StackNavigator for More |
129,187 | 12.02.2018 22:51:04 | 18,000 | ce5a2d26fe511e41f031ea6d71bf3f5750eb8c72 | EditEmail/EditPassword and EditSettingButton in MoreScreen | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -92,6 +92,8 @@ type ExtraData = {\n// defined navigationOptions.tabBarOnPress below.\nlet currentCalendarRef: ?InnerCalendar = null;\n+const forceInset = { top: 'always', bottom: 'never' };\n+\ntype Props = {\nnavigation: NavigationScreenProp<NavigationRoute>,\n// Redux state\n@@ -671,10 +673,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n);\n}\nreturn (\n- <SafeAreaView\n- forceInset={{ top: 'always', bottom: 'never' }}\n- style={styles.container}\n- >\n+ <SafeAreaView forceInset={forceInset} style={styles.container}>\n<TextHeightMeasurer\ntextToMeasure={this.state.textToMeasure}\nallHeightsMeasuredCallback={this.allHeightsMeasured}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-color.react.js",
"new_path": "native/chat/settings/thread-settings-color.react.js",
"diff": "@@ -30,7 +30,7 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import EditSettingButton from './edit-setting-button.react';\n+import EditSettingButton from '../../components/edit-setting-button.react';\nimport ColorSplotch from '../../components/color-splotch.react';\nimport ColorPickerModal from '../color-picker-modal.react';\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-description.react.js",
"new_path": "native/chat/settings/thread-settings-description.react.js",
"diff": "@@ -33,7 +33,7 @@ import {\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadHasPermission } from 'lib/shared/thread-utils';\n-import EditSettingButton from './edit-setting-button.react';\n+import EditSettingButton from '../../components/edit-setting-button.react';\nimport SaveSettingButton from './save-setting-button.react';\nimport {\nThreadSettingsCategoryHeader,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-member.react.js",
"new_path": "native/chat/settings/thread-settings-member.react.js",
"diff": "@@ -42,7 +42,7 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import EditSettingButton from './edit-setting-button.react';\n+import EditSettingButton from '../../components/edit-setting-button.react';\nimport Button from '../../components/button.react';\ntype Props = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-name.react.js",
"new_path": "native/chat/settings/thread-settings-name.react.js",
"diff": "@@ -8,7 +8,7 @@ import type { LoadingStatus } from 'lib/types/loading-types';\nimport { loadingStatusPropType } from 'lib/types/loading-types';\nimport type { AppState } from '../../redux-setup';\n-import React from 'react';\n+import * as React from 'react';\nimport {\nText,\nStyleSheet,\n@@ -31,7 +31,7 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import EditSettingButton from './edit-setting-button.react';\n+import EditSettingButton from '../../components/edit-setting-button.react';\nimport SaveSettingButton from './save-setting-button.react';\ntype Props = {|\n@@ -81,20 +81,20 @@ class ThreadSettingsName extends React.PureComponent<Props> {\nthis.props.nameEditValue === null ||\nthis.props.nameEditValue === undefined\n) {\n- return [\n+ return (\n+ <React.Fragment>\n<Text\nstyle={styles.currentValue}\nonLayout={this.onLayoutText}\n- key=\"text\"\n>\n{this.props.threadInfo.uiName}\n- </Text>,\n+ </Text>\n<EditSettingButton\nonPress={this.onPressEdit}\ncanChangeSettings={this.props.canChangeSettings}\n- key=\"editButton\"\n- />,\n- ];\n+ />\n+ </React.Fragment>\n+ );\n}\nlet button;\n@@ -117,7 +117,8 @@ class ThreadSettingsName extends React.PureComponent<Props> {\ntextInputStyle.height = this.props.nameTextHeight;\n}\n- return [\n+ return (\n+ <React.Fragment>\n<TextInput\nstyle={[styles.currentValue, textInputStyle]}\nunderlineColorAndroid=\"transparent\"\n@@ -131,9 +132,10 @@ class ThreadSettingsName extends React.PureComponent<Props> {\nonContentSizeChange={this.onTextInputContentSizeChange}\nref={this.textInputRef}\nkey=\"textInput\"\n- />,\n- button,\n- ];\n+ />\n+ {button}\n+ </React.Fragment>\n+ );\n}\ntextInputRef = (textInput: ?TextInput) => {\n"
},
{
"change_type": "RENAME",
"old_path": "native/chat/settings/edit-setting-button.react.js",
"new_path": "native/components/edit-setting-button.react.js",
"diff": ""
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/edit-email.react.js",
"diff": "+// @flow\n+\n+import type { AppState } from '../redux-setup';\n+import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import type { ChangeUserSettingsResult } from 'lib/actions/user-actions';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import { Text } from 'react-native';\n+import { connect } from 'react-redux';\n+import { SafeAreaView } from 'react-navigation';\n+\n+import {\n+ includeDispatchActionProps,\n+ bindServerCalls,\n+} from 'lib/utils/action-utils';\n+import {\n+ changeUserSettingsActionTypes,\n+ changeUserSettings,\n+} from 'lib/actions/user-actions';\n+\n+const forceInset = { top: 'always', bottom: 'never' };\n+\n+type Props = {\n+ // Redux state\n+ // Redux dispatch functions\n+ dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ changeUserSettings: (\n+ currentPassword: string,\n+ newEmail: string,\n+ newPassword: string,\n+ ) => Promise<ChangeUserSettingsResult>,\n+};\n+class InnerEditEmail extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ changeUserSettings: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ return (\n+ <SafeAreaView forceInset={forceInset}>\n+ <Text>Email</Text>\n+ </SafeAreaView>\n+ );\n+ }\n+\n+}\n+\n+const EditEmailRouteName = 'EditEmail';\n+const EditEmail = connect(\n+ (state: AppState) => ({\n+ cookie: state.cookie,\n+ }),\n+ includeDispatchActionProps,\n+ bindServerCalls({ changeUserSettings }),\n+)(InnerEditEmail);\n+\n+export {\n+ EditEmail,\n+ EditEmailRouteName,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/edit-password.react.js",
"diff": "+// @flow\n+\n+import type { AppState } from '../redux-setup';\n+import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import type { ChangeUserSettingsResult } from 'lib/actions/user-actions';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import { Text } from 'react-native';\n+import { connect } from 'react-redux';\n+import { SafeAreaView } from 'react-navigation';\n+\n+import {\n+ includeDispatchActionProps,\n+ bindServerCalls,\n+} from 'lib/utils/action-utils';\n+import {\n+ changeUserSettingsActionTypes,\n+ changeUserSettings,\n+} from 'lib/actions/user-actions';\n+\n+const forceInset = { top: 'always', bottom: 'never' };\n+\n+type Props = {\n+ // Redux state\n+ // Redux dispatch functions\n+ dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ changeUserSettings: (\n+ currentPassword: string,\n+ newEmail: string,\n+ newPassword: string,\n+ ) => Promise<ChangeUserSettingsResult>,\n+};\n+class InnerEditPassword extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ changeUserSettings: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ return (\n+ <SafeAreaView forceInset={forceInset}>\n+ <Text>Password</Text>\n+ </SafeAreaView>\n+ );\n+ }\n+\n+}\n+\n+const EditPasswordRouteName = 'EditAccount';\n+const EditPassword = connect(\n+ (state: AppState) => ({\n+ cookie: state.cookie,\n+ }),\n+ includeDispatchActionProps,\n+ bindServerCalls({ changeUserSettings }),\n+)(InnerEditPassword);\n+\n+export {\n+ EditPassword,\n+ EditPasswordRouteName,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more.react.js",
"new_path": "native/more/more.react.js",
"diff": "@@ -5,14 +5,15 @@ import { StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport { StackNavigator } from 'react-navigation';\n-import {\n- MoreScreen,\n- MoreScreenRouteName,\n-} from './more-screen.react';\n+import { MoreScreen, MoreScreenRouteName } from './more-screen.react';\n+import { EditEmail, EditEmailRouteName } from './edit-email.react';\n+import { EditPassword, EditPasswordRouteName } from './edit-password.react';\nconst More = StackNavigator(\n{\n[MoreScreenRouteName]: { screen: MoreScreen },\n+ [EditEmailRouteName]: { screen: EditEmail },\n+ [EditPasswordRouteName]: { screen: EditPassword },\n},\n{\nnavigationOptions: ({ navigation }) => ({\n@@ -24,7 +25,7 @@ const More = StackNavigator(\n/>\n),\n}),\n- headerMode: \"none\",\n+ mode: \"modal\",\n},\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | EditEmail/EditPassword and EditSettingButton in MoreScreen |
129,187 | 13.02.2018 11:37:10 | 18,000 | f30aa61c9acf452a937611d4b40c776d2f2d3bbb | Working EditEmail on native | [
{
"change_type": "MODIFY",
"old_path": "native/account/forgot-password-panel.react.js",
"new_path": "native/account/forgot-password-panel.react.js",
"diff": "@@ -33,11 +33,7 @@ import {\n} from 'lib/shared/account-regexes';\nimport { TextInput } from './modal-components.react';\n-import {\n- PanelButton,\n- PanelOnePasswordButton,\n- Panel,\n-} from './panel-components.react';\n+import { PanelButton, Panel } from './panel-components.react';\ntype Props = {\nsetActiveAlert: (activeAlert: bool) => void,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/panel-components.react.js",
"new_path": "native/account/panel-components.react.js",
"diff": "@@ -12,14 +12,13 @@ import {\nActivityIndicator,\nText,\nStyleSheet,\n- TouchableWithoutFeedback,\n- Image,\nAnimated,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport PropTypes from 'prop-types';\nimport Button from '../components/button.react';\n+import OnePasswordButton from '../components/one-password-button.react';\ntype ButtonProps = {\ntext: string,\n@@ -69,12 +68,10 @@ class PanelButton extends React.PureComponent<ButtonProps> {\nfunction PanelOnePasswordButton(props: { onPress: () => Promise<void> }) {\nreturn (\n- <TouchableWithoutFeedback onPress={props.onPress}>\n- <Image\n- source={require(\"../img/onepassword.png\")}\n+ <OnePasswordButton\n+ onPress={props.onPress}\nstyle={styles.onePasswordImage}\n/>\n- </TouchableWithoutFeedback>\n);\n}\n@@ -123,9 +120,6 @@ const styles = StyleSheet.create({\nposition: 'absolute',\ntop: 8,\nright: 5,\n- width: 24,\n- height: 24,\n- opacity: 0.6,\n},\ncontainer: {\npaddingBottom: 37,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-name.react.js",
"new_path": "native/chat/settings/thread-settings-name.react.js",
"diff": "@@ -99,14 +99,9 @@ class ThreadSettingsName extends React.PureComponent<Props> {\nlet button;\nif (this.props.loadingStatus !== \"loading\") {\n- button = (\n- <SaveSettingButton\n- onPress={this.onSubmit}\n- key=\"saveButton\"\n- />\n- );\n+ button = <SaveSettingButton onPress={this.onSubmit} />;\n} else {\n- button = <ActivityIndicator size=\"small\" key=\"activityIndicator\" />;\n+ button = <ActivityIndicator size=\"small\" />;\n}\nconst textInputStyle = {};\n@@ -131,7 +126,6 @@ class ThreadSettingsName extends React.PureComponent<Props> {\neditable={this.props.loadingStatus !== \"loading\"}\nonContentSizeChange={this.onTextInputContentSizeChange}\nref={this.textInputRef}\n- key=\"textInput\"\n/>\n{button}\n</React.Fragment>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/one-password-button.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import * as React from 'react';\n+import { TouchableWithoutFeedback, Image, StyleSheet } from 'react-native';\n+\n+type Props = {|\n+ onPress: () => Promise<void>,\n+ style?: StyleObj,\n+|};\n+function OnePasswordButton(props: Props) {\n+ return (\n+ <TouchableWithoutFeedback onPress={props.onPress}>\n+ <Image\n+ source={require(\"../img/onepassword.png\")}\n+ style={[styles.image, props.style]}\n+ />\n+ </TouchableWithoutFeedback>\n+ );\n+}\n+\n+const styles = StyleSheet.create({\n+ image: {\n+ width: 24,\n+ height: 24,\n+ opacity: 0.6,\n+ },\n+});\n+\n+export default OnePasswordButton;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/edit-email.react.js",
"new_path": "native/more/edit-email.react.js",
"diff": "import type { AppState } from '../redux-setup';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { ChangeUserSettingsResult } from 'lib/actions/user-actions';\n+import type { NavigationScreenProp } from 'react-navigation';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import { loadingStatusPropType } from 'lib/types/loading-types';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { Text } from 'react-native';\n+import {\n+ Text,\n+ StyleSheet,\n+ View,\n+ TextInput,\n+ ScrollView,\n+ Platform,\n+ Alert,\n+ ActivityIndicator,\n+} from 'react-native';\nimport { connect } from 'react-redux';\n-import { SafeAreaView } from 'react-navigation';\n+import invariant from 'invariant';\n+import OnePassword from 'react-native-onepassword';\nimport {\nincludeDispatchActionProps,\n@@ -18,11 +31,17 @@ import {\nchangeUserSettingsActionTypes,\nchangeUserSettings,\n} from 'lib/actions/user-actions';\n+import { validEmailRegex } from 'lib/shared/account-regexes';\n+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-const forceInset = { top: 'always', bottom: 'never' };\n+import Button from '../components/button.react';\n+import OnePasswordButton from '../components/one-password-button.react';\n-type Props = {\n+type Props = {|\n+ navigation: NavigationScreenProp<*>,\n// Redux state\n+ email: ?string,\n+ loadingStatus: LoadingStatus,\n// Redux dispatch functions\ndispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -31,28 +50,315 @@ type Props = {\nnewEmail: string,\nnewPassword: string,\n) => Promise<ChangeUserSettingsResult>,\n-};\n-class InnerEditEmail extends React.PureComponent<Props> {\n+|};\n+type State = {|\n+ email: string,\n+ password: string,\n+ onePasswordSupported: bool,\n+|};\n+class InnerEditEmail extends React.PureComponent<Props, State> {\nstatic propTypes = {\n+ navigation: PropTypes.shape({\n+ navigate: PropTypes.func.isRequired,\n+ }).isRequired,\n+ email: PropTypes.string,\n+ loadingStatus: loadingStatusPropType.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nchangeUserSettings: PropTypes.func.isRequired,\n};\n+ static navigationOptions = ({ navigation }) => ({\n+ headerTitle: \"Change email\",\n+ });\n+ mounted = false;\n+ passwordInput: ?TextInput;\n+ emailInput: ?TextInput;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ email: props.email ? props.email : \"\",\n+ password: \"\",\n+ onePasswordSupported: false,\n+ };\n+ this.determineOnePasswordSupport();\n+ }\n+\n+ componentDidMount() {\n+ this.mounted = true;\n+ }\n+\n+ componentWillUnmount() {\n+ this.mounted = false;\n+ }\n+\n+ async determineOnePasswordSupport() {\n+ let onePasswordSupported;\n+ try {\n+ onePasswordSupported = await OnePassword.isSupported();\n+ } catch (e) {\n+ onePasswordSupported = false;\n+ }\n+ if (this.mounted) {\n+ this.setState({ onePasswordSupported });\n+ }\n+ }\nrender() {\n+ let onePasswordButton = null;\n+ if (this.state.onePasswordSupported) {\n+ onePasswordButton = (\n+ <OnePasswordButton\n+ onPress={this.onPressOnePassword}\n+ style={styles.onePasswordButton}\n+ />\n+ );\n+ }\n+ const buttonContent = this.props.loadingStatus === \"loading\"\n+ ? <ActivityIndicator size=\"small\" color=\"white\" />\n+ : <Text style={styles.saveText}>Save</Text>;\nreturn (\n- <SafeAreaView forceInset={forceInset}>\n- <Text>Email</Text>\n- </SafeAreaView>\n+ <ScrollView contentContainerStyle={styles.scrollView}>\n+ <Text style={styles.header}>EMAIL</Text>\n+ <View style={styles.section}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.email}\n+ onChangeText={this.onChangeEmailText}\n+ placeholder=\"Email\"\n+ autoFocus={true}\n+ selectTextOnFocus={true}\n+ returnKeyType=\"next\"\n+ onSubmitEditing={this.focusPasswordInput}\n+ ref={this.emailInputRef}\n+ />\n+ </View>\n+ <Text style={styles.header}>PASSWORD</Text>\n+ <View style={styles.section}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.password}\n+ onChangeText={this.onChangePasswordText}\n+ placeholder=\"Password\"\n+ secureTextEntry={true}\n+ returnKeyType=\"go\"\n+ onSubmitEditing={this.submitEmail}\n+ ref={this.passwordInputRef}\n+ />\n+ {onePasswordButton}\n+ </View>\n+ <Button\n+ onPress={this.submitEmail}\n+ style={styles.saveButton}\n+ >\n+ {buttonContent}\n+ </Button>\n+ </ScrollView>\n+ );\n+ }\n+\n+ onChangeEmailText = (newEmail: string) => {\n+ this.setState({ email: newEmail });\n+ }\n+\n+ emailInputRef = (emailInput: ?TextInput) => {\n+ this.emailInput = emailInput;\n+ }\n+\n+ onChangePasswordText = (newPassword: string) => {\n+ this.setState({ password: newPassword });\n+ }\n+\n+ passwordInputRef = (passwordInput: ?TextInput) => {\n+ this.passwordInput = passwordInput;\n+ }\n+\n+ focusPasswordInput = () => {\n+ invariant(this.passwordInput, \"passwordInput should be set\");\n+ this.passwordInput.focus();\n+ }\n+\n+ onPressOnePassword = async () => {\n+ try {\n+ const credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n+ this.setState(\n+ { password: credentials.password },\n+ () => {\n+ if (this.state.email && this.state.email !== this.props.email) {\n+ this.submitEmail();\n+ }\n+ },\n);\n+ } catch (e) { }\n}\n+ submitEmail = () => {\n+ if (this.state.email.search(validEmailRegex) === -1) {\n+ Alert.alert(\n+ \"Invalid email address\",\n+ \"Valid email addresses only\",\n+ [\n+ { text: 'OK', onPress: this.onEmailAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else if (this.state.password === \"\") {\n+ Alert.alert(\n+ \"Empty password\",\n+ \"Password cannot be empty\",\n+ [\n+ { text: 'OK', onPress: this.onPasswordAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else if (this.state.email === this.props.email) {\n+ this.props.navigation.goBack();\n+ } else {\n+ this.props.dispatchActionPromise(\n+ changeUserSettingsActionTypes,\n+ this.saveEmail(),\n+ );\n}\n+ }\n+\n+ async saveEmail() {\n+ try {\n+ const result = await this.props.changeUserSettings(\n+ this.state.password,\n+ this.state.email,\n+ \"\",\n+ );\n+ this.props.navigation.goBack();\n+ Alert.alert(\n+ \"Verify email\",\n+ \"We've sent you an email to verify your email address. Just click on \" +\n+ \"the link in the email to complete the verification process.\",\n+ );\n+ return result;\n+ } catch (e) {\n+ if (e.message === 'invalid_credentials') {\n+ Alert.alert(\n+ \"Incorrect password\",\n+ \"The password you entered is incorrect\",\n+ [\n+ { text: 'OK', onPress: this.onPasswordAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else {\n+ Alert.alert(\n+ \"Unknown error\",\n+ \"Uhh... try again?\",\n+ [\n+ { text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ }\n+ }\n+ }\n+\n+ onEmailAlertAcknowledged = () => {\n+ this.setState(\n+ { email: \"\" },\n+ () => {\n+ invariant(this.emailInput, \"ref should exist\");\n+ this.emailInput.focus();\n+ },\n+ );\n+ }\n+\n+ onPasswordAlertAcknowledged = () => {\n+ this.setState(\n+ { password: \"\" },\n+ () => {\n+ invariant(this.passwordInput, \"ref should exist\");\n+ this.passwordInput.focus();\n+ },\n+ );\n+ }\n+\n+ onUnknownErrorAlertAcknowledged = () => {\n+ this.setState(\n+ { email: \"\", password: \"\" },\n+ () => {\n+ invariant(this.emailInput, \"ref should exist\");\n+ this.emailInput.focus();\n+ },\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ flex: 1,\n+ padding: 0,\n+ margin: 0,\n+ },\n+ scrollView: {\n+ paddingTop: 24,\n+ },\n+ header: {\n+ paddingHorizontal: 24,\n+ paddingBottom: 3,\n+ fontSize: 12,\n+ fontWeight: \"400\",\n+ color: \"#888888\",\n+ },\n+ section: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ paddingVertical: Platform.select({\n+ ios: 12,\n+ default: 8,\n+ }),\n+ paddingHorizontal: 24,\n+ marginBottom: 24,\n+ },\n+ input: {\n+ flex: 1,\n+ fontSize: 16,\n+ color: \"#333333\",\n+ fontFamily: 'Arial',\n+ paddingVertical: 0,\n+ },\n+ saveButton: {\n+ flex: 1,\n+ backgroundColor: \"#88BB88\",\n+ marginVertical: 12,\n+ marginHorizontal: 24,\n+ borderRadius: 5,\n+ padding: 12,\n+ },\n+ saveText: {\n+ fontSize: 18,\n+ textAlign: 'center',\n+ color: \"white\",\n+ },\n+ onePasswordButton: {\n+ marginLeft: 6,\n+ },\n+});\n+\n+const loadingStatusSelector = createLoadingStatusSelector(\n+ changeUserSettingsActionTypes,\n+);\nconst EditEmailRouteName = 'EditEmail';\nconst EditEmail = connect(\n(state: AppState) => ({\ncookie: state.cookie,\n+ email: state.currentUserInfo && !state.currentUserInfo.anonymous\n+ ? state.currentUserInfo.email\n+ : undefined,\n+ loadingStatus: loadingStatusSelector(state),\n}),\nincludeDispatchActionProps,\nbindServerCalls({ changeUserSettings }),\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/edit-password.react.js",
"new_path": "native/more/edit-password.react.js",
"diff": "@@ -8,7 +8,6 @@ import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Text } from 'react-native';\nimport { connect } from 'react-redux';\n-import { SafeAreaView } from 'react-navigation';\nimport {\nincludeDispatchActionProps,\n@@ -19,8 +18,6 @@ import {\nchangeUserSettings,\n} from 'lib/actions/user-actions';\n-const forceInset = { top: 'always', bottom: 'never' };\n-\ntype Props = {\n// Redux state\n// Redux dispatch functions\n@@ -38,12 +35,13 @@ class InnerEditPassword extends React.PureComponent<Props> {\ndispatchActionPromise: PropTypes.func.isRequired,\nchangeUserSettings: PropTypes.func.isRequired,\n};\n+ static navigationOptions = {\n+ headerTitle: \"Change password\",\n+ };\nrender() {\nreturn (\n- <SafeAreaView forceInset={forceInset}>\n<Text>Password</Text>\n- </SafeAreaView>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -254,7 +254,8 @@ const styles = StyleSheet.create({\n},\nsection: {\nbackgroundColor: 'white',\n- borderWidth: 1,\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\nborderColor: \"#CCCCCC\",\npaddingVertical: 12,\npaddingHorizontal: 24,\n@@ -329,7 +330,6 @@ const styles = StyleSheet.create({\n});\nregisterFetchKey(logOutActionTypes);\n-registerFetchKey(resendVerificationEmailActionTypes);\nconst resendVerificationLoadingStatusSelector = createLoadingStatusSelector(\nresendVerificationEmailActionTypes,\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Working EditEmail on native |
129,187 | 13.02.2018 12:50:31 | 18,000 | b7a02c7fe86d4ba69e5e999500be21fdf06df22b | Working EditPassword on native | [
{
"change_type": "MODIFY",
"old_path": "native/account/native-credentials.js",
"new_path": "native/account/native-credentials.js",
"diff": "@@ -16,14 +16,14 @@ import URL from 'url-parse';\nimport { logInActionTypes, logIn } from 'lib/actions/user-actions';\nimport { getConfig } from 'lib/utils/config';\n-type Credentials = {\n+type Credentials = {|\nusername: string,\npassword: string,\n-};\n-type StoredCredentials = {\n+|};\n+type StoredCredentials = {|\nstate: \"undetermined\" | \"determined\" | \"unsupported\",\ncredentials: ?Credentials,\n-};\n+|};\nlet storedNativeKeychainCredentials = {\nstate: \"undetermined\",\ncredentials: null,\n@@ -153,7 +153,20 @@ async function setNativeSharedWebCredentials(credentials: Credentials) {\n}\n}\n-async function setNativeCredentials(credentials: Credentials) {\n+async function setNativeCredentials(credentials: $Shape<Credentials>) {\n+ if (!credentials.username || !credentials.password) {\n+ const currentCredentials = await fetchNativeCredentials();\n+ if (currentCredentials) {\n+ credentials = {\n+ username: credentials.username\n+ ? credentials.username\n+ : currentCredentials.username,\n+ password: credentials.password\n+ ? credentials.password\n+ : currentCredentials.password,\n+ };\n+ }\n+ }\nawait Promise.all([\nsetNativeKeychainCredentials(credentials),\nsetNativeSharedWebCredentials(credentials),\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/edit-email.react.js",
"new_path": "native/more/edit-email.react.js",
"diff": "@@ -167,6 +167,11 @@ class InnerEditEmail extends React.PureComponent<Props, State> {\nthis.emailInput = emailInput;\n}\n+ focusEmailInput = () => {\n+ invariant(this.emailInput, \"emailInput should be set\");\n+ this.emailInput.focus();\n+ }\n+\nonChangePasswordText = (newPassword: string) => {\nthis.setState({ password: newPassword });\n}\n@@ -263,41 +268,27 @@ class InnerEditEmail extends React.PureComponent<Props, State> {\nonEmailAlertAcknowledged = () => {\nthis.setState(\n{ email: \"\" },\n- () => {\n- invariant(this.emailInput, \"ref should exist\");\n- this.emailInput.focus();\n- },\n+ this.focusEmailInput,\n);\n}\nonPasswordAlertAcknowledged = () => {\nthis.setState(\n{ password: \"\" },\n- () => {\n- invariant(this.passwordInput, \"ref should exist\");\n- this.passwordInput.focus();\n- },\n+ this.focusPasswordInput,\n);\n}\nonUnknownErrorAlertAcknowledged = () => {\nthis.setState(\n{ email: \"\", password: \"\" },\n- () => {\n- invariant(this.emailInput, \"ref should exist\");\n- this.emailInput.focus();\n- },\n+ this.focusEmailInput,\n);\n}\n}\nconst styles = StyleSheet.create({\n- container: {\n- flex: 1,\n- padding: 0,\n- margin: 0,\n- },\nscrollView: {\npaddingTop: 24,\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/edit-password.react.js",
"new_path": "native/more/edit-password.react.js",
"diff": "import type { AppState } from '../redux-setup';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { ChangeUserSettingsResult } from 'lib/actions/user-actions';\n+import type { NavigationScreenProp } from 'react-navigation';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import { loadingStatusPropType } from 'lib/types/loading-types';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { Text } from 'react-native';\n+import {\n+ Text,\n+ StyleSheet,\n+ View,\n+ TextInput,\n+ ScrollView,\n+ Platform,\n+ Alert,\n+ ActivityIndicator,\n+} from 'react-native';\nimport { connect } from 'react-redux';\n+import invariant from 'invariant';\n+import OnePassword from 'react-native-onepassword';\nimport {\nincludeDispatchActionProps,\n@@ -17,9 +31,17 @@ import {\nchangeUserSettingsActionTypes,\nchangeUserSettings,\n} from 'lib/actions/user-actions';\n+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+\n+import Button from '../components/button.react';\n+import OnePasswordButton from '../components/one-password-button.react';\n+import { setNativeCredentials } from '../account/native-credentials';\ntype Props = {\n+ navigation: NavigationScreenProp<*>,\n// Redux state\n+ email: ?string,\n+ loadingStatus: LoadingStatus,\n// Redux dispatch functions\ndispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\n@@ -29,28 +51,377 @@ type Props = {\nnewPassword: string,\n) => Promise<ChangeUserSettingsResult>,\n};\n-class InnerEditPassword extends React.PureComponent<Props> {\n+type State = {|\n+ currentPassword: string,\n+ newPassword: string,\n+ confirmPassword: string,\n+ onePasswordSupported: bool,\n+|};\n+class InnerEditPassword extends React.PureComponent<Props, State> {\nstatic propTypes = {\n+ navigation: PropTypes.shape({\n+ navigate: PropTypes.func.isRequired,\n+ }).isRequired,\n+ email: PropTypes.string,\n+ loadingStatus: loadingStatusPropType.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nchangeUserSettings: PropTypes.func.isRequired,\n};\nstatic navigationOptions = {\nheaderTitle: \"Change password\",\n};\n+ mounted = false;\n+ currentPasswordInput: ?TextInput;\n+ newPasswordInput: ?TextInput;\n+ confirmPasswordInput: ?TextInput;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ currentPassword: \"\",\n+ newPassword: \"\",\n+ confirmPassword: \"\",\n+ onePasswordSupported: false,\n+ };\n+ this.determineOnePasswordSupport();\n+ }\n+\n+ componentDidMount() {\n+ this.mounted = true;\n+ }\n+\n+ componentWillUnmount() {\n+ this.mounted = false;\n+ }\n+\n+ async determineOnePasswordSupport() {\n+ let onePasswordSupported;\n+ try {\n+ onePasswordSupported = await OnePassword.isSupported();\n+ } catch (e) {\n+ onePasswordSupported = false;\n+ }\n+ if (this.mounted) {\n+ this.setState({ onePasswordSupported });\n+ }\n+ }\nrender() {\n+ let onePasswordCurrentPasswordButton = null;\n+ let onePasswordNewPasswordButton = null;\n+ if (this.state.onePasswordSupported) {\n+ onePasswordCurrentPasswordButton = (\n+ <OnePasswordButton\n+ onPress={this.onPressOnePasswordCurrentPassword}\n+ style={styles.onePasswordButton}\n+ />\n+ );\n+ onePasswordNewPasswordButton = (\n+ <OnePasswordButton\n+ onPress={this.onPressOnePasswordNewPassword}\n+ style={styles.onePasswordButton}\n+ />\n+ );\n+ }\n+ const buttonContent = this.props.loadingStatus === \"loading\"\n+ ? <ActivityIndicator size=\"small\" color=\"white\" />\n+ : <Text style={styles.saveText}>Save</Text>;\nreturn (\n- <Text>Password</Text>\n+ <ScrollView contentContainerStyle={styles.scrollView}>\n+ <Text style={styles.header}>CURRENT PASSWORD</Text>\n+ <View style={styles.section}>\n+ <View style={styles.row}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.currentPassword}\n+ onChangeText={this.onChangeCurrentPassword}\n+ placeholder=\"Current password\"\n+ secureTextEntry={true}\n+ autoFocus={true}\n+ selectTextOnFocus={true}\n+ returnKeyType=\"next\"\n+ onSubmitEditing={this.focusNewPassword}\n+ ref={this.currentPasswordRef}\n+ />\n+ {onePasswordCurrentPasswordButton}\n+ </View>\n+ </View>\n+ <Text style={styles.header}>NEW PASSWORD</Text>\n+ <View style={styles.section}>\n+ <View style={styles.row}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.newPassword}\n+ onChangeText={this.onChangeNewPassword}\n+ placeholder=\"New password\"\n+ secureTextEntry={true}\n+ returnKeyType=\"next\"\n+ onSubmitEditing={this.focusConfirmPassword}\n+ ref={this.newPasswordRef}\n+ />\n+ {onePasswordNewPasswordButton}\n+ </View>\n+ <View style={styles.hr} />\n+ <View style={styles.row}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.confirmPassword}\n+ onChangeText={this.onChangeConfirmPassword}\n+ placeholder=\"Confirm password\"\n+ secureTextEntry={true}\n+ returnKeyType=\"go\"\n+ onSubmitEditing={this.submitPassword}\n+ ref={this.confirmPasswordRef}\n+ />\n+ </View>\n+ </View>\n+ <Button\n+ onPress={this.submitPassword}\n+ style={styles.saveButton}\n+ >\n+ {buttonContent}\n+ </Button>\n+ </ScrollView>\n);\n}\n+ onChangeCurrentPassword = (currentPassword: string) => {\n+ this.setState({ currentPassword });\n}\n+ currentPasswordRef = (currentPasswordInput: ?TextInput) => {\n+ this.currentPasswordInput = currentPasswordInput;\n+ }\n+\n+ focusCurrentPassword = () => {\n+ invariant(this.currentPasswordInput, \"currentPasswordInput should be set\");\n+ this.currentPasswordInput.focus();\n+ }\n+\n+ onChangeNewPassword = (newPassword: string) => {\n+ this.setState({ newPassword });\n+ }\n+\n+ newPasswordRef = (newPasswordInput: ?TextInput) => {\n+ this.newPasswordInput = newPasswordInput;\n+ }\n+\n+ focusNewPassword = () => {\n+ invariant(this.newPasswordInput, \"newPasswordInput should be set\");\n+ this.newPasswordInput.focus();\n+ }\n+\n+ onChangeConfirmPassword = (confirmPassword: string) => {\n+ this.setState({ confirmPassword });\n+ }\n+\n+ confirmPasswordRef = (confirmPasswordInput: ?TextInput) => {\n+ this.confirmPasswordInput = confirmPasswordInput;\n+ }\n+\n+ focusConfirmPassword = () => {\n+ invariant(this.confirmPasswordInput, \"confirmPasswordInput should be set\");\n+ this.confirmPasswordInput.focus();\n+ }\n+\n+ onPressOnePasswordCurrentPassword = async () => {\n+ try {\n+ const credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n+ this.setState(\n+ { currentPassword: credentials.password },\n+ () => {\n+ if (\n+ this.state.newPassword &&\n+ this.state.newPassword === this.state.confirmPassword\n+ ) {\n+ this.submitPassword();\n+ }\n+ },\n+ );\n+ } catch (e) { }\n+ }\n+\n+ onPressOnePasswordNewPassword = async () => {\n+ try {\n+ const credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n+ this.setState(\n+ {\n+ newPassword: credentials.password,\n+ confirmPassword: credentials.password,\n+ },\n+ () => {\n+ if (this.state.currentPassword) {\n+ this.submitPassword();\n+ }\n+ },\n+ );\n+ } catch (e) { }\n+ }\n+\n+ submitPassword = () => {\n+ if (this.state.newPassword === '') {\n+ Alert.alert(\n+ \"Empty password\",\n+ \"New password cannot be empty\",\n+ [\n+ { text: 'OK', onPress: this.onNewPasswordAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else if (this.state.newPassword !== this.state.confirmPassword) {\n+ Alert.alert(\n+ \"Passwords don't match\",\n+ \"New password fields must contain the same password\",\n+ [\n+ { text: 'OK', onPress: this.onNewPasswordAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else if (this.state.newPassword === this.state.currentPassword) {\n+ this.props.navigation.goBack();\n+ } else {\n+ this.props.dispatchActionPromise(\n+ changeUserSettingsActionTypes,\n+ this.savePassword(),\n+ );\n+ }\n+ }\n+\n+ async savePassword() {\n+ try {\n+ const result = await this.props.changeUserSettings(\n+ this.state.currentPassword,\n+ this.props.email ? this.props.email : \"\",\n+ this.state.newPassword,\n+ );\n+ await setNativeCredentials({\n+ password: this.state.newPassword,\n+ });\n+ this.props.navigation.goBack();\n+ return result;\n+ } catch (e) {\n+ if (e.message === 'invalid_credentials') {\n+ Alert.alert(\n+ \"Incorrect password\",\n+ \"The current password you entered is incorrect\",\n+ [\n+ { text: 'OK', onPress: this.onCurrentPasswordAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else {\n+ Alert.alert(\n+ \"Unknown error\",\n+ \"Uhh... try again?\",\n+ [\n+ { text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ }\n+ }\n+ }\n+\n+ onNewPasswordAlertAcknowledged = () => {\n+ this.setState(\n+ { newPassword: \"\", confirmPassword: \"\" },\n+ this.focusNewPassword,\n+ );\n+ }\n+\n+ onCurrentPasswordAlertAcknowledged = () => {\n+ this.setState(\n+ { currentPassword: \"\" },\n+ this.focusCurrentPassword,\n+ );\n+ }\n+\n+ onUnknownErrorAlertAcknowledged = () => {\n+ this.setState(\n+ { currentPassword: \"\", newPassword: \"\", confirmPassword: \"\" },\n+ this.focusCurrentPassword,\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ scrollView: {\n+ paddingTop: 24,\n+ },\n+ header: {\n+ paddingHorizontal: 24,\n+ paddingBottom: 3,\n+ fontSize: 12,\n+ fontWeight: \"400\",\n+ color: \"#888888\",\n+ },\n+ section: {\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ paddingVertical: Platform.select({\n+ ios: 3,\n+ default: 2,\n+ }),\n+ marginBottom: 24,\n+ },\n+ row: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ paddingVertical: Platform.select({\n+ ios: 9,\n+ default: 6,\n+ }),\n+ paddingHorizontal: 24,\n+ },\n+ hr: {\n+ height: 1,\n+ backgroundColor: \"#CCCCCC\",\n+ marginHorizontal: 15,\n+ },\n+ input: {\n+ flex: 1,\n+ fontSize: 16,\n+ color: \"#333333\",\n+ fontFamily: 'Arial',\n+ paddingVertical: 0,\n+ },\n+ saveButton: {\n+ flex: 1,\n+ backgroundColor: \"#88BB88\",\n+ marginVertical: 12,\n+ marginHorizontal: 24,\n+ borderRadius: 5,\n+ padding: 12,\n+ },\n+ saveText: {\n+ fontSize: 18,\n+ textAlign: 'center',\n+ color: \"white\",\n+ },\n+ onePasswordButton: {\n+ marginLeft: 6,\n+ },\n+});\n+\n+const loadingStatusSelector = createLoadingStatusSelector(\n+ changeUserSettingsActionTypes,\n+);\n+\nconst EditPasswordRouteName = 'EditAccount';\nconst EditPassword = connect(\n(state: AppState) => ({\ncookie: state.cookie,\n+ email: state.currentUserInfo && !state.currentUserInfo.anonymous\n+ ? state.currentUserInfo.email\n+ : undefined,\n+ loadingStatus: loadingStatusSelector(state),\n}),\nincludeDispatchActionProps,\nbindServerCalls({ changeUserSettings }),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Working EditPassword on native |
129,187 | 13.02.2018 18:03:41 | 18,000 | 77993cc01e0b0de605f977f2b3283cbbff587555 | Working DeleteAccount on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-leave-thread.react.js",
"new_path": "native/chat/settings/thread-settings-leave-thread.react.js",
"diff": "// @flow\n-import type { ThreadInfo, RelativeMemberInfo } from 'lib/types/thread-types';\n-import {\n- threadInfoPropType,\n- relativeMemberInfoPropType,\n-} from 'lib/types/thread-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+import { threadInfoPropType } from 'lib/types/thread-types';\nimport type { LeaveThreadResult } from 'lib/actions/thread-actions';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport { loadingStatusPropType } from 'lib/types/loading-types';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/delete-account.react.js",
"diff": "+// @flow\n+\n+import type { AppState } from '../redux-setup';\n+import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import type { ChangeUserSettingsResult } from 'lib/actions/user-actions';\n+import type { NavigationScreenProp } from 'react-navigation';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import { loadingStatusPropType } from 'lib/types/loading-types';\n+import type { LogOutResult } from 'lib/actions/user-actions';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import {\n+ Text,\n+ StyleSheet,\n+ View,\n+ TextInput,\n+ ScrollView,\n+ Platform,\n+ Alert,\n+ ActivityIndicator,\n+} from 'react-native';\n+import { connect } from 'react-redux';\n+import invariant from 'invariant';\n+import OnePassword from 'react-native-onepassword';\n+\n+import {\n+ includeDispatchActionProps,\n+ bindServerCalls,\n+} from 'lib/utils/action-utils';\n+import {\n+ deleteAccountActionTypes,\n+ deleteAccount,\n+} from 'lib/actions/user-actions';\n+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+\n+import Button from '../components/button.react';\n+import OnePasswordButton from '../components/one-password-button.react';\n+import { deleteNativeCredentialsFor } from '../account/native-credentials';\n+\n+type Props = {|\n+ navigation: NavigationScreenProp<*>,\n+ // Redux state\n+ loadingStatus: LoadingStatus,\n+ username: ?string,\n+ // Redux dispatch functions\n+ dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ deleteAccount: (password: string) => Promise<LogOutResult>,\n+|};\n+type State = {|\n+ password: string,\n+ onePasswordSupported: bool,\n+|};\n+class InnerDeleteAccount extends React.PureComponent<Props, State> {\n+\n+ static propTypes = {\n+ navigation: PropTypes.shape({\n+ navigate: PropTypes.func.isRequired,\n+ }).isRequired,\n+ loadingStatus: loadingStatusPropType.isRequired,\n+ username: PropTypes.string,\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ deleteAccount: PropTypes.func.isRequired,\n+ };\n+ static navigationOptions = ({ navigation }) => ({\n+ headerTitle: \"Delete account\",\n+ });\n+ mounted = false;\n+ passwordInput: ?TextInput;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ password: \"\",\n+ onePasswordSupported: false,\n+ };\n+ this.determineOnePasswordSupport();\n+ }\n+\n+ componentDidMount() {\n+ this.mounted = true;\n+ }\n+\n+ componentWillUnmount() {\n+ this.mounted = false;\n+ }\n+\n+ async determineOnePasswordSupport() {\n+ let onePasswordSupported;\n+ try {\n+ onePasswordSupported = await OnePassword.isSupported();\n+ } catch (e) {\n+ onePasswordSupported = false;\n+ }\n+ if (this.mounted) {\n+ this.setState({ onePasswordSupported });\n+ }\n+ }\n+\n+ render() {\n+ let onePasswordButton = null;\n+ if (this.state.onePasswordSupported) {\n+ onePasswordButton = (\n+ <OnePasswordButton\n+ onPress={this.onPressOnePassword}\n+ style={styles.onePasswordButton}\n+ />\n+ );\n+ }\n+ const buttonContent = this.props.loadingStatus === \"loading\"\n+ ? <ActivityIndicator size=\"small\" color=\"white\" />\n+ : <Text style={styles.saveText}>Delete account</Text>;\n+ return (\n+ <ScrollView contentContainerStyle={styles.scrollView}>\n+ <View>\n+ <Text style={styles.warningText}>\n+ Your account will be permanently deleted.\n+ </Text>\n+ </View>\n+ <View>\n+ <Text style={[styles.warningText, styles.lastWarningText]}>\n+ There is no way to reverse this.\n+ </Text>\n+ </View>\n+ <Text style={styles.header}>PASSWORD</Text>\n+ <View style={styles.section}>\n+ <TextInput\n+ style={styles.input}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.password}\n+ onChangeText={this.onChangePasswordText}\n+ placeholder=\"Password\"\n+ secureTextEntry={true}\n+ returnKeyType=\"go\"\n+ onSubmitEditing={this.submitDeletion}\n+ ref={this.passwordInputRef}\n+ />\n+ {onePasswordButton}\n+ </View>\n+ <Button\n+ onPress={this.submitDeletion}\n+ style={styles.deleteButton}\n+ >\n+ {buttonContent}\n+ </Button>\n+ </ScrollView>\n+ );\n+ }\n+\n+ onChangePasswordText = (newPassword: string) => {\n+ this.setState({ password: newPassword });\n+ }\n+\n+ passwordInputRef = (passwordInput: ?TextInput) => {\n+ this.passwordInput = passwordInput;\n+ }\n+\n+ focusPasswordInput = () => {\n+ invariant(this.passwordInput, \"passwordInput should be set\");\n+ this.passwordInput.focus();\n+ }\n+\n+ onPressOnePassword = async () => {\n+ try {\n+ const credentials = await OnePassword.findLogin(\"https://squadcal.org\");\n+ this.setState({ password: credentials.password });\n+ } catch (e) { }\n+ }\n+\n+ submitDeletion = () => {\n+ this.props.dispatchActionPromise(\n+ deleteAccountActionTypes,\n+ this.deleteAccount(),\n+ );\n+ }\n+\n+ async deleteAccount() {\n+ try {\n+ const result = await this.props.deleteAccount(this.state.password);\n+ if (this.props.username) {\n+ await deleteNativeCredentialsFor(this.props.username);\n+ }\n+ return result;\n+ } catch (e) {\n+ if (e.message === 'invalid_credentials') {\n+ Alert.alert(\n+ \"Incorrect password\",\n+ \"The password you entered is incorrect\",\n+ [\n+ { text: 'OK', onPress: this.onErrorAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ } else {\n+ Alert.alert(\n+ \"Unknown error\",\n+ \"Uhh... try again?\",\n+ [\n+ { text: 'OK', onPress: this.onErrorAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ }\n+ }\n+ }\n+\n+ onErrorAlertAcknowledged = () => {\n+ this.setState(\n+ { password: \"\" },\n+ this.focusPasswordInput,\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ scrollView: {\n+ paddingTop: 24,\n+ },\n+ header: {\n+ paddingHorizontal: 24,\n+ paddingBottom: 3,\n+ fontSize: 12,\n+ fontWeight: \"400\",\n+ color: \"#888888\",\n+ },\n+ section: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ paddingVertical: Platform.select({\n+ ios: 12,\n+ default: 8,\n+ }),\n+ paddingHorizontal: 24,\n+ marginBottom: 24,\n+ },\n+ input: {\n+ flex: 1,\n+ fontSize: 16,\n+ color: \"#333333\",\n+ fontFamily: 'Arial',\n+ paddingVertical: 0,\n+ },\n+ deleteButton: {\n+ flex: 1,\n+ backgroundColor: \"#BB8888\",\n+ marginVertical: 12,\n+ marginHorizontal: 24,\n+ borderRadius: 5,\n+ padding: 12,\n+ },\n+ saveText: {\n+ fontSize: 18,\n+ textAlign: 'center',\n+ color: \"white\",\n+ },\n+ onePasswordButton: {\n+ marginLeft: 6,\n+ },\n+ warningText: {\n+ marginHorizontal: 24,\n+ textAlign: 'center',\n+ color: \"#333333\",\n+ fontSize: 16,\n+ },\n+ lastWarningText: {\n+ marginBottom: 24,\n+ },\n+});\n+\n+const loadingStatusSelector = createLoadingStatusSelector(\n+ deleteAccountActionTypes,\n+);\n+\n+const DeleteAccountRouteName = 'DeleteAccount';\n+const DeleteAccount = connect(\n+ (state: AppState) => ({\n+ cookie: state.cookie,\n+ loadingStatus: loadingStatusSelector(state),\n+ username: state.currentUserInfo && !state.currentUserInfo.anonymous\n+ ? state.currentUserInfo.username\n+ : undefined,\n+ }),\n+ includeDispatchActionProps,\n+ bindServerCalls({ deleteAccount }),\n+)(InnerDeleteAccount);\n+\n+export {\n+ DeleteAccount,\n+ DeleteAccountRouteName,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/edit-password.react.js",
"new_path": "native/more/edit-password.react.js",
"diff": "@@ -140,7 +140,6 @@ class InnerEditPassword extends React.PureComponent<Props, State> {\nplaceholder=\"Current password\"\nsecureTextEntry={true}\nautoFocus={true}\n- selectTextOnFocus={true}\nreturnKeyType=\"next\"\nonSubmitEditing={this.focusNewPassword}\nref={this.currentPasswordRef}\n@@ -414,7 +413,7 @@ const loadingStatusSelector = createLoadingStatusSelector(\nchangeUserSettingsActionTypes,\n);\n-const EditPasswordRouteName = 'EditAccount';\n+const EditPasswordRouteName = 'EditPassword';\nconst EditPassword = connect(\n(state: AppState) => ({\ncookie: state.cookie,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -45,6 +45,7 @@ import Button from '../components/button.react';\nimport EditSettingButton from '../components/edit-setting-button.react';\nimport { EditEmailRouteName } from './edit-email.react';\nimport { EditPasswordRouteName } from './edit-password.react';\n+import { DeleteAccountRouteName } from './delete-account.react';\nconst forceInset = { top: 'always', bottom: 'never' };\n@@ -166,6 +167,16 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n/>\n</View>\n</View>\n+ <View style={styles.unpaddedSection}>\n+ <Button\n+ onPress={this.onPressDeleteAccount}\n+ style={styles.deleteAccountButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.deleteAccountText}>Delete account...</Text>\n+ </Button>\n+ </View>\n</ScrollView>\n</SafeAreaView>\n);\n@@ -213,10 +224,11 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nasync logOutAndDeleteNativeCredentials() {\nconst username = this.props.username;\ninvariant(username, \"can't log out if not logged in\");\n- await Promise.all([\n+ const [ result ] = await Promise.all([\nthis.props.logOut(),\ndeleteNativeCredentialsFor(username),\n]);\n+ return result;\n}\nonPressResendVerificationEmail = () => {\n@@ -243,6 +255,10 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nthis.props.navigation.navigate(EditPasswordRouteName);\n}\n+ onPressDeleteAccount = () => {\n+ this.props.navigation.navigate(DeleteAccountRouteName);\n+ }\n+\n}\nconst styles = StyleSheet.create({\n@@ -261,6 +277,13 @@ const styles = StyleSheet.create({\npaddingHorizontal: 24,\nmarginBottom: 24,\n},\n+ unpaddedSection: {\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ marginBottom: 24,\n+ },\nrow: {\nflex: 1,\nflexDirection: 'row',\n@@ -327,6 +350,15 @@ const styles = StyleSheet.create({\neditPasswordButton: {\npaddingTop: Platform.OS === \"android\" ? 3 : 2,\n},\n+ deleteAccountButton: {\n+ paddingHorizontal: 24,\n+ paddingVertical: 12,\n+ },\n+ deleteAccountText: {\n+ fontSize: 16,\n+ color: \"#AA0000\",\n+ flex: 1,\n+ },\n});\nregisterFetchKey(logOutActionTypes);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more.react.js",
"new_path": "native/more/more.react.js",
"diff": "@@ -8,12 +8,14 @@ import { StackNavigator } from 'react-navigation';\nimport { MoreScreen, MoreScreenRouteName } from './more-screen.react';\nimport { EditEmail, EditEmailRouteName } from './edit-email.react';\nimport { EditPassword, EditPasswordRouteName } from './edit-password.react';\n+import { DeleteAccount, DeleteAccountRouteName } from './delete-account.react';\nconst More = StackNavigator(\n{\n[MoreScreenRouteName]: { screen: MoreScreen },\n[EditEmailRouteName]: { screen: EditEmail },\n[EditPasswordRouteName]: { screen: EditPassword },\n+ [DeleteAccountRouteName]: { screen: DeleteAccount },\n},\n{\nnavigationOptions: ({ navigation }) => ({\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Working DeleteAccount on native |
129,187 | 13.02.2018 20:22:31 | 18,000 | b6a1a0328c246d4763076f73fe3a63b272896a65 | edit_account.php -> jserver pt 1
Everything except for email. Introducing new utility function `promiseAll` which works on object-maps | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -8,7 +8,10 @@ import errorHandler from './error_handler';\nimport { messageCreationResponder } from './responders/message-responders';\nimport { updateActivityResponder } from './responders/activity-responders';\nimport { deviceTokenUpdateResponder } from './responders/device-responders';\n-import { userSubscriptionUpdateResponder } from './responders/user-responders';\n+import {\n+ userSubscriptionUpdateResponder,\n+ accountUpdateResponder,\n+} from './responders/user-responders';\nconst app = express();\napp.use(bodyParser.json());\n@@ -29,4 +32,8 @@ app.post(\n'/update_device_token',\nerrorHandler(deviceTokenUpdateResponder),\n);\n+app.post(\n+ '/update_account',\n+ errorHandler(accountUpdateResponder),\n+);\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/activity-responders.js",
"new_path": "jserver/src/responders/activity-responders.js",
"diff": "@@ -7,25 +7,21 @@ import t from 'tcomb';\nimport { activityUpdater } from '../updaters/activity-updater';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\n-import { tBool } from '../utils/tcomb-utils';\n+import { tBool, tShape } from '../utils/tcomb-utils';\nconst inputValidator = t.list(t.union([\n- t.interface(\n- { focus: tBool(true), threadID: t.String },\n- { strict: true },\n- ),\n- t.interface(\n- {\n+ tShape({\n+ focus: tBool(true),\n+ threadID: t.String,\n+ }),\n+ tShape({\nfocus: tBool(false),\nthreadID: t.String,\nlatestMessage: t.maybe(t.String),\n- },\n- { strict: true },\n- ),\n- t.interface(\n- { closing: tBool(true) },\n- { strict: true },\n- ),\n+ }),\n+ tShape({\n+ closing: tBool(true),\n+ }),\n]));\nasync function updateActivityResponder(req: $Request, res: $Response) {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/device-responders.js",
"new_path": "jserver/src/responders/device-responders.js",
"diff": "@@ -7,14 +7,12 @@ import t from 'tcomb';\nimport { deviceTokenUpdater } from '../updaters/device-token-updater';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\n+import { tShape } from '../utils/tcomb-utils';\n-const inputValidator = t.interface(\n- {\n+const inputValidator = tShape({\ndeviceType: t.enums.of(['ios', 'android']),\ndeviceToken: t.String,\n- },\n- { strict: true },\n-);\n+});\nasync function deviceTokenUpdateResponder(req: $Request, res: $Response) {\nconst deviceTokenUpdate: DeviceTokenUpdate = (req.body: any);\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "import type { $Response, $Request } from 'express';\nimport type { SubscriptionUpdate } from 'lib/types/subscription-types';\n+import type { AccountUpdate } from 'lib/types/user-types';\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\nimport { userSubscriptionUpdater } from '../updaters/user-subscription-updater';\n+import { accountUpdater } from '../updaters/account-updater';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\n+import { tShape } from '../utils/tcomb-utils';\n+import { currentViewer } from '../session/viewer';\n-const inputValidator = t.interface(\n- {\n+const subscriptionUpdateInputValidator = tShape({\nthreadID: t.String,\n- updatedFields: t.interface(\n- { pushNotifs: t.maybe(t.Boolean), home: t.maybe(t.Boolean) },\n- { strict: true },\n- ),\n- },\n- { strict: true },\n-);\n+ updatedFields: tShape({\n+ pushNotifs: t.maybe(t.Boolean),\n+ home: t.maybe(t.Boolean)\n+ }),\n+});\nasync function userSubscriptionUpdateResponder(req: $Request, res: $Response) {\nconst subscriptionUpdate: SubscriptionUpdate = (req.body: any);\n- if (!inputValidator.is(subscriptionUpdate)) {\n+ if (!subscriptionUpdateInputValidator.is(subscriptionUpdate)) {\nreturn { error: 'invalid_parameters' };\n}\n@@ -34,6 +37,40 @@ async function userSubscriptionUpdateResponder(req: $Request, res: $Response) {\nreturn { success: true, threadSubscription };\n}\n+const accountUpdateInputValidator = tShape({\n+ updatedFields: tShape({\n+ email: t.maybe(t.String),\n+ password: t.maybe(t.String),\n+ }),\n+ currentPassword: t.String,\n+});\n+\n+async function accountUpdateResponder(req: $Request, res: $Response) {\n+ const accountUpdate: AccountUpdate = (req.body: any);\n+ if (!accountUpdateInputValidator.is(accountUpdate)) {\n+ return { error: 'invalid_parameters' };\n+ }\n+\n+ const viewer = currentViewer();\n+ if (!viewer.loggedIn) {\n+ return { error: 'not_logged_in' };\n+ }\n+\n+ await setCurrentViewerFromCookie(req.cookies);\n+ try {\n+ await accountUpdater(viewer, accountUpdate);\n+ } catch (e) {\n+ if (e instanceof ServerError) {\n+ return { error: e.message };\n+ } else {\n+ throw e;\n+ }\n+ }\n+\n+ return { success: true };\n+}\n+\nexport {\nuserSubscriptionUpdateResponder,\n+ accountUpdateResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/session/viewer.js",
"new_path": "jserver/src/session/viewer.js",
"diff": "@@ -17,7 +17,7 @@ type AnonymousViewerData = {|\ntype ViewerData = UserViewerData | AnonymousViewerData;\n-type UserViewer = {\n+export type UserViewer = {\nloggedIn: true,\nid: string,\nuserID: string,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/updaters/account-updater.js",
"diff": "+// @flow\n+\n+import type { AccountUpdate } from 'lib/types/user-types';\n+import type { UserViewer } from '../session/viewer';\n+\n+import bcrypt from 'twin-bcrypt';\n+\n+import { validEmailRegex } from 'lib/shared/account-regexes';\n+import { promiseAll } from 'lib/utils/promises';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\n+import { pool, SQL } from '../database';\n+\n+async function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\n+ const email = update.updatedFields.email;\n+ const newPassword = update.updatedFields.password;\n+\n+ const promises = {};\n+ if (email) {\n+ if (email.search(validEmailRegex) === -1) {\n+ throw new ServerError('invalid_email');\n+ }\n+ promises.emailQuery = pool.query(SQL`\n+ SELECT COUNT(id) AS count FROM users WHERE email = ${email}\n+ `);\n+ }\n+ promises.verifyQuery = pool.query(SQL`\n+ SELECT username, email, hash FROM users WHERE id = ${viewer.userID}\n+ `);\n+ const { verifyQuery, emailQuery } = await promiseAll(promises);\n+\n+ const [ verifyResult ] = verifyQuery;\n+ if (verifyResult.length === 0) {\n+ throw new ServerError('internal_error');\n+ }\n+ const verifyRow = verifyResult[0];\n+ if (!bcrypt.compareSync(update.currentPassword, verifyRow.hash)) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\n+ const changedFields = {};\n+ if (email) {\n+ const [ emailResult ] = emailQuery;\n+ const emailRow = emailResult[0];\n+ if (emailRow.count !== 0) {\n+ throw new ServerError('email_taken');\n+ }\n+ changedFields.email = email;\n+ changedFields.email_verified = 0;\n+ // TODO verify email\n+ }\n+ if (newPassword) {\n+ changedFields.hash = bcrypt.hashSync(newPassword);\n+ }\n+\n+ if (Object.keys(changedFields).length > 0) {\n+ pool.query(SQL`\n+ UPDATE users SET ${changedFields} WHERE id = ${viewer.userID}\n+ `);\n+ }\n+}\n+\n+export {\n+ accountUpdater,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/utils/tcomb-utils.js",
"new_path": "jserver/src/utils/tcomb-utils.js",
"diff": "@@ -6,6 +6,11 @@ function tBool(value: bool) {\nreturn t.irreducible('true', x => x === value);\n}\n+function tShape(spec: *) {\n+ return t.interface(spec, { strict: true });\n+}\n+\nexport {\ntBool,\n+ tShape,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/user-types.js",
"new_path": "lib/types/user-types.js",
"diff": "@@ -47,3 +47,11 @@ export type LoggedOutUserInfo = {|\n|};\nexport type CurrentUserInfo = LoggedInUserInfo | LoggedOutUserInfo;\n+\n+export type AccountUpdate = {|\n+ updatedFields: {|\n+ email?: ?string,\n+ password?: ?string,\n+ |},\n+ currentPassword: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/fetch-utils.js",
"new_path": "lib/utils/fetch-utils.js",
"diff": "@@ -18,7 +18,7 @@ class ServerError extends ExtendableError {\nresult: ?Object;\n- constructor(error: string, result: Object) {\n+ constructor(error: string, result?: Object) {\nsuper(error);\nthis.result = result;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/utils/promises.js",
"diff": "+// @flow\n+\n+type Promisable<T> = Promise<T> | T;\n+type SpinPromise = <V>(promise: Promisable<V>) => V;\n+\n+async function promiseAll<T: {[key: string]: Promisable<*>}>(\n+ input: T,\n+): Promise<$ObjMap<T, SpinPromise>> {\n+ const promises = [];\n+ const keys = Object.keys(input);\n+ for (let i = 0; i < keys.length; i++) {\n+ const key = keys[i];\n+ const promise = input[key];\n+ promises.push(promise);\n+ }\n+ const results = await Promise.all(promises);\n+ const byName = {};\n+ for (let i = 0; i < keys.length; i++) {\n+ const key = keys[i];\n+ byName[key] = results[i];\n+ }\n+ return byName;\n+}\n+\n+export {\n+ promiseAll,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | edit_account.php -> jserver pt 1
Everything except for email. Introducing new utility function `promiseAll` which works on object-maps |
129,187 | 13.02.2018 23:56:32 | 18,000 | 77ff764e50f4d740f2238b3a821657ddabb55fce | resend_verification.php -> jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -11,6 +11,7 @@ import { deviceTokenUpdateResponder } from './responders/device-responders';\nimport {\nuserSubscriptionUpdateResponder,\naccountUpdateResponder,\n+ resendVerificationEmailResponder,\n} from './responders/user-responders';\nconst app = express();\n@@ -36,4 +37,8 @@ app.post(\n'/update_account',\nerrorHandler(accountUpdateResponder),\n);\n+app.post(\n+ '/resend_verification_email',\n+ errorHandler(resendVerificationEmailResponder),\n+);\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/creators/verification-code-creator.js",
"diff": "+// @flow\n+\n+import type { VerifyField } from 'lib/types/verify-types';\n+\n+import crypto from 'crypto';\n+import bcrypt from 'twin-bcrypt';\n+\n+import { pool, SQL } from '../database';\n+import createIDs from './id-creator';\n+\n+async function createVerificationCode(\n+ userID: string,\n+ field: VerifyField,\n+): Promise<string> {\n+ const code = crypto.randomBytes(4).toString('hex');\n+ const hash = bcrypt.hashSync(code);\n+ const [ id ] = await createIDs(\"verifications\", 1);\n+ const time = Date.now();\n+ const row = [id, userID, field, hash, time];\n+ const query = SQL`\n+ INSERT INTO verifications(id, user, field, hash, creation_time)\n+ VALUES ${[row]}\n+ `;\n+ await pool.query(query);\n+ return `${code}${parseInt(id).toString(16)}`;\n+}\n+\n+export default createVerificationCode;\n"
},
{
"change_type": "RENAME",
"old_path": "jserver/src/emails/verify-email-address.js",
"new_path": "jserver/src/emails/verification.js",
"diff": "// @flow\n-import type { VerifyField } from 'lib/types/verify-types';\n-\nimport React from 'react'\nimport ReactHTML from 'react-html-email';\n-import crypto from 'crypto';\n-import bcrypt from 'twin-bcrypt';\nimport nodemailer from 'nodemailer';\nimport { verifyField } from 'lib/types/verify-types';\nimport urlFacts from '../../facts/url';\n-import { pool, SQL } from '../database';\n-import createIDs from '../creators/id-creator';\n+import createVerificationCode from '../creators/verification-code-creator';\nconst { Email, Item, Span, A, renderEmail } = ReactHTML;\nconst sendmail = nodemailer.createTransport({ sendmail: true });\n@@ -24,7 +19,7 @@ async function sendEmailAddressVerificationEmail(\nemailAddress: string,\nwelcome: bool = false,\n): Promise<void> {\n- const code = await generateVerificationCode(userID, verifyField.EMAIL);\n+ const code = await createVerificationCode(userID, verifyField.EMAIL);\nconst link = baseDomain + basePath + `verify/${code}/`;\nlet welcomeText = null;\n@@ -62,23 +57,6 @@ async function sendEmailAddressVerificationEmail(\n});\n}\n-async function generateVerificationCode(\n- userID: string,\n- field: VerifyField,\n-): Promise<string> {\n- const code = crypto.randomBytes(4).toString('hex');\n- const hash = bcrypt.hashSync(code);\n- const [ id ] = await createIDs(\"verifications\", 1);\n- const time = Date.now();\n- const row = [id, userID, field, hash, time];\n- const query = SQL`\n- INSERT INTO verifications(id, user, field, hash, creation_time)\n- VALUES ${[row]}\n- `;\n- await pool.query(query);\n- return `${code}${parseInt(id).toString(16)}`;\n-}\n-\nexport {\nsendEmailAddressVerificationEmail,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -9,7 +9,10 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport { userSubscriptionUpdater } from '../updaters/user-subscription-updater';\n-import { accountUpdater } from '../updaters/account-updater';\n+import {\n+ accountUpdater,\n+ resendVerificationEmail,\n+} from '../updaters/account-updater';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tShape } from '../utils/tcomb-utils';\nimport { currentViewer } from '../session/viewer';\n@@ -70,7 +73,28 @@ async function accountUpdateResponder(req: $Request, res: $Response) {\nreturn { success: true };\n}\n+async function resendVerificationEmailResponder(req: $Request, res: $Response) {\n+ await setCurrentViewerFromCookie(req.cookies);\n+ const viewer = currentViewer();\n+ if (!viewer.loggedIn) {\n+ return { error: 'not_logged_in' };\n+ }\n+\n+ try {\n+ await resendVerificationEmail(viewer);\n+ } catch (e) {\n+ if (e instanceof ServerError) {\n+ return { error: e.message };\n+ } else {\n+ throw e;\n+ }\n+ }\n+\n+ return { success: true };\n+}\n+\nexport {\nuserSubscriptionUpdateResponder,\naccountUpdateResponder,\n+ resendVerificationEmailResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/account-updater.js",
"new_path": "jserver/src/updaters/account-updater.js",
"diff": "@@ -10,9 +10,7 @@ import { promiseAll } from 'lib/utils/promises';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport { pool, SQL } from '../database';\n-import {\n- sendEmailAddressVerificationEmail,\n-} from '../emails/verify-email-address';\n+import { sendEmailAddressVerificationEmail } from '../emails/verification';\nasync function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\nconst email = update.updatedFields.email;\n@@ -71,6 +69,29 @@ async function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\nawait Promise.all(savePromises);\n}\n+async function resendVerificationEmail(viewer: UserViewer) {\n+ const query = SQL`\n+ SELECT username, email, email_verified\n+ FROM users\n+ WHERE id = ${viewer.userID}\n+ `;\n+ const [ result ] = await pool.query(query);\n+ if (result.length === 0) {\n+ throw new ServerError('internal_error');\n+ }\n+ const row = result[0];\n+ if (row.email_verified) {\n+ throw new ServerError('already_verified');\n+ }\n+\n+ await sendEmailAddressVerificationEmail(\n+ viewer.userID,\n+ row.username,\n+ row.email,\n+ );\n+}\n+\nexport {\naccountUpdater,\n+ resendVerificationEmail,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/resend_verification.php",
"new_path": "server/resend_verification.php",
"diff": "<?php\n-require_once('async_lib.php');\n-require_once('config.php');\n-require_once('auth.php');\n-require_once('verify_lib.php');\n+require_once('call_node.php');\n-async_start();\n-\n-if (!user_logged_in()) {\n- async_end(array(\n- 'error' => 'not_logged_in',\n- ));\n-}\n-\n-$viewer_id = get_viewer_id();\n-$result = $conn->query(\n- \"SELECT username, email, email_verified FROM users WHERE id = $viewer_id\"\n-);\n-$user_row = $result->fetch_assoc();\n-$username = $user_row['username'];\n-$email = $user_row['email'];\n-$email_verified = $user_row['email_verified'];\n-\n-if ($email_verified) {\n- async_end(array(\n- 'error' => 'already_verified',\n- ));\n-}\n-\n-verify_email($viewer_id, $username, $email);\n-\n-async_end(array(\n- 'success' => true,\n-));\n+proxy_to_node('resend_verification_email');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | resend_verification.php -> jserver |
129,187 | 14.02.2018 00:00:58 | 18,000 | 1627f0f7d0175e84bb78579ca5cf125f63265633 | Couple jserver email fixes after production testing
Can't test sendmail on dev right now unfortunately... | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/emails/verification.js",
"new_path": "jserver/src/emails/verification.js",
"diff": "@@ -53,7 +53,7 @@ async function sendEmailAddressVerificationEmail(\nfrom: \"no-reply@squadcal.org\",\nto: emailAddress,\nsubject: title,\n- text: html,\n+ html,\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/account-updater.js",
"new_path": "jserver/src/updaters/account-updater.js",
"diff": "@@ -53,7 +53,7 @@ async function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\nsendEmailAddressVerificationEmail(\nviewer.userID,\nverifyRow.username,\n- verifyRow.email,\n+ email,\n),\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Couple jserver email fixes after production testing
Can't test sendmail on dev right now unfortunately... |
129,187 | 14.02.2018 00:10:26 | 18,000 | a1c9d4574710f3df2574d87abb6f7ba2c57bfaa9 | Allow use of call_node without any params
Needed for `resend_verification_email` | [
{
"change_type": "MODIFY",
"old_path": "server/call_node.php",
"new_path": "server/call_node.php",
"diff": "@@ -30,15 +30,13 @@ function call_node($path, $blob) {\nfunction proxy_to_node($path) {\nasync_start();\n- if (!isset($_POST['input'])) {\n- async_end(array(\n- 'error' => 'invalid_parameters',\n- ));\n+ if (isset($_POST['input'])) {\n+ $payload = fix_bools($_POST['input']);\n+ } else {\n+ $payload = (object)array();\n}\n- $fixed_bools = fix_bools($_POST['input']);\n-\n- async_end(call_node($path, $fixed_bools));\n+ async_end(call_node($path, $payload));\n}\nfunction fix_bools($input) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Allow use of call_node without any params
Needed for `resend_verification_email` |
129,187 | 14.02.2018 11:20:25 | 18,000 | 78da21f754ed9a809d3155896400a51cbc5467f0 | Use more idiomatic "Material Design" standards on Android | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -7,17 +7,27 @@ import { chatThreadItemPropType } from '../selectors/chat-selectors';\nimport type { NavigationScreenProp, NavigationRoute } from 'react-navigation';\nimport React from 'react';\n-import { View, StyleSheet, FlatList } from 'react-native';\n+import { View, StyleSheet, FlatList, Platform } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\n+import IonIcon from 'react-native-vector-icons/Ionicons';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport _sum from 'lodash/fp/sum';\n+import { FloatingAction } from 'react-native-floating-action';\nimport { chatListData } from '../selectors/chat-selectors';\nimport ChatThreadListItem from './chat-thread-list-item.react';\nimport { MessageListRouteName } from './message-list.react';\n-import AddThreadButton from './add-thread-button.react';\n+import ComposeThreadButton from './compose-thread-button.react';\nimport { registerChatScreen } from './chat-screen-registry';\n+import { AddThreadRouteName } from './add-thread.react';\n+\n+const floatingActions = [{\n+ text: 'Compose',\n+ icon: (<IonIcon name=\"md-create\" size={24} color=\"#FFFFFF\" />),\n+ name: 'compose',\n+ position: 1,\n+}];\ntype Props = {\nnavigation: NavigationScreenProp<NavigationRoute>,\n@@ -39,7 +49,9 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n};\nstatic navigationOptions = ({ navigation }) => ({\ntitle: 'Threads',\n- headerRight: <AddThreadButton navigate={navigation.navigate} />,\n+ headerRight: Platform.OS === \"ios\"\n+ ? (<ComposeThreadButton navigate={navigation.navigate} />)\n+ : null,\n});\ncomponentDidMount() {\n@@ -91,6 +103,17 @@ class InnerChatThreadList extends React.PureComponent<Props> {\nrender() {\n// this.props.viewerID is in extraData since it's used by MessagePreview\n// within ChatThreadListItem\n+ let floatingAction = null;\n+ if (Platform.OS === \"android\") {\n+ floatingAction = (\n+ <FloatingAction\n+ actions={floatingActions}\n+ overrideWithAction\n+ onPressItem={this.composeThread}\n+ buttonColor=\"#66AA66\"\n+ />\n+ );\n+ }\nreturn (\n<View style={styles.container}>\n<FlatList\n@@ -102,6 +125,7 @@ class InnerChatThreadList extends React.PureComponent<Props> {\nextraData={this.props.viewerID}\nstyle={styles.flatList}\n/>\n+ {floatingAction}\n</View>\n);\n}\n@@ -113,6 +137,10 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n);\n}\n+ composeThread = () => {\n+ this.props.navigation.navigate(AddThreadRouteName, {});\n+ }\n+\n}\nconst styles = StyleSheet.create({\n"
},
{
"change_type": "RENAME",
"old_path": "native/chat/add-thread-button.react.js",
"new_path": "native/chat/compose-thread-button.react.js",
"diff": "import type { NavigationParams } from 'react-navigation';\nimport React from 'react';\n-import { Platform, StyleSheet } from 'react-native';\n+import { StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport PropTypes from 'prop-types';\n@@ -17,7 +17,7 @@ type Props = {\nparams?: NavigationParams,\n) => bool,\n};\n-class AddThreadButton extends React.PureComponent<Props> {\n+class ComposeThreadButton extends React.PureComponent<Props> {\nstatic propTypes = {\nparentThreadID: PropTypes.string,\n@@ -25,29 +25,14 @@ class AddThreadButton extends React.PureComponent<Props> {\n};\nrender() {\n- let icon;\n- if (Platform.OS === \"ios\") {\n- icon = (\n+ return (\n+ <Button onPress={this.onPress} androidBorderlessRipple={true}>\n<Icon\n- name=\"ios-add\"\n- size={36}\n- style={styles.addButton}\n+ name=\"ios-create-outline\"\n+ size={30}\n+ style={styles.composeButton}\ncolor=\"#036AFF\"\n/>\n- );\n- } else {\n- icon = (\n- <Icon\n- name=\"md-add\"\n- size={36}\n- style={styles.addButton}\n- color=\"#0077CC\"\n- />\n- );\n- }\n- return (\n- <Button onPress={this.onPress} androidBorderlessRipple={true}>\n- {icon}\n</Button>\n);\n}\n@@ -62,9 +47,9 @@ class AddThreadButton extends React.PureComponent<Props> {\n}\nconst styles = StyleSheet.create({\n- addButton: {\n+ composeButton: {\npaddingHorizontal: 10,\n},\n});\n-export default AddThreadButton;\n+export default ComposeThreadButton;\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": "@@ -49,15 +49,6 @@ class MessageListHeaderTitle extends React.PureComponent<Props> {\nstyle={styles.fakeIcon}\n/>\n);\n- } else {\n- icon = (\n- <Icon\n- name=\"md-arrow-forward\"\n- size={20}\n- style={styles.forwardIcon}\n- color=\"#0077CC\"\n- />\n- );\n}\nreturn (\n<Button\n@@ -103,9 +94,9 @@ const styles = StyleSheet.create({\n},\ncontainer: {\nflex: 1,\n- flexDirection: 'row',\n- alignItems: 'center',\n- justifyContent: 'center',\n+ flexDirection: \"row\",\n+ alignItems: \"center\",\n+ justifyContent: Platform.OS === \"android\" ? \"flex-start\" : \"center\",\n},\nforwardIcon: {\nflex: 1,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -58,10 +58,10 @@ import { Message, messageItemHeight } from './message.react';\nimport TextHeightMeasurer from '../text-height-measurer.react';\nimport InputBar from './input-bar.react';\nimport ListLoadingIndicator from '../list-loading-indicator.react';\n-import AddThreadButton from './add-thread-button.react';\nimport MessageListHeaderTitle from './message-list-header-title.react';\nimport MessageListHeader from './message-list-header.react';\nimport { registerChatScreen } from './chat-screen-registry';\n+import ThreadSettingsButton from './thread-settings-button.react';\ntype NavProp = NavigationScreenProp<NavigationRoute>\n& { state: { params: { threadInfo: ThreadInfo } } };\n@@ -152,12 +152,15 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nonWidthChange={onTitleWidthChange}\n/>\n),\n- headerRight: (\n- <AddThreadButton\n- parentThreadID={navigation.state.params.threadInfo.id}\n+ headerRight:\n+ Platform.OS === \"android\"\n+ ? (\n+ <ThreadSettingsButton\n+ threadInfo={navigation.state.params.threadInfo}\nnavigate={navigation.navigate}\n/>\n- ),\n+ )\n+ : null,\nheader: (props: *) => (\n<MessageListHeader\n{...props}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/thread-settings-button.react.js",
"diff": "+// @flow\n+\n+import type { NavigationParams } from 'react-navigation';\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+\n+import React from 'react';\n+import { StyleSheet } from 'react-native';\n+import Icon from 'react-native-vector-icons/Ionicons';\n+import PropTypes from 'prop-types';\n+\n+import { ThreadSettingsRouteName } from './settings/thread-settings.react';\n+import Button from '../components/button.react';\n+\n+type Props = {\n+ threadInfo: ThreadInfo,\n+ navigate: (\n+ routeName: string,\n+ params?: NavigationParams,\n+ ) => bool,\n+};\n+class ThreadSettingsButton extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ navigate: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ return (\n+ <Button onPress={this.onPress} androidBorderlessRipple={true}>\n+ <Icon\n+ name=\"md-settings\"\n+ size={30}\n+ style={styles.button}\n+ color=\"#3366AA\"\n+ />\n+ </Button>\n+ );\n+ }\n+\n+ onPress = () => {\n+ this.props.navigate(\n+ ThreadSettingsRouteName,\n+ { threadInfo: this.props.threadInfo },\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ button: {\n+ paddingHorizontal: 10,\n+ },\n+});\n+\n+export default ThreadSettingsButton;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/lib_vx.x.x.js",
"new_path": "native/flow-typed/npm/lib_vx.x.x.js",
"diff": "-// flow-typed signature: 034e9f6dc5802ccdde9f3f7407fe12b2\n+// flow-typed signature: 92bb348d313ffc88d7b6d48021652c54\n// flow-typed version: <<STUB>>/lib_v0.0.1/flow_v0.61.0\n/**\n@@ -230,6 +230,10 @@ declare module 'lib/types/activity-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/device-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/entry-types' {\ndeclare module.exports: any;\n}\n@@ -270,6 +274,10 @@ declare module 'lib/types/user-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/verify-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/utils/action-utils' {\ndeclare module.exports: any;\n}\n@@ -294,6 +302,10 @@ declare module 'lib/utils/local-ids' {\ndeclare module.exports: any;\n}\n+declare module 'lib/utils/promises' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/utils/sleep' {\ndeclare module.exports: any;\n}\n@@ -467,6 +479,9 @@ declare module 'lib/shared/user-utils.js' {\ndeclare module 'lib/types/activity-types.js' {\ndeclare module.exports: $Exports<'lib/types/activity-types'>;\n}\n+declare module 'lib/types/device-types.js' {\n+ declare module.exports: $Exports<'lib/types/device-types'>;\n+}\ndeclare module 'lib/types/entry-types.js' {\ndeclare module.exports: $Exports<'lib/types/entry-types'>;\n}\n@@ -497,6 +512,9 @@ declare module 'lib/types/thread-types.js' {\ndeclare module 'lib/types/user-types.js' {\ndeclare module.exports: $Exports<'lib/types/user-types'>;\n}\n+declare module 'lib/types/verify-types.js' {\n+ declare module.exports: $Exports<'lib/types/verify-types'>;\n+}\ndeclare module 'lib/utils/action-utils.js' {\ndeclare module.exports: $Exports<'lib/utils/action-utils'>;\n}\n@@ -515,6 +533,9 @@ declare module 'lib/utils/fetch-utils.js' {\ndeclare module 'lib/utils/local-ids.js' {\ndeclare module.exports: $Exports<'lib/utils/local-ids'>;\n}\n+declare module 'lib/utils/promises.js' {\n+ declare module.exports: $Exports<'lib/utils/promises'>;\n+}\ndeclare module 'lib/utils/sleep.js' {\ndeclare module.exports: $Exports<'lib/utils/sleep'>;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/flow-typed/npm/react-native-floating-action_vx.x.x.js",
"diff": "+// flow-typed signature: 177073943a2b5ffd3b48b0c4548b54f0\n+// flow-typed version: <<STUB>>/react-native-floating-action_v^1.9.0/flow_v0.61.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'react-native-floating-action'\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 'react-native-floating-action' {\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 'react-native-floating-action/component/FloatingAction' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/component/FloatingActionItem' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/component/index' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/component/utils/color' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/component/utils/touchable' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/App' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/components/Property' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/rn-cli.config' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionActionsDistance' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionCenterScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionChangeActionColor' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionColorScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionDistanceEdge' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionHideBackgroundScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionLeftScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOpenMountScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverlayScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverrideWithActionScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionRightScreen' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionStatusProgramatically' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionVisibilityScreen' {\n+ declare module.exports: any;\n+}\n+\n+// Filename aliases\n+declare module 'react-native-floating-action/component/FloatingAction.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/component/FloatingAction'>;\n+}\n+declare module 'react-native-floating-action/component/FloatingActionItem.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/component/FloatingActionItem'>;\n+}\n+declare module 'react-native-floating-action/component/index.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/component/index'>;\n+}\n+declare module 'react-native-floating-action/component/utils/color.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/component/utils/color'>;\n+}\n+declare module 'react-native-floating-action/component/utils/touchable.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/component/utils/touchable'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/App.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/App'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/components/Property.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/components/Property'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/rn-cli.config.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/rn-cli.config'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionActionsDistance.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionActionsDistance'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionCenterScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionCenterScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionChangeActionColor.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionChangeActionColor'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionColorScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionColorScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionDistanceEdge.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionDistanceEdge'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionHideBackgroundScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionHideBackgroundScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionLeftScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionLeftScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOpenMountScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOpenMountScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverlayScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverlayScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverrideWithActionScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionOverrideWithActionScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionRightScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionRightScreen'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionStatusProgramatically.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionStatusProgramatically'>;\n+}\n+declare module 'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionVisibilityScreen.js' {\n+ declare module.exports: $Exports<'react-native-floating-action/example/ReactNativeFloatingAction-Expo/screens/FloatingActionVisibilityScreen'>;\n+}\n+declare module 'react-native-floating-action/index' {\n+ declare module.exports: $Exports<'react-native-floating-action'>;\n+}\n+declare module 'react-native-floating-action/index.js' {\n+ declare module.exports: $Exports<'react-native-floating-action'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/react-native-popover-tooltip_vx.x.x.js",
"new_path": "native/flow-typed/npm/react-native-popover-tooltip_vx.x.x.js",
"diff": "-// flow-typed signature: 2341d0507766af2e25225ad8bc98b9bd\n-// flow-typed version: <<STUB>>/react-native-popover-tooltip_v^1.1.4/flow_v0.61.0\n+// flow-typed signature: 1daaef4adbdf7bfd1cabe37203d9ff99\n+// flow-typed version: <<STUB>>/react-native-popover-tooltip_vgit+https://git@github.com/ashoat/react-native-popover-tooltip.git/flow_v0.61.0\n/**\n* This is an autogenerated libdef stub for:\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/react-navigation-redux-helpers_vx.x.x.js",
"new_path": "native/flow-typed/npm/react-navigation-redux-helpers_vx.x.x.js",
"diff": "-// flow-typed signature: 9d35655972b3387dcff7bd3b68a2f951\n-// flow-typed version: <<STUB>>/react-navigation-redux-helpers_v^1.0.0/flow_v0.61.0\n+// flow-typed signature: f7fd4a451aa4b8dcda2ff9ccd5e3bbd5\n+// flow-typed version: <<STUB>>/react-navigation-redux-helpers_v^1.0.1/flow_v0.61.0\n/**\n* This is an autogenerated libdef stub for:\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"new_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"diff": "-// flow-typed signature: 0ff157c8ecd2c1bd0d65f0e03956025c\n-// flow-typed version: f4e88d4fed/react-navigation_v1.x.x/flow_>=v0.60.x\n+// flow-typed signature: 2ec149f998c0e60bacc18810504a8499\n+// flow-typed version: 061d4cda47/react-navigation_v1.x.x/flow_>=v0.60.x\n// @flow\ndeclare module 'react-navigation' {\n-\n/**\n* First, a bunch of things we would love to import but instead must\n* reconstruct (mostly copy-pasted).\n@@ -71,6 +70,8 @@ declare module 'react-navigation' {\n// The action to run inside the sub-router\naction?: NavigationNavigateAction,\n+\n+ key?: string,\n|};\ndeclare type DeprecatedNavigationNavigateAction = {|\n@@ -133,8 +134,9 @@ declare module 'react-navigation' {\ntype: 'Reset',\nindex: number,\nkey?: ?string,\n- actions:\n- Array<NavigationNavigateAction | DeprecatedNavigationNavigateAction>,\n+ actions: Array<\n+ NavigationNavigateAction | DeprecatedNavigationNavigateAction\n+ >,\n|};\ndeclare export type NavigationUriAction = {|\n@@ -147,9 +149,37 @@ declare module 'react-navigation' {\nuri: string,\n|};\n+ declare export type NavigationReplaceAction = {|\n+ +type: 'Navigation/REPLACE',\n+ +key: string,\n+ +routeName: string,\n+ +params?: NavigationParams,\n+ +action?: NavigationNavigateAction,\n+ |};\n+ declare export type NavigationPopAction = {|\n+ +type: 'Navigation/POP',\n+ +n?: number,\n+ +immediate?: boolean,\n+ |};\n+ declare export type NavigationPopToTopAction = {|\n+ +type: 'Navigation/POP_TO_TOP',\n+ +immediate?: boolean,\n+ |};\n+ declare export type NavigationPushAction = {|\n+ +type: 'Navigation/PUSH',\n+ +routeName: string,\n+ +params?: NavigationParams,\n+ +action?: NavigationNavigateAction,\n+ +key?: string,\n+ |};\n+\ndeclare export type NavigationAction =\n| NavigationInitAction\n| NavigationNavigateAction\n+ | NavigationReplaceAction\n+ | NavigationPopAction\n+ | NavigationPopToTopAction\n+ | NavigationPushAction\n| NavigationBackAction\n| NavigationSetParamsAction\n| NavigationResetAction;\n@@ -212,9 +242,8 @@ declare module 'react-navigation' {\nparams?: NavigationParams,\n};\n- declare export type NavigationStateRoute =\n- & NavigationLeafRoute\n- & NavigationState;\n+ declare export type NavigationStateRoute = NavigationLeafRoute &\n+ NavigationState;\n/**\n* Router\n@@ -294,12 +323,8 @@ declare module 'react-navigation' {\nRoute: NavigationRoute,\nOptions: {},\nProps: {}\n- > =\n- & React$ComponentType<NavigationNavigatorProps<Options, Route> & Props>\n- & (\n- | {}\n- | { navigationOptions: NavigationScreenConfig<Options> }\n- );\n+ > = React$ComponentType<NavigationNavigatorProps<Options, Route> & Props> &\n+ ({} | { navigationOptions: NavigationScreenConfig<Options> });\ndeclare export type NavigationNavigator<\nState: NavigationState,\n@@ -337,7 +362,8 @@ declare module 'react-navigation' {\ndeclare export type HeaderMode = 'float' | 'screen' | 'none';\n- declare export type HeaderProps = $Shape<NavigationSceneRendererProps & {\n+ declare export type HeaderProps = $Shape<\n+ NavigationSceneRendererProps & {\nmode: HeaderMode,\nrouter: NavigationRouter<NavigationState, NavigationStackScreenOptions>,\ngetScreenDetails: NavigationScene => NavigationScreenDetails<\n@@ -346,7 +372,8 @@ declare module 'react-navigation' {\nleftInterpolator: (props: NavigationSceneRendererProps) => {},\ntitleInterpolator: (props: NavigationSceneRendererProps) => {},\nrightInterpolator: (props: NavigationSceneRendererProps) => {},\n- }>;\n+ }\n+ >;\n/**\n* Stack Navigator\n@@ -496,6 +523,18 @@ declare module 'react-navigation' {\neventName: string,\ncallback: NavigationEventCallback\n) => NavigationEventSubscription,\n+ push: (\n+ routeName: string,\n+ params?: NavigationParams,\n+ action?: NavigationNavigateAction\n+ ) => boolean,\n+ replace: (\n+ routeName: string,\n+ params?: NavigationParams,\n+ action?: NavigationNavigateAction\n+ ) => boolean,\n+ pop: (n?: number, params?: { immediate?: boolean }) => boolean,\n+ popToTop: (params?: { immediate?: boolean }) => boolean,\n};\ndeclare export type NavigationNavigatorProps<O: {}, S: {}> = $Shape<{\n@@ -770,7 +809,7 @@ declare module 'react-navigation' {\n>(\nrouter: NavigationRouter<S, O>,\nrouteConfigs?: NavigationRouteConfigMap,\n- navigatorConfig?: NavigatorConfig,\n+ navigatorConfig?: NavigatorConfig\n): _NavigatorCreator<NavigationViewProps, S, O>;\ndeclare export function StackNavigator(\n@@ -1029,6 +1068,7 @@ declare module 'react-navigation' {\ndeclare type _TabBarBottomProps = {\nactiveTintColor: string,\nactiveBackgroundColor: string,\n+ adaptive?: boolean,\ninactiveTintColor: string,\ninactiveBackgroundColor: string,\nshowLabel: boolean,\n"
},
{
"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-fcm\": \"^11.2.0\",\n+ \"react-native-floating-action\": \"^1.9.0\",\n\"react-native-in-app-notification\": \"^2.1.0\",\n\"react-native-keychain\": \"^1.2.1\",\n\"react-native-modal\": \"^4.0.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -7279,6 +7279,12 @@ react-native-fcm@^11.2.0:\nversion \"11.3.1\"\nresolved \"https://registry.yarnpkg.com/react-native-fcm/-/react-native-fcm-11.3.1.tgz#eae59deb3972d19fdd8d8b52da18984377276e84\"\n+react-native-floating-action@^1.9.0:\n+ version \"1.9.0\"\n+ resolved \"https://registry.yarnpkg.com/react-native-floating-action/-/react-native-floating-action-1.9.0.tgz#5a10f47c5a1c2bf8fc1e07435d60f12576958835\"\n+ dependencies:\n+ lodash \"^4.17.4\"\n+\nreact-native-in-app-notification@^2.1.0:\nversion \"2.2.0\"\nresolved \"https://registry.yarnpkg.com/react-native-in-app-notification/-/react-native-in-app-notification-2.2.0.tgz#690a9ef75bd0eecc15de77468f009a762c9f1748\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use more idiomatic "Material Design" standards on Android |
129,187 | 14.02.2018 19:46:27 | 18,000 | 88b5459f5fda0b700921db7e3611ec9c2cbde88c | New thread composition workflow | [
{
"change_type": "MODIFY",
"old_path": "native/chat/add-thread.react.js",
"new_path": "native/chat/add-thread.react.js",
"diff": "@@ -58,6 +58,7 @@ import LinkButton from '../components/link-button.react';\nimport { MessageListRouteName } from './message-list.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport ColorPickerModal from './color-picker-modal.react';\n+import { iosKeyboardHeight } from '../dimensions';\nconst tagInputProps = {\nplaceholder: \"username\",\n@@ -293,7 +294,7 @@ class InnerAddThread extends React.PureComponent<Props, State> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={65}\n+ keyboardVerticalOffset={iosKeyboardHeight}\n>{content}</KeyboardAvoidingView>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -20,7 +20,7 @@ import ChatThreadListItem from './chat-thread-list-item.react';\nimport { MessageListRouteName } from './message-list.react';\nimport ComposeThreadButton from './compose-thread-button.react';\nimport { registerChatScreen } from './chat-screen-registry';\n-import { AddThreadRouteName } from './add-thread.react';\n+import { ComposeThreadRouteName } from './compose-thread.react';\nconst floatingActions = [{\ntext: 'Compose',\n@@ -138,7 +138,7 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n}\ncomposeThread = () => {\n- this.props.navigation.navigate(AddThreadRouteName, {});\n+ this.props.navigation.navigate(ComposeThreadRouteName, {});\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat.react.js",
"new_path": "native/chat/chat.react.js",
"diff": "@@ -13,6 +13,7 @@ import {\n} from './chat-thread-list.react';\nimport { MessageList, MessageListRouteName } from './message-list.react';\nimport { AddThread, AddThreadRouteName } from './add-thread.react';\n+import { ComposeThread, ComposeThreadRouteName } from './compose-thread.react';\nimport {\nThreadSettings,\nThreadSettingsRouteName,\n@@ -24,6 +25,7 @@ const Chat = StackNavigator(\n[ChatThreadListRouteName]: { screen: ChatThreadList },\n[MessageListRouteName]: { screen: MessageList },\n[AddThreadRouteName]: { screen: AddThread },\n+ [ComposeThreadRouteName]: { screen: ComposeThread },\n[ThreadSettingsRouteName]: { screen: ThreadSettings },\n},\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread-button.react.js",
"new_path": "native/chat/compose-thread-button.react.js",
"diff": "@@ -7,11 +7,10 @@ import { StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport PropTypes from 'prop-types';\n-import { AddThreadRouteName } from './add-thread.react';\n+import { ComposeThreadRouteName } from './compose-thread.react';\nimport Button from '../components/button.react';\ntype Props = {\n- parentThreadID?: string,\nnavigate: (\nrouteName: string,\nparams?: NavigationParams,\n@@ -20,7 +19,6 @@ type Props = {\nclass ComposeThreadButton extends React.PureComponent<Props> {\nstatic propTypes = {\n- parentThreadID: PropTypes.string,\nnavigate: PropTypes.func.isRequired,\n};\n@@ -38,10 +36,7 @@ class ComposeThreadButton extends React.PureComponent<Props> {\n}\nonPress = () => {\n- this.props.navigate(\n- AddThreadRouteName,\n- { parentThreadID: this.props.parentThreadID },\n- );\n+ this.props.navigate(ComposeThreadRouteName, {});\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/compose-thread.react.js",
"diff": "+// @flow\n+\n+import type { NavigationScreenProp, NavigationRoute } from 'react-navigation';\n+import type { AppState } from '../redux-setup';\n+import type { LoadingStatus } from 'lib/types/loading-types';\n+import { loadingStatusPropType } from 'lib/types/loading-types';\n+import {\n+ type ThreadInfo,\n+ threadInfoPropType,\n+ type VisibilityRules,\n+ visibilityRules,\n+} from 'lib/types/thread-types';\n+import type { AccountUserInfo } from 'lib/types/user-types';\n+import { accountUserInfoPropType } from 'lib/types/user-types';\n+import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import type { SearchUsersResult } from 'lib/actions/user-actions';\n+import type { NewThreadResult } from 'lib/actions/thread-actions';\n+\n+import * as React from 'react';\n+import PropTypes from 'prop-types';\n+import {\n+ View,\n+ Text,\n+ StyleSheet,\n+ Alert,\n+ KeyboardAvoidingView,\n+ Platform,\n+} from 'react-native';\n+import { connect } from 'react-redux';\n+import invariant from 'invariant';\n+import _flow from 'lodash/fp/flow';\n+import _filter from 'lodash/fp/filter';\n+import _sortBy from 'lodash/fp/sortBy';\n+\n+import {\n+ includeDispatchActionProps,\n+ bindServerCalls,\n+} from 'lib/utils/action-utils';\n+import {\n+ newThreadActionTypes,\n+ newChatThread,\n+} from 'lib/actions/thread-actions';\n+import {\n+ searchUsersActionTypes,\n+ searchUsers,\n+} from 'lib/actions/user-actions';\n+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+import {\n+ userInfoSelectorForOtherMembersOfThread,\n+ userSearchIndexForOtherMembersOfThread,\n+} from 'lib/selectors/user-selectors';\n+import SearchIndex from 'lib/shared/search-index';\n+import { generateRandomColor } from 'lib/shared/thread-utils';\n+import { getUserSearchResults } from 'lib/shared/search-utils';\n+import { registerFetchKey } from 'lib/reducers/loading-reducer';\n+import { threadInfoSelector } from 'lib/selectors/thread-selectors';\n+\n+import TagInput from '../components/tag-input.react';\n+import UserList from '../components/user-list.react';\n+import ThreadList from '../components/thread-list.react';\n+import LinkButton from '../components/link-button.react';\n+import { MessageListRouteName } from './message-list.react';\n+import { registerChatScreen } from './chat-screen-registry';\n+import { iosKeyboardHeight } from '../dimensions';\n+\n+const tagInputProps = {\n+ placeholder: \"username\",\n+ autoFocus: true,\n+};\n+\n+const segmentedPrivacyOptions = ['Public', 'Secret'];\n+\n+type Props = {\n+ navigation: NavigationScreenProp<NavigationRoute>,\n+ // Redux state\n+ loadingStatus: LoadingStatus,\n+ parentThreadInfo: ?ThreadInfo,\n+ otherUserInfos: {[id: string]: AccountUserInfo},\n+ userSearchIndex: SearchIndex,\n+ threadInfos: {[id: string]: ThreadInfo},\n+ // Redux dispatch functions\n+ dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ newChatThread: (\n+ name: string,\n+ ourVisibilityRules: VisibilityRules,\n+ color: string,\n+ userIDs: string[],\n+ parentThreadID: ?string,\n+ ) => Promise<NewThreadResult>,\n+ searchUsers: (usernamePrefix: string) => Promise<SearchUsersResult>,\n+};\n+type State = {\n+ usernameInputText: string,\n+ userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n+ userSearchResults: $ReadOnlyArray<AccountUserInfo>,\n+ tagInputHeight: number,\n+ existingThreads: ThreadInfo[],\n+};\n+class InnerComposeThread extends React.PureComponent<Props, State> {\n+\n+ static propTypes = {\n+ navigation: PropTypes.shape({\n+ state: PropTypes.shape({\n+ key: PropTypes.string.isRequired,\n+ }).isRequired,\n+ setParams: PropTypes.func.isRequired,\n+ goBack: PropTypes.func.isRequired,\n+ navigate: PropTypes.func.isRequired,\n+ }).isRequired,\n+ loadingStatus: loadingStatusPropType.isRequired,\n+ parentThreadInfo: threadInfoPropType,\n+ otherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\n+ userSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\n+ threadInfos: PropTypes.objectOf(threadInfoPropType).isRequired,\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ newChatThread: PropTypes.func.isRequired,\n+ searchUsers: PropTypes.func.isRequired,\n+ };\n+ static navigationOptions = ({ navigation }) => ({\n+ title: 'Compose thread',\n+ headerRight: (\n+ <LinkButton\n+ text=\"Create\"\n+ onPress={() => navigation.state.params.onPressCreateThread()}\n+ />\n+ ),\n+ headerBackTitle: \"Back\",\n+ });\n+ mounted = false;\n+ tagInput: ?TagInput<AccountUserInfo>;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ const userSearchResults = getUserSearchResults(\n+ \"\",\n+ props.otherUserInfos,\n+ props.userSearchIndex,\n+ [],\n+ );\n+ this.state = {\n+ usernameInputText: \"\",\n+ userInfoInputArray: [],\n+ userSearchResults,\n+ tagInputHeight: 36,\n+ existingThreads: [],\n+ };\n+ }\n+\n+ componentDidMount() {\n+ this.mounted = true;\n+ registerChatScreen(this.props.navigation.state.key, this);\n+ this.searchUsers(\"\");\n+ this.props.navigation.setParams({\n+ onPressCreateThread: this.onPressCreateThread,\n+ });\n+ }\n+\n+ componentWillUnmount() {\n+ this.mounted = false;\n+ registerChatScreen(this.props.navigation.state.key, null);\n+ }\n+\n+ canReset = () => false;\n+\n+ componentWillReceiveProps(nextProps: Props) {\n+ if (!this.mounted) {\n+ return;\n+ }\n+ const newState = {};\n+ if (\n+ this.props.otherUserInfos !== nextProps.otherUserInfos ||\n+ this.props.userSearchIndex !== nextProps.userSearchIndex\n+ ) {\n+ const userSearchResults = getUserSearchResults(\n+ this.state.usernameInputText,\n+ nextProps.otherUserInfos,\n+ nextProps.userSearchIndex,\n+ this.state.userInfoInputArray.map(userInfo => userInfo.id),\n+ );\n+ newState.userSearchResults = userSearchResults;\n+ }\n+ if (this.props.threadInfos !== nextProps.threadInfos) {\n+ const existingThreads = InnerComposeThread.existingThreadsWithUsers(\n+ nextProps,\n+ this.state,\n+ );\n+ newState.existingThreads = existingThreads;\n+ }\n+ if (Object.keys(newState).length > 0) {\n+ this.setState(newState);\n+ }\n+ }\n+\n+ componentWillUpdate(nextProps: Props, nextState: State) {\n+ if (this.state.userInfoInputArray !== nextState.userInfoInputArray) {\n+ const existingThreads = InnerComposeThread.existingThreadsWithUsers(\n+ nextProps,\n+ nextState,\n+ );\n+ this.setState({ existingThreads });\n+ }\n+ }\n+\n+ static existingThreadsWithUsers(props: Props, state: State) {\n+ const userIDs = state.userInfoInputArray.map(userInfo => userInfo.id);\n+ if (userIDs.length === 0) {\n+ return [];\n+ }\n+ return _flow(\n+ _filter(\n+ (threadInfo: ThreadInfo) => userIDs.every(\n+ userID => threadInfo.members.some(member => member.id === userID),\n+ ),\n+ ),\n+ _sortBy([\n+ 'members.length',\n+ (threadInfo: ThreadInfo) => threadInfo.name ? 1 : 0,\n+ ]),\n+ )(props.threadInfos);\n+ }\n+\n+ render() {\n+ let existingThreadsSection = null;\n+ const existingThreads = this.state.existingThreads;\n+ if (existingThreads.length > 0) {\n+ existingThreadsSection = (\n+ <View style={styles.existingThreads}>\n+ <View style={styles.existingThreadsRow}>\n+ <Text style={styles.existingThreadsLabel}>\n+ Existing threads\n+ </Text>\n+ </View>\n+ <View style={styles.existingThreadList}>\n+ <ThreadList\n+ threadInfos={existingThreads}\n+ onSelect={this.onSelectExistingThread}\n+ itemTextStyle={styles.listItem}\n+ />\n+ </View>\n+ </View>\n+ );\n+ }\n+ const content = (\n+ <React.Fragment>\n+ <View style={[\n+ styles.userSelectionRow,\n+ { height: this.state.tagInputHeight + 13 },\n+ ]}>\n+ <Text style={styles.tagInputLabel}>To: </Text>\n+ <View style={styles.tagInputContainer}>\n+ <TagInput\n+ value={this.state.userInfoInputArray}\n+ onChange={this.onChangeTagInput}\n+ text={this.state.usernameInputText}\n+ onChangeText={this.setUsernameInputText}\n+ onHeightChange={this.onTagInputHeightChange}\n+ labelExtractor={this.tagDataLabelExtractor}\n+ inputProps={tagInputProps}\n+ ref={this.tagInputRef}\n+ />\n+ </View>\n+ </View>\n+ <View style={styles.userList}>\n+ <UserList\n+ userInfos={this.state.userSearchResults}\n+ onSelect={this.onUserSelect}\n+ itemTextStyle={styles.listItem}\n+ />\n+ </View>\n+ {existingThreadsSection}\n+ </React.Fragment>\n+ );\n+ if (Platform.OS === \"ios\") {\n+ return (\n+ <KeyboardAvoidingView\n+ style={styles.container}\n+ behavior=\"padding\"\n+ keyboardVerticalOffset={iosKeyboardHeight}\n+ >{content}</KeyboardAvoidingView>\n+ );\n+ } else {\n+ return <View style={styles.container}>{content}</View>;\n+ }\n+ }\n+\n+ tagInputRef = (tagInput: ?TagInput<AccountUserInfo>) => {\n+ this.tagInput = tagInput;\n+ }\n+\n+ onChangeTagInput = (userInfoInputArray: $ReadOnlyArray<AccountUserInfo>) => {\n+ const userSearchResults = getUserSearchResults(\n+ this.state.usernameInputText,\n+ this.props.otherUserInfos,\n+ this.props.userSearchIndex,\n+ userInfoInputArray.map(userInfo => userInfo.id),\n+ );\n+ this.setState({ userInfoInputArray, userSearchResults });\n+ }\n+\n+ tagDataLabelExtractor = (userInfo: AccountUserInfo) => userInfo.username;\n+\n+ setUsernameInputText = (text: string) => {\n+ const userSearchResults = getUserSearchResults(\n+ text,\n+ this.props.otherUserInfos,\n+ this.props.userSearchIndex,\n+ this.state.userInfoInputArray.map(userInfo => userInfo.id),\n+ );\n+ this.searchUsers(text);\n+ this.setState({ usernameInputText: text, userSearchResults });\n+ }\n+\n+ searchUsers(usernamePrefix: string) {\n+ this.props.dispatchActionPromise(\n+ searchUsersActionTypes,\n+ this.props.searchUsers(usernamePrefix),\n+ );\n+ }\n+\n+ onUserSelect = (userID: string) => {\n+ for (let existingUserInfo of this.state.userInfoInputArray) {\n+ if (userID === existingUserInfo.id) {\n+ return;\n+ }\n+ }\n+ const userInfoInputArray = [\n+ ...this.state.userInfoInputArray,\n+ this.props.otherUserInfos[userID],\n+ ];\n+ const userSearchResults = getUserSearchResults(\n+ \"\",\n+ this.props.otherUserInfos,\n+ this.props.userSearchIndex,\n+ userInfoInputArray.map(userInfo => userInfo.id),\n+ );\n+ this.setState({\n+ userInfoInputArray,\n+ usernameInputText: \"\",\n+ userSearchResults,\n+ });\n+ }\n+\n+ onTagInputHeightChange = (height: number) => {\n+ this.setState({ tagInputHeight: height });\n+ }\n+\n+ onPressCreateThread = () => {\n+ this.props.dispatchActionPromise(\n+ newThreadActionTypes,\n+ this.newChatThreadAction(),\n+ );\n+ }\n+\n+ async newChatThreadAction() {\n+ try {\n+ return await this.props.newChatThread(\n+ \"\",\n+ visibilityRules.CHAT_SECRET,\n+ generateRandomColor(),\n+ this.state.userInfoInputArray.map(\n+ (userInfo: AccountUserInfo) => userInfo.id,\n+ ),\n+ null,\n+ );\n+ } catch (e) {\n+ Alert.alert(\n+ \"Unknown error\",\n+ \"Uhh... try again?\",\n+ [\n+ { text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged },\n+ ],\n+ { cancelable: false },\n+ );\n+ throw e;\n+ }\n+ }\n+\n+ onErrorAcknowledged = () => {\n+ invariant(this.tagInput, \"tagInput should be set\");\n+ this.tagInput.focus();\n+ }\n+\n+ onUnknownErrorAlertAcknowledged = () => {\n+ this.setState(\n+ {\n+ usernameInputText: \"\",\n+ userSearchResults: [],\n+ tagInputHeight: 36,\n+ },\n+ this.onErrorAcknowledged,\n+ );\n+ }\n+\n+ onSelectExistingThread = (threadID: string) => {\n+ this.props.navigation.navigate(\n+ MessageListRouteName,\n+ { threadInfo: this.props.threadInfos[threadID] },\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ flex: 1,\n+ },\n+ userSelectionRow: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ backgroundColor: \"white\",\n+ paddingVertical: 6,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ },\n+ tagInputLabel: {\n+ paddingLeft: 12,\n+ fontSize: 16,\n+ color: \"#888888\",\n+ },\n+ tagInputContainer: {\n+ flex: 1,\n+ marginLeft: 8,\n+ paddingRight: 12,\n+ },\n+ userList: {\n+ flex: 1,\n+ paddingLeft: 35,\n+ paddingRight: 12,\n+ },\n+ listItem: {\n+ color: \"#222222\",\n+ },\n+ existingThreadsRow: {\n+ backgroundColor: \"white\",\n+ paddingVertical: 6,\n+ borderBottomWidth: 1,\n+ borderTopWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ },\n+ existingThreadsLabel: {\n+ textAlign: 'center',\n+ paddingLeft: 12,\n+ fontSize: 16,\n+ color: \"#888888\",\n+ },\n+ existingThreadList: {\n+ flex: 1,\n+ marginRight: 12,\n+ },\n+ existingThreads: {\n+ flex: 1,\n+ },\n+});\n+\n+const ComposeThreadRouteName = 'ComposeThread';\n+\n+const loadingStatusSelector\n+ = createLoadingStatusSelector(newThreadActionTypes);\n+registerFetchKey(searchUsersActionTypes);\n+\n+const ComposeThread = connect(\n+ (state: AppState) => ({\n+ loadingStatus: loadingStatusSelector(state),\n+ otherUserInfos: userInfoSelectorForOtherMembersOfThread(null)(state),\n+ userSearchIndex: userSearchIndexForOtherMembersOfThread(null)(state),\n+ threadInfos: threadInfoSelector(state),\n+ cookie: state.cookie,\n+ }),\n+ includeDispatchActionProps,\n+ bindServerCalls({ newChatThread, searchUsers }),\n+)(InnerComposeThread);\n+\n+export {\n+ ComposeThread,\n+ ComposeThreadRouteName,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -50,6 +50,7 @@ import { threadActualMembers } from 'lib/shared/thread-utils';\nimport UserList from '../../components/user-list.react';\nimport TagInput from '../../components/tag-input.react';\nimport Button from '../../components/button.react';\n+import { iosKeyboardHeight } from '../../dimensions';\nconst tagInputProps = {\nplaceholder: \"Select users to add\",\n@@ -228,7 +229,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={65}\n+ keyboardVerticalOffset={iosKeyboardHeight}\n>{content}</KeyboardAvoidingView>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/tag-input.react.js",
"new_path": "native/components/tag-input.react.js",
"diff": "@@ -118,6 +118,7 @@ class TagInput<T> extends React.PureComponent<Props<T>, State> {\n// scroll to bottom\ncontentHeight = 0;\nscrollViewHeight = 0;\n+ scrollToBottomAfterNextScrollViewLayout = false;\n// refs\ntagInput: ?React.ElementRef<typeof TextInput> = null;\nscrollView: ?React.ElementRef<typeof ScrollView> = null;\n@@ -309,28 +310,35 @@ class TagInput<T> extends React.PureComponent<Props<T>, State> {\n}\nonScrollViewContentSizeChange = (w: number, h: number) => {\n- if (this.contentHeight === h) {\n+ const oldContentHeight = this.contentHeight;\n+ if (oldContentHeight === h) {\nreturn;\n}\n+ this.contentHeight = h;\nconst nextWrapperHeight = Math.max(\nMath.min(this.props.maxHeight, h),\nthis.props.minHeight,\n);\nif (nextWrapperHeight !== this.state.wrapperHeight) {\n- this.setState(\n- { wrapperHeight: nextWrapperHeight },\n- this.contentHeight < h ? this.scrollToBottom : undefined,\n- );\n- } else if (this.contentHeight < h) {\n+ this.setState({ wrapperHeight: nextWrapperHeight });\n+ }\n+ if (oldContentHeight < h) {\n+ if (this.scrollViewHeight === this.props.maxHeight) {\nthis.scrollToBottom();\n+ } else {\n+ this.scrollToBottomAfterNextScrollViewLayout = true;\n+ }\n}\n- this.contentHeight = h;\n}\nonScrollViewLayout = (\nevent: { nativeEvent: { layout: { height: number } } },\n) => {\nthis.scrollViewHeight = event.nativeEvent.layout.height;\n+ if (this.scrollToBottomAfterNextScrollViewLayout) {\n+ this.scrollToBottom();\n+ this.scrollToBottomAfterNextScrollViewLayout = false;\n+ }\n}\nonLayoutLastTag = (endPosOfTag: number) => {\n@@ -441,10 +449,11 @@ const styles = StyleSheet.create({\n},\ntextInput: {\nfontSize: 18,\n+ height: 24,\nflex: .6,\npadding: 0,\nmarginTop: 3,\n- marginBottom: 0,\n+ marginBottom: 3,\nmarginHorizontal: 0,\n},\ntextInputContainer: {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/thread-list-thread.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import {\n+ StyleSheet,\n+ Text,\n+ ViewPropTypes,\n+} from 'react-native';\n+\n+import Button from './button.react';\n+import ColorSplotch from './color-splotch.react';\n+\n+type Props = {\n+ threadInfo: ThreadInfo,\n+ onSelect: (threadID: string) => void,\n+ style?: StyleObj,\n+ textStyle?: StyleObj,\n+};\n+class ThreadListThread extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ onSelect: PropTypes.func.isRequired,\n+ style: ViewPropTypes.style,\n+ textStyle: Text.propTypes.style,\n+ };\n+\n+ render() {\n+ return (\n+ <Button\n+ onPress={this.onSelect}\n+ iosFormat=\"highlight\"\n+ iosActiveOpacity={0.85}\n+ style={[styles.button, this.props.style]}\n+ >\n+ <ColorSplotch color={this.props.threadInfo.color} />\n+ <Text style={[styles.text, this.props.textStyle]} numberOfLines={1}>\n+ {this.props.threadInfo.uiName}\n+ </Text>\n+ </Button>\n+ );\n+ }\n+\n+ onSelect = () => {\n+ this.props.onSelect(this.props.threadInfo.id);\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ button: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ paddingLeft: 13,\n+ },\n+ text: {\n+ paddingLeft: 9,\n+ paddingRight: 12,\n+ paddingVertical: 6,\n+ fontSize: 16,\n+ },\n+});\n+\n+\n+export default ThreadListThread;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/thread-list.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import { FlatList, ViewPropTypes, Text } from 'react-native';\n+\n+import ThreadListThread from './thread-list-thread.react';\n+\n+type Props = {\n+ threadInfos: $ReadOnlyArray<ThreadInfo>,\n+ onSelect: (threadID: string) => void,\n+ itemStyle?: StyleObj,\n+ itemTextStyle?: StyleObj,\n+};\n+class ThreadList extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ threadInfos: PropTypes.arrayOf(threadInfoPropType).isRequired,\n+ onSelect: PropTypes.func.isRequired,\n+ itemStyle: ViewPropTypes.style,\n+ itemTextStyle: Text.propTypes.style,\n+ };\n+\n+ render() {\n+ return (\n+ <FlatList\n+ data={this.props.threadInfos}\n+ renderItem={this.renderItem}\n+ keyExtractor={ThreadList.keyExtractor}\n+ getItemLayout={ThreadList.getItemLayout}\n+ keyboardShouldPersistTaps=\"handled\"\n+ initialNumToRender={20}\n+ />\n+ );\n+ }\n+\n+ static keyExtractor(threadInfo: ThreadInfo) {\n+ return threadInfo.id;\n+ }\n+\n+ renderItem = (row: { item: ThreadInfo }) => {\n+ return (\n+ <ThreadListThread\n+ threadInfo={row.item}\n+ onSelect={this.props.onSelect}\n+ style={this.props.itemStyle}\n+ textStyle={this.props.itemTextStyle}\n+ />\n+ );\n+ }\n+\n+ static getItemLayout(data: ?$ReadOnlyArray<ThreadInfo>, index: number) {\n+ return { length: 24, offset: 24 * index, index };\n+ }\n+\n+}\n+\n+export default ThreadList;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/user-list-user.react.js",
"new_path": "native/components/user-list-user.react.js",
"diff": "// @flow\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\nimport type { AccountUserInfo } from 'lib/types/user-types';\nimport { accountUserInfoPropType } from 'lib/types/user-types';\n@@ -8,6 +12,7 @@ import PropTypes from 'prop-types';\nimport {\nStyleSheet,\nText,\n+ ViewPropTypes,\n} from 'react-native';\nimport Button from './button.react';\n@@ -15,12 +20,16 @@ import Button from './button.react';\ntype Props = {\nuserInfo: AccountUserInfo,\nonSelect: (userID: string) => void,\n+ style?: StyleObj,\n+ textStyle?: StyleObj,\n};\nclass UserListUser extends React.PureComponent<Props> {\nstatic propTypes = {\nuserInfo: accountUserInfoPropType.isRequired,\nonSelect: PropTypes.func.isRequired,\n+ style: ViewPropTypes.style,\n+ textStyle: Text.propTypes.style,\n};\nrender() {\n@@ -29,8 +38,11 @@ class UserListUser extends React.PureComponent<Props> {\nonPress={this.onSelect}\niosFormat=\"highlight\"\niosActiveOpacity={0.85}\n+ style={this.props.style}\n>\n- <Text style={styles.text}>{this.props.userInfo.username}</Text>\n+ <Text style={[styles.text, this.props.textStyle]} numberOfLines={1}>\n+ {this.props.userInfo.username}\n+ </Text>\n</Button>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/user-list.react.js",
"new_path": "native/components/user-list.react.js",
"diff": "// @flow\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\nimport type { AccountUserInfo } from 'lib/types/user-types';\nimport { accountUserInfoPropType } from 'lib/types/user-types';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { FlatList } from 'react-native';\n+import { FlatList, ViewPropTypes, Text } from 'react-native';\nimport UserListUser from './user-list-user.react';\ntype Props = {\nuserInfos: $ReadOnlyArray<AccountUserInfo>,\nonSelect: (userID: string) => void,\n+ itemStyle?: StyleObj,\n+ itemTextStyle?: StyleObj,\n};\nclass UserList extends React.PureComponent<Props> {\nstatic propTypes = {\nuserInfos: PropTypes.arrayOf(accountUserInfoPropType).isRequired,\nonSelect: PropTypes.func.isRequired,\n+ itemStyle: ViewPropTypes.style,\n+ itemTextStyle: Text.propTypes.style,\n};\nrender() {\n@@ -28,12 +36,13 @@ class UserList extends React.PureComponent<Props> {\nkeyExtractor={UserList.keyExtractor}\ngetItemLayout={UserList.getItemLayout}\nkeyboardShouldPersistTaps=\"handled\"\n+ initialNumToRender={20}\n/>\n);\n}\n- static keyExtractor(threadInfo: AccountUserInfo) {\n- return threadInfo.id;\n+ static keyExtractor(userInfo: AccountUserInfo) {\n+ return userInfo.id;\n}\nrenderItem = (row: { item: AccountUserInfo }) => {\n@@ -41,6 +50,8 @@ class UserList extends React.PureComponent<Props> {\n<UserListUser\nuserInfo={row.item}\nonSelect={this.props.onSelect}\n+ style={this.props.itemStyle}\n+ textStyle={this.props.itemTextStyle}\n/>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/dimensions.js",
"new_path": "native/dimensions.js",
"diff": "@@ -18,8 +18,11 @@ if (Platform.OS === \"ios\") {\ncontentVerticalOffset = DeviceInfo.isIPhoneX_deprecated ? 44 : 20;\n}\n+const iosKeyboardHeight = DeviceInfo.isIPhoneX_deprecated ? 89 : 65;\n+\nexport {\nwindowHeight,\nwindowWidth,\ncontentVerticalOffset,\n+ iosKeyboardHeight,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | New thread composition workflow |
129,187 | 14.02.2018 21:09:14 | 18,000 | 07524fb7ab254911de4b1d1f772344a77aa804f5 | Handle return key and empty user list for ComposeThread | [
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -66,6 +66,7 @@ import { iosKeyboardHeight } from '../dimensions';\nconst tagInputProps = {\nplaceholder: \"username\",\nautoFocus: true,\n+ returnKeyType: \"go\",\n};\nconst segmentedPrivacyOptions = ['Public', 'Secret'];\n@@ -241,6 +242,10 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n</View>\n);\n}\n+ const inputProps = {\n+ ...tagInputProps,\n+ onSubmitEditing: this.onPressCreateThread,\n+ };\nconst content = (\n<React.Fragment>\n<View style={[\n@@ -256,7 +261,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nonChangeText={this.setUsernameInputText}\nonHeightChange={this.onTagInputHeightChange}\nlabelExtractor={this.tagDataLabelExtractor}\n- inputProps={tagInputProps}\n+ inputProps={inputProps}\nref={this.tagInputRef}\n/>\n</View>\n@@ -346,6 +351,21 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nonPressCreateThread = () => {\n+ if (this.state.userInfoInputArray.length === 0) {\n+ Alert.alert(\n+ \"Chatting to yourself?\",\n+ \"Are you sure you want to create a thread containing only yourself?\",\n+ [\n+ { text: 'Cancel', style: 'cancel' },\n+ { text: 'Confirm', onPress: this.dispatchNewChatThreadAction },\n+ ],\n+ );\n+ } else {\n+ this.dispatchNewChatThreadAction();\n+ }\n+ }\n+\n+ dispatchNewChatThreadAction = () => {\nthis.props.dispatchActionPromise(\nnewThreadActionTypes,\nthis.newChatThreadAction(),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Handle return key and empty user list for ComposeThread |
129,187 | 14.02.2018 21:34:55 | 18,000 | 1dce4d78ea70894061cbf6405eb21a026888fc83 | search_users.php -> jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -13,6 +13,7 @@ import {\naccountUpdateResponder,\nresendVerificationEmailResponder,\n} from './responders/user-responders';\n+import { userSearchResponder } from './responders/search-responders';\nconst app = express();\napp.use(bodyParser.json());\n@@ -41,4 +42,8 @@ app.post(\n'/resend_verification_email',\nerrorHandler(resendVerificationEmailResponder),\n);\n+app.post(\n+ '/search_users',\n+ errorHandler(userSearchResponder),\n+);\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/fetchers/user-fetcher.js",
"new_path": "jserver/src/fetchers/user-fetcher.js",
"diff": "@@ -18,8 +18,9 @@ async function fetchUserInfos(\nconst userInfos = {};\nfor (let row of result) {\n- userInfos[row.id] = {\n- id: row.id,\n+ const id = row.id.toString();\n+ userInfos[id] = {\n+ id,\nusername: row.username,\n};\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/responders/search-responders.js",
"diff": "+// @flow\n+\n+import type { $Response, $Request } from 'express';\n+import type { UserSearchQuery } from 'lib/types/search-types';\n+\n+import t from 'tcomb';\n+\n+import { tShape } from '../utils/tcomb-utils';\n+import { setCurrentViewerFromCookie } from '../session/cookies';\n+import { searchForUsers } from '../search/users';\n+\n+const userSearchQueryInputValidator = tShape({\n+ prefix: t.maybe(t.String),\n+});\n+\n+async function userSearchResponder(req: $Request, res: $Response) {\n+ const userSearchQuery: UserSearchQuery = (req.body: any);\n+ if (!userSearchQueryInputValidator.is(userSearchQuery)) {\n+ return { error: 'invalid_parameters' };\n+ }\n+\n+ await setCurrentViewerFromCookie(req.cookies);\n+ const searchResults = await searchForUsers(userSearchQuery);\n+\n+ return { success: true, userInfos: searchResults };\n+}\n+\n+export {\n+ userSearchResponder,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/search/users.js",
"diff": "+// @flow\n+\n+import type { UserInfo } from 'lib/types/user-types';\n+import type { UserSearchQuery } from 'lib/types/search-types';\n+\n+import { pool, SQL } from '../database';\n+\n+async function searchForUsers(query: UserSearchQuery): Promise<UserInfo[]> {\n+ const sqlQuery = SQL`SELECT id, username FROM users `;\n+ const prefix = query.prefix;\n+ if (prefix) {\n+ sqlQuery.append(SQL`WHERE username LIKE ${prefix + \"%\"} `);\n+ }\n+ sqlQuery.append(SQL`LIMIT 20`);\n+\n+ const [ result ] = await pool.query(sqlQuery);\n+\n+ const userInfos = [];\n+ for (let row of result) {\n+ userInfos.push({\n+ id: row.id.toString(),\n+ username: row.username,\n+ });\n+ }\n+ return userInfos;\n+}\n+\n+export {\n+ searchForUsers,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/actions/user-actions.js",
"new_path": "lib/actions/user-actions.js",
"diff": "@@ -361,10 +361,10 @@ async function searchUsers(\n): Promise<SearchUsersResult> {\nconst response = await fetchJSON(\n'search_users.php',\n- { prefix: usernamePrefix },\n+ { input: { prefix: usernamePrefix } },\n);\nreturn {\n- userInfos: response.user_infos,\n+ userInfos: response.userInfos,\n};\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/types/search-types.js",
"diff": "+// @flow\n+\n+export type UserSearchQuery = {|\n+ prefix?: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/search_users.php",
"new_path": "server/search_users.php",
"diff": "<?php\n-require_once('async_lib.php');\n-require_once('config.php');\n+require_once('call_node.php');\n-async_start();\n-\n-$prefix_fragment = \"\";\n-if (isset($_POST['prefix'])) {\n- $prefix_fragment = \"WHERE username LIKE '\"\n- . $conn->real_escape_string($_POST['prefix'])\n- . \"%' \";\n-}\n-\n-$query = \"SELECT id, username FROM users {$prefix_fragment}LIMIT 20\";\n-$result = $conn->query($query);\n-\n-$user_infos = array();\n-while ($row = $result->fetch_assoc()) {\n- $user_infos[] = $row;\n-}\n-\n-async_end(array(\n- 'success' => true,\n- 'user_infos' => $user_infos,\n-));\n+proxy_to_node('search_users');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | search_users.php -> jserver |
129,187 | 14.02.2018 21:53:50 | 18,000 | bccbc212aadc7eef6a43a1510f9f1c11a94d3f2b | Update some scripts for pushing to prod | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"flow-mono-cli\": \"^1.3.0\"\n},\n\"scripts\": {\n- \"clean\": \"rm -rf node_modules/ && rm -rf lib/node_modules/ && rm -rf web/node_modules/ && rm -rf native/node_modules/ && rm -rf jserver/node_modules/\",\n- \"cleaninstall\": \"rm -rf node_modules/ && rm -rf lib/node_modules/ && rm -rf web/node_modules/ && rm -rf native/node_modules/ && rm -rf jserver/node_modules/ && yarn\"\n+ \"clean\": \"rm -rf node_modules/ && rm -rf lib/node_modules/ && rm -rf web/node_modules/ && rm -rf native/node_modules/ && rm -rf jserver/node_modules/ && rm -rf jserver/dist/\",\n+ \"cleaninstall\": \"npm run clean && yarn\"\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Update some scripts for pushing to prod |
129,187 | 14.02.2018 22:51:08 | 18,000 | 31df98f1158dcfb53b0e3772ca6d463bc4bf2ec1 | forgot_password.php -> jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -11,7 +11,8 @@ import { deviceTokenUpdateResponder } from './responders/device-responders';\nimport {\nuserSubscriptionUpdateResponder,\naccountUpdateResponder,\n- resendVerificationEmailResponder,\n+ sendVerificationEmailResponder,\n+ sendPasswordResetEmailResponder,\n} from './responders/user-responders';\nimport { userSearchResponder } from './responders/search-responders';\n@@ -39,11 +40,15 @@ app.post(\nerrorHandler(accountUpdateResponder),\n);\napp.post(\n- '/resend_verification_email',\n- errorHandler(resendVerificationEmailResponder),\n+ '/send_verification_email',\n+ errorHandler(sendVerificationEmailResponder),\n);\napp.post(\n'/search_users',\nerrorHandler(userSearchResponder),\n);\n+app.post(\n+ '/send_password_reset_email',\n+ errorHandler(sendPasswordResetEmailResponder),\n+);\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/emails/reset-password.js",
"diff": "+// @flow\n+\n+import React from 'react'\n+import ReactHTML from 'react-html-email';\n+\n+import { verifyField } from 'lib/types/verify-types';\n+\n+import urlFacts from '../../facts/url';\n+import createVerificationCode from '../creators/verification-code-creator';\n+import sendmail from './sendmail';\n+\n+const { Email, Item, Span, A, renderEmail } = ReactHTML;\n+const { baseDomain, basePath } = urlFacts;\n+\n+async function sendPasswordResetEmail(\n+ userID: string,\n+ username: string,\n+ emailAddress: string,\n+): Promise<void> {\n+ const code = await createVerificationCode(userID, verifyField.RESET_PASSWORD);\n+ const link = baseDomain + basePath + `verify/${code}/`;\n+\n+ const title = \"Reset password for SquadCal\";\n+ const text =\n+ \"We received a request to reset the password associated with your \" +\n+ `account ${username} on SquadCal. If you did not issue this request, you ` +\n+ \"do not need to do anything, and your password will remain the same. \" +\n+ \"However, if you did issue this request, please visit this link to reset \" +\n+ \"your password: \";\n+ const email = (\n+ <Email title={title}>\n+ <Item>\n+ <Span>\n+ {text}\n+ <A href={link}>{link}</A>\n+ </Span>\n+ </Item>\n+ </Email>\n+ );\n+ const html = renderEmail(email);\n+\n+ sendmail.sendMail({\n+ from: \"no-reply@squadcal.org\",\n+ to: emailAddress,\n+ subject: title,\n+ html,\n+ });\n+}\n+\n+export {\n+ sendPasswordResetEmail,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/emails/sendmail.js",
"diff": "+// @flow\n+\n+import nodemailer from 'nodemailer';\n+\n+const sendmail = nodemailer.createTransport({ sendmail: true });\n+\n+export default sendmail;\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/emails/verification.js",
"new_path": "jserver/src/emails/verification.js",
"diff": "import React from 'react'\nimport ReactHTML from 'react-html-email';\n-import nodemailer from 'nodemailer';\nimport { verifyField } from 'lib/types/verify-types';\nimport urlFacts from '../../facts/url';\nimport createVerificationCode from '../creators/verification-code-creator';\n+import sendmail from './sendmail';\nconst { Email, Item, Span, A, renderEmail } = ReactHTML;\n-const sendmail = nodemailer.createTransport({ sendmail: true });\nconst { baseDomain, basePath } = urlFacts;\nasync function sendEmailAddressVerificationEmail(\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "import type { $Response, $Request } from 'express';\nimport type { SubscriptionUpdate } from 'lib/types/subscription-types';\nimport type { AccountUpdate } from 'lib/types/user-types';\n+import type { PasswordResetRequest } from 'lib/types/account-types';\nimport t from 'tcomb';\n@@ -11,7 +12,8 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport { userSubscriptionUpdater } from '../updaters/user-subscription-updater';\nimport {\naccountUpdater,\n- resendVerificationEmail,\n+ checkAndSendVerificationEmail,\n+ checkAndSendPasswordResetEmail,\n} from '../updaters/account-updater';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tShape } from '../utils/tcomb-utils';\n@@ -73,7 +75,7 @@ async function accountUpdateResponder(req: $Request, res: $Response) {\nreturn { success: true };\n}\n-async function resendVerificationEmailResponder(req: $Request, res: $Response) {\n+async function sendVerificationEmailResponder(req: $Request, res: $Response) {\nawait setCurrentViewerFromCookie(req.cookies);\nconst viewer = currentViewer();\nif (!viewer.loggedIn) {\n@@ -81,7 +83,32 @@ async function resendVerificationEmailResponder(req: $Request, res: $Response) {\n}\ntry {\n- await resendVerificationEmail(viewer);\n+ await checkAndSendVerificationEmail(viewer);\n+ } catch (e) {\n+ if (e instanceof ServerError) {\n+ return { error: e.message };\n+ } else {\n+ throw e;\n+ }\n+ }\n+\n+ return { success: true };\n+}\n+\n+const resetPasswordRequestInputValidator = tShape({\n+ usernameOrEmail: t.String,\n+});\n+\n+async function sendPasswordResetEmailResponder(req: $Request, res: $Response) {\n+ const resetPasswordRequest: PasswordResetRequest = (req.body: any);\n+ if (!resetPasswordRequestInputValidator.is(resetPasswordRequest)) {\n+ return { error: 'invalid_parameters' };\n+ }\n+\n+ await setCurrentViewerFromCookie(req.cookies);\n+\n+ try {\n+ await checkAndSendPasswordResetEmail(resetPasswordRequest);\n} catch (e) {\nif (e instanceof ServerError) {\nreturn { error: e.message };\n@@ -96,5 +123,6 @@ async function resendVerificationEmailResponder(req: $Request, res: $Response) {\nexport {\nuserSubscriptionUpdateResponder,\naccountUpdateResponder,\n- resendVerificationEmailResponder,\n+ sendVerificationEmailResponder,\n+ sendPasswordResetEmailResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/account-updater.js",
"new_path": "jserver/src/updaters/account-updater.js",
"diff": "import type { AccountUpdate } from 'lib/types/user-types';\nimport type { UserViewer } from '../session/viewer';\n+import type { PasswordResetRequest } from 'lib/types/account-types';\nimport bcrypt from 'twin-bcrypt';\n@@ -11,6 +12,7 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport { pool, SQL } from '../database';\nimport { sendEmailAddressVerificationEmail } from '../emails/verification';\n+import { sendPasswordResetEmail } from '../emails/reset-password';\nasync function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\nconst email = update.updatedFields.email;\n@@ -69,7 +71,7 @@ async function accountUpdater(viewer: UserViewer, update: AccountUpdate) {\nawait Promise.all(savePromises);\n}\n-async function resendVerificationEmail(viewer: UserViewer) {\n+async function checkAndSendVerificationEmail(viewer: UserViewer) {\nconst query = SQL`\nSELECT username, email, email_verified\nFROM users\n@@ -91,7 +93,28 @@ async function resendVerificationEmail(viewer: UserViewer) {\n);\n}\n+async function checkAndSendPasswordResetEmail(request: PasswordResetRequest) {\n+ const query = SQL`\n+ SELECT id, username, email\n+ FROM users\n+ WHERE LCASE(username) = LCASE(${request.usernameOrEmail})\n+ OR LCASE(email) = LCASE(${request.usernameOrEmail})\n+ `;\n+ const [ result ] = await pool.query(query);\n+ if (result.length === 0) {\n+ throw new ServerError('invalid_user');\n+ }\n+ const row = result[0];\n+\n+ await sendPasswordResetEmail(\n+ row.id.toString(),\n+ row.username,\n+ row.email,\n+ );\n+}\n+\nexport {\naccountUpdater,\n- resendVerificationEmail,\n+ checkAndSendVerificationEmail,\n+ checkAndSendPasswordResetEmail,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/actions/user-actions.js",
"new_path": "lib/actions/user-actions.js",
"diff": "@@ -290,7 +290,9 @@ async function forgotPassword(\nfetchJSON: FetchJSON,\nusernameOrEmail: string,\n): Promise<void> {\n- await fetchJSON('forgot_password.php', { 'username': usernameOrEmail });\n+ await fetchJSON('forgot_password.php', {\n+ input: { usernameOrEmail },\n+ });\n}\nexport type ChangeUserSettingsResult = {|\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/types/account-types.js",
"diff": "+// @flow\n+\n+export type PasswordResetRequest = {|\n+ usernameOrEmail: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/forgot_password.php",
"new_path": "server/forgot_password.php",
"diff": "<?php\n-require_once('async_lib.php');\n-require_once('config.php');\n-require_once('auth.php');\n-require_once('verify_lib.php');\n+require_once('call_node.php');\n-async_start();\n-\n-if (!isset($_POST['username'])) {\n- async_end(array(\n- 'error' => 'invalid_parameters',\n- ));\n-}\n-$username = $conn->real_escape_string($_POST['username']);\n-\n-$query = <<<SQL\n-SELECT id, username, email\n-FROM users\n-WHERE LCASE(username) = LCASE('$username') OR LCASE(email) = LCASE('$username')\n-SQL;\n-$result = $conn->query($query);\n-$user_row = $result->fetch_assoc();\n-if (!$user_row) {\n- async_end(array(\n- 'error' => 'invalid_user',\n- ));\n-}\n-$id = $user_row['id'];\n-$username = $user_row['username'];\n-$email = $user_row['email'];\n-\n-$code = generate_verification_code($id, VERIFY_FIELD_RESET_PASSWORD);\n-$link = $base_domain . $base_url . \"verify/$code/\";\n-$contents = <<<EMAIL\n-<html>\n- <body style=\"font-family: sans-serif;\">\n- <p>\n- We received a request to reset the password associated with your account\n- $username on SquadCal. If you did not issue this request, you do not\n- need to do anything, and your password will remain the same. However, if\n- you did issue this request, please visit this link to reset your password:\n- <a href=\"$link\">$link</a>\n- </p>\n- </body>\n-</html>\n-EMAIL;\n-mail(\n- $email,\n- 'Reset password for SquadCal',\n- $contents,\n- \"From: no-reply@squadcal.org\\r\\n\".\n- \"MIME-Version: 1.0\\r\\n\".\n- \"Content-type: text/html; charset=iso-8859-1\\r\\n\"\n-);\n-\n-async_end(array(\n- 'success' => true,\n-));\n+proxy_to_node('send_password_reset_email');\n"
},
{
"change_type": "MODIFY",
"old_path": "server/resend_verification.php",
"new_path": "server/resend_verification.php",
"diff": "require_once('call_node.php');\n-proxy_to_node('resend_verification_email');\n+proxy_to_node('send_verification_email');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | forgot_password.php -> jserver |
129,187 | 14.02.2018 23:07:57 | 18,000 | 1e41b61d74285eaaed058fef66db30db363b2d89 | Only consider visible threads the viewer is a member of as "existing threads" | [
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -50,10 +50,15 @@ import {\nuserSearchIndexForOtherMembersOfThread,\n} from 'lib/selectors/user-selectors';\nimport SearchIndex from 'lib/shared/search-index';\n-import { generateRandomColor } from 'lib/shared/thread-utils';\n+import {\n+ generateRandomColor,\n+ threadHasPermission,\n+ viewerIsMember,\n+} from 'lib/shared/thread-utils';\nimport { getUserSearchResults } from 'lib/shared/search-utils';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\n+import { threadPermissions } from 'lib/types/thread-types';\nimport TagInput from '../components/tag-input.react';\nimport UserList from '../components/user-list.react';\n@@ -210,7 +215,10 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nreturn _flow(\n_filter(\n- (threadInfo: ThreadInfo) => userIDs.every(\n+ (threadInfo: ThreadInfo) =>\n+ viewerIsMember(threadInfo) &&\n+ threadHasPermission(threadInfo, threadPermissions.VISIBLE) &&\n+ userIDs.every(\nuserID => threadInfo.members.some(member => member.id === userID),\n),\n),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Only consider visible threads the viewer is a member of as "existing threads" |
129,187 | 15.02.2018 19:33:10 | 18,000 | e254ed59e7d3008522c5f304db7be4e0c8541495 | Use ComposeThread for new subthreads and get rid of AddThread
Introducing `ComposeSubthreadModal` for selecting visibility rules for new subthread | [
{
"change_type": "DELETE",
"old_path": "native/chat/add-thread.react.js",
"new_path": null,
"diff": "-// @flow\n-\n-import type { NavigationScreenProp, NavigationRoute } from 'react-navigation';\n-import type { AppState } from '../redux-setup';\n-import type { LoadingStatus } from 'lib/types/loading-types';\n-import { loadingStatusPropType } from 'lib/types/loading-types';\n-import type { ThreadInfo, VisibilityRules } from 'lib/types/thread-types';\n-import { threadInfoPropType, visibilityRules } from 'lib/types/thread-types';\n-import type { AccountUserInfo } from 'lib/types/user-types';\n-import { accountUserInfoPropType } from 'lib/types/user-types';\n-import type { DispatchActionPromise } from 'lib/utils/action-utils';\n-import type { SearchUsersResult } from 'lib/actions/user-actions';\n-import type { NewThreadResult } from 'lib/actions/thread-actions';\n-\n-import React from 'react';\n-import PropTypes from 'prop-types';\n-import {\n- View,\n- Text,\n- StyleSheet,\n- TextInput,\n- Alert,\n- TouchableWithoutFeedback,\n- KeyboardAvoidingView,\n- Platform,\n-} from 'react-native';\n-import { connect } from 'react-redux';\n-import SegmentedControlTab from 'react-native-segmented-control-tab';\n-import invariant from 'invariant';\n-\n-import {\n- includeDispatchActionProps,\n- bindServerCalls,\n-} from 'lib/utils/action-utils';\n-import {\n- newThreadActionTypes,\n- newChatThread,\n-} from 'lib/actions/thread-actions';\n-import {\n- searchUsersActionTypes,\n- searchUsers,\n-} from 'lib/actions/user-actions';\n-import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import {\n- userInfoSelectorForOtherMembersOfThread,\n- userSearchIndexForOtherMembersOfThread,\n-} from 'lib/selectors/user-selectors';\n-import SearchIndex from 'lib/shared/search-index';\n-import { generateRandomColor } from 'lib/shared/thread-utils';\n-import { getUserSearchResults } from 'lib/shared/search-utils';\n-import { registerFetchKey } from 'lib/reducers/loading-reducer';\n-import { threadInfoSelector } from 'lib/selectors/thread-selectors';\n-\n-import ColorSplotch from '../components/color-splotch.react';\n-import TagInput from '../components/tag-input.react';\n-import UserList from '../components/user-list.react';\n-import LinkButton from '../components/link-button.react';\n-import { MessageListRouteName } from './message-list.react';\n-import { registerChatScreen } from './chat-screen-registry';\n-import ColorPickerModal from './color-picker-modal.react';\n-import { iosKeyboardHeight } from '../dimensions';\n-\n-const tagInputProps = {\n- placeholder: \"username\",\n-};\n-\n-type NavProp = NavigationScreenProp<NavigationRoute>\n- & { state: { params: { parentThreadID: ?string } } };\n-const segmentedPrivacyOptions = ['Public', 'Secret'];\n-\n-type Props = {\n- navigation: NavProp,\n- // Redux state\n- loadingStatus: LoadingStatus,\n- parentThreadInfo: ?ThreadInfo,\n- otherUserInfos: {[id: string]: AccountUserInfo},\n- userSearchIndex: SearchIndex,\n- // Redux dispatch functions\n- dispatchActionPromise: DispatchActionPromise,\n- // async functions that hit server APIs\n- newChatThread: (\n- name: string,\n- ourVisibilityRules: VisibilityRules,\n- color: string,\n- userIDs: string[],\n- parentThreadID: ?string,\n- ) => Promise<NewThreadResult>,\n- searchUsers: (usernamePrefix: string) => Promise<SearchUsersResult>,\n-};\n-type State = {\n- nameInputText: string,\n- usernameInputText: string,\n- userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n- userSearchResults: $ReadOnlyArray<AccountUserInfo>,\n- selectedPrivacyIndex: number,\n- tagInputHeight: number,\n- showColorPicker: bool,\n- color: string,\n-};\n-class InnerAddThread extends React.PureComponent<Props, State> {\n-\n- static propTypes = {\n- navigation: PropTypes.shape({\n- state: PropTypes.shape({\n- key: PropTypes.string.isRequired,\n- params: PropTypes.shape({\n- parentThreadID: PropTypes.string,\n- }).isRequired,\n- }).isRequired,\n- setParams: PropTypes.func.isRequired,\n- goBack: PropTypes.func.isRequired,\n- navigate: PropTypes.func.isRequired,\n- }).isRequired,\n- loadingStatus: loadingStatusPropType.isRequired,\n- parentThreadInfo: threadInfoPropType,\n- otherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\n- userSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- newChatThread: PropTypes.func.isRequired,\n- searchUsers: PropTypes.func.isRequired,\n- };\n- static navigationOptions = ({ navigation }) => ({\n- title: 'New thread',\n- headerRight: navigation.state.params.showColorPicker\n- ? null\n- : (\n- <LinkButton\n- text=\"Create\"\n- onPress={() => navigation.state.params.onPressCreateThread()}\n- />\n- ),\n- });\n- mounted = false;\n- nameInput: ?TextInput;\n-\n- constructor(props: Props) {\n- super(props);\n- const userSearchResults = getUserSearchResults(\n- \"\",\n- props.otherUserInfos,\n- props.userSearchIndex,\n- [],\n- );\n- this.state = {\n- nameInputText: \"\",\n- usernameInputText: \"\",\n- userInfoInputArray: [],\n- userSearchResults,\n- selectedPrivacyIndex: props.parentThreadInfo ? 0 : 1,\n- tagInputHeight: 36,\n- showColorPicker: false,\n- color: props.parentThreadInfo\n- ? props.parentThreadInfo.color\n- : generateRandomColor(),\n- };\n- }\n-\n- componentDidMount() {\n- this.mounted = true;\n- registerChatScreen(this.props.navigation.state.key, this);\n- this.searchUsers(\"\");\n- this.props.navigation.setParams({\n- onPressCreateThread: this.onPressCreateThread,\n- });\n- }\n-\n- componentWillUnmount() {\n- this.mounted = false;\n- registerChatScreen(this.props.navigation.state.key, null);\n- }\n-\n- canReset = () => false;\n-\n- componentWillReceiveProps(nextProps: Props) {\n- if (!this.mounted) {\n- return;\n- }\n- if (\n- this.props.otherUserInfos !== nextProps.otherUserInfos ||\n- this.props.userSearchIndex !== nextProps.userSearchIndex\n- ) {\n- const userSearchResults = getUserSearchResults(\n- this.state.usernameInputText,\n- nextProps.otherUserInfos,\n- nextProps.userSearchIndex,\n- this.state.userInfoInputArray.map(userInfo => userInfo.id),\n- );\n- this.setState({ userSearchResults });\n- }\n- }\n-\n- componentWillUpdate(nextProps: Props, nextState: State) {\n- if (this.state.showColorPicker !== nextState.showColorPicker) {\n- nextProps.navigation.setParams({\n- showColorPicker: nextState.showColorPicker,\n- });\n- }\n- }\n-\n- render() {\n- let visibility;\n- if (this.props.parentThreadInfo) {\n- visibility = (\n- <View style={styles.row}>\n- <Text style={styles.label}>Visibility</Text>\n- <View style={styles.input}>\n- <SegmentedControlTab\n- values={segmentedPrivacyOptions}\n- selectedIndex={this.state.selectedPrivacyIndex}\n- onTabPress={this.handleIndexChange}\n- tabStyle={styles.segmentedTabStyle}\n- activeTabStyle={styles.segmentedActiveTabStyle}\n- tabTextStyle={styles.segmentedTextStyle}\n- />\n- <Text\n- style={styles.parentThreadName}\n- numberOfLines={1}\n- >\n- <Text style={styles.parentThreadNameRobotext}>\n- {\"within \"}\n- </Text>\n- {this.props.parentThreadInfo.uiName}\n- </Text>\n- </View>\n- </View>\n- );\n- }\n- const oldColor = this.props.parentThreadInfo\n- ? this.props.parentThreadInfo.color\n- : null;\n- const content = (\n- <View style={styles.content}>\n- <View style={styles.row}>\n- <Text style={styles.label}>Name</Text>\n- <View style={styles.input}>\n- <TextInput\n- style={styles.textInput}\n- value={this.state.nameInputText}\n- onChangeText={this.onChangeNameInputText}\n- placeholder=\"thread name\"\n- autoFocus={true}\n- autoCorrect={false}\n- autoCapitalize=\"none\"\n- returnKeyType=\"next\"\n- editable={this.props.loadingStatus !== \"loading\"}\n- underlineColorAndroid=\"transparent\"\n- ref={this.nameInputRef}\n- />\n- </View>\n- </View>\n- {visibility}\n- <View style={styles.row}>\n- <Text style={styles.label}>Color</Text>\n- <View style={[styles.input, styles.inlineInput]}>\n- <ColorSplotch color={this.state.color} />\n- <LinkButton\n- text=\"Change\"\n- onPress={this.onPressChangeColor}\n- style={styles.changeColorButton}\n- />\n- </View>\n- </View>\n- <View style={[styles.row, { height: this.state.tagInputHeight }]}>\n- <Text style={styles.tagInputLabel}>People</Text>\n- <View style={styles.input}>\n- <TagInput\n- value={this.state.userInfoInputArray}\n- onChange={this.onChangeTagInput}\n- text={this.state.usernameInputText}\n- onChangeText={this.setUsernameInputText}\n- onHeightChange={this.onTagInputHeightChange}\n- labelExtractor={this.tagDataLabelExtractor}\n- inputProps={tagInputProps}\n- />\n- </View>\n- </View>\n- <View style={styles.userList}>\n- <UserList\n- userInfos={this.state.userSearchResults}\n- onSelect={this.onUserSelect}\n- />\n- </View>\n- <ColorPickerModal\n- isVisible={this.state.showColorPicker}\n- closeModal={this.closeColorPicker}\n- color={this.state.color}\n- oldColor={oldColor}\n- onColorSelected={this.onColorSelected}\n- />\n- </View>\n- );\n- if (Platform.OS === \"ios\") {\n- return (\n- <KeyboardAvoidingView\n- style={styles.container}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardHeight}\n- >{content}</KeyboardAvoidingView>\n- );\n- } else {\n- return <View style={styles.container}>{content}</View>;\n- }\n- }\n-\n- nameInputRef = (nameInput: ?TextInput) => {\n- this.nameInput = nameInput;\n- }\n-\n- onChangeNameInputText = (text: string) => {\n- this.setState({ nameInputText: text });\n- }\n-\n- onChangeTagInput = (userInfoInputArray: $ReadOnlyArray<AccountUserInfo>) => {\n- const userSearchResults = getUserSearchResults(\n- this.state.usernameInputText,\n- this.props.otherUserInfos,\n- this.props.userSearchIndex,\n- userInfoInputArray.map(userInfo => userInfo.id),\n- );\n- this.setState({ userInfoInputArray, userSearchResults });\n- }\n-\n- tagDataLabelExtractor = (userInfo: AccountUserInfo) => userInfo.username;\n-\n- handleIndexChange = (index: number) => {\n- this.setState({ selectedPrivacyIndex: index });\n- }\n-\n- setUsernameInputText = (text: string) => {\n- const userSearchResults = getUserSearchResults(\n- text,\n- this.props.otherUserInfos,\n- this.props.userSearchIndex,\n- this.state.userInfoInputArray.map(userInfo => userInfo.id),\n- );\n- this.searchUsers(text);\n- this.setState({ usernameInputText: text, userSearchResults });\n- }\n-\n- searchUsers(usernamePrefix: string) {\n- this.props.dispatchActionPromise(\n- searchUsersActionTypes,\n- this.props.searchUsers(usernamePrefix),\n- );\n- }\n-\n- onUserSelect = (userID: string) => {\n- for (let existingUserInfo of this.state.userInfoInputArray) {\n- if (userID === existingUserInfo.id) {\n- return;\n- }\n- }\n- const userInfoInputArray = [\n- ...this.state.userInfoInputArray,\n- this.props.otherUserInfos[userID],\n- ];\n- const userSearchResults = getUserSearchResults(\n- \"\",\n- this.props.otherUserInfos,\n- this.props.userSearchIndex,\n- userInfoInputArray.map(userInfo => userInfo.id),\n- );\n- this.setState({\n- userInfoInputArray,\n- usernameInputText: \"\",\n- userSearchResults,\n- });\n- }\n-\n- onTagInputHeightChange = (height: number) => {\n- this.setState({ tagInputHeight: height });\n- }\n-\n- onPressChangeColor = () => {\n- this.setState({ showColorPicker: true });\n- }\n-\n- onColorSelected = (color: string) => {\n- this.setState({\n- showColorPicker: false,\n- color: color.substr(1),\n- });\n- }\n-\n- closeColorPicker = () => {\n- this.setState({ showColorPicker: false });\n- }\n-\n- onPressCreateThread = () => {\n- this.props.dispatchActionPromise(\n- newThreadActionTypes,\n- this.newChatThreadAction(),\n- );\n- }\n-\n- async newChatThreadAction() {\n- const name = this.state.nameInputText.trim();\n- try {\n- return await this.props.newChatThread(\n- name,\n- this.state.selectedPrivacyIndex === 0\n- ? visibilityRules.CHAT_NESTED_OPEN\n- : visibilityRules.CHAT_SECRET,\n- this.state.color,\n- this.state.userInfoInputArray.map(\n- (userInfo: AccountUserInfo) => userInfo.id,\n- ),\n- this.props.parentThreadInfo ? this.props.parentThreadInfo.id : null,\n- );\n- } catch (e) {\n- Alert.alert(\n- \"Unknown error\",\n- \"Uhh... try again?\",\n- [\n- { text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged },\n- ],\n- { cancelable: false },\n- );\n- throw e;\n- }\n- }\n-\n- onErrorAcknowledged = () => {\n- invariant(this.nameInput, \"nameInput should be set\");\n- this.nameInput.focus();\n- }\n-\n- onUnknownErrorAlertAcknowledged = () => {\n- this.setState(\n- {\n- nameInputText: \"\",\n- usernameInputText: \"\",\n- userSearchResults: [],\n- selectedPrivacyIndex: 0,\n- tagInputHeight: 36,\n- },\n- this.onErrorAcknowledged,\n- );\n- }\n-\n-}\n-\n-const styles = StyleSheet.create({\n- container: {\n- paddingTop: 5,\n- flex: 1,\n- backgroundColor: '#FFFFFF',\n- },\n- content: {\n- flex: 1,\n- },\n- row: {\n- flexDirection: 'row',\n- marginBottom: 10,\n- },\n- input: {\n- flex: 1,\n- paddingRight: 12,\n- },\n- inlineInput: {\n- flexDirection: 'row',\n- },\n- label: {\n- paddingTop: 2,\n- paddingLeft: 12,\n- fontSize: 20,\n- width: 100,\n- },\n- tagInputLabel: {\n- paddingTop: 2,\n- paddingLeft: 12,\n- fontSize: 20,\n- width: 100,\n- },\n- textInput: {\n- fontSize: 18,\n- paddingTop: 4,\n- paddingBottom: 0,\n- paddingHorizontal: 0,\n- margin: 0,\n- },\n- parentThreadName: {\n- paddingTop: 5,\n- fontSize: 18,\n- },\n- parentThreadNameRobotext: {\n- color: '#AAAAAA',\n- },\n- segmentedTabStyle: {\n- borderColor: '#777',\n- },\n- segmentedActiveTabStyle: {\n- backgroundColor: '#777',\n- },\n- segmentedTextStyle: {\n- color: '#777',\n- },\n- colorPicker: {\n- top: 10,\n- bottom: 10,\n- left: 10,\n- right: 10,\n- position: 'absolute',\n- },\n- changeColorButton: {\n- paddingTop: 2,\n- },\n- closeButton: {\n- position: 'absolute',\n- top: 5,\n- right: 5,\n- width: 18,\n- height: 18,\n- borderRadius: 3,\n- },\n- closeButtonIcon: {\n- position: 'absolute',\n- left: 3,\n- },\n- userList: {\n- marginLeft: 88,\n- marginRight: 12,\n- },\n-});\n-\n-const AddThreadRouteName = 'AddThread';\n-\n-const loadingStatusSelector\n- = createLoadingStatusSelector(newThreadActionTypes);\n-registerFetchKey(searchUsersActionTypes);\n-\n-const AddThread = connect(\n- (state: AppState, ownProps: { navigation: NavProp }) => {\n- let parentThreadInfo = null;\n- const parentThreadID = ownProps.navigation.state.params.parentThreadID;\n- if (parentThreadID) {\n- parentThreadInfo = threadInfoSelector(state)[parentThreadID];\n- invariant(parentThreadInfo, \"parent thread should exist\");\n- }\n- return {\n- loadingStatus: loadingStatusSelector(state),\n- parentThreadInfo,\n- otherUserInfos:\n- userInfoSelectorForOtherMembersOfThread(parentThreadID)(state),\n- userSearchIndex:\n- userSearchIndexForOtherMembersOfThread(parentThreadID)(state),\n- cookie: state.cookie,\n- };\n- },\n- includeDispatchActionProps,\n- bindServerCalls({ newChatThread, searchUsers }),\n-)(InnerAddThread);\n-\n-export {\n- AddThread,\n- AddThreadRouteName,\n-};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat.react.js",
"new_path": "native/chat/chat.react.js",
"diff": "@@ -12,7 +12,6 @@ import {\nChatThreadListRouteName,\n} from './chat-thread-list.react';\nimport { MessageList, MessageListRouteName } from './message-list.react';\n-import { AddThread, AddThreadRouteName } from './add-thread.react';\nimport { ComposeThread, ComposeThreadRouteName } from './compose-thread.react';\nimport {\nThreadSettings,\n@@ -24,7 +23,6 @@ const Chat = StackNavigator(\n{\n[ChatThreadListRouteName]: { screen: ChatThreadList },\n[MessageListRouteName]: { screen: MessageList },\n- [AddThreadRouteName]: { screen: AddThread },\n[ComposeThreadRouteName]: { screen: ComposeThread },\n[ThreadSettingsRouteName]: { screen: ThreadSettings },\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -31,6 +31,7 @@ import invariant from 'invariant';\nimport _flow from 'lodash/fp/flow';\nimport _filter from 'lodash/fp/filter';\nimport _sortBy from 'lodash/fp/sortBy';\n+import Icon from 'react-native-vector-icons/MaterialIcons';\nimport {\nincludeDispatchActionProps,\n@@ -74,11 +75,17 @@ const tagInputProps = {\nreturnKeyType: \"go\",\n};\n-const segmentedPrivacyOptions = ['Public', 'Secret'];\n+type NavProp =\n+ & NavigationScreenProp<NavigationRoute>\n+ & { state: { params: {\n+ parentThreadID?: string,\n+ visibilityRules?: VisibilityRules,\n+ } } };\ntype Props = {\n- navigation: NavigationScreenProp<NavigationRoute>,\n+ navigation: NavProp,\n// Redux state\n+ parentThreadInfo: ?ThreadInfo,\nloadingStatus: LoadingStatus,\nparentThreadInfo: ?ThreadInfo,\notherUserInfos: {[id: string]: AccountUserInfo},\n@@ -100,7 +107,6 @@ type State = {\nusernameInputText: string,\nuserInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\nuserSearchResults: $ReadOnlyArray<AccountUserInfo>,\n- tagInputHeight: number,\nexistingThreads: ThreadInfo[],\n};\nclass InnerComposeThread extends React.PureComponent<Props, State> {\n@@ -109,11 +115,16 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nnavigation: PropTypes.shape({\nstate: PropTypes.shape({\nkey: PropTypes.string.isRequired,\n+ params: PropTypes.shape({\n+ parentThreadID: PropTypes.string,\n+ visibilityRules: PropTypes.number,\n+ }).isRequired,\n}).isRequired,\nsetParams: PropTypes.func.isRequired,\ngoBack: PropTypes.func.isRequired,\nnavigate: PropTypes.func.isRequired,\n}).isRequired,\n+ parentThreadInfo: threadInfoPropType,\nloadingStatus: loadingStatusPropType.isRequired,\nparentThreadInfo: threadInfoPropType,\notherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\n@@ -148,7 +159,6 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nusernameInputText: \"\",\nuserInfoInputArray: [],\nuserSearchResults,\n- tagInputHeight: 36,\nexistingThreads: [],\n};\n}\n@@ -250,16 +260,58 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n</View>\n);\n}\n+ let parentThreadRow = null;\n+ const parentThreadID = this.props.navigation.state.params.parentThreadID;\n+ if (parentThreadID) {\n+ const parentThreadInfo = this.props.parentThreadInfo;\n+ invariant(\n+ parentThreadInfo,\n+ `can't find ThreadInfo for parent ${parentThreadID}`,\n+ );\n+ const visRules = this.props.navigation.state.params.visibilityRules;\n+ invariant(\n+ visRules !== undefined && visRules !== null,\n+ `no visibilityRules provided for ${parentThreadID}`,\n+ );\n+ let visibilityInfo;\n+ if (visRules === visibilityRules.CHAT_NESTED_OPEN) {\n+ visibilityInfo = (\n+ <React.Fragment>\n+ <Icon name=\"public\" size={18} />\n+ <Text style={styles.visibilityLabel}>Open</Text>\n+ </React.Fragment>\n+ );\n+ } else if (visRules === visibilityRules.CHAT_SECRET) {\n+ visibilityInfo = (\n+ <React.Fragment>\n+ <Icon name=\"lock-outline\" size={18} />\n+ <Text style={styles.visibilityLabel}>Secret</Text>\n+ </React.Fragment>\n+ );\n+ } else {\n+ invariant(\n+ false,\n+ `invalid visibilityRules passed to ComposeThread: ${visRules}`,\n+ );\n+ }\n+ parentThreadRow = (\n+ <View style={styles.parentThreadRow}>\n+ {visibilityInfo}\n+ <Text style={styles.parentThreadLabel}>within</Text>\n+ <Text style={styles.parentThreadName}>\n+ {parentThreadInfo.uiName}\n+ </Text>\n+ </View>\n+ );\n+ }\nconst inputProps = {\n...tagInputProps,\nonSubmitEditing: this.onPressCreateThread,\n};\nconst content = (\n<React.Fragment>\n- <View style={[\n- styles.userSelectionRow,\n- { height: this.state.tagInputHeight + 13 },\n- ]}>\n+ {parentThreadRow}\n+ <View style={styles.userSelectionRow}>\n<Text style={styles.tagInputLabel}>To: </Text>\n<View style={styles.tagInputContainer}>\n<TagInput\n@@ -267,7 +319,6 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nonChange={this.onChangeTagInput}\ntext={this.state.usernameInputText}\nonChangeText={this.setUsernameInputText}\n- onHeightChange={this.onTagInputHeightChange}\nlabelExtractor={this.tagDataLabelExtractor}\ninputProps={inputProps}\nref={this.tagInputRef}\n@@ -354,10 +405,6 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n});\n}\n- onTagInputHeightChange = (height: number) => {\n- this.setState({ tagInputHeight: height });\n- }\n-\nonPressCreateThread = () => {\nif (this.state.userInfoInputArray.length === 0) {\nAlert.alert(\n@@ -389,7 +436,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nthis.state.userInfoInputArray.map(\n(userInfo: AccountUserInfo) => userInfo.id,\n),\n- null,\n+ this.props.parentThreadInfo ? this.props.parentThreadInfo.id : null,\n);\n} catch (e) {\nAlert.alert(\n@@ -414,7 +461,6 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n{\nusernameInputText: \"\",\nuserSearchResults: [],\n- tagInputHeight: 36,\n},\nthis.onErrorAcknowledged,\n);\n@@ -433,6 +479,27 @@ const styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n},\n+ parentThreadRow: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ backgroundColor: \"#CCCCCC\",\n+ paddingVertical: 6,\n+ paddingLeft: 12,\n+ },\n+ parentThreadLabel: {\n+ fontSize: 16,\n+ color: \"#777777\",\n+ paddingLeft: 6,\n+ },\n+ parentThreadName: {\n+ fontSize: 16,\n+ paddingLeft: 6,\n+ },\n+ visibilityLabel: {\n+ fontSize: 16,\n+ fontWeight: \"bold\",\n+ paddingLeft: 4,\n+ },\nuserSelectionRow: {\nflexDirection: 'row',\nalignItems: 'center',\n@@ -488,13 +555,22 @@ const loadingStatusSelector\nregisterFetchKey(searchUsersActionTypes);\nconst ComposeThread = connect(\n- (state: AppState) => ({\n+ (state: AppState, ownProps: { navigation: NavProp }) => {\n+ let parentThreadInfo = null;\n+ const parentThreadID = ownProps.navigation.state.params.parentThreadID;\n+ if (parentThreadID) {\n+ parentThreadInfo = threadInfoSelector(state)[parentThreadID];\n+ invariant(parentThreadInfo, \"parent thread should exist\");\n+ }\n+ return {\n+ parentThreadInfo,\nloadingStatus: loadingStatusSelector(state),\notherUserInfos: userInfoSelectorForOtherMembersOfThread(null)(state),\nuserSearchIndex: userSearchIndexForOtherMembersOfThread(null)(state),\nthreadInfos: threadInfoSelector(state),\ncookie: state.cookie,\n- }),\n+ };\n+ },\nincludeDispatchActionProps,\nbindServerCalls({ newChatThread, searchUsers }),\n)(InnerComposeThread);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -357,8 +357,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nconst styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n- marginLeft: 15,\n- marginRight: 15,\n+ marginHorizontal: 15,\nmarginTop: 100,\n},\nmodal: {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/settings/compose-subthread-modal.react.js",
"diff": "+// @flow\n+\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { NavigationParams } from 'react-navigation';\n+\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import {\n+ View,\n+ StyleSheet,\n+ Platform,\n+ KeyboardAvoidingView,\n+ Text,\n+ InteractionManager,\n+} from 'react-native';\n+import Icon from 'react-native-vector-icons/MaterialIcons';\n+import IonIcon from 'react-native-vector-icons/Ionicons';\n+\n+import { visibilityRules } from 'lib/types/thread-types';\n+\n+import { iosKeyboardHeight } from '../../dimensions';\n+import Button from '../../components/button.react';\n+import { ComposeThreadRouteName } from '../compose-thread.react';\n+\n+type Props = {|\n+ threadInfo: ThreadInfo,\n+ navigate: (\n+ routeName: string,\n+ params?: NavigationParams\n+ ) => bool,\n+ closeModal: () => void,\n+|};\n+class ComposeSubthreadModal extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ navigate: PropTypes.func.isRequired,\n+ closeModal: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ const content = (\n+ <View style={styles.modal}>\n+ <Text style={styles.visibility}>Visibility</Text>\n+ <Button style={styles.option} onPress={this.onPressOpen}>\n+ <Icon name=\"public\" size={32} />\n+ <Text style={styles.optionText}>Open</Text>\n+ <Text style={styles.optionExplanation}>\n+ Anybody in the parent thread can see an open child thread.\n+ </Text>\n+ <IonIcon\n+ name=\"ios-arrow-forward\"\n+ size={20}\n+ color=\"#036AFF\"\n+ style={styles.forwardIcon}\n+ />\n+ </Button>\n+ <Button style={styles.option} onPress={this.onPressSecret}>\n+ <Icon name=\"lock-outline\" size={32} />\n+ <Text style={styles.optionText}>Secret</Text>\n+ <Text style={styles.optionExplanation}>\n+ Only visible to its members and admins of ancestor threads.\n+ </Text>\n+ <IonIcon\n+ name=\"ios-arrow-forward\"\n+ size={20}\n+ color=\"#036AFF\"\n+ style={styles.forwardIcon}\n+ />\n+ </Button>\n+ </View>\n+ );\n+ if (Platform.OS === \"ios\") {\n+ return (\n+ <KeyboardAvoidingView\n+ style={styles.container}\n+ behavior=\"padding\"\n+ keyboardVerticalOffset={iosKeyboardHeight}\n+ >{content}</KeyboardAvoidingView>\n+ );\n+ } else {\n+ return <View style={styles.container}>{content}</View>;\n+ }\n+ }\n+\n+ onPressOpen = () => {\n+ InteractionManager.runAfterInteractions(() => {\n+ this.props.navigate(\n+ ComposeThreadRouteName,\n+ {\n+ parentThreadID: this.props.threadInfo.id,\n+ visibilityRules: visibilityRules.CHAT_NESTED_OPEN,\n+ },\n+ );\n+ });\n+ this.props.closeModal();\n+ }\n+\n+ onPressSecret = () => {\n+ InteractionManager.runAfterInteractions(() => {\n+ this.props.navigate(\n+ ComposeThreadRouteName,\n+ {\n+ parentThreadID: this.props.threadInfo.id,\n+ visibilityRules: visibilityRules.CHAT_SECRET,\n+ },\n+ );\n+ });\n+ this.props.closeModal();\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ marginHorizontal: 10,\n+ },\n+ modal: {\n+ padding: 12,\n+ borderRadius: 5,\n+ backgroundColor: '#EEEEEE',\n+ },\n+ visibility: {\n+ fontSize: 24,\n+ textAlign: 'center',\n+ },\n+ option: {\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ paddingHorizontal: 10,\n+ paddingVertical: 20,\n+ },\n+ optionText: {\n+ fontSize: 20,\n+ paddingLeft: 5,\n+ },\n+ optionExplanation: {\n+ flex: 1,\n+ fontSize: 14,\n+ paddingLeft: 10,\n+ textAlign: 'center',\n+ },\n+ forwardIcon: {\n+ paddingLeft: 10,\n+ },\n+});\n+\n+export default ComposeSubthreadModal;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-list-action.react.js",
"new_path": "native/chat/settings/thread-settings-list-action.react.js",
"diff": "import type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n-import type { ThreadInfo } from 'lib/types/thread-types';\n-import type { NavigationParams } from 'react-navigation';\nimport React from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport Button from '../../components/button.react';\n-import { AddThreadRouteName } from '../add-thread.react';\ntype ListActionProps = {|\nonPress: () => void,\n@@ -73,11 +70,7 @@ function ThreadSettingsAddMember(props: AddMemberProps) {\n}\ntype AddChildThreadProps = {|\n- threadInfo: ThreadInfo,\n- navigate: (\n- routeName: string,\n- params?: NavigationParams,\n- ) => bool,\n+ onPress: () => void,\n|};\nclass ThreadSettingsAddChildThread\nextends React.PureComponent<AddChildThreadProps> {\n@@ -86,7 +79,7 @@ class ThreadSettingsAddChildThread\nreturn (\n<View style={styles.addItemRow}>\n<ThreadSettingsListAction\n- onPress={this.onPressAddChildThread}\n+ onPress={this.props.onPress}\ntext=\"Add child thread\"\niconName=\"md-add\"\niconColor=\"#009900\"\n@@ -96,13 +89,6 @@ class ThreadSettingsAddChildThread\n);\n}\n- onPressAddChildThread = () => {\n- this.props.navigate(\n- AddThreadRouteName,\n- { parentThreadID: this.props.threadInfo.id },\n- );\n- }\n-\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-visibility.react.js",
"new_path": "native/chat/settings/thread-settings-visibility.react.js",
"diff": "@@ -22,7 +22,7 @@ class ThreadSettingsVisibility extends React.PureComponent<Props> {\nconst visibility =\nvisRules === visibilityRules.OPEN ||\nvisRules === visibilityRules.CHAT_NESTED_OPEN\n- ? \"Public\"\n+ ? \"Open\"\n: \"Secret\";\nreturn (\n<View style={styles.row}>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings.react.js",
"new_path": "native/chat/settings/thread-settings.react.js",
"diff": "@@ -49,6 +49,7 @@ import {\nThreadSettingsAddChildThread,\n} from './thread-settings-list-action.react';\nimport AddUsersModal from './add-users-modal.react';\n+import ComposeSubthreadModal from './compose-subthread-modal.react';\nimport ThreadSettingsChildThread from './thread-settings-child-thread.react';\nimport { registerChatScreen } from '../chat-screen-registry';\nimport ThreadSettingsName from './thread-settings-name.react';\n@@ -129,8 +130,6 @@ type ChatSettingsItem =\n| {|\nitemType: \"addChildThread\",\nkey: string,\n- threadInfo: ThreadInfo,\n- navigate: (routeName: string, params?: NavigationParams) => bool,\n|}\n| {|\nitemType: \"member\",\n@@ -162,6 +161,7 @@ type Props = {|\n|};\ntype State = {|\nshowAddUsersModal: bool,\n+ showComposeSubthreadModal: bool,\nshowMaxMembers: number,\nshowMaxChildThreads: number,\nnameEditValue: ?string,\n@@ -198,6 +198,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nsuper(props);\nthis.state = {\nshowAddUsersModal: false,\n+ showComposeSubthreadModal: false,\nshowMaxMembers: itemPageLength,\nshowMaxChildThreads: itemPageLength,\nnameEditValue: null,\n@@ -254,6 +255,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\ncanReset = () => {\nreturn !this.state.showAddUsersModal &&\n+ !this.state.showComposeSubthreadModal &&\n(this.state.nameEditValue === null ||\nthis.state.nameEditValue === undefined) &&\n!this.state.showEditColorModal &&\n@@ -388,8 +390,6 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\naddChildThread = {\nitemType: \"addChildThread\",\nkey: \"addChildThread\",\n- threadInfo: this.props.threadInfo,\n- navigate: this.props.navigation.navigate,\n};\n}\n@@ -498,6 +498,17 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nclose={this.closeAddUsersModal}\n/>\n</Modal>\n+ <Modal\n+ isVisible={this.state.showComposeSubthreadModal}\n+ onBackButtonPress={this.closeComposeSubthreadModal}\n+ onBackdropPress={this.closeComposeSubthreadModal}\n+ >\n+ <ComposeSubthreadModal\n+ threadInfo={this.props.threadInfo}\n+ navigate={this.props.navigation.navigate}\n+ closeModal={this.closeComposeSubthreadModal}\n+ />\n+ </Modal>\n</View>\n);\n}\n@@ -568,10 +579,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n);\n} else if (item.itemType === \"addChildThread\") {\nreturn (\n- <ThreadSettingsAddChildThread\n- threadInfo={item.threadInfo}\n- navigate={item.navigate}\n- />\n+ <ThreadSettingsAddChildThread onPress={this.onPressComposeSubthread} />\n);\n} else if (item.itemType === \"member\") {\nreturn (\n@@ -612,6 +620,14 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nthis.setState({ descriptionTextHeight: height });\n}\n+ onPressComposeSubthread = () => {\n+ this.setState({ showComposeSubthreadModal: true });\n+ }\n+\n+ closeComposeSubthreadModal = () => {\n+ this.setState({ showComposeSubthreadModal: false });\n+ }\n+\nonPressAddMember = () => {\nthis.setState({ showAddUsersModal: true });\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use ComposeThread for new subthreads and get rid of AddThread
Introducing `ComposeSubthreadModal` for selecting visibility rules for new subthread |
129,187 | 15.02.2018 19:47:20 | 18,000 | 7bd0a4e0256c24e90a110f8f1c16bca0ca481a8e | Additional constraints on "existing threads" in ComposeThread
Make sure they are within parent thread and all users in the `TagInput` are actually members of them | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -51,6 +51,21 @@ function viewerIsMember(threadInfo: ?(ThreadInfo | RawThreadInfo)) {\nthreadInfo.currentUser.role !== undefined;\n}\n+function userIsMember(\n+ threadInfo: ?(ThreadInfo | RawThreadInfo),\n+ userID: string,\n+) {\n+ if (!threadInfo) {\n+ return false;\n+ }\n+ return threadInfo &&\n+ threadInfo.members.some(\n+ member => member.id === userID &&\n+ member.role !== null &&\n+ member.role !== undefined,\n+ );\n+}\n+\nfunction threadActualMembers(memberInfos: MemberInfo[]) {\nreturn memberInfos\n.filter(\n@@ -188,6 +203,7 @@ export {\ngenerateRandomColor,\nthreadHasPermission,\nviewerIsMember,\n+ userIsMember,\nthreadActualMembers,\nthreadIsPersonalChat,\nthreadIsTwoPersonChat,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -55,6 +55,7 @@ import {\ngenerateRandomColor,\nthreadHasPermission,\nviewerIsMember,\n+ userIsMember,\n} from 'lib/shared/thread-utils';\nimport { getUserSearchResults } from 'lib/shared/search-utils';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\n@@ -228,9 +229,9 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n(threadInfo: ThreadInfo) =>\nviewerIsMember(threadInfo) &&\nthreadHasPermission(threadInfo, threadPermissions.VISIBLE) &&\n- userIDs.every(\n- userID => threadInfo.members.some(member => member.id === userID),\n- ),\n+ (!props.parentThreadInfo ||\n+ threadInfo.parentThreadID === props.parentThreadInfo.id) &&\n+ userIDs.every(userID => userIsMember(threadInfo, userID)),\n),\n_sortBy([\n'members.length',\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Additional constraints on "existing threads" in ComposeThread
Make sure they are within parent thread and all users in the `TagInput` are actually members of them |
129,187 | 16.02.2018 01:37:58 | 18,000 | a2d99d073148dbbaa4be4aa9bb28e7ab421f3446 | Consider parent thread membership in UserList | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/search-utils.js",
"new_path": "lib/shared/search-utils.js",
"diff": "// @flow\nimport type { AccountUserInfo } from '../types/user-types';\n+import type { ThreadInfo } from '../types/thread-types';\n+\nimport SearchIndex from './search-index';\n+import { userIsMember } from './thread-utils';\nfunction getUserSearchResults(\ntext: string,\nuserInfos: {[id: string]: AccountUserInfo},\nsearchIndex: SearchIndex,\nexcludeUserIDs: $ReadOnlyArray<string>,\n+ parentThreadInfo: ?ThreadInfo,\n) {\nconst results = [];\nconst appendUserInfo = (userInfo: AccountUserInfo) => {\n@@ -25,7 +29,20 @@ function getUserSearchResults(\nappendUserInfo(userInfos[id]);\n}\n}\n- return results;\n+ const resultsWithMembershipInfo = results.map(\n+ userInfo => ({\n+ id: userInfo.id,\n+ username: userInfo.username,\n+ memberOfParentThread: !parentThreadInfo ||\n+ userIsMember(parentThreadInfo, userInfo.id),\n+ }),\n+ );\n+ if (text === \"\") {\n+ return resultsWithMembershipInfo.filter(\n+ userInfo => userInfo.memberOfParentThread,\n+ );\n+ }\n+ return resultsWithMembershipInfo;\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/user-types.js",
"new_path": "lib/types/user-types.js",
"diff": "@@ -55,3 +55,15 @@ export type AccountUpdate = {|\n|},\ncurrentPassword: string,\n|};\n+\n+export type UserListItem = {|\n+ id: string,\n+ username: string,\n+ memberOfParentThread: bool,\n+|};\n+\n+export const userListItemPropType = PropTypes.shape({\n+ id: PropTypes.string.isRequired,\n+ username: PropTypes.string.isRequired,\n+ memberOfParentThread: PropTypes.bool.isRequired,\n+});\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -10,8 +10,11 @@ import {\ntype VisibilityRules,\nvisibilityRules,\n} from 'lib/types/thread-types';\n-import type { AccountUserInfo } from 'lib/types/user-types';\n-import { accountUserInfoPropType } from 'lib/types/user-types';\n+import {\n+ type AccountUserInfo,\n+ accountUserInfoPropType,\n+ type UserListItem,\n+} from 'lib/types/user-types';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { SearchUsersResult } from 'lib/actions/user-actions';\nimport type { NewThreadResult } from 'lib/actions/thread-actions';\n@@ -88,7 +91,6 @@ type Props = {\n// Redux state\nparentThreadInfo: ?ThreadInfo,\nloadingStatus: LoadingStatus,\n- parentThreadInfo: ?ThreadInfo,\notherUserInfos: {[id: string]: AccountUserInfo},\nuserSearchIndex: SearchIndex,\nthreadInfos: {[id: string]: ThreadInfo},\n@@ -107,7 +109,7 @@ type Props = {\ntype State = {\nusernameInputText: string,\nuserInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n- userSearchResults: $ReadOnlyArray<AccountUserInfo>,\n+ userSearchResults: $ReadOnlyArray<UserListItem>,\nexistingThreads: ThreadInfo[],\n};\nclass InnerComposeThread extends React.PureComponent<Props, State> {\n@@ -127,7 +129,6 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}).isRequired,\nparentThreadInfo: threadInfoPropType,\nloadingStatus: loadingStatusPropType.isRequired,\n- parentThreadInfo: threadInfoPropType,\notherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\nuserSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\nthreadInfos: PropTypes.objectOf(threadInfoPropType).isRequired,\n@@ -150,11 +151,12 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nconstructor(props: Props) {\nsuper(props);\n- const userSearchResults = getUserSearchResults(\n+ const userSearchResults = InnerComposeThread.getSearchResults(\n\"\",\nprops.otherUserInfos,\nprops.userSearchIndex,\n[],\n+ props.parentThreadInfo,\n);\nthis.state = {\nusernameInputText: \"\",\n@@ -164,6 +166,22 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n};\n}\n+ static getSearchResults(\n+ text: string,\n+ userInfos: {[id: string]: AccountUserInfo},\n+ searchIndex: SearchIndex,\n+ userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n+ parentThreadInfo: ?ThreadInfo,\n+ ) {\n+ return getUserSearchResults(\n+ text,\n+ userInfos,\n+ searchIndex,\n+ userInfoInputArray.map(userInfo => userInfo.id),\n+ parentThreadInfo,\n+ );\n+ }\n+\ncomponentDidMount() {\nthis.mounted = true;\nregisterChatScreen(this.props.navigation.state.key, this);\n@@ -189,11 +207,12 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nthis.props.otherUserInfos !== nextProps.otherUserInfos ||\nthis.props.userSearchIndex !== nextProps.userSearchIndex\n) {\n- const userSearchResults = getUserSearchResults(\n+ const userSearchResults = InnerComposeThread.getSearchResults(\nthis.state.usernameInputText,\nnextProps.otherUserInfos,\nnextProps.userSearchIndex,\n- this.state.userInfoInputArray.map(userInfo => userInfo.id),\n+ this.state.userInfoInputArray,\n+ nextProps.parentThreadInfo,\n);\nnewState.userSearchResults = userSearchResults;\n}\n@@ -278,14 +297,14 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nif (visRules === visibilityRules.CHAT_NESTED_OPEN) {\nvisibilityInfo = (\n<React.Fragment>\n- <Icon name=\"public\" size={18} />\n+ <Icon name=\"public\" size={18} color=\"black\" />\n<Text style={styles.visibilityLabel}>Open</Text>\n</React.Fragment>\n);\n} else if (visRules === visibilityRules.CHAT_SECRET) {\nvisibilityInfo = (\n<React.Fragment>\n- <Icon name=\"lock-outline\" size={18} />\n+ <Icon name=\"lock-outline\" size={18} color=\"black\" />\n<Text style={styles.visibilityLabel}>Secret</Text>\n</React.Fragment>\n);\n@@ -354,11 +373,12 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nonChangeTagInput = (userInfoInputArray: $ReadOnlyArray<AccountUserInfo>) => {\n- const userSearchResults = getUserSearchResults(\n+ const userSearchResults = InnerComposeThread.getSearchResults(\nthis.state.usernameInputText,\nthis.props.otherUserInfos,\nthis.props.userSearchIndex,\n- userInfoInputArray.map(userInfo => userInfo.id),\n+ userInfoInputArray,\n+ this.props.parentThreadInfo,\n);\nthis.setState({ userInfoInputArray, userSearchResults });\n}\n@@ -366,11 +386,12 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\ntagDataLabelExtractor = (userInfo: AccountUserInfo) => userInfo.username;\nsetUsernameInputText = (text: string) => {\n- const userSearchResults = getUserSearchResults(\n+ const userSearchResults = InnerComposeThread.getSearchResults(\ntext,\nthis.props.otherUserInfos,\nthis.props.userSearchIndex,\n- this.state.userInfoInputArray.map(userInfo => userInfo.id),\n+ this.state.userInfoInputArray,\n+ this.props.parentThreadInfo,\n);\nthis.searchUsers(text);\nthis.setState({ usernameInputText: text, userSearchResults });\n@@ -393,11 +414,12 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n...this.state.userInfoInputArray,\nthis.props.otherUserInfos[userID],\n];\n- const userSearchResults = getUserSearchResults(\n+ const userSearchResults = InnerComposeThread.getSearchResults(\n\"\",\nthis.props.otherUserInfos,\nthis.props.userSearchIndex,\n- userInfoInputArray.map(userInfo => userInfo.id),\n+ userInfoInputArray,\n+ this.props.parentThreadInfo,\n);\nthis.setState({\nuserInfoInputArray,\n@@ -495,11 +517,13 @@ const styles = StyleSheet.create({\nparentThreadName: {\nfontSize: 16,\npaddingLeft: 6,\n+ color: \"black\",\n},\nvisibilityLabel: {\nfontSize: 16,\nfontWeight: \"bold\",\npaddingLeft: 4,\n+ color: \"black\",\n},\nuserSelectionRow: {\nflexDirection: 'row',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "import type { AppState } from '../../redux-setup';\nimport type { ThreadInfo } from 'lib/types/thread-types';\nimport { threadInfoPropType } from 'lib/types/thread-types';\n-import type { AccountUserInfo } from 'lib/types/user-types';\n-import { accountUserInfoPropType } from 'lib/types/user-types';\n+import {\n+ type AccountUserInfo,\n+ accountUserInfoPropType,\n+ type UserListItem,\n+} from 'lib/types/user-types';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\nimport type { ChangeThreadSettingsResult } from 'lib/actions/thread-actions';\nimport type { SearchUsersResult } from 'lib/actions/user-actions';\n@@ -46,6 +49,7 @@ import {\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { threadActualMembers } from 'lib/shared/thread-utils';\n+import { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport UserList from '../../components/user-list.react';\nimport TagInput from '../../components/tag-input.react';\n@@ -61,6 +65,7 @@ type Props = {\nthreadInfo: ThreadInfo,\nclose: () => void,\n// Redux state\n+ parentThreadInfo: ?ThreadInfo,\notherUserInfos: {[id: string]: AccountUserInfo},\nuserSearchIndex: SearchIndex,\naddUsersLoadingStatus: LoadingStatus,\n@@ -74,7 +79,7 @@ type Props = {\nsearchUsers: (usernamePrefix: string) => Promise<SearchUsersResult>,\n};\ntype State = {|\n- userSearchResults: $ReadOnlyArray<AccountUserInfo>,\n+ userSearchResults: $ReadOnlyArray<UserListItem>,\nusernameInputText: string,\nuserInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\n|};\n@@ -83,6 +88,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\nclose: PropTypes.func.isRequired,\n+ parentThreadInfo: threadInfoPropType,\notherUserInfos: PropTypes.objectOf(accountUserInfoPropType).isRequired,\nuserSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\naddUsersLoadingStatus: loadingStatusPropType.isRequired,\n@@ -101,6 +107,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nprops.userSearchIndex,\n[],\nprops.threadInfo,\n+ props.parentThreadInfo,\n);\nthis.state = {\nuserSearchResults,\n@@ -115,6 +122,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nsearchIndex: SearchIndex,\nuserInfoInputArray: $ReadOnlyArray<AccountUserInfo>,\nthreadInfo: ThreadInfo,\n+ parentThreadInfo: ?ThreadInfo,\n) {\nconst excludeUserIDs = userInfoInputArray\n.map(userInfo => userInfo.id)\n@@ -124,6 +132,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nuserInfos,\nsearchIndex,\nexcludeUserIDs,\n+ parentThreadInfo,\n);\n}\n@@ -158,6 +167,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nnextProps.userSearchIndex,\nthis.state.userInfoInputArray,\nnextProps.threadInfo,\n+ nextProps.parentThreadInfo,\n);\nthis.setState({ userSearchResults });\n}\n@@ -251,6 +261,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nthis.props.userSearchIndex,\nuserInfoInputArray,\nthis.props.threadInfo,\n+ this.props.parentThreadInfo,\n);\nthis.setState({ userInfoInputArray, userSearchResults });\n}\n@@ -267,6 +278,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nthis.props.userSearchIndex,\nthis.state.userInfoInputArray,\nthis.props.threadInfo,\n+ this.props.parentThreadInfo,\n);\nthis.searchUsers(text);\nthis.setState({ usernameInputText: text, userSearchResults });\n@@ -291,6 +303,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nthis.props.userSearchIndex,\nuserInfoInputArray,\nthis.props.threadInfo,\n+ this.props.parentThreadInfo,\n);\nthis.setState({\nuserInfoInputArray,\n@@ -341,6 +354,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nthis.props.userSearchIndex,\nuserInfoInputArray,\nthis.props.threadInfo,\n+ this.props.parentThreadInfo,\n);\nthis.setState(\n{\n@@ -402,12 +416,21 @@ const addUsersToThreadLoadingStatusSelector\nregisterFetchKey(searchUsersActionTypes);\nexport default connect(\n- (state: AppState) => ({\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\n+ let parentThreadInfo = null;\n+ const parentThreadID = ownProps.threadInfo.parentThreadID;\n+ if (parentThreadID) {\n+ parentThreadInfo = threadInfoSelector(state)[parentThreadID];\n+ invariant(parentThreadInfo, \"parent thread should exist\");\n+ }\n+ return {\n+ parentThreadInfo,\notherUserInfos: userInfoSelectorForOtherMembersOfThread(null)(state),\nuserSearchIndex: userSearchIndexForOtherMembersOfThread(null)(state),\naddUsersLoadingStatus: addUsersToThreadLoadingStatusSelector(state),\ncookie: state.cookie,\n- }),\n+ };\n+ },\nincludeDispatchActionProps,\nbindServerCalls({ addUsersToThread, searchUsers }),\n)(AddUsersModal);\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": "@@ -43,7 +43,7 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\n<View style={styles.modal}>\n<Text style={styles.visibility}>Visibility</Text>\n<Button style={styles.option} onPress={this.onPressOpen}>\n- <Icon name=\"public\" size={32} />\n+ <Icon name=\"public\" size={32} color=\"black\" />\n<Text style={styles.optionText}>Open</Text>\n<Text style={styles.optionExplanation}>\nAnybody in the parent thread can see an open child thread.\n@@ -56,7 +56,7 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\n/>\n</Button>\n<Button style={styles.option} onPress={this.onPressSecret}>\n- <Icon name=\"lock-outline\" size={32} />\n+ <Icon name=\"lock-outline\" size={32} color=\"black\" />\n<Text style={styles.optionText}>Secret</Text>\n<Text style={styles.optionExplanation}>\nOnly visible to its members and admins of ancestor threads.\n@@ -123,6 +123,7 @@ const styles = StyleSheet.create({\nvisibility: {\nfontSize: 24,\ntextAlign: 'center',\n+ color: \"black\",\n},\noption: {\nflexDirection: 'row',\n@@ -133,12 +134,14 @@ const styles = StyleSheet.create({\noptionText: {\nfontSize: 20,\npaddingLeft: 5,\n+ color: \"black\",\n},\noptionExplanation: {\nflex: 1,\nfontSize: 14,\npaddingLeft: 10,\ntextAlign: 'center',\n+ color: \"black\",\n},\nforwardIcon: {\npaddingLeft: 10,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/tag-input.react.js",
"new_path": "native/components/tag-input.react.js",
"diff": "@@ -226,16 +226,12 @@ class TagInput<T> extends React.PureComponent<Props<T>, State> {\n}\nscrollToBottom = () => {\n- const y = this.contentHeight - this.scrollViewHeight;\n- if (y <= 0) {\n- return;\n- }\nconst scrollView = this.scrollView;\ninvariant(\nscrollView,\n\"this.scrollView ref should exist before scrollToBottom called\",\n);\n- scrollView.scrollTo({ y, animated: true });\n+ scrollView.scrollToEnd();\n}\nrender() {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/user-list-user.react.js",
"new_path": "native/components/user-list-user.react.js",
"diff": "import type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n-\n-import type { AccountUserInfo } from 'lib/types/user-types';\n-import { accountUserInfoPropType } from 'lib/types/user-types';\n+import { type UserListItem, userListItemPropType } from 'lib/types/user-types';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import {\n- StyleSheet,\n- Text,\n- ViewPropTypes,\n-} from 'react-native';\n+import { StyleSheet, Text, Platform } from 'react-native';\nimport Button from './button.react';\n+const getUserListItemHeight = (item: UserListItem) => {\n+ return Platform.OS === \"ios\" ? 31.5 : 33.5;\n+};\n+\ntype Props = {\n- userInfo: AccountUserInfo,\n+ userInfo: UserListItem,\nonSelect: (userID: string) => void,\n- style?: StyleObj,\ntextStyle?: StyleObj,\n};\nclass UserListUser extends React.PureComponent<Props> {\nstatic propTypes = {\n- userInfo: accountUserInfoPropType.isRequired,\n+ userInfo: userListItemPropType.isRequired,\nonSelect: PropTypes.func.isRequired,\n- style: ViewPropTypes.style,\ntextStyle: Text.propTypes.style,\n};\nrender() {\n+ let parentThreadNotice = null;\n+ if (!this.props.userInfo.memberOfParentThread) {\n+ parentThreadNotice = (\n+ <Text style={styles.parentThreadNotice}>not in parent thread</Text>\n+ );\n+ }\nreturn (\n<Button\nonPress={this.onSelect}\niosFormat=\"highlight\"\niosActiveOpacity={0.85}\n- style={this.props.style}\n+ style={styles.button}\n>\n<Text style={[styles.text, this.props.textStyle]} numberOfLines={1}>\n{this.props.userInfo.username}\n</Text>\n+ {parentThreadNotice}\n</Button>\n);\n}\n@@ -54,12 +57,25 @@ class UserListUser extends React.PureComponent<Props> {\n}\nconst styles = StyleSheet.create({\n+ button: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ alignItems: 'center',\n+ },\ntext: {\n+ flex: 1,\npaddingHorizontal: 12,\npaddingVertical: 6,\nfontSize: 16,\n},\n+ parentThreadNotice: {\n+ color: \"#888888\",\n+ fontStyle: 'italic',\n+ },\n});\n-export default UserListUser;\n+export {\n+ UserListUser,\n+ getUserListItemHeight,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/user-list.react.js",
"new_path": "native/components/user-list.react.js",
"diff": "import type {\nStyleObj,\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n-\n-import type { AccountUserInfo } from 'lib/types/user-types';\n-import { accountUserInfoPropType } from 'lib/types/user-types';\n+import { type UserListItem, userListItemPropType } from 'lib/types/user-types';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { FlatList, ViewPropTypes, Text } from 'react-native';\n+import { FlatList, Text } from 'react-native';\n+import _sum from 'lodash/fp/sum';\n-import UserListUser from './user-list-user.react';\n+import { UserListUser, getUserListItemHeight } from './user-list-user.react';\ntype Props = {\n- userInfos: $ReadOnlyArray<AccountUserInfo>,\n+ userInfos: $ReadOnlyArray<UserListItem>,\nonSelect: (userID: string) => void,\n- itemStyle?: StyleObj,\nitemTextStyle?: StyleObj,\n};\nclass UserList extends React.PureComponent<Props> {\nstatic propTypes = {\n- userInfos: PropTypes.arrayOf(accountUserInfoPropType).isRequired,\n+ userInfos: PropTypes.arrayOf(userListItemPropType).isRequired,\nonSelect: PropTypes.func.isRequired,\n- itemStyle: ViewPropTypes.style,\nitemTextStyle: Text.propTypes.style,\n};\n@@ -41,23 +38,28 @@ class UserList extends React.PureComponent<Props> {\n);\n}\n- static keyExtractor(userInfo: AccountUserInfo) {\n+ static keyExtractor(userInfo: UserListItem) {\nreturn userInfo.id;\n}\n- renderItem = (row: { item: AccountUserInfo }) => {\n+ renderItem = (row: { item: UserListItem }) => {\nreturn (\n<UserListUser\nuserInfo={row.item}\nonSelect={this.props.onSelect}\n- style={this.props.itemStyle}\ntextStyle={this.props.itemTextStyle}\n/>\n);\n}\n- static getItemLayout(data: ?$ReadOnlyArray<AccountUserInfo>, index: number) {\n- return { length: 24, offset: 24 * index, index };\n+ static getItemLayout(data: ?$ReadOnlyArray<UserListItem>, index: number) {\n+ if (!data) {\n+ return { length: 0, offset: 0, index };\n+ }\n+ const offset = _sum(data.filter((_, i) => i < index).map(getUserListItemHeight));\n+ const item = data[index];\n+ const length = item ? getUserListItemHeight(item) : 0;\n+ return { length, offset, index };\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Consider parent thread membership in UserList |
129,187 | 16.02.2018 12:37:10 | 18,000 | 3ba91a16fb382e953c70fe2037eb014ce8cd1160 | send_message.php -> jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -5,7 +5,10 @@ import bodyParser from 'body-parser';\nimport cookieParser from 'cookie-parser';\nimport errorHandler from './error_handler';\n-import { messageCreationResponder } from './responders/message-responders';\n+import {\n+ messageCreationResponder,\n+ textMessageCreationResponder,\n+} from './responders/message-responders';\nimport { updateActivityResponder } from './responders/activity-responders';\nimport { deviceTokenUpdateResponder } from './responders/device-responders';\nimport {\n@@ -51,4 +54,8 @@ app.post(\n'/send_password_reset_email',\nerrorHandler(sendPasswordResetEmailResponder),\n);\n+app.post(\n+ '/create_text_message',\n+ errorHandler(textMessageCreationResponder),\n+);\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/fetchers/thread-fetcher.js",
"new_path": "jserver/src/fetchers/thread-fetcher.js",
"diff": "// @flow\n-import type { RawThreadInfo, ServerThreadInfo } from 'lib/types/thread-types';\n+import type {\n+ RawThreadInfo,\n+ ServerThreadInfo,\n+ ThreadPermission,\n+} from 'lib/types/thread-types';\nimport type { UserInfo } from 'lib/types/user-types';\n+import type { PermissionsInfo } from 'lib/permissions/thread-permissions';\nimport {\nassertVisibilityRules,\nthreadPermissions,\n} from 'lib/types/thread-types';\n-import { getAllThreadPermissions } from 'lib/permissions/thread-permissions';\n+import {\n+ getAllThreadPermissions,\n+ permissionHelper,\n+} from 'lib/permissions/thread-permissions';\nimport { rawThreadInfoFromServerThreadInfo } from 'lib/shared/thread-utils';\nimport { pool, SQL, SQLStatement } from '../database';\n@@ -147,8 +155,39 @@ async function verifyThreadIDs(\nreturn verified;\n}\n+async function fetchThreadPermissionsInfo(\n+ threadID: string,\n+): Promise<?PermissionsInfo> {\n+ const viewerID = currentViewer().id;\n+ const query = SQL`\n+ SELECT t.visibility_rules, m.permissions\n+ FROM threads t\n+ LEFT JOIN memberships m ON m.thread = t.id AND m.user = ${viewerID}\n+ WHERE t.id = ${threadID}\n+ `;\n+ const [ result ] = await pool.query(query);\n+\n+ if (result.length === 0) {\n+ return null;\n+ }\n+ const row = result[0];\n+ return {\n+ permissions: row.permissions,\n+ visibilityRules: assertVisibilityRules(row.visibility_rules),\n+ };\n+}\n+\n+async function checkThreadPermission(\n+ threadID: string,\n+ permission: ThreadPermission,\n+): Promise<bool> {\n+ const permissionsInfo = await fetchThreadPermissionsInfo(threadID);\n+ return permissionHelper(permissionsInfo, permission);\n+}\n+\nexport {\nfetchServerThreadInfos,\nfetchThreadInfos,\nverifyThreadIDs,\n+ checkThreadPermission,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/message-responders.js",
"new_path": "jserver/src/responders/message-responders.js",
"diff": "// @flow\nimport type { $Response, $Request } from 'express';\n-import type { MessageData } from 'lib/types/message-types';\n+import type {\n+ MessageData,\n+ TextMessageCreationInfo,\n+} from 'lib/types/message-types';\n+\n+import t from 'tcomb';\n+\n+import { threadPermissions } from 'lib/types/thread-types';\n+import { messageType } from 'lib/types/message-types';\nimport createMessages from '../creators/message-creator';\nimport { setCurrentViewerFromCookie } from '../session/cookies';\n+import { tShape } from '../utils/tcomb-utils';\n+import { checkThreadPermission } from '../fetchers/thread-fetcher';\n+import { currentViewer } from '../session/viewer';\nasync function messageCreationResponder(req: $Request, res: $Response) {\nconst messageDatas: MessageData[] = (req.body: any);\n@@ -15,6 +26,39 @@ async function messageCreationResponder(req: $Request, res: $Response) {\nreturn { success: true, rawMessageInfos };\n}\n+const textMessageCreationInfoInputValidator = tShape({\n+ threadID: t.String,\n+ text: t.String,\n+});\n+\n+async function textMessageCreationResponder(req: $Request, res: $Response) {\n+ const textMessageCreationInfo: TextMessageCreationInfo = (req.body: any);\n+ if (!textMessageCreationInfoInputValidator.is(textMessageCreationInfo)) {\n+ return { error: 'invalid_parameters' };\n+ }\n+\n+ await setCurrentViewerFromCookie(req.cookies);\n+ const hasPermission = await checkThreadPermission(\n+ textMessageCreationInfo.threadID,\n+ threadPermissions.VOICED,\n+ );\n+ if (!hasPermission) {\n+ return { error: 'invalid_parameters' };\n+ }\n+\n+ const messageData = {\n+ type: messageType.TEXT,\n+ threadID: textMessageCreationInfo.threadID,\n+ creatorID: currentViewer().id,\n+ time: Date.now(),\n+ text: textMessageCreationInfo.text,\n+ };\n+ const rawMessageInfos = await createMessages([messageData]);\n+\n+ return { success: true, newMessageInfo: rawMessageInfos[0] };\n+}\n+\nexport {\nmessageCreationResponder,\n+ textMessageCreationResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/actions/message-actions.js",
"new_path": "lib/actions/message-actions.js",
"diff": "@@ -86,12 +86,11 @@ async function sendMessage(\ntext: string,\n): Promise<SendMessageResult> {\nconst response = await fetchJSON('send_message.php', {\n- 'thread': threadID,\n- 'text': text,\n+ input: { threadID, text },\n});\nreturn {\n- id: response.new_message_infos[0].id,\n- time: response.new_message_infos[0].time,\n+ id: response.newMessageInfo.id,\n+ time: response.newMessageInfo.time,\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/permissions/thread-permissions.js",
"new_path": "lib/permissions/thread-permissions.js",
"diff": "@@ -11,7 +11,7 @@ import {\nthreadPermissions,\n} from '../types/thread-types';\n-type PermissionsInfo = {\n+export type PermissionsInfo = {\npermissions: ?ThreadPermissionsBlob,\nvisibilityRules: VisibilityRules,\n};\n@@ -27,9 +27,12 @@ function permissionLookup(\n}\nfunction permissionHelper(\n- permissionsInfo: PermissionsInfo,\n+ permissionsInfo: ?PermissionsInfo,\npermission: ThreadPermission,\n): bool {\n+ if (!permissionsInfo) {\n+ return false;\n+ }\nconst visRules = permissionsInfo.visibilityRules;\nif (\n(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/message-types.js",
"new_path": "lib/types/message-types.js",
"diff": "@@ -410,3 +410,8 @@ export function assertMessageTruncationStatus(\n);\nreturn ourMessageTruncationStatus;\n}\n+\n+export type TextMessageCreationInfo = {|\n+ threadID: string,\n+ text: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/send_message.php",
"new_path": "server/send_message.php",
"diff": "<?php\n-require_once('async_lib.php');\n-require_once('config.php');\n-require_once('auth.php');\n-require_once('message_lib.php');\n-require_once('permissions.php');\n+require_once('call_node.php');\n-async_start();\n-\n-if (!isset($_POST['thread']) || !isset($_POST['text'])) {\n- async_end(array(\n- 'error' => 'invalid_parameters',\n- ));\n-}\n-$thread = (int)$_POST['thread'];\n-if (!check_thread_permission($thread, PERMISSION_VOICED)) {\n- async_end(array(\n- 'error' => 'invalid_parameters',\n- ));\n-}\n-\n-$message_info = array(\n- 'type' => MESSAGE_TYPE_TEXT,\n- 'threadID' => (string)$thread,\n- 'creatorID' => (string)get_viewer_id(),\n- 'time' => round(microtime(true) * 1000), // in milliseconds\n- 'text' => $_POST['text'],\n-);\n-$new_message_infos = create_message_infos(array($message_info));\n-\n-async_end(array(\n- 'success' => true,\n- 'new_message_infos' => $new_message_infos,\n-));\n+proxy_to_node('create_text_message');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | send_message.php -> jserver |
129,187 | 16.02.2018 16:49:44 | 18,000 | fa004708d578de8a25170869a4a5c11215dd82e0 | errorHandler -> jsonHandler
Move try-catch `ServerError` handling and `setCurrentViewerFromCookie` call here | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -4,7 +4,7 @@ import express from 'express';\nimport bodyParser from 'body-parser';\nimport cookieParser from 'cookie-parser';\n-import errorHandler from './error_handler';\n+import { jsonHandler } from './responders/handlers';\nimport {\nmessageCreationResponder,\ntextMessageCreationResponder,\n@@ -22,40 +22,21 @@ import { userSearchResponder } from './responders/search-responders';\nconst app = express();\napp.use(bodyParser.json());\napp.use(cookieParser());\n-app.post(\n- '/create_messages',\n- errorHandler(messageCreationResponder),\n-);\n-app.post(\n- '/update_activity',\n- errorHandler(updateActivityResponder),\n-);\n-app.post(\n- '/update_user_subscription',\n- errorHandler(userSubscriptionUpdateResponder),\n-);\n-app.post(\n- '/update_device_token',\n- errorHandler(deviceTokenUpdateResponder),\n-);\n-app.post(\n- '/update_account',\n- errorHandler(accountUpdateResponder),\n-);\n-app.post(\n- '/send_verification_email',\n- errorHandler(sendVerificationEmailResponder),\n-);\n-app.post(\n- '/search_users',\n- errorHandler(userSearchResponder),\n-);\n-app.post(\n- '/send_password_reset_email',\n- errorHandler(sendPasswordResetEmailResponder),\n-);\n-app.post(\n- '/create_text_message',\n- errorHandler(textMessageCreationResponder),\n-);\n+\n+const jsonEndpoints = {\n+ 'create_messages': messageCreationResponder,\n+ 'update_activity': updateActivityResponder,\n+ 'update_user_subscription': userSubscriptionUpdateResponder,\n+ 'update_device_token': deviceTokenUpdateResponder,\n+ 'update_account': accountUpdateResponder,\n+ 'send_verification_email': sendVerificationEmailResponder,\n+ 'search_users': userSearchResponder,\n+ 'send_password_reset_email': sendPasswordResetEmailResponder,\n+ 'create_text_message': textMessageCreationResponder,\n+};\n+for (let endpoint in jsonEndpoints) {\n+ const responder = jsonEndpoints[endpoint];\n+ app.post(`/${endpoint}`, jsonHandler(responder));\n+}\n+\napp.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "DELETE",
"old_path": "jserver/src/error_handler.js",
"new_path": null,
"diff": "-// @flow\n-\n-import type { $Response, $Request } from 'express';\n-\n-type OurHandler = (req: $Request, res: $Response) => Promise<*>;\n-\n-export default function errorHandler(handler: OurHandler) {\n- return async (req: $Request, res: $Response) => {\n- try {\n- const result = await handler(req, res);\n- if (res.headersSent) {\n- return;\n- } else if (typeof result === \"object\") {\n- res.json(result);\n- } else {\n- res.send(result);\n- }\n- } catch (error) {\n- console.warn(error);\n- if (!res.headersSent) {\n- res.status(500).send(error.message);\n- }\n- }\n- };\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/activity-responders.js",
"new_path": "jserver/src/responders/activity-responders.js",
"diff": "@@ -5,8 +5,9 @@ import type { ActivityUpdate } from 'lib/types/activity-types';\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\nimport { activityUpdater } from '../updaters/activity-updater';\n-import { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tBool, tShape } from '../utils/tcomb-utils';\nconst inputValidator = t.list(t.union([\n@@ -27,17 +28,16 @@ const inputValidator = t.list(t.union([\nasync function updateActivityResponder(req: $Request, res: $Response) {\nconst updates: $ReadOnlyArray<ActivityUpdate> = (req.body: any);\nif (!inputValidator.is(updates)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nconst result = await activityUpdater(updates);\n- if (result) {\n- return { success: true, unfocusedToUnread: result.unfocusedToUnread };\n- } else {\n- return { error: 'invalid_credentials' };\n+ if (!result) {\n+ throw new ServerError('invalid_credentials');\n}\n+\n+ return { unfocusedToUnread: result.unfocusedToUnread };\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/device-responders.js",
"new_path": "jserver/src/responders/device-responders.js",
"diff": "@@ -5,8 +5,9 @@ import type { DeviceTokenUpdate } from 'lib/types/device-types';\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\nimport { deviceTokenUpdater } from '../updaters/device-token-updater';\n-import { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tShape } from '../utils/tcomb-utils';\nconst inputValidator = tShape({\n@@ -17,11 +18,9 @@ const inputValidator = tShape({\nasync function deviceTokenUpdateResponder(req: $Request, res: $Response) {\nconst deviceTokenUpdate: DeviceTokenUpdate = (req.body: any);\nif (!inputValidator.is(deviceTokenUpdate)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nawait deviceTokenUpdater(deviceTokenUpdate);\n- return { success: true };\n}\nexport {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/responders/handlers.js",
"diff": "+// @flow\n+\n+import type { $Response, $Request } from 'express';\n+\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\n+import { setCurrentViewerFromCookie } from '../session/cookies';\n+\n+type Responder = (req: $Request, res: $Response) => Promise<*>;\n+\n+function jsonHandler(responder: Responder) {\n+ return async (req: $Request, res: $Response) => {\n+ try {\n+ await setCurrentViewerFromCookie(req.cookies);\n+ const result = await responder(req, res);\n+ if (!res.headersSent) {\n+ res.json({ success: true, ...result });\n+ }\n+ } catch (e) {\n+ console.warn(e);\n+ if (res.headersSent) {\n+ return;\n+ }\n+ if (e instanceof ServerError) {\n+ res.json({ error: e.message });\n+ } else {\n+ res.status(500).send(e.message);\n+ }\n+ }\n+ };\n+}\n+\n+export {\n+ jsonHandler,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/message-responders.js",
"new_path": "jserver/src/responders/message-responders.js",
"diff": "@@ -8,11 +8,11 @@ import type {\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\nimport { threadPermissions } from 'lib/types/thread-types';\nimport { messageType } from 'lib/types/message-types';\nimport createMessages from '../creators/message-creator';\n-import { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tShape } from '../utils/tcomb-utils';\nimport { checkThreadPermission } from '../fetchers/thread-fetcher';\nimport { currentViewer } from '../session/viewer';\n@@ -21,9 +21,8 @@ async function messageCreationResponder(req: $Request, res: $Response) {\nconst messageDatas: MessageData[] = (req.body: any);\n// We don't currently do any input validation since we have only internal\n// callers as of now\n- await setCurrentViewerFromCookie(req.cookies);\nconst rawMessageInfos = await createMessages(messageDatas);\n- return { success: true, rawMessageInfos };\n+ return { rawMessageInfos };\n}\nconst textMessageCreationInfoInputValidator = tShape({\n@@ -34,16 +33,15 @@ const textMessageCreationInfoInputValidator = tShape({\nasync function textMessageCreationResponder(req: $Request, res: $Response) {\nconst textMessageCreationInfo: TextMessageCreationInfo = (req.body: any);\nif (!textMessageCreationInfoInputValidator.is(textMessageCreationInfo)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nconst hasPermission = await checkThreadPermission(\ntextMessageCreationInfo.threadID,\nthreadPermissions.VOICED,\n);\nif (!hasPermission) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\nconst messageData = {\n@@ -55,7 +53,7 @@ async function textMessageCreationResponder(req: $Request, res: $Response) {\n};\nconst rawMessageInfos = await createMessages([messageData]);\n- return { success: true, newMessageInfo: rawMessageInfos[0] };\n+ return { newMessageInfo: rawMessageInfos[0] };\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/search-responders.js",
"new_path": "jserver/src/responders/search-responders.js",
"diff": "@@ -5,8 +5,9 @@ import type { UserSearchQuery } from 'lib/types/search-types';\nimport t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\nimport { tShape } from '../utils/tcomb-utils';\n-import { setCurrentViewerFromCookie } from '../session/cookies';\nimport { searchForUsers } from '../search/users';\nconst userSearchQueryInputValidator = tShape({\n@@ -16,13 +17,12 @@ const userSearchQueryInputValidator = tShape({\nasync function userSearchResponder(req: $Request, res: $Response) {\nconst userSearchQuery: UserSearchQuery = (req.body: any);\nif (!userSearchQueryInputValidator.is(userSearchQuery)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nconst searchResults = await searchForUsers(userSearchQuery);\n- return { success: true, userInfos: searchResults };\n+ return { userInfos: searchResults };\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -15,7 +15,6 @@ import {\ncheckAndSendVerificationEmail,\ncheckAndSendPasswordResetEmail,\n} from '../updaters/account-updater';\n-import { setCurrentViewerFromCookie } from '../session/cookies';\nimport { tShape } from '../utils/tcomb-utils';\nimport { currentViewer } from '../session/viewer';\n@@ -30,16 +29,15 @@ const subscriptionUpdateInputValidator = tShape({\nasync function userSubscriptionUpdateResponder(req: $Request, res: $Response) {\nconst subscriptionUpdate: SubscriptionUpdate = (req.body: any);\nif (!subscriptionUpdateInputValidator.is(subscriptionUpdate)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nconst threadSubscription = await userSubscriptionUpdater(subscriptionUpdate);\nif (!threadSubscription) {\n- return { error: 'not_member' };\n+ throw new ServerError('not_member');\n}\n- return { success: true, threadSubscription };\n+ return { threadSubscription };\n}\nconst accountUpdateInputValidator = tShape({\n@@ -53,46 +51,24 @@ const accountUpdateInputValidator = tShape({\nasync function accountUpdateResponder(req: $Request, res: $Response) {\nconst accountUpdate: AccountUpdate = (req.body: any);\nif (!accountUpdateInputValidator.is(accountUpdate)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\nconst viewer = currentViewer();\nif (!viewer.loggedIn) {\n- return { error: 'not_logged_in' };\n+ throw new ServerError('not_logged_in');\n}\n- try {\nawait accountUpdater(viewer, accountUpdate);\n- } catch (e) {\n- if (e instanceof ServerError) {\n- return { error: e.message };\n- } else {\n- throw e;\n- }\n- }\n-\n- return { success: true };\n}\nasync function sendVerificationEmailResponder(req: $Request, res: $Response) {\n- await setCurrentViewerFromCookie(req.cookies);\nconst viewer = currentViewer();\nif (!viewer.loggedIn) {\n- return { error: 'not_logged_in' };\n+ throw new ServerError('not_logged_in');\n}\n- try {\nawait checkAndSendVerificationEmail(viewer);\n- } catch (e) {\n- if (e instanceof ServerError) {\n- return { error: e.message };\n- } else {\n- throw e;\n- }\n- }\n-\n- return { success: true };\n}\nconst resetPasswordRequestInputValidator = tShape({\n@@ -102,22 +78,10 @@ const resetPasswordRequestInputValidator = tShape({\nasync function sendPasswordResetEmailResponder(req: $Request, res: $Response) {\nconst resetPasswordRequest: PasswordResetRequest = (req.body: any);\nif (!resetPasswordRequestInputValidator.is(resetPasswordRequest)) {\n- return { error: 'invalid_parameters' };\n+ throw new ServerError('invalid_parameters');\n}\n- await setCurrentViewerFromCookie(req.cookies);\n-\n- try {\nawait checkAndSendPasswordResetEmail(resetPasswordRequest);\n- } catch (e) {\n- if (e instanceof ServerError) {\n- return { error: e.message };\n- } else {\n- throw e;\n- }\n- }\n-\n- return { success: true };\n}\nexport {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | errorHandler -> jsonHandler
Move try-catch `ServerError` handling and `setCurrentViewerFromCookie` call here |
129,187 | 16.02.2018 17:57:22 | 18,000 | d985baed5a19b7074b6193737bec05860110f964 | fetcher.js -> fetchers.js | [
{
"change_type": "RENAME",
"old_path": "jserver/src/fetchers/message-fetcher.js",
"new_path": "jserver/src/fetchers/message-fetchers.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/fetchers/thread-fetcher.js",
"new_path": "jserver/src/fetchers/thread-fetchers.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/fetchers/user-fetcher.js",
"new_path": "jserver/src/fetchers/user-fetchers.js",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/push/send.js",
"new_path": "jserver/src/push/send.js",
"diff": "@@ -7,7 +7,7 @@ import type { DeviceType } from 'lib/types/device-types';\nimport type {\nCollapsableNotifInfo,\nFetchCollapsableNotifsResult,\n-} from '../fetchers/message-fetcher';\n+} from '../fetchers/message-fetchers';\nimport apn from 'apn';\nimport invariant from 'invariant';\n@@ -29,9 +29,9 @@ import {\nimport { pool, SQL, mergeOrConditions } from '../database';\nimport { apnPush, fcmPush, getUnreadCounts } from './utils';\n-import { fetchServerThreadInfos } from '../fetchers/thread-fetcher';\n-import { fetchUserInfos } from '../fetchers/user-fetcher';\n-import { fetchCollapsableNotifs } from '../fetchers/message-fetcher';\n+import { fetchServerThreadInfos } from '../fetchers/thread-fetchers';\n+import { fetchUserInfos } from '../fetchers/user-fetchers';\n+import { fetchCollapsableNotifs } from '../fetchers/message-fetchers';\nimport createIDs from '../creators/id-creator';\ntype Device = { deviceType: DeviceType, deviceToken: string };\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/message-responders.js",
"new_path": "jserver/src/responders/message-responders.js",
"diff": "@@ -14,7 +14,7 @@ import { messageType } from 'lib/types/message-types';\nimport createMessages from '../creators/message-creator';\nimport { tShape } from '../utils/tcomb-utils';\n-import { checkThreadPermission } from '../fetchers/thread-fetcher';\n+import { checkThreadPermission } from '../fetchers/thread-fetchers';\nimport { currentViewer } from '../session/viewer';\nasync function messageCreationResponder(req: $Request, res: $Response) {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/activity-updater.js",
"new_path": "jserver/src/updaters/activity-updater.js",
"diff": "@@ -14,7 +14,7 @@ import { visibilityRules, threadPermissions } from 'lib/types/thread-types';\nimport { currentViewer } from '../session/viewer';\nimport { pool, SQL, mergeOrConditions } from '../database';\n-import { verifyThreadIDs } from '../fetchers/thread-fetcher';\n+import { verifyThreadIDs } from '../fetchers/thread-fetchers';\nimport { rescindPushNotifs } from '../push/rescind';\nasync function activityUpdater(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | fetcher.js -> fetchers.js |
129,187 | 16.02.2018 23:03:37 | 18,000 | e5171e999e8453089ef52c857d2f2e6afd7415fe | Thread search bar on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -6,8 +6,15 @@ import type { ChatThreadItem } from '../selectors/chat-selectors';\nimport { chatThreadItemPropType } from '../selectors/chat-selectors';\nimport type { NavigationScreenProp, NavigationRoute } from 'react-navigation';\n-import React from 'react';\n-import { View, StyleSheet, FlatList, Platform } from 'react-native';\n+import * as React from 'react';\n+import {\n+ View,\n+ StyleSheet,\n+ FlatList,\n+ Platform,\n+ TextInput,\n+ KeyboardAvoidingView,\n+} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\nimport { connect } from 'react-redux';\n@@ -15,12 +22,17 @@ import PropTypes from 'prop-types';\nimport _sum from 'lodash/fp/sum';\nimport { FloatingAction } from 'react-native-floating-action';\n+import { viewerIsMember } from 'lib/shared/thread-utils';\n+import { threadSearchIndex } from 'lib/selectors/nav-selectors';\n+import SearchIndex from 'lib/shared/search-index';\n+\nimport { chatListData } from '../selectors/chat-selectors';\nimport ChatThreadListItem from './chat-thread-list-item.react';\nimport { 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 { iosKeyboardHeight } from '../dimensions';\nconst floatingActions = [{\ntext: 'Compose',\n@@ -29,13 +41,21 @@ const floatingActions = [{\nposition: 1,\n}];\n-type Props = {\n+type Item = ChatThreadItem | {| type: \"search\", searchText: string |};\n+\n+type Props = {|\nnavigation: NavigationScreenProp<NavigationRoute>,\n// Redux state\nchatListData: $ReadOnlyArray<ChatThreadItem>,\nviewerID: ?string,\n-};\n-class InnerChatThreadList extends React.PureComponent<Props> {\n+ threadSearchIndex: SearchIndex,\n+|};\n+type State = {|\n+ listData: $ReadOnlyArray<Item>,\n+ searchText: string,\n+ searchResults: Set<string>,\n+|};\n+class InnerChatThreadList extends React.PureComponent<Props, State> {\nstatic propTypes = {\nnavigation: PropTypes.shape({\n@@ -46,6 +66,7 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n}).isRequired,\nchatListData: PropTypes.arrayOf(chatThreadItemPropType).isRequired,\nviewerID: PropTypes.string,\n+ threadSearchIndex: PropTypes.instanceOf(SearchIndex).isRequired,\n};\nstatic navigationOptions = ({ navigation }) => ({\ntitle: 'Threads',\n@@ -54,6 +75,16 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n: null,\n});\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ listData: [],\n+ searchText: \"\",\n+ searchResults: new Set(),\n+ };\n+ this.state.listData = InnerChatThreadList.listData(props, this.state);\n+ }\n+\ncomponentDidMount() {\nregisterChatScreen(this.props.navigation.state.key, this);\n}\n@@ -62,20 +93,68 @@ class InnerChatThreadList extends React.PureComponent<Props> {\nregisterChatScreen(this.props.navigation.state.key, null);\n}\n+ componentWillReceiveProps(newProps: Props) {\n+ if (newProps.chatListData !== this.props.chatListData) {\n+ this.setState((prevState: State) => ({\n+ listData: InnerChatThreadList.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: InnerChatThreadList.listData(nextProps, nextState),\n+ }));\n+ }\n+ }\n+\ncanReset = () => false;\n- renderItem = (row: { item: ChatThreadItem }) => {\n+ renderItem = (row: { item: Item }) => {\n+ const item = row.item;\n+ if (item.type === \"search\") {\n+ return this.renderSearchBar();\n+ }\nreturn (\n- <ChatThreadListItem data={row.item} onPressItem={this.onPressItem} />\n+ <ChatThreadListItem data={item} onPressItem={this.onPressItem} />\n);\n}\n- static keyExtractor(item: ChatThreadItem) {\n+ renderSearchBar = () => {\n+ return (\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+ />\n+ </View>\n+ </View>\n+ );\n+ }\n+\n+ static keyExtractor(item: Item) {\n+ if (item.threadInfo) {\nreturn item.threadInfo.id;\n+ } else {\n+ return \"search\";\n+ }\n}\nstatic getItemLayout(\n- data: ?$ReadOnlyArray<ChatThreadItem>,\n+ data: ?$ReadOnlyArray<Item>,\nindex: number,\n) {\nif (!data) {\n@@ -88,16 +167,32 @@ class InnerChatThreadList extends React.PureComponent<Props> {\nreturn { length, offset, index };\n}\n- static itemHeight(item: ChatThreadItem): number {\n+ static itemHeight(item: Item): number {\n+ if (item.type === \"search\") {\n+ return Platform.OS === \"ios\" ? 54.5 : 55;\n+ }\nreturn 60;\n}\n- static heightOfItems(data: $ReadOnlyArray<ChatThreadItem>): number {\n+ static heightOfItems(data: $ReadOnlyArray<Item>): number {\nreturn _sum(data.map(InnerChatThreadList.itemHeight));\n}\n- static ListHeaderComponent(props: {}) {\n- return <View style={styles.header} />;\n+ static listData(props: Props, state: State) {\n+ let chatItems;\n+ if (!state.searchText) {\n+ chatItems = props.chatListData.filter(\n+ item => viewerIsMember(item.threadInfo),\n+ );\n+ } else {\n+ chatItems = props.chatListData.filter(\n+ item => state.searchResults.has(item.threadInfo.id),\n+ );\n+ }\n+ return [\n+ { type: \"search\", searchText: state.searchText },\n+ ...chatItems,\n+ ];\n}\nrender() {\n@@ -114,20 +209,35 @@ class InnerChatThreadList extends React.PureComponent<Props> {\n/>\n);\n}\n- return (\n- <View style={styles.container}>\n+ const content = (\n+ <React.Fragment>\n<FlatList\n- data={this.props.chatListData}\n+ data={this.state.listData}\nrenderItem={this.renderItem}\nkeyExtractor={InnerChatThreadList.keyExtractor}\ngetItemLayout={InnerChatThreadList.getItemLayout}\n- ListHeaderComponent={InnerChatThreadList.ListHeaderComponent}\nextraData={this.props.viewerID}\nstyle={styles.flatList}\n/>\n{floatingAction}\n- </View>\n+ </React.Fragment>\n);\n+ if (Platform.OS === \"ios\") {\n+ return (\n+ <KeyboardAvoidingView\n+ style={styles.container}\n+ behavior=\"padding\"\n+ keyboardVerticalOffset={iosKeyboardHeight}\n+ >{content}</KeyboardAvoidingView>\n+ );\n+ } else {\n+ return <View style={styles.container}>{content}</View>;\n+ }\n+ }\n+\n+ onChangeSearchText = (searchText: string) => {\n+ const results = this.props.threadSearchIndex.getSearchResults(searchText);\n+ this.setState({ searchText, searchResults: new Set(results) });\n}\nonPressItem = (threadInfo: ThreadInfo) => {\n@@ -150,12 +260,37 @@ const styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n},\n- header: {\n- height: 5,\n+ searchContainer: {\n+ backgroundColor: '#F6F6F6',\n+ borderBottomWidth: 1,\n+ borderColor: '#DDDDDD',\n+ marginBottom: 5,\n+ },\n+ searchIcon: {\n+ paddingBottom: Platform.OS === \"android\" ? 0 : 2,\n+ },\n+ search: {\n+ backgroundColor: '#DDDDDD',\n+ flexDirection: 'row',\n+ alignItems: 'center',\n+ marginHorizontal: 12,\n+ marginBottom: 8,\n+ marginTop: Platform.OS === \"android\" ? 10 : 8,\n+ paddingHorizontal: 14,\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},\nflatList: {\nflex: 1,\n- backgroundColor: '#FFFFFF',\n+ backgroundColor: 'white',\n},\n});\n@@ -163,6 +298,7 @@ const ChatThreadListRouteName = 'ChatThreadList';\nconst ChatThreadList = connect((state: AppState): * => ({\nchatListData: chatListData(state),\nviewerID: state.currentUserInfo && state.currentUserInfo.id,\n+ threadSearchIndex: threadSearchIndex(state),\n}))(InnerChatThreadList);\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/chat-selectors.js",
"new_path": "native/selectors/chat-selectors.js",
"diff": "@@ -26,15 +26,16 @@ import {\nrobotextForMessageInfo,\ncreateMessageInfo,\n} from 'lib/shared/message-utils';\n-import { viewerIsMember } from 'lib/shared/thread-utils';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\n-export type ChatThreadItem = {\n+export type ChatThreadItem = {|\n+ type: \"chatThreadItem\",\nthreadInfo: ThreadInfo,\nmostRecentMessageInfo?: MessageInfo,\nlastUpdatedTime: number,\n-};\n+|};\nconst chatThreadItemPropType = PropTypes.shape({\n+ type: PropTypes.oneOf([\"chatThreadItem\"]),\nthreadInfo: threadInfoPropType.isRequired,\nmostRecentMessageInfo: messageInfoPropType,\nlastUpdatedTime: PropTypes.number.isRequired,\n@@ -50,11 +51,14 @@ const chatListData = createSelector(\nviewerID: ?string,\nuserInfos: {[id: string]: UserInfo},\n): ChatThreadItem[] => _flow(\n- _filter(viewerIsMember),\n_map((threadInfo: ThreadInfo): ChatThreadItem => {\nconst thread = messageStore.threads[threadInfo.id];\nif (!thread || thread.messageIDs.length === 0) {\n- return { threadInfo, lastUpdatedTime: threadInfo.creationTime };\n+ return {\n+ type: \"chatThreadItem\",\n+ threadInfo,\n+ lastUpdatedTime: threadInfo.creationTime,\n+ };\n}\nlet mostRecentMessageInfo = undefined;\nfor (let messageID of thread.messageIDs) {\n@@ -70,9 +74,14 @@ const chatListData = createSelector(\n}\n}\nif (!mostRecentMessageInfo) {\n- return { threadInfo, lastUpdatedTime: threadInfo.creationTime };\n+ return {\n+ type: \"chatThreadItem\",\n+ threadInfo,\n+ lastUpdatedTime: threadInfo.creationTime,\n+ };\n}\nreturn {\n+ type: \"chatThreadItem\",\nthreadInfo,\nmostRecentMessageInfo,\nlastUpdatedTime: mostRecentMessageInfo.time,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Thread search bar on native |
129,187 | 17.02.2018 12:02:00 | 18,000 | a03e251e71937de84ae6eb988d707c5c3cc99426 | Some iPhone X adjustments for the log-in/verification modals | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -29,12 +29,14 @@ import {\nPlatform,\nBackHandler,\nActivityIndicator,\n+ DeviceInfo,\n} from 'react-native';\nimport invariant from 'invariant';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport OnePassword from 'react-native-onepassword';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\n+import { SafeAreaView } from 'react-navigation';\nimport {\nincludeDispatchActionProps,\n@@ -55,6 +57,8 @@ import { createIsForegroundSelector } from '../selectors/nav-selectors';\nimport { pingNativeStartingPayload } from '../selectors/ping-selectors';\nimport { navigateToAppActionType } from '../navigation-setup';\n+const forceInset = { top: 'always', bottom: 'always' };\n+\ntype LoggedOutMode = \"loading\" | \"prompt\" | \"log-in\" | \"register\";\ntype Props = {\nnavigation: NavigationScreenProp<NavigationRoute, NavigationAction>,\n@@ -333,6 +337,9 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nstatic calculateFooterPaddingTop(keyboardHeight: number) {\nconst textHeight = Platform.OS === \"ios\" ? 17 : 19;\n+ if (DeviceInfo.isIPhoneX_deprecated) {\n+ keyboardHeight -= 34;\n+ }\nreturn windowHeight - keyboardHeight - textHeight - 20;\n}\n@@ -607,13 +614,13 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\nlet content;\nif (Platform.OS === \"ios\") {\nreturn (\n- <View style={styles.container}>\n+ <SafeAreaView forceInset={forceInset} style={styles.container}>\n{statusBar}\n{background}\n{animatedContent}\n{buttons}\n{forgotPasswordLink}\n- </View>\n+ </SafeAreaView>\n);\n} else {\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/verification-modal.react.js",
"new_path": "native/account/verification-modal.react.js",
"diff": "@@ -29,12 +29,14 @@ import {\nKeyboard,\nTouchableHighlight,\nEasing,\n+ DeviceInfo,\n} from 'react-native';\nimport { connect } from 'react-redux';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport invariant from 'invariant';\nimport OnePassword from 'react-native-onepassword';\nimport PropTypes from 'prop-types';\n+import { SafeAreaView } from 'react-navigation';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport {\n@@ -53,6 +55,8 @@ import ResetPasswordPanel from './reset-password-panel.react';\nimport { createIsForegroundSelector } from '../selectors/nav-selectors';\nimport { navigateToAppActionType } from '../navigation-setup';\n+const forceInset = { top: 'always', bottom: 'always' };\n+\ntype VerificationModalMode = \"simple-text\" | \"reset-password\";\ntype Props = {\nnavigation: NavigationScreenProp<NavigationLeafRoute>\n@@ -440,17 +444,21 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\n</Animated.View>\n);\nreturn (\n- <View style={styles.container}>\n+ <SafeAreaView forceInset={forceInset} style={styles.container}>\n{statusBar}\n{background}\n{animatedContent}\n{closeButton}\n- </View>\n+ </SafeAreaView>\n);\n}\n}\n+const closeButtonTop = Platform.OS === \"ios\"\n+ ? (DeviceInfo.isIPhoneX_deprecated ? 49 : 25)\n+ : 15;\n+\nconst styles = StyleSheet.create({\nmodalBackgroundContainer: {\nposition: 'absolute',\n@@ -479,7 +487,7 @@ const styles = StyleSheet.create({\ncloseButton: {\nposition: 'absolute',\nbackgroundColor: \"#D0D0D055\",\n- top: Platform.OS === \"ios\" ? 25 : 15,\n+ top: closeButtonTop,\nright: 15,\nwidth: 36,\nheight: 36,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -446,7 +446,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\nfailedToRegisterPushPermissions = (error) => {\n- if (Platform.OS === \"ios\") {\n+ if (Platform.OS === \"ios\" && !__DEV__) {\nAlert.alert(\n\"Need notif permissions\",\n\"SquadCal needs notification permissions to keep you in the loop! \" +\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Some iPhone X adjustments for the log-in/verification modals |
129,187 | 18.02.2018 19:35:03 | 18,000 | ba1c812c1f52f1740ba93432c0164dc94b34d362 | Move privacy checks out of responders | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/creators/day-creator.js",
"new_path": "jserver/src/creators/day-creator.js",
"diff": "// @flow\n-import { threadPermissions } from 'lib/types/thread-types';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport { pool, SQL } from '../database';\n-import { checkThreadPermission } from '../fetchers/thread-fetchers';\nimport createIDs from './id-creator';\nasync function fetchOrCreateDayID(\n@@ -14,13 +12,6 @@ async function fetchOrCreateDayID(\nif (!threadID || !date) {\nthrow new ServerError('invalid_parameters');\n}\n- const hasPermission = await checkThreadPermission(\n- threadID,\n- threadPermissions.EDIT_ENTRIES,\n- );\n- if (!hasPermission) {\n- throw new ServerError('invalid_credentials');\n- }\nconst existingQuery = SQL`\nSELECT id FROM days WHERE date = ${date} AND thread = ${threadID}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/creators/entry-creator.js",
"new_path": "jserver/src/creators/entry-creator.js",
"diff": "import type { CreateEntryRequest } from 'lib/types/entry-types';\nimport { messageType } from 'lib/types/message-types';\n+import { threadPermissions } from 'lib/types/thread-types';\n+import { ServerError } from 'lib/utils/fetch-utils';\nimport { pool, SQL } from '../database';\nimport fetchOrCreateDayID from '../creators/day-creator';\nimport createIDs from '../creators/id-creator';\nimport { currentViewer } from '../session/viewer';\nimport createMessages from '../creators/message-creator';\n+import { checkThreadPermission } from '../fetchers/thread-fetchers';\nasync function createEntry(request: CreateEntryRequest) {\n- const [ dayID, [ entryID ], [ revisionID ] ] = await Promise.all([\n+ const [\n+ hasPermission,\n+ dayID,\n+ [ entryID ],\n+ [ revisionID ],\n+ ] = await Promise.all([\n+ checkThreadPermission(\n+ request.threadID,\n+ threadPermissions.EDIT_ENTRIES,\n+ ),\nfetchOrCreateDayID(\nrequest.threadID,\nrequest.date,\n@@ -19,6 +31,9 @@ async function createEntry(request: CreateEntryRequest) {\ncreateIDs(\"entries\", 1),\ncreateIDs(\"revisions\", 1),\n]);\n+ if (!hasPermission) {\n+ throw new ServerError('invalid_credentials');\n+ }\nconst viewerID = currentViewer().id;\nconst entryRow = [\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/creators/message-creator.js",
"new_path": "jserver/src/creators/message-creator.js",
"diff": "@@ -30,6 +30,7 @@ type ThreadRestriction = {|\nsubthread?: ?string,\n|};\n+// Does not do permission checks! (checkThreadPermission)\nasync function createMessages(\nmessageDatas: MessageData[],\n): Promise<RawMessageInfo[]> {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/deleters/thread-deleters.js",
"new_path": "jserver/src/deleters/thread-deleters.js",
"diff": "@@ -6,13 +6,23 @@ import type { UserViewer } from '../session/viewer';\nimport bcrypt from 'twin-bcrypt';\nimport { ServerError } from 'lib/utils/fetch-utils';\n+import { threadPermissions } from 'lib/types/thread-types';\nimport { pool, SQL } from '../database';\n+import { checkThreadPermission } from '../fetchers/thread-fetchers';\nasync function deleteThread(\nviewer: UserViewer,\nthreadDeletionRequest: ThreadDeletionRequest,\n) {\n+ const hasPermission = await checkThreadPermission(\n+ threadDeletionRequest.threadID,\n+ threadPermissions.DELETE_THREAD,\n+ );\n+ if (!hasPermission) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\nconst hashQuery = SQL`SELECT hash FROM users WHERE id = ${viewer.userID}`;\nconst [ result ] = await pool.query(hashQuery);\nif (result.length === 0) {\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/fetchers/entry-fetchers.js",
"new_path": "jserver/src/fetchers/entry-fetchers.js",
"diff": "@@ -11,6 +11,7 @@ import {\nassertVisibilityRules,\n} from 'lib/types/thread-types';\nimport { permissionHelper } from 'lib/permissions/thread-permissions';\n+import { ServerError } from 'lib/utils/fetch-utils';\nimport { pool, SQL } from '../database';\nimport { currentViewer } from '../session/viewer';\n@@ -111,6 +112,14 @@ async function checkThreadPermissionForEntry(\nasync function fetchEntryRevisionInfo(\nentryID: string,\n): Promise<HistoryRevisionInfo[]> {\n+ const hasPermission = await checkThreadPermissionForEntry(\n+ entryID,\n+ threadPermissions.VISIBLE,\n+ );\n+ if (!hasPermission) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\nconst query = SQL`\nSELECT r.id, u.username AS author, r.text, r.last_update AS lastUpdate,\nr.deleted, d.thread AS threadID, r.entry AS entryID\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/entry-responders.js",
"new_path": "jserver/src/responders/entry-responders.js",
"diff": "@@ -16,7 +16,6 @@ import { tShape, tDate } from '../utils/tcomb-utils';\nimport { verifyThreadID } from '../fetchers/thread-fetchers';\nimport {\nfetchEntryInfos,\n- checkThreadPermissionForEntry,\nfetchEntryRevisionInfo,\n} from '../fetchers/entry-fetchers';\nimport createEntry from '../creators/entry-creator';\n@@ -60,14 +59,6 @@ async function entryRevisionFetchResponder(req: $Request, res: $Response) {\nthrow new ServerError('invalid_parameters');\n}\n- const hasPermission = await checkThreadPermissionForEntry(\n- entryRevisionHistoryFetch.id,\n- threadPermissions.VISIBLE,\n- );\n- if (!hasPermission) {\n- throw new ServerError('invalid_credentials');\n- }\n-\nconst entryHistory = await fetchEntryRevisionInfo(\nentryRevisionHistoryFetch.id,\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/thread-responders.js",
"new_path": "jserver/src/responders/thread-responders.js",
"diff": "@@ -6,11 +6,9 @@ import type { ThreadDeletionRequest } from 'lib/types/thread-types';\nimport t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { threadPermissions } from 'lib/types/thread-types';\nimport { tShape } from '../utils/tcomb-utils';\nimport { currentViewer } from '../session/viewer';\n-import { checkThreadPermission } from '../fetchers/thread-fetchers';\nimport { deleteThread } from '../deleters/thread-deleters';\nconst threadDeletionRequestInputValidator = tShape({\n@@ -29,14 +27,6 @@ async function threadDeletionResponder(req: $Request, res: $Response) {\nthrow new ServerError('not_logged_in');\n}\n- const hasPermission = await checkThreadPermission(\n- threadDeletionRequest.threadID,\n- threadPermissions.DELETE_THREAD,\n- );\n- if (!hasPermission) {\n- throw new ServerError('invalid_credentials');\n- }\n-\nawait deleteThread(viewer, threadDeletionRequest);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move privacy checks out of responders |
129,187 | 19.02.2018 10:49:22 | 18,000 | 0329b8f20577ab553de727a5c29d706d2e61d8f7 | Make hyperlinks in chat messages clickable
Also added to calendar entries, but it won't work for now since all visible entries are rendered as TextInputs right now. Will work once I add an edit button | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -38,6 +38,7 @@ import _omit from 'lodash/fp/omit';\nimport _isEqual from 'lodash/fp/isEqual';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport { NavigationActions } from 'react-navigation';\n+import Hyperlink from 'react-native-hyperlink';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport {\n@@ -281,10 +282,13 @@ class Entry extends React.Component<Props, State> {\n/>\n);\n} else {\n+ const linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\ntext = (\n+ <Hyperlink linkDefault={true} linkStyle={linkStyle}>\n<Text style={[styles.text, textStyle]}>\n{this.state.text}\n</Text>\n+ </Hyperlink>\n);\n}\nlet entry;\n@@ -590,6 +594,14 @@ const styles = StyleSheet.create({\npaddingHorizontal: 10,\npaddingVertical: 5,\n},\n+ darkLinkText: {\n+ color: \"#036AFF\",\n+ textDecorationLine: \"underline\",\n+ },\n+ lightLinkText: {\n+ color: \"#129AFF\",\n+ textDecorationLine: \"underline\",\n+ },\n});\nregisterFetchKey(saveEntryActionTypes);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/text-message.react.js",
"new_path": "native/chat/text-message.react.js",
"diff": "@@ -16,6 +16,7 @@ import {\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\nimport Color from 'color';\n+import Hyperlink from 'react-native-hyperlink';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport { messageKey } from 'lib/shared/message-utils';\n@@ -119,7 +120,9 @@ class TextMessage extends React.PureComponent<Props> {\nonResponderGrant={this.onResponderGrant}\nonResponderTerminationRequest={this.onResponderTerminationRequest}\n>\n+ <Hyperlink linkDefault={true} linkStyle={styles.linkText}>\n<Text style={[styles.text, textStyle]}>{text}</Text>\n+ </Hyperlink>\n</View>\n</View>\n);\n@@ -153,6 +156,10 @@ const styles = StyleSheet.create({\npaddingVertical: 4,\nheight: 25,\n},\n+ linkText: {\n+ color: \"#036AFF\",\n+ textDecorationLine: \"underline\",\n+ },\n});\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"react-native\": \"^0.52.0\",\n\"react-native-fcm\": \"^11.2.0\",\n\"react-native-floating-action\": \"^1.9.0\",\n+ \"react-native-hyperlink\": \"git+https://git@github.com/ashoat/react-native-hyperlink.git\",\n\"react-native-in-app-notification\": \"^2.1.0\",\n\"react-native-keychain\": \"^1.2.1\",\n\"react-native-modal\": \"^4.0.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -5249,6 +5249,12 @@ levn@~0.3.0:\nprelude-ls \"~1.1.2\"\ntype-check \"~0.3.2\"\n+linkify-it@^1.2.0:\n+ version \"1.2.4\"\n+ resolved \"https://registry.yarnpkg.com/linkify-it/-/linkify-it-1.2.4.tgz#0773526c317c8fd13bd534ee1d180ff88abf881a\"\n+ dependencies:\n+ uc.micro \"^1.0.1\"\n+\nload-json-file@^1.0.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0\"\n@@ -7285,6 +7291,12 @@ react-native-floating-action@^1.9.0:\ndependencies:\nlodash \"^4.17.4\"\n+\"react-native-hyperlink@git+https://git@github.com/ashoat/react-native-hyperlink.git\":\n+ version \"0.0.12\"\n+ resolved \"git+https://git@github.com/ashoat/react-native-hyperlink.git#49fcdc3e27e23f894427a3c3fa6cb3d3058971db\"\n+ dependencies:\n+ linkify-it \"^1.2.0\"\n+\nreact-native-in-app-notification@^2.1.0:\nversion \"2.2.0\"\nresolved \"https://registry.yarnpkg.com/react-native-in-app-notification/-/react-native-in-app-notification-2.2.0.tgz#690a9ef75bd0eecc15de77468f009a762c9f1748\"\n@@ -8884,6 +8896,10 @@ ua-parser-js@^0.7.9:\nversion \"0.7.17\"\nresolved \"https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac\"\n+uc.micro@^1.0.1:\n+ version \"1.0.5\"\n+ resolved \"https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376\"\n+\nuglify-es@^3.1.9:\nversion \"3.3.10\"\nresolved \"https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.10.tgz#8b0b7992cebe20edc26de1bf325cef797b8f3fa5\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Make hyperlinks in chat messages clickable
Also added to calendar entries, but it won't work for now since all visible entries are rendered as TextInputs right now. Will work once I add an edit button |
129,187 | 19.02.2018 11:35:31 | 18,000 | cc307ad59e91e7a6a9e20afc559547f74b2b8341 | Allow copying message text to clipboard on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -364,12 +364,12 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n<Message\nitem={messageInfoItem}\nfocused={focused}\n- onFocus={this.onMessageFocus}\n+ toggleFocus={this.toggleMessageFocus}\n/>\n);\n}\n- onMessageFocus = (messageKey: string) => {\n+ toggleMessageFocus = (messageKey: string) => {\nif (this.state.focusedMessageKey === messageKey) {\nthis.setState({ focusedMessageKey: null });\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message.react.js",
"new_path": "native/chat/message.react.js",
"diff": "@@ -47,7 +47,7 @@ function messageItemHeight(\ntype Props = {\nitem: ChatMessageInfoItemWithHeight,\nfocused: bool,\n- onFocus: (messageKey: string) => void,\n+ toggleFocus: (messageKey: string) => void,\n// Redux state\nthreadInfo: ThreadInfo,\n};\n@@ -59,7 +59,7 @@ class InnerMessage extends React.PureComponent<Props, State> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nfocused: PropTypes.bool.isRequired,\n- onFocus: PropTypes.func.isRequired,\n+ toggleFocus: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n};\n@@ -105,7 +105,7 @@ class InnerMessage extends React.PureComponent<Props, State> {\n<TextMessage\nitem={this.props.item}\nfocused={this.props.focused}\n- onFocus={this.props.onFocus}\n+ toggleFocus={this.props.toggleFocus}\nthreadInfo={this.props.threadInfo}\n/>\n);\n@@ -113,7 +113,7 @@ class InnerMessage extends React.PureComponent<Props, State> {\nmessage = (\n<RobotextMessage\nitem={this.props.item}\n- onFocus={this.props.onFocus}\n+ toggleFocus={this.props.toggleFocus}\nthreadInfo={this.props.threadInfo}\n/>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/robotext-message.react.js",
"new_path": "native/chat/robotext-message.react.js",
"diff": "@@ -33,14 +33,14 @@ function robotextMessageItemHeight(\ntype Props = {\nitem: ChatMessageInfoItemWithHeight,\n- onFocus: (messageKey: string) => void,\n+ toggleFocus: (messageKey: string) => void,\nthreadInfo: ThreadInfo,\n};\nclass RobotextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n- onFocus: PropTypes.func.isRequired,\n+ toggleFocus: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n};\n@@ -111,7 +111,7 @@ class RobotextMessage extends React.PureComponent<Props> {\nonStartShouldSetResponder = () => true;\nonResponderGrant = () => {\n- this.props.onFocus(messageKey(this.props.item.messageInfo));\n+ this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n}\nonResponderTerminationRequest = () => true;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-member.react.js",
"new_path": "native/chat/settings/thread-settings-member.react.js",
"diff": "@@ -26,7 +26,6 @@ import PropTypes from 'prop-types';\nimport _isEqual from 'lodash/fp/isEqual';\nimport { connect } from 'react-redux';\nimport invariant from 'invariant';\n-import PopoverTooltip from 'react-native-popover-tooltip';\nimport { threadHasPermission } from 'lib/shared/thread-utils';\nimport { stringForUser } from 'lib/shared/user-utils';\n@@ -44,6 +43,7 @@ import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport EditSettingButton from '../../components/edit-setting-button.react';\nimport Button from '../../components/button.react';\n+import Tooltip from '../../components/tooltip.react';\ntype Props = {|\nmemberInfo: RelativeMemberInfo,\n@@ -164,7 +164,7 @@ class ThreadSettingsMember extends React.PureComponent<Props, State> {\neditButton = <ActivityIndicator size=\"small\" />;\n} else if (this.state.popoverConfig.length !== 0) {\neditButton = (\n- <PopoverTooltip\n+ <Tooltip\nbuttonComponent={icon}\nitems={this.state.popoverConfig}\nlabelStyle={styles.popoverLabelStyle}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/text-message.react.js",
"new_path": "native/chat/text-message.react.js",
"diff": "@@ -4,6 +4,7 @@ import type { ThreadInfo } from 'lib/types/thread-types';\nimport { threadInfoPropType } from 'lib/types/thread-types';\nimport type { ChatMessageInfoItemWithHeight } from './message-list.react';\nimport { chatMessageItemPropType } from '../selectors/chat-selectors';\n+import type { TooltipItemData } from '../components/tooltip.react';\nimport React from 'react';\nimport {\n@@ -12,6 +13,7 @@ import {\nView,\nTouchableOpacity,\nLayoutAnimation,\n+ Clipboard,\n} from 'react-native';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\n@@ -23,6 +25,8 @@ import { messageKey } from 'lib/shared/message-utils';\nimport { stringForUser } from 'lib/shared/user-utils';\nimport { messageType } from 'lib/types/message-types';\n+import Tooltip from '../components/tooltip.react';\n+\nfunction textMessageItemHeight(\nitem: ChatMessageInfoItemWithHeight,\nviewerID: ?string,\n@@ -40,7 +44,7 @@ function textMessageItemHeight(\ntype Props = {\nitem: ChatMessageInfoItemWithHeight,\nfocused: bool,\n- onFocus: (messageKey: string) => void,\n+ toggleFocus: (messageKey: string) => void,\nthreadInfo: ThreadInfo,\n};\nclass TextMessage extends React.PureComponent<Props> {\n@@ -48,9 +52,10 @@ class TextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nfocused: PropTypes.bool.isRequired,\n- onFocus: PropTypes.func.isRequired,\n+ toggleFocus: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n};\n+ popoverConfig: $ReadOnlyArray<TooltipItemData>;\nconstructor(props: Props) {\nsuper(props);\n@@ -58,6 +63,9 @@ class TextMessage extends React.PureComponent<Props> {\nprops.item.messageInfo.type === messageType.TEXT,\n\"TextMessage should only be used for messageType.TEXT\",\n);\n+ this.popoverConfig = [\n+ { label: \"Copy\", onPress: this.onPressCopy },\n+ ];\n}\ncomponentWillReceiveProps(nextProps: Props) {\n@@ -111,30 +119,47 @@ class TextMessage extends React.PureComponent<Props> {\n);\nconst text = this.props.item.messageInfo.text;\n- return (\n- <View style={containerStyle}>\n- {authorName}\n- <View\n- style={[styles.message, messageStyle]}\n- onStartShouldSetResponder={this.onStartShouldSetResponder}\n- onResponderGrant={this.onResponderGrant}\n- onResponderTerminationRequest={this.onResponderTerminationRequest}\n- >\n+ const content = (\n+ <View style={[styles.message, messageStyle]}>\n<Hyperlink linkDefault={true} linkStyle={styles.linkText}>\n<Text style={[styles.text, textStyle]}>{text}</Text>\n</Hyperlink>\n</View>\n+ );\n+\n+ return (\n+ <View style={containerStyle}>\n+ {authorName}\n+ <Tooltip\n+ buttonComponent={content}\n+ items={this.popoverConfig}\n+ labelStyle={styles.popoverLabelStyle}\n+ onOpenTooltipMenu={this.onFocus}\n+ onCloseTooltipMenu={this.onBlur}\n+ />\n</View>\n);\n}\n- onStartShouldSetResponder = () => true;\n+ onFocus = () => {\n+ if (!this.props.focused) {\n+ this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n+ }\n+ }\n- onResponderGrant = () => {\n- this.props.onFocus(messageKey(this.props.item.messageInfo));\n+ onBlur = () => {\n+ if (this.props.focused) {\n+ this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n+ }\n}\n- onResponderTerminationRequest = () => true;\n+ onPressCopy = () => {\n+ invariant(\n+ this.props.item.messageInfo.type === messageType.TEXT,\n+ \"TextMessage should only be used for messageType.TEXT\",\n+ );\n+ Clipboard.setString(this.props.item.messageInfo.text);\n+ }\n}\n@@ -160,6 +185,10 @@ const styles = StyleSheet.create({\ncolor: \"#036AFF\",\ntextDecorationLine: \"underline\",\n},\n+ popoverLabelStyle: {\n+ textAlign: 'center',\n+ color: '#444',\n+ },\n});\nexport {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/tooltip-item.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import * as React from 'react';\n+import {\n+ View,\n+ TouchableOpacity,\n+ StyleSheet,\n+ Text,\n+ ViewPropTypes,\n+} from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+export type Label = string | () => React.Node;\n+export const labelPropType = PropTypes.oneOfType([\n+ PropTypes.string,\n+ PropTypes.func,\n+]);\n+\n+type Props = {\n+ onPress: (userCallback: () => void) => void,\n+ onPressUserCallback: () => void,\n+ label: Label,\n+ containerStyle: ?StyleObj,\n+ labelStyle: ?StyleObj,\n+};\n+class TooltipItem extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ onPress: PropTypes.func.isRequired,\n+ onPressUserCallback: PropTypes.func.isRequired,\n+ label: labelPropType.isRequired,\n+ containerStyle: ViewPropTypes.style,\n+ labelStyle: Text.propTypes.style,\n+ };\n+ static defaultProps = {\n+ labelStyle: null,\n+ containerStyle: null,\n+ };\n+\n+ render() {\n+ const label = typeof this.props.label === 'string'\n+ ? <Text style={this.props.labelStyle}>{this.props.label}</Text>\n+ : this.props.label();\n+ return (\n+ <View style={[styles.itemContainer, this.props.containerStyle]}>\n+ <TouchableOpacity onPress={this.onPress}>\n+ {label}\n+ </TouchableOpacity>\n+ </View>\n+ );\n+ }\n+\n+ onPress = () => {\n+ this.props.onPress(this.props.onPressUserCallback);\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ itemContainer: {\n+ padding: 10,\n+ },\n+});\n+\n+export default TooltipItem;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/tooltip.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import * as React from 'react';\n+import {\n+ View,\n+ Modal,\n+ Animated,\n+ TouchableOpacity,\n+ StyleSheet,\n+ Dimensions,\n+ Text,\n+ Easing,\n+ ViewPropTypes,\n+} from 'react-native';\n+import PropTypes from 'prop-types';\n+import invariant from 'invariant';\n+\n+import TooltipItem, { type Label, labelPropType } from './tooltip-item.react';\n+\n+export type TooltipItemData = { +label: Label, onPress: () => void };\n+\n+const window = Dimensions.get('window');\n+\n+type Props = {\n+ buttonComponent: React.Node,\n+ buttonComponentExpandRatio: number,\n+ items: $ReadOnlyArray<{ +label: Label, onPress: () => void }>,\n+ componentWrapperStyle?: StyleObj,\n+ overlayStyle?: StyleObj,\n+ tooltipContainerStyle?: StyleObj,\n+ labelContainerStyle?: StyleObj,\n+ labelSeparatorColor: string,\n+ labelStyle?: StyleObj,\n+ setBelow: bool,\n+ animationType?: \"timing\" | \"spring\",\n+ onRequestClose: () => void,\n+ triangleOffset: number,\n+ delayLongPress: number,\n+ onOpenTooltipMenu?: () => void,\n+ onCloseTooltipMenu?: () => void,\n+ onPress?: () => void,\n+ componentContainerStyle?: StyleObj,\n+ timingConfig?: { duration?: number },\n+ springConfig?: { tension?: number, friction?: number },\n+ opacityChangeDuration?: number,\n+};\n+type State = {\n+ isModalOpen: bool,\n+ x: number,\n+ y: number,\n+ width: number,\n+ height: number,\n+ opacity: Animated.Value,\n+ tooltipContainerScale: Animated.Value,\n+ buttonComponentContainerScale: number | Animated.Interpolation,\n+ tooltipTriangleDown: bool,\n+ tooltipTriangleLeftMargin: number,\n+ triangleOffset: number,\n+ willPopUp: bool,\n+ oppositeOpacity: ?Animated.Interpolation,\n+ tooltipContainerX: ?Animated.Interpolation,\n+ tooltipContainerY: ?Animated.Interpolation,\n+ buttonComponentOpacity: number,\n+};\n+class Tooltip extends React.PureComponent<Props, State> {\n+\n+ static propTypes = {\n+ buttonComponent: PropTypes.node.isRequired,\n+ buttonComponentExpandRatio: PropTypes.number,\n+ items: PropTypes.arrayOf(PropTypes.shape({\n+ label: labelPropType.isRequired,\n+ onPress: PropTypes.func.isRequired,\n+ })).isRequired,\n+ componentWrapperStyle: ViewPropTypes.style,\n+ overlayStyle: ViewPropTypes.style,\n+ tooltipContainerStyle: ViewPropTypes.style,\n+ labelContainerStyle: ViewPropTypes.style,\n+ labelSeparatorColor: PropTypes.string,\n+ labelStyle: Text.propTypes.style,\n+ setBelow: PropTypes.bool,\n+ animationType: PropTypes.oneOf([ \"timing\", \"spring\" ]),\n+ onRequestClose: PropTypes.func,\n+ triangleOffset: PropTypes.number,\n+ delayLongPress: PropTypes.number,\n+ onOpenTooltipMenu: PropTypes.func,\n+ onCloseTooltipMenu: PropTypes.func,\n+ onPress: PropTypes.func,\n+ componentContainerStyle: ViewPropTypes.style,\n+ timingConfig: PropTypes.object,\n+ springConfig: PropTypes.object,\n+ opacityChangeDuration: PropTypes.number,\n+ };\n+ static defaultProps = {\n+ buttonComponentExpandRatio: 1.0,\n+ labelSeparatorColor: \"#E1E1E1\",\n+ onRequestClose: () => {},\n+ setBelow: false,\n+ delayLongPress: 100,\n+ triangleOffset: 0,\n+ };\n+ wrapperComponent: ?TouchableOpacity;\n+ callOnDismiss: ?(() => void) = null;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ isModalOpen: false,\n+ x: 0,\n+ y: 0,\n+ width: 0,\n+ height: 0,\n+ opacity: new Animated.Value(0),\n+ tooltipContainerScale: new Animated.Value(0),\n+ buttonComponentContainerScale: 1,\n+ tooltipTriangleDown: !props.setBelow,\n+ tooltipTriangleLeftMargin: 0,\n+ triangleOffset: props.triangleOffset,\n+ willPopUp: false,\n+ oppositeOpacity: undefined,\n+ tooltipContainerX: undefined,\n+ tooltipContainerY: undefined,\n+ buttonComponentOpacity: 0,\n+ };\n+ }\n+\n+ componentWillMount() {\n+ const newOppositeOpacity = this.state.opacity.interpolate({\n+ inputRange: [0, 1],\n+ outputRange: [1, 0],\n+ });\n+ this.setState({ oppositeOpacity: newOppositeOpacity });\n+ }\n+\n+ toggleModal = () => {\n+ this.setState({ isModalOpen: !this.state.isModalOpen });\n+ }\n+\n+ openModal = () => {\n+ this.setState({ willPopUp: true });\n+ this.toggleModal();\n+ this.props.onOpenTooltipMenu && this.props.onOpenTooltipMenu();\n+ }\n+\n+ hideModal = () => {\n+ this.setState({ willPopUp: false });\n+ this.showZoomingOutAnimation();\n+ this.props.onCloseTooltipMenu && this.props.onCloseTooltipMenu();\n+ }\n+\n+ onPressItem = (userCallback: () => void) => {\n+ if (this.state.isModalOpen) {\n+ this.callOnDismiss = userCallback;\n+ } else {\n+ userCallback();\n+ }\n+ this.toggle();\n+ }\n+\n+ onInnerContainerLayout = (\n+ event: { nativeEvent: { layout: { height: number, width: number } } },\n+ ) => {\n+ const tooltipContainerWidth = event.nativeEvent.layout.width;\n+ const tooltipContainerHeight = event.nativeEvent.layout.height;\n+ if (\n+ !this.state.willPopUp ||\n+ tooltipContainerWidth === 0 ||\n+ tooltipContainerHeight === 0\n+ ) {\n+ return;\n+ }\n+\n+ const componentWrapper = this.wrapperComponent;\n+ invariant(componentWrapper, \"should be set\");\n+ componentWrapper.measure((x, y, width, height, pageX, pageY) => {\n+ const fullWidth = pageX + tooltipContainerWidth\n+ + (width - tooltipContainerWidth) / 2;\n+ const tooltipContainerX_final = fullWidth > window.width\n+ ? window.width - tooltipContainerWidth\n+ : pageX + (width - tooltipContainerWidth) / 2;\n+ let tooltipContainerY_final = this.state.tooltipTriangleDown\n+ ? pageY - tooltipContainerHeight - 20\n+ : pageY + tooltipContainerHeight - 20;\n+ let tooltipTriangleDown = this.state.tooltipTriangleDown;\n+ if (pageY - tooltipContainerHeight - 20 < 0) {\n+ tooltipContainerY_final = pageY + height + 20;\n+ tooltipTriangleDown = false;\n+ }\n+ if (pageY + tooltipContainerHeight + 80 > window.height) {\n+ tooltipContainerY_final = pageY - tooltipContainerHeight - 20;\n+ tooltipTriangleDown = true;\n+ }\n+ const tooltipContainerX = this.state.tooltipContainerScale.interpolate({\n+ inputRange: [0, 1],\n+ outputRange: [tooltipContainerX_final, tooltipContainerX_final],\n+ });\n+ const tooltipContainerY = this.state.tooltipContainerScale.interpolate({\n+ inputRange: [0, 1],\n+ outputRange: [\n+ tooltipContainerY_final + tooltipContainerHeight / 2 + 20,\n+ tooltipContainerY_final,\n+ ],\n+ });\n+ const buttonComponentContainerScale =\n+ this.state.tooltipContainerScale.interpolate({\n+ inputRange: [0, 1],\n+ outputRange: [1, this.props.buttonComponentExpandRatio],\n+ });\n+ const tooltipTriangleLeftMargin =\n+ pageX + width / 2 - tooltipContainerX_final - 10;\n+ this.setState(\n+ {\n+ x: pageX,\n+ y: pageY,\n+ width,\n+ height,\n+ tooltipContainerX,\n+ tooltipContainerY,\n+ tooltipTriangleDown,\n+ tooltipTriangleLeftMargin,\n+ buttonComponentContainerScale,\n+ buttonComponentOpacity: 1,\n+ },\n+ this.showZoomingInAnimation,\n+ );\n+ });\n+ this.setState({ willPopUp: false });\n+ }\n+\n+ render() {\n+ const tooltipContainerStyle = {\n+ left: this.state.tooltipContainerX,\n+ top: this.state.tooltipContainerY,\n+ transform: [\n+ { scale: this.state.tooltipContainerScale },\n+ ],\n+ };\n+\n+ const items = this.props.items.map((item, index) => {\n+ const classes = [ this.props.labelContainerStyle ];\n+\n+ if (index !== this.props.items.length - 1) {\n+ classes.push([\n+ styles.tooltipMargin,\n+ { borderBottomColor: this.props.labelSeparatorColor },\n+ ]);\n+ }\n+\n+ return (\n+ <TooltipItem\n+ key={index}\n+ label={item.label}\n+ onPressUserCallback={item.onPress}\n+ onPress={this.onPressItem}\n+ containerStyle={classes}\n+ labelStyle={this.props.labelStyle}\n+ />\n+ );\n+ });\n+\n+ const labelContainerStyle = this.props.labelContainerStyle;\n+ const borderStyle =\n+ labelContainerStyle && labelContainerStyle.backgroundColor\n+ ? { borderTopColor: labelContainerStyle.backgroundColor }\n+ : null;\n+ let triangleDown = null;\n+ let triangleUp = null;\n+ if (this.state.tooltipTriangleDown) {\n+ triangleDown = (\n+ <View style={[\n+ styles.triangleDown,\n+ {\n+ marginLeft: this.state.tooltipTriangleLeftMargin,\n+ left: this.state.triangleOffset,\n+ },\n+ borderStyle,\n+ ]} />\n+ );\n+ } else {\n+ triangleUp = (\n+ <View style={[\n+ styles.triangleUp,\n+ {\n+ marginLeft: this.state.tooltipTriangleLeftMargin,\n+ left: this.state.triangleOffset,\n+ },\n+ borderStyle,\n+ ]} />\n+ );\n+ }\n+\n+ return (\n+ <TouchableOpacity\n+ ref={this.wrapperRef}\n+ style={this.props.componentWrapperStyle}\n+ onPress={this.props.onPress}\n+ onLongPress={this.toggle}\n+ delayLongPress={this.props.delayLongPress}\n+ activeOpacity={1.0}\n+ >\n+ <Animated.View style={[\n+ { opacity: this.state.oppositeOpacity },\n+ this.props.componentContainerStyle,\n+ ]}>\n+ {this.props.buttonComponent}\n+ </Animated.View>\n+ <Modal\n+ visible={this.state.isModalOpen}\n+ onRequestClose={this.props.onRequestClose}\n+ onDismiss={this.onDismiss}\n+ transparent\n+ >\n+ <Animated.View style={[\n+ styles.overlay,\n+ this.props.overlayStyle,\n+ { opacity: this.state.opacity },\n+ ]}>\n+ <TouchableOpacity\n+ activeOpacity={1}\n+ focusedOpacity={1}\n+ style={styles.button}\n+ onPress={this.toggle}\n+ >\n+ <Animated.View\n+ style={[\n+ styles.tooltipContainer,\n+ this.props.tooltipContainerStyle,\n+ tooltipContainerStyle,\n+ ]}\n+ >\n+ <View\n+ onLayout={this.onInnerContainerLayout}\n+ style={styles.innerContainer}\n+ >\n+ {triangleUp}\n+ <View style={[\n+ styles.allItemContainer,\n+ this.props.tooltipContainerStyle,\n+ ]}>\n+ {items}\n+ </View>\n+ {triangleDown}\n+ </View>\n+ </Animated.View>\n+ </TouchableOpacity>\n+ </Animated.View>\n+ <Animated.View style={{\n+ position: 'absolute',\n+ left: this.state.x,\n+ top: this.state.y,\n+ width: this.state.width,\n+ height: this.state.height,\n+ backgroundColor: '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+ transform: [\n+ { scale: this.state.buttonComponentContainerScale },\n+ ],\n+ }}>\n+ <TouchableOpacity\n+ onPress={this.toggle}\n+ activeOpacity={1.0}\n+ >\n+ {this.props.buttonComponent}\n+ </TouchableOpacity>\n+ </Animated.View>\n+ </Modal>\n+ </TouchableOpacity>\n+ );\n+ }\n+\n+ wrapperRef = (wrapperComponent: ?TouchableOpacity) => {\n+ this.wrapperComponent = wrapperComponent;\n+ }\n+\n+ showZoomingInAnimation = () => {\n+ let tooltipAnimation = Animated.timing(\n+ this.state.tooltipContainerScale,\n+ {\n+ toValue: 1,\n+ duration: this.props.timingConfig && this.props.timingConfig.duration\n+ ? this.props.timingConfig.duration\n+ : 200,\n+ }\n+ );\n+ if (this.props.animationType == 'spring') {\n+ tooltipAnimation = Animated.spring(\n+ this.state.tooltipContainerScale,\n+ {\n+ toValue: 1,\n+ tension: this.props.springConfig && this.props.springConfig.tension\n+ ? this.props.springConfig.tension\n+ : 100,\n+ friction: this.props.springConfig && this.props.springConfig.friction\n+ ? this.props.springConfig.friction\n+ : 7,\n+ },\n+ );\n+ }\n+ Animated.parallel([\n+ tooltipAnimation,\n+ Animated.timing(\n+ this.state.opacity,\n+ {\n+ toValue: 1,\n+ duration: this.props.opacityChangeDuration\n+ ? this.props.opacityChangeDuration\n+ : 200,\n+ },\n+ ),\n+ ]).start();\n+ }\n+\n+ showZoomingOutAnimation() {\n+ Animated.parallel([\n+ Animated.timing(\n+ this.state.tooltipContainerScale,\n+ {\n+ toValue: 0,\n+ duration: this.props.opacityChangeDuration\n+ ? this.props.opacityChangeDuration\n+ : 200,\n+ },\n+ ),\n+ Animated.timing(\n+ this.state.opacity,\n+ {\n+ toValue: 0,\n+ duration: this.props.opacityChangeDuration\n+ ? this.props.opacityChangeDuration\n+ : 200,\n+ },\n+ ),\n+ ]).start(this.toggleModal);\n+ }\n+\n+ toggle = () => {\n+ if (this.state.isModalOpen) {\n+ this.hideModal();\n+ } else {\n+ this.openModal();\n+ }\n+ }\n+\n+ onDismiss = () => {\n+ if (this.callOnDismiss) {\n+ this.callOnDismiss();\n+ this.callOnDismiss = null;\n+ }\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ overlay: {\n+ backgroundColor: 'rgba(0,0,0,0.5)',\n+ flex: 1,\n+ },\n+ innerContainer: {\n+ backgroundColor: 'transparent',\n+ alignItems: 'flex-start'\n+ },\n+ tooltipMargin: {\n+ borderBottomWidth: 1,\n+ },\n+ tooltipContainer: {\n+ backgroundColor: 'transparent',\n+ position: 'absolute',\n+ },\n+ triangleDown: {\n+ width: 10,\n+ height: 10,\n+ backgroundColor: 'transparent',\n+ borderStyle: 'solid',\n+ borderTopWidth: 10,\n+ borderRightWidth: 10,\n+ borderBottomWidth: 0,\n+ borderLeftWidth: 10,\n+ borderTopColor: 'white',\n+ borderRightColor: 'transparent',\n+ borderBottomColor: 'transparent',\n+ borderLeftColor: 'transparent',\n+ },\n+ triangleUp: {\n+ width: 10,\n+ height: 10,\n+ backgroundColor: 'transparent',\n+ borderStyle: 'solid',\n+ borderTopWidth: 0,\n+ borderRightWidth: 10,\n+ borderBottomWidth: 10,\n+ borderLeftWidth: 10,\n+ borderBottomColor: 'white',\n+ borderTopColor: 'transparent',\n+ borderRightColor: 'transparent',\n+ borderLeftColor: 'transparent',\n+ },\n+ button: {\n+ flex: 1,\n+ },\n+ allItemContainer: {\n+ borderRadius: 5,\n+ backgroundColor: 'white',\n+ alignSelf: 'stretch',\n+ overflow: 'hidden',\n+ },\n+});\n+\n+export default Tooltip;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"react-native-modal\": \"^4.0.0\",\n\"react-native-notifications\": \"git+https://git@github.com/ashoat/react-native-notifications.git\",\n\"react-native-onepassword\": \"^1.0.6\",\n- \"react-native-popover-tooltip\": \"git+https://git@github.com/ashoat/react-native-popover-tooltip.git\",\n\"react-native-segmented-control-tab\": \"^3.2.1\",\n\"react-native-vector-icons\": \"^4.5.0\",\n\"react-navigation\": \"^1.0.3\",\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Allow copying message text to clipboard on native |
129,187 | 19.02.2018 14:16:33 | 18,000 | c394340bbaf81200c730af424f6bc7279009b42b | Some fixes for make new chat message features work better on Android | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/AndroidManifest.xml",
"new_path": "native/android/app/src/main/AndroidManifest.xml",
"diff": "<action android:name=\"android.intent.action.VIEW\" />\n<category android:name=\"android.intent.category.DEFAULT\" />\n<category android:name=\"android.intent.category.BROWSABLE\" />\n- <data android:scheme=\"http\" android:host=\"squadcal.org\" />\n- <data android:scheme=\"https\" android:host=\"squadcal.org\" />\n- <data android:scheme=\"http\" android:host=\"www.squadcal.org\" />\n- <data android:scheme=\"https\" android:host=\"www.squadcal.org\" />\n+ <data android:scheme=\"http\" android:host=\"squadcal.org\" android:pathPrefix=\"/verify/\" />\n+ <data android:scheme=\"https\" android:host=\"squadcal.org\" android:pathPrefix=\"/verify/\" />\n+ <data android:scheme=\"http\" android:host=\"www.squadcal.org\" android:pathPrefix=\"/verify/\" />\n+ <data android:scheme=\"https\" android:host=\"www.squadcal.org\" android:pathPrefix=\"/verify/\" />\n</intent-filter>\n</activity>\n</application>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/text-message.react.js",
"new_path": "native/chat/text-message.react.js",
"diff": "@@ -12,7 +12,6 @@ import {\nStyleSheet,\nView,\nTouchableOpacity,\n- LayoutAnimation,\nClipboard,\n} from 'react-native';\nimport invariant from 'invariant';\n@@ -55,7 +54,8 @@ class TextMessage extends React.PureComponent<Props> {\ntoggleFocus: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n};\n- popoverConfig: $ReadOnlyArray<TooltipItemData>;\n+ tooltipConfig: $ReadOnlyArray<TooltipItemData>;\n+ tooltip: ?Tooltip;\nconstructor(props: Props) {\nsuper(props);\n@@ -63,7 +63,7 @@ class TextMessage extends React.PureComponent<Props> {\nprops.item.messageInfo.type === messageType.TEXT,\n\"TextMessage should only be used for messageType.TEXT\",\n);\n- this.popoverConfig = [\n+ this.tooltipConfig = [\n{ label: \"Copy\", onPress: this.onPressCopy },\n];\n}\n@@ -122,7 +122,11 @@ class TextMessage extends React.PureComponent<Props> {\nconst content = (\n<View style={[styles.message, messageStyle]}>\n<Hyperlink linkDefault={true} linkStyle={styles.linkText}>\n- <Text style={[styles.text, textStyle]}>{text}</Text>\n+ <Text\n+ onPress={this.onPress}\n+ onLongPress={this.onPress}\n+ style={[styles.text, textStyle]}\n+ >{text}</Text>\n</Hyperlink>\n</View>\n);\n@@ -132,15 +136,20 @@ class TextMessage extends React.PureComponent<Props> {\n{authorName}\n<Tooltip\nbuttonComponent={content}\n- items={this.popoverConfig}\n+ items={this.tooltipConfig}\nlabelStyle={styles.popoverLabelStyle}\nonOpenTooltipMenu={this.onFocus}\nonCloseTooltipMenu={this.onBlur}\n+ ref={this.tooltipRef}\n/>\n</View>\n);\n}\n+ tooltipRef = (tooltip: ?Tooltip) => {\n+ this.tooltip = tooltip;\n+ }\n+\nonFocus = () => {\nif (!this.props.focused) {\nthis.props.toggleFocus(messageKey(this.props.item.messageInfo));\n@@ -161,6 +170,16 @@ class TextMessage extends React.PureComponent<Props> {\nClipboard.setString(this.props.item.messageInfo.text);\n}\n+ onPress = () => {\n+ const tooltip = this.tooltip;\n+ invariant(tooltip, \"tooltip should be set\");\n+ if (this.props.focused) {\n+ tooltip.hideModal();\n+ } else {\n+ tooltip.openModal();\n+ }\n+ }\n+\n}\nconst styles = StyleSheet.create({\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/tooltip.react.js",
"new_path": "native/components/tooltip.react.js",
"diff": "@@ -42,7 +42,6 @@ type Props = {\ndelayLongPress: number,\nonOpenTooltipMenu?: () => void,\nonCloseTooltipMenu?: () => void,\n- onPress?: () => void,\ncomponentContainerStyle?: StyleObj,\ntimingConfig?: { duration?: number },\nspringConfig?: { tension?: number, friction?: number },\n@@ -88,7 +87,6 @@ class Tooltip extends React.PureComponent<Props, State> {\ndelayLongPress: PropTypes.number,\nonOpenTooltipMenu: PropTypes.func,\nonCloseTooltipMenu: PropTypes.func,\n- onPress: PropTypes.func,\ncomponentContainerStyle: ViewPropTypes.style,\ntimingConfig: PropTypes.object,\nspringConfig: PropTypes.object,\n@@ -296,7 +294,7 @@ class Tooltip extends React.PureComponent<Props, State> {\n<TouchableOpacity\nref={this.wrapperRef}\nstyle={this.props.componentWrapperStyle}\n- onPress={this.props.onPress}\n+ onPress={this.toggle}\nonLongPress={this.toggle}\ndelayLongPress={this.props.delayLongPress}\nactiveOpacity={1.0}\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -7327,13 +7327,6 @@ react-native-onepassword@^1.0.6:\ndependencies:\n\"1PasswordExtension\" \"git+https://github.com/jjshammas/onepassword-app-extension.git\"\n-\"react-native-popover-tooltip@git+https://git@github.com/ashoat/react-native-popover-tooltip.git\":\n- version \"1.1.4\"\n- resolved \"git+https://git@github.com/ashoat/react-native-popover-tooltip.git#26b8eef75ade5afcbe45ea0393f8618f15020e7d\"\n- dependencies:\n- invariant \"^2.2.2\"\n- prop-types \"^15.6.0\"\n-\nreact-native-safe-area-view@^0.6.0:\nversion \"0.6.0\"\nresolved \"https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.6.0.tgz#ce01eb27905a77780219537e0f53fe9c783a8b3d\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Some fixes for make new chat message features work better on Android |
129,187 | 19.02.2018 15:29:32 | 18,000 | f22e5ee49448b28ad525507244dae4ebeab4d547 | Use lowercased protocol for Android in my forked react-native-hyperlink | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"react-native\": \"^0.52.0\",\n\"react-native-fcm\": \"^11.2.0\",\n\"react-native-floating-action\": \"^1.9.0\",\n- \"react-native-hyperlink\": \"git+https://git@github.com/ashoat/react-native-hyperlink.git\",\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\"react-native-keychain\": \"^1.2.1\",\n\"react-native-modal\": \"^4.0.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -5598,6 +5598,10 @@ md5@^2.1.0:\ncrypt \"~0.0.1\"\nis-buffer \"~1.1.1\"\n+mdurl@^1.0.1:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e\"\n+\nmedia-typer@0.3.0:\nversion \"0.3.0\"\nresolved \"https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748\"\n@@ -7291,11 +7295,12 @@ react-native-floating-action@^1.9.0:\ndependencies:\nlodash \"^4.17.4\"\n-\"react-native-hyperlink@git+https://git@github.com/ashoat/react-native-hyperlink.git\":\n+\"react-native-hyperlink@git+https://git@github.com/ashoat/react-native-hyperlink.git#both\":\nversion \"0.0.12\"\n- resolved \"git+https://git@github.com/ashoat/react-native-hyperlink.git#49fcdc3e27e23f894427a3c3fa6cb3d3058971db\"\n+ resolved \"git+https://git@github.com/ashoat/react-native-hyperlink.git#7fe82da2c0729e0cf3cd47cb3184b8739135ef97\"\ndependencies:\nlinkify-it \"^1.2.0\"\n+ mdurl \"^1.0.1\"\nreact-native-in-app-notification@^2.1.0:\nversion \"2.2.0\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use lowercased protocol for Android in my forked react-native-hyperlink |
129,187 | 19.02.2018 17:14:13 | 18,000 | 3b34f023b488df9da381762a05a993b0ef08f597 | *-updater.js -> *-updaters.js | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/activity-responders.js",
"new_path": "jserver/src/responders/activity-responders.js",
"diff": "@@ -7,7 +7,7 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { activityUpdater } from '../updaters/activity-updater';\n+import { activityUpdater } from '../updaters/activity-updaters';\nimport { tBool, tShape } from '../utils/tcomb-utils';\nconst inputValidator = t.list(t.union([\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/device-responders.js",
"new_path": "jserver/src/responders/device-responders.js",
"diff": "@@ -7,7 +7,7 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { deviceTokenUpdater } from '../updaters/device-token-updater';\n+import { deviceTokenUpdater } from '../updaters/device-token-updaters';\nimport { tShape } from '../utils/tcomb-utils';\nconst inputValidator = tShape({\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/entry-responders.js",
"new_path": "jserver/src/responders/entry-responders.js",
"diff": "@@ -23,7 +23,7 @@ import {\nfetchEntryRevisionInfo,\n} from '../fetchers/entry-fetchers';\nimport createEntry from '../creators/entry-creator';\n-import { updateEntry } from '../updaters/entry-updater';\n+import { updateEntry } from '../updaters/entry-updaters';\nimport { deleteEntry, restoreEntry } from '../deleters/entry-deleters';\nconst entryQueryInputValidator = tShape({\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -9,12 +9,12 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { userSubscriptionUpdater } from '../updaters/user-subscription-updater';\n+import { userSubscriptionUpdater } from '../updaters/user-subscription-updaters';\nimport {\naccountUpdater,\ncheckAndSendVerificationEmail,\ncheckAndSendPasswordResetEmail,\n-} from '../updaters/account-updater';\n+} from '../updaters/account-updaters';\nimport { tShape } from '../utils/tcomb-utils';\nimport { currentViewer } from '../session/viewer';\n"
},
{
"change_type": "RENAME",
"old_path": "jserver/src/updaters/account-updater.js",
"new_path": "jserver/src/updaters/account-updaters.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/updaters/activity-updater.js",
"new_path": "jserver/src/updaters/activity-updaters.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/updaters/device-token-updater.js",
"new_path": "jserver/src/updaters/device-token-updaters.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/updaters/entry-updater.js",
"new_path": "jserver/src/updaters/entry-updaters.js",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "jserver/src/updaters/user-subscription-updater.js",
"new_path": "jserver/src/updaters/user-subscription-updaters.js",
"diff": ""
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | *-updater.js -> *-updaters.js |
129,187 | 19.02.2018 17:15:05 | 18,000 | 813638650496f9d92842562cc2c1668da16309e8 | Use strings in database for permission source | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -92,12 +92,12 @@ if (!__DEV__) {\n// This is a magic IP address that forwards to the emulator's host\nurlPrefix = \"http://10.0.2.2/~ashoat/squadcal/\";\n// Uncomment below and update IP address if testing on physical device\n- //urlPrefix = \"http://192.168.1.7/~ashoat/squadcal/\";\n+ //urlPrefix = \"http://192.168.1.4/~ashoat/squadcal/\";\n} else if (Platform.OS === \"ios\") {\n// Since iOS is simulated and not emulated, we can use localhost\nurlPrefix = \"http://localhost/~ashoat/squadcal/\";\n// Uncomment below and update IP address if testing on physical device\n- //urlPrefix = \"http://192.168.1.7/~ashoat/squadcal/\";\n+ //urlPrefix = \"http://192.168.1.4/~ashoat/squadcal/\";\n} else {\ninvariant(false, \"unsupported platform\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/permissions.php",
"new_path": "server/permissions.php",
"diff": "@@ -186,11 +186,11 @@ SQL;\n// $role_permissions: ?array<permission: int, value: bool>\n// can be null if role = 0\n// $permissions_from_parent:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>\n// can be null if no permissions from parent (should never be empty array)\n// $thread_id: int\n// $vis_rules: int\n-// return: ?array<permission: string, array(value => bool, source => int)>\n+// return: ?array<permission: string, array(value => bool, source => string)>\n// can be null if no permissions exist\nfunction make_permissions_blob(\n$role_permissions,\n@@ -227,7 +227,7 @@ function make_permissions_blob(\nif ($value || (!$value && (!$current_pair || !$current_pair['value']))) {\n$permissions[$permission] = array(\n'value' => $value,\n- 'source' => $thread_id,\n+ 'source' => (string)$thread_id,\n);\n}\n}\n@@ -240,9 +240,13 @@ function make_permissions_blob(\nreturn $permissions;\n}\n-// $permissions: ?array<permission: string, array(value => bool, source => int)>\n+// $permissions:\n+// ?array<\n+// permission: string,\n+// array(value => bool, source => string),\n+// >\n// can be null if make_permissions_blob returns null\n-// return: ?array<permission: string, array(value => bool, source => int)>\n+// return: ?array<permission: string, array(value => bool, source => string)>\n// can be null if $permissions is null, or if no permissions go to children\nfunction permissions_for_children($permissions) {\nif (!$permissions) {\n@@ -266,9 +270,12 @@ function permissions_for_children($permissions) {\n// $to_save: array<array(\n// user_id: int,\n// thread_id: int,\n-// permissions: array<permission: string, array(value => bool, source => int)>\n+// permissions: array<\n+// permission: string,\n+// array(value => bool, source => string),\n+// >\n// permissions_for_children:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>\n// role: int,\n// subscription?: array(home => bool, pushNotifs => bool),\n// unread?: bool,\n@@ -365,16 +372,19 @@ SQL;\n// $initial_users_to_permissions_from_parent:\n// array<\n// user_id: int,\n-// array<permission: string, array(value => bool, source => int)>,\n+// array<permission: string, array(value => bool, source => string)>,\n// >\n// returns:\n// array(\n// to_save => array<array(\n// user_id: int,\n// thread_id: int,\n-// permissions: array<permission: string, array(value => bool, source => int)>\n+// permissions: array<permission: string, array(\n+// value => bool,\n+// source => string,\n+// )>,\n// permissions_for_children:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>,\n// role: int,\n// )>,\n// to_delete: array<array(user_id: int, thread_id: int)>,\n@@ -506,10 +516,10 @@ SQL;\n// thread_id: int,\n// permissions: array<\n// permission: string,\n-// array(value => bool, source => int),\n+// array(value => bool, source => string),\n// >,\n// permissions_for_children:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>\n// role: int,\n// )>,\n// to_delete: array<array(user_id: int, thread_id: int)>,\n@@ -661,10 +671,10 @@ SQL;\n// thread_id: int,\n// permissions: array<\n// permission: string,\n-// array(value => bool, source => int),\n+// array(value => bool, source => string),\n// >,\n// permissions_for_children:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>\n// role: int,\n// )>,\n// to_delete: array<array(user_id: int, thread_id: int)>,\n@@ -778,9 +788,12 @@ SQL;\n// to_save => array<array(\n// user_id: int,\n// thread_id: int,\n-// permissions: array<permission: string, array(value => bool, source => int)>\n+// permissions: array<permission: string, array(\n+// value => bool,\n+// source => string,\n+// )>,\n// permissions_for_children:\n-// ?array<permission: string, array(value => bool, source => int)>\n+// ?array<permission: string, array(value => bool, source => string)>,\n// role: int,\n// )>,\n// to_delete: array<array(user_id: int, thread_id: int)>,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/scripts/strings_for_permission_source.php",
"diff": "+<?php\n+\n+require_once('../config.php');\n+\n+$fetch_query = <<<SQL\n+SELECT user, thread, permissions, permissions_for_children\n+FROM memberships\n+SQL;\n+\n+$fetch_results = $conn->query($fetch_query);\n+while ($row = $fetch_results->fetch_assoc()) {\n+ $permissions = json_decode($row['permissions'], true);\n+ $permissions_for_children =\n+ json_decode($row['permissions_for_children'], true);\n+ foreach ($permissions as $key => $permission) {\n+ $permissions[$key]['source'] = (string)$permission['source'];\n+ }\n+ foreach ($permissions_for_children as $key => $permission) {\n+ $permissions_for_children[$key]['source'] = (string)$permission['source'];\n+ }\n+ $save_permissions = $conn->real_escape_string(json_encode($permissions));\n+ $save_permissions_for_children =\n+ $conn->real_escape_string(json_encode($permissions_for_children));\n+\n+ $update_query = <<<SQL\n+UPDATE memberships\n+SET permissions = '{$save_permissions}',\n+ permissions_for_children = '{$save_permissions_for_children}'\n+WHERE user = {$row['user']} AND thread = {$row['thread']}\n+SQL;\n+ $conn->query($update_query);\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use strings in database for permission source |
129,187 | 20.02.2018 01:04:57 | 18,000 | 6f25be2b3cb3276f236ecadc07c3ab6035d8044f | Fix rawMessageInfoFromRow
This was hilariously broken, not sure how I missed it... | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/fetchers/message-fetchers.js",
"new_path": "jserver/src/fetchers/message-fetchers.js",
"diff": "import type { PushInfo } from '../push/send';\nimport type { UserInfo } from 'lib/types/user-types';\n-import type { RawMessageInfo } from 'lib/types/message-types';\n+import {\n+ type RawMessageInfo,\n+ messageType,\n+ assertMessageType,\n+} from 'lib/types/message-types';\nimport invariant from 'invariant';\nimport { notifCollapseKeyForRawMessageInfo } from 'lib/shared/notif-utils';\n-import { messageType } from 'lib/types/message-types';\nimport {\nassertVisibilityRules,\nthreadPermissions,\n@@ -130,33 +133,33 @@ async function fetchCollapsableNotifs(\n}\nfunction rawMessageInfoFromRow(row: Object): ?RawMessageInfo {\n- const type = parseInt(row.type);\n+ const type = assertMessageType(row.type);\nif (type === messageType.TEXT) {\nreturn {\ntype: messageType.TEXT,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\ntext: row.content,\n};\n} else if (type === messageType.CREATE_THREAD) {\nreturn {\ntype: messageType.CREATE_THREAD,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- initialThreadState: row.content,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ initialThreadState: JSON.parse(row.content),\n};\n} else if (type === messageType.ADD_MEMBERS) {\nreturn {\ntype: messageType.ADD_MEMBERS,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- addedUserIDs: row.content,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ addedUserIDs: JSON.parse(row.content),\n};\n} else if (type === messageType.CREATE_SUB_THREAD) {\nconst subthreadPermissionInfo = {\n@@ -168,101 +171,107 @@ function rawMessageInfoFromRow(row: Object): ?RawMessageInfo {\n}\nreturn {\ntype: messageType.CREATE_SUB_THREAD,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\nchildThreadID: row.content,\n};\n} else if (type === messageType.CHANGE_SETTINGS) {\n- const field = Object.keys(row.content)[0];\n+ const content = JSON.parse(row.content);\n+ const field = Object.keys(content)[0];\nreturn {\ntype: messageType.CHANGE_SETTINGS,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\nfield,\n- value: row.content[field],\n+ value: content[field],\n};\n} else if (type === messageType.REMOVE_MEMBERS) {\nreturn {\ntype: messageType.REMOVE_MEMBERS,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- removedUserIDs: row.content,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ removedUserIDs: JSON.parse(row.content),\n};\n} else if (type === messageType.CHANGE_ROLE) {\n+ const content = JSON.parse(row.content);\nreturn {\ntype: messageType.CHANGE_ROLE,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- userIDs: row.content.userIDs,\n- newRole: row.content.newRole,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ userIDs: content.userIDs,\n+ newRole: content.newRole,\n};\n} else if (type === messageType.LEAVE_THREAD) {\nreturn {\ntype: messageType.LEAVE_THREAD,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n};\n} else if (type === messageType.JOIN_THREAD) {\nreturn {\ntype: messageType.JOIN_THREAD,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n};\n} else if (type === messageType.CREATE_ENTRY) {\n+ const content = JSON.parse(row.content);\nreturn {\ntype: messageType.CREATE_ENTRY,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- entryID: row.content.entryID,\n- date: row.content.date,\n- text: row.content.text,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ entryID: content.entryID,\n+ date: content.date,\n+ text: content.text,\n};\n} else if (type === messageType.EDIT_ENTRY) {\n+ const content = JSON.parse(row.content);\nreturn {\ntype: messageType.EDIT_ENTRY,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- entryID: row.content.entryID,\n- date: row.content.date,\n- text: row.content.text,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ entryID: content.entryID,\n+ date: content.date,\n+ text: content.text,\n};\n} else if (type === messageType.DELETE_ENTRY) {\n+ const content = JSON.parse(row.content);\nreturn {\ntype: messageType.DELETE_ENTRY,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- entryID: row.content.entryID,\n- date: row.content.date,\n- text: row.content.text,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ entryID: content.entryID,\n+ date: content.date,\n+ text: content.text,\n};\n} else if (type === messageType.RESTORE_ENTRY) {\n+ const content = JSON.parse(row.content);\nreturn {\ntype: messageType.RESTORE_ENTRY,\n- id: row.id,\n- threadID: row.threadID,\n- time: parseInt(row.time),\n- creatorID: row.creatorID,\n- entryID: row.content.entryID,\n- date: row.content.date,\n- text: row.content.text,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ entryID: content.entryID,\n+ date: content.date,\n+ text: content.text,\n};\n} else {\ninvariant(false, `unrecognized messageType ${type}`);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix rawMessageInfoFromRow
This was hilariously broken, not sure how I missed it... |
129,187 | 20.02.2018 14:40:13 | 18,000 | cb4b63b455407ad7cf5cae7a49e6cde4e68402bd | Don't crash when leaving a thread
Screens need to cache the latest ThreadInfo and not update it when it goes to `null`/`undefined` | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/thread-reducer.js",
"new_path": "lib/reducers/thread-reducer.js",
"diff": "@@ -76,7 +76,10 @@ export default function reduceThreadInfos(\n} else if (action.type === updateActivityActionTypes.success) {\nconst newState = { ...state };\nfor (let setToUnread of action.payload.unfocusedToUnread) {\n- newState[setToUnread].currentUser.unread = true;\n+ const threadInfo = newState[setToUnread];\n+ if (threadInfo) {\n+ threadInfo.currentUser.unread = true;\n+ }\n}\nreturn newState;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -46,7 +46,6 @@ import {\njoinThread,\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport Button from '../components/button.react';\n@@ -54,12 +53,11 @@ const draftKeyFromThreadID =\n(threadID: string) => `${threadID}/message_composer`;\ntype Props = {\n- threadID: string,\n+ threadInfo: ThreadInfo,\n// Redux state\nusername: ?string,\nviewerID: ?string,\ndraft: string,\n- threadInfo: ThreadInfo,\njoinThreadLoadingStatus: LoadingStatus,\n// Redux dispatch functions\ndispatchActionPayload: DispatchActionPayload,\n@@ -78,11 +76,10 @@ type State = {\nclass ChatInputBar extends React.PureComponent<Props, State> {\nstatic propTypes = {\n- threadID: PropTypes.string.isRequired,\n+ threadInfo: threadInfoPropType.isRequired,\nusername: PropTypes.string,\nviewerID: PropTypes.string,\ndraft: PropTypes.string.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\njoinThreadLoadingStatus: loadingStatusPropType.isRequired,\ndispatchActionPayload: PropTypes.func.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -232,7 +229,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nthis.setState({ text });\nthis.props.dispatchActionPayload(\nsaveDraftActionType,\n- { key: draftKeyFromThreadID(this.props.threadID), draft: text },\n+ { key: draftKeyFromThreadID(this.props.threadInfo.id), draft: text },\n);\n}\n@@ -251,7 +248,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nconst messageInfo = ({\ntype: messageType.TEXT,\nlocalID,\n- threadID: this.props.threadID,\n+ threadID: this.props.threadInfo.id,\ntext: this.state.text,\ncreatorID,\ntime: Date.now(),\n@@ -356,15 +353,14 @@ const joinThreadLoadingStatusSelector\n= createLoadingStatusSelector(joinThreadActionTypes);\nexport default connect(\n- (state: AppState, ownProps: { threadID: string }) => {\n- const draft = state.drafts[draftKeyFromThreadID(ownProps.threadID)];\n+ (state: AppState, ownProps: { threadInfo: ThreadInfo }) => {\n+ const draft = state.drafts[draftKeyFromThreadID(ownProps.threadInfo.id)];\nreturn {\nusername: state.currentUserInfo && !state.currentUserInfo.anonymous\n? state.currentUserInfo.username\n: undefined,\nviewerID: state.currentUserInfo && state.currentUserInfo.id,\ndraft: draft ? draft : \"\",\n- threadInfo: threadInfoSelector(state)[ownProps.threadID],\njoinThreadLoadingStatus: joinThreadLoadingStatusSelector(state),\ncookie: state.cookie,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -70,6 +70,7 @@ type NavProp = NavigationScreenProp<NavigationRoute>\nexport type RobotextChatMessageInfoItemWithHeight = {|\nitemType: \"message\",\nmessageInfo: RobotextMessageInfo,\n+ threadInfo: ThreadInfo,\nstartsConversation: bool,\nstartsCluster: bool,\nendsCluster: bool,\n@@ -81,6 +82,7 @@ export type ChatMessageInfoItemWithHeight =\nRobotextChatMessageInfoItemWithHeight | {|\nitemType: \"message\",\nmessageInfo: TextMessageInfo,\n+ threadInfo: ThreadInfo,\nstartsConversation: bool,\nstartsCluster: bool,\nendsCluster: bool,\n@@ -191,22 +193,22 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n}\ncomponentDidMount() {\n+ const threadInfo = InnerMessageList.getThreadInfo(this.props);\nregisterChatScreen(this.props.navigation.state.key, this);\n- if (!viewerIsMember(InnerMessageList.getThreadInfo(this.props))) {\n- threadWatcher.watchID(InnerMessageList.getThreadInfo(this.props).id);\n+ if (!viewerIsMember(threadInfo)) {\n+ threadWatcher.watchID(threadInfo.id);\nthis.props.dispatchActionPromise(\nfetchMostRecentMessagesActionTypes,\n- this.props.fetchMostRecentMessages(\n- InnerMessageList.getThreadInfo(this.props).id,\n- ),\n+ this.props.fetchMostRecentMessages(threadInfo.id),\n);\n}\n}\ncomponentWillUnmount() {\n+ const threadInfo = InnerMessageList.getThreadInfo(this.props);\nregisterChatScreen(this.props.navigation.state.key, null);\n- if (!viewerIsMember(InnerMessageList.getThreadInfo(this.props))) {\n- threadWatcher.removeID(InnerMessageList.getThreadInfo(this.props).id);\n+ if (!viewerIsMember(threadInfo)) {\n+ threadWatcher.removeID(threadInfo.id);\n}\n}\n@@ -241,39 +243,41 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n}\ncomponentWillReceiveProps(nextProps: Props) {\n- if (\n- nextProps.threadInfo &&\n- !_isEqual(nextProps.threadInfo)\n- (this.props.navigation.state.params.threadInfo)\n- ) {\n- this.props.navigation.setParams({\n- threadInfo: nextProps.threadInfo,\n- });\n+ const oldThreadInfo = InnerMessageList.getThreadInfo(this.props);\n+ const newThreadInfo = nextProps.threadInfo;\n+\n+ let threadInfoChanged = false;\n+ if (newThreadInfo && !_isEqual(newThreadInfo)(oldThreadInfo)) {\n+ threadInfoChanged = true;\n+ this.props.navigation.setParams({ threadInfo: newThreadInfo });\n}\nif (\n- viewerIsMember(InnerMessageList.getThreadInfo(this.props)) &&\n- !viewerIsMember(InnerMessageList.getThreadInfo(nextProps))\n+ viewerIsMember(oldThreadInfo) &&\n+ !viewerIsMember(newThreadInfo)\n) {\n- threadWatcher.watchID(InnerMessageList.getThreadInfo(nextProps).id);\n+ threadWatcher.watchID(oldThreadInfo.id);\n} else if (\n- !viewerIsMember(InnerMessageList.getThreadInfo(this.props)) &&\n- viewerIsMember(InnerMessageList.getThreadInfo(nextProps))\n+ !viewerIsMember(oldThreadInfo) &&\n+ viewerIsMember(newThreadInfo)\n) {\n- threadWatcher.removeID(InnerMessageList.getThreadInfo(nextProps).id);\n+ threadWatcher.removeID(oldThreadInfo.id);\n}\n- if (nextProps.listData === this.props.messageListData) {\n- return;\n- }\n+ const oldListData = this.props.messageListData;\nconst newListData = nextProps.messageListData;\n-\n- if (!newListData) {\n+ if (!newListData && oldListData) {\nthis.setState({\ntextToMeasure: [],\nlistDataWithHeights: null,\nfocusedMessageKey: null,\n});\n+ }\n+ if (!newListData) {\n+ return;\n+ }\n+\n+ if (newListData === oldListData && !threadInfoChanged) {\nreturn;\n}\n@@ -291,6 +295,7 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n}\n}\n}\n+\nif (allTextAlreadyMeasured) {\nthis.mergeHeightsIntoListData(newListData);\nreturn;\n@@ -311,10 +316,10 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nthis.textHeights = null;\nthis.setState({ textToMeasure: newTextToMeasure });\n}\n-\n}\nmergeHeightsIntoListData(listData: $ReadOnlyArray<ChatMessageItem>) {\n+ const threadInfo = InnerMessageList.getThreadInfo(this.props);\nconst textHeights = this.textHeights;\ninvariant(textHeights, \"textHeights should be set\");\nconst listDataWithHeights = listData.map((item: ChatMessageItem) => {\n@@ -330,6 +335,7 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nreturn {\nitemType: \"message\",\nmessageInfo: item.messageInfo,\n+ threadInfo,\nstartsConversation: item.startsConversation,\nstartsCluster: item.startsCluster,\nendsCluster: item.endsCluster,\n@@ -343,6 +349,7 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nreturn {\nitemType: \"message\",\nmessageInfo: item.messageInfo,\n+ threadInfo,\nstartsConversation: item.startsConversation,\nstartsCluster: item.startsCluster,\nendsCluster: item.endsCluster,\n@@ -465,8 +472,8 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n);\n}\n- const threadID = InnerMessageList.getThreadInfo(this.props).id;\n- const inputBar = <ChatInputBar threadID={threadID} />;\n+ const threadInfo = InnerMessageList.getThreadInfo(this.props);\n+ const inputBar = <ChatInputBar threadInfo={threadInfo} />;\nconst behavior = Platform.OS === \"ios\" ? \"padding\" : undefined;\nconst keyboardVerticalOffset = Platform.OS === \"ios\"\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message.react.js",
"new_path": "native/chat/message.react.js",
"diff": "// @flow\n-import type { ThreadInfo } from 'lib/types/thread-types';\n-import { threadInfoPropType } from 'lib/types/thread-types';\n-import type { AppState } from '../redux-setup';\nimport type { ChatMessageInfoItemWithHeight } from './message-list.react';\nimport { chatMessageItemPropType } from '../selectors/chat-selectors';\nimport React from 'react';\n-import {\n- Text,\n- StyleSheet,\n- View,\n- LayoutAnimation,\n-} from 'react-native';\n-import { connect } from 'react-redux';\n+import { Text, StyleSheet, View, LayoutAnimation } from 'react-native';\nimport _isEqual from 'lodash/fp/isEqual';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\n@@ -48,40 +39,16 @@ type Props = {\nitem: ChatMessageInfoItemWithHeight,\nfocused: bool,\ntoggleFocus: (messageKey: string) => void,\n- // Redux state\n- threadInfo: ThreadInfo,\n-};\n-type State = {\n- threadInfo: ThreadInfo,\n};\n-class InnerMessage extends React.PureComponent<Props, State> {\n+class Message extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nfocused: PropTypes.bool.isRequired,\ntoggleFocus: PropTypes.func.isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n};\n- constructor(props: Props) {\n- super(props);\n- invariant(props.threadInfo, \"should be set\");\n- this.state = {\n- // On log out, it's possible for the thread to be deauthorized before\n- // the log out animation completes. To avoid having rendering issues in\n- // that case, we cache the threadInfo in state and don't reset it when the\n- // threadInfo is undefined.\n- threadInfo: props.threadInfo,\n- };\n- }\n-\ncomponentWillReceiveProps(nextProps: Props) {\n- if (\n- nextProps.threadInfo &&\n- !_isEqual(nextProps.threadInfo)(this.state.threadInfo)\n- ) {\n- this.setState({ threadInfo: nextProps.threadInfo });\n- }\nif (\n(nextProps.focused || nextProps.item.startsConversation) !==\n(this.props.focused || this.props.item.startsConversation)\n@@ -106,7 +73,7 @@ class InnerMessage extends React.PureComponent<Props, State> {\nitem={this.props.item}\nfocused={this.props.focused}\ntoggleFocus={this.props.toggleFocus}\n- threadInfo={this.props.threadInfo}\n+ threadInfo={this.props.item.threadInfo}\n/>\n);\n} else {\n@@ -114,7 +81,7 @@ class InnerMessage extends React.PureComponent<Props, State> {\n<RobotextMessage\nitem={this.props.item}\ntoggleFocus={this.props.toggleFocus}\n- threadInfo={this.props.threadInfo}\n+ threadInfo={this.props.item.threadInfo}\n/>\n);\n}\n@@ -138,12 +105,6 @@ const styles = StyleSheet.create({\n},\n});\n-const Message = connect(\n- (state: AppState, ownProps: { item: ChatMessageInfoItemWithHeight }): * => ({\n- threadInfo: threadInfoSelector(state)[ownProps.item.messageInfo.threadID],\n- }),\n-)(InnerMessage);\n-\nexport {\nMessage,\nmessageItemHeight,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings.react.js",
"new_path": "native/chat/settings/thread-settings.react.js",
"diff": "@@ -20,6 +20,7 @@ import PropTypes from 'prop-types';\nimport { FlatList, StyleSheet, View } from 'react-native';\nimport Modal from 'react-native-modal';\nimport _isEqual from 'lodash/fp/isEqual';\n+import invariant from 'invariant';\nimport {\nrelativeMemberInfoSelectorForMembersOfThread,\n@@ -149,7 +150,7 @@ type ChatSettingsItem =\n|};\ntype StateProps = {|\n- threadInfo: ThreadInfo,\n+ threadInfo: ?ThreadInfo,\nthreadMembers: RelativeMemberInfo[],\nchildThreadInfos: ?ThreadInfo[],\nsomethingIsSaving: bool,\n@@ -184,7 +185,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nnavigate: PropTypes.func.isRequired,\nsetParams: PropTypes.func.isRequired,\n}).isRequired,\n- threadInfo: threadInfoPropType.isRequired,\n+ threadInfo: threadInfoPropType,\nthreadMembers: PropTypes.arrayOf(relativeMemberInfoPropType).isRequired,\nchildThreadInfos: PropTypes.arrayOf(threadInfoPropType),\nsomethingIsSaving: PropTypes.bool.isRequired,\n@@ -196,6 +197,11 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nconstructor(props: Props) {\nsuper(props);\n+ const threadInfo = props.threadInfo;\n+ invariant(\n+ threadInfo,\n+ \"ThreadInfo should exist when ThreadSettings opened\",\n+ );\nthis.state = {\nshowAddUsersModal: false,\nshowComposeSubthreadModal: false,\n@@ -206,50 +212,59 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nnameTextHeight: null,\ndescriptionTextHeight: null,\nshowEditColorModal: false,\n- colorEditValue: props.threadInfo.color,\n+ colorEditValue: threadInfo.color,\n};\n}\n+ static getThreadInfo(props: Props): ThreadInfo {\n+ return props.navigation.state.params.threadInfo;\n+ }\n+\ncomponentDidMount() {\nregisterChatScreen(this.props.navigation.state.key, this);\n- if (!viewerIsMember(this.props.threadInfo)) {\n- threadWatcher.watchID(this.props.threadInfo.id);\n+ const threadInfo = InnerThreadSettings.getThreadInfo(this.props);\n+ if (!viewerIsMember(threadInfo)) {\n+ threadWatcher.watchID(threadInfo.id);\n}\n}\ncomponentWillUnmount() {\nregisterChatScreen(this.props.navigation.state.key, null);\n- if (!viewerIsMember(this.props.threadInfo)) {\n- threadWatcher.removeID(this.props.threadInfo.id);\n+ const threadInfo = InnerThreadSettings.getThreadInfo(this.props);\n+ if (!viewerIsMember(threadInfo)) {\n+ threadWatcher.removeID(threadInfo.id);\n}\n}\ncomponentWillReceiveProps(nextProps: Props) {\n+ const oldThreadInfo = InnerThreadSettings.getThreadInfo(this.props);\n+ const newThreadInfo = nextProps.threadInfo;\n+\nif (\n- viewerIsMember(this.props.threadInfo) &&\n- !viewerIsMember(nextProps.threadInfo)\n+ viewerIsMember(oldThreadInfo) &&\n+ !viewerIsMember(newThreadInfo)\n) {\n- threadWatcher.watchID(nextProps.threadInfo.id);\n+ threadWatcher.watchID(oldThreadInfo.id);\n} else if (\n- !viewerIsMember(this.props.threadInfo) &&\n- viewerIsMember(nextProps.threadInfo)\n+ !viewerIsMember(oldThreadInfo) &&\n+ viewerIsMember(newThreadInfo)\n) {\n- threadWatcher.removeID(nextProps.threadInfo.id);\n+ threadWatcher.removeID(oldThreadInfo.id);\n}\n- if (\n- !_isEqual(nextProps.threadInfo)\n- (this.props.navigation.state.params.threadInfo)\n- ) {\n- this.props.navigation.setParams({\n- threadInfo: nextProps.threadInfo,\n- });\n+ if (!newThreadInfo) {\n+ return;\n+ }\n+\n+ const newState = {};\n+ if (!_isEqual(newThreadInfo)(oldThreadInfo)) {\n+ this.props.navigation.setParams({ threadInfo: newThreadInfo });\n}\nif (\n- nextProps.threadInfo.color !== this.props.threadInfo.color &&\n- this.state.colorEditValue === this.props.threadInfo.color\n+ newThreadInfo.color !== oldThreadInfo.color &&\n+ this.state.colorEditValue === oldThreadInfo.color\n) {\n- this.setState({ colorEditValue: nextProps.threadInfo.color });\n+ this.setState({ colorEditValue: newThreadInfo.color });\n}\n}\n@@ -263,9 +278,11 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n}\nrender() {\n+ const threadInfo = InnerThreadSettings.getThreadInfo(this.props);\n+\nconst canStartEditing = this.canReset();\nconst canEditThread = threadHasPermission(\n- this.props.threadInfo,\n+ threadInfo,\nthreadPermissions.EDIT_THREAD,\n);\nconst canChangeSettings = canEditThread && canStartEditing;\n@@ -280,7 +297,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlistData.push({\nitemType: \"name\",\nkey: \"name\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\nnameEditValue: this.state.nameEditValue,\nnameTextHeight: this.state.nameTextHeight,\ncanChangeSettings,\n@@ -288,7 +305,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlistData.push({\nitemType: \"color\",\nkey: \"color\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\ncolorEditValue: this.state.colorEditValue,\nshowEditColorModal: this.state.showEditColorModal,\ncanChangeSettings,\n@@ -302,13 +319,13 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nif (\n(this.state.descriptionEditValue !== null &&\nthis.state.descriptionEditValue !== undefined) ||\n- this.props.threadInfo.description ||\n+ threadInfo.description ||\ncanEditThread\n) {\nlistData.push({\nitemType: \"description\",\nkey: \"description\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\ndescriptionEditValue: this.state.descriptionEditValue,\ndescriptionTextHeight: this.state.descriptionTextHeight,\ncanChangeSettings,\n@@ -324,7 +341,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlistData.push({\nitemType: \"pushNotifs\",\nkey: \"pushNotifs\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\n});\nlistData.push({\nitemType: \"footer\",\n@@ -341,13 +358,13 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlistData.push({\nitemType: \"parent\",\nkey: \"parent\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\nnavigate: this.props.navigation.navigate,\n});\nlistData.push({\nitemType: \"visibility\",\nkey: \"visibility\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\n});\nlistData.push({\nitemType: \"footer\",\n@@ -370,10 +387,10 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n} else {\nchildThreadInfos = this.props.childThreadInfos;\n}\n- childThreads = childThreadInfos.map(threadInfo => ({\n+ childThreads = childThreadInfos.map(childThreadInfo => ({\nitemType: \"childThread\",\n- key: `childThread${threadInfo.id}`,\n- threadInfo,\n+ key: `childThread${childThreadInfo.id}`,\n+ threadInfo: childThreadInfo,\nnavigate: this.props.navigation.navigate,\n}));\nif (seeMoreChildThreads) {\n@@ -383,7 +400,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlet addChildThread = null;\nconst canCreateSubthreads = threadHasPermission(\n- this.props.threadInfo,\n+ threadInfo,\nthreadPermissions.CREATE_SUBTHREADS,\n);\nif (canCreateSubthreads) {\n@@ -432,7 +449,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nitemType: \"member\",\nkey: `member${memberInfo.id}`,\nmemberInfo,\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\ncanEdit: canStartEditing,\n}));\nif (seeMoreMembers) {\n@@ -441,7 +458,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nlet addMembers = null;\nconst canAddMembers = threadHasPermission(\n- this.props.threadInfo,\n+ threadInfo,\nthreadPermissions.ADD_MEMBERS,\n);\nif (canAddMembers) {\n@@ -473,11 +490,11 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n});\n}\n- if (viewerIsMember(this.props.threadInfo)) {\n+ if (viewerIsMember(threadInfo)) {\nlistData.push({\nitemType: \"leaveThread\",\nkey: \"leaveThread\",\n- threadInfo: this.props.threadInfo,\n+ threadInfo,\n});\n}\n@@ -494,7 +511,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nonBackdropPress={this.closeAddUsersModal}\n>\n<AddUsersModal\n- threadInfo={this.props.threadInfo}\n+ threadInfo={threadInfo}\nclose={this.closeAddUsersModal}\n/>\n</Modal>\n@@ -504,7 +521,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nonBackdropPress={this.closeComposeSubthreadModal}\n>\n<ComposeSubthreadModal\n- threadInfo={this.props.threadInfo}\n+ threadInfo={threadInfo}\nnavigate={this.props.navigation.navigate}\ncloseModal={this.closeComposeSubthreadModal}\n/>\n@@ -705,16 +722,13 @@ const somethingIsSaving = (\nconst ThreadSettingsRouteName = 'ThreadSettings';\nconst ThreadSettings = connect(\n(state: AppState, ownProps: { navigation: NavProp }): * => {\n- const parsedThreadInfos = threadInfoSelector(state);\n- const passedThreadInfo = ownProps.navigation.state.params.threadInfo;\n- // We pull the version from Redux so we get updates once they go through\n- const threadInfo = parsedThreadInfos[passedThreadInfo.id];\n+ const threadID = ownProps.navigation.state.params.threadInfo.id;\nconst threadMembers =\n- relativeMemberInfoSelectorForMembersOfThread(threadInfo.id)(state);\n+ relativeMemberInfoSelectorForMembersOfThread(threadID)(state);\nreturn {\n- threadInfo,\n+ threadInfo: threadInfoSelector(state)[threadID],\nthreadMembers,\n- childThreadInfos: childThreadInfos(state)[threadInfo.id],\n+ childThreadInfos: childThreadInfos(state)[threadID],\nsomethingIsSaving: somethingIsSaving(state, threadMembers),\n};\n},\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't crash when leaving a thread
Screens need to cache the latest ThreadInfo and not update it when it goes to `null`/`undefined` |
129,187 | 20.02.2018 15:26:34 | 18,000 | e50fc6056b57303fbfd27745cf9cd5d8f8b9594e | Use ThreadList for ThreadPicker on native
Also clean up the style and make it more consistent with other modals | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/section-footer.react.js",
"new_path": "native/calendar/section-footer.react.js",
"diff": "@@ -27,7 +27,6 @@ class SectionFooter extends React.PureComponent<Props> {\n<View style={styles.sectionFooter}>\n<Button\nonPress={this.onSubmit}\n- androidBorderlessRipple={true}\niosFormat=\"highlight\"\niosActiveOpacity={0.85}\nstyle={styles.addButton}\n"
},
{
"change_type": "DELETE",
"old_path": "native/calendar/thread-picker-thread.react.js",
"new_path": null,
"diff": "-// @flow\n-\n-import type { ThreadInfo } from 'lib/types/thread-types';\n-import { threadInfoPropType } from 'lib/types/thread-types';\n-\n-import React from 'react';\n-import { Text, View, StyleSheet } from 'react-native';\n-import PropTypes from 'prop-types';\n-\n-import Button from '../components/button.react';\n-import ColorSplotch from '../components/color-splotch.react';\n-\n-type Props = {\n- threadInfo: ThreadInfo,\n- threadPicked: (threadID: string) => void,\n-};\n-class ThreadPickerThread extends React.PureComponent<Props> {\n-\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- threadPicked: PropTypes.func.isRequired,\n- };\n-\n- onPress = () => {\n- this.props.threadPicked(this.props.threadInfo.id);\n- }\n-\n- render() {\n- return (\n- <Button\n- onPress={this.onPress}\n- iosFormat=\"highlight\"\n- iosActiveOpacity={0.85}\n- >\n- <View style={styles.container}>\n- <ColorSplotch color={this.props.threadInfo.color} />\n- <Text style={styles.text}>{this.props.threadInfo.uiName}</Text>\n- </View>\n- </Button>\n- );\n- }\n-\n-}\n-\n-const styles = StyleSheet.create({\n- container: {\n- flex: 1,\n- flexDirection: 'row',\n- paddingLeft: 10,\n- paddingTop: 5,\n- paddingBottom: 5,\n- },\n- text: {\n- paddingTop: 2,\n- paddingLeft: 10,\n- fontSize: 16,\n- color: '#333333',\n- fontWeight: '500',\n- },\n-});\n-\n-export default ThreadPickerThread;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/thread-picker.react.js",
"new_path": "native/calendar/thread-picker.react.js",
"diff": "@@ -7,14 +7,7 @@ import type { DispatchActionPayload } from 'lib/utils/action-utils';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import {\n- View,\n- Text,\n- StyleSheet,\n- FlatList,\n- TouchableHighlight,\n-} from 'react-native';\n-import Icon from 'react-native-vector-icons/FontAwesome';\n+import { View, Text, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport invariant from 'invariant';\n@@ -25,7 +18,7 @@ import {\n} from 'lib/actions/entry-actions';\nimport { includeDispatchActionProps } from 'lib/utils/action-utils';\n-import ThreadPickerThread from './thread-picker-thread.react';\n+import ThreadList from '../components/thread-list.react';\ntype Props = {\ndateString: ?string,\n@@ -49,56 +42,18 @@ class ThreadPicker extends React.PureComponent<Props> {\nrender() {\nreturn (\n<View style={styles.picker}>\n- <View style={styles.header}>\n<Text style={styles.headerText}>\nPick a thread\n</Text>\n- <TouchableHighlight\n- onPress={this.props.close}\n- style={styles.closeButton}\n- underlayColor=\"#CCCCCCDD\"\n- >\n- <Icon\n- name=\"close\"\n- size={16}\n- color=\"#AAAAAA\"\n- style={styles.closeButtonIcon}\n- />\n- </TouchableHighlight>\n- </View>\n- <FlatList\n- data={this.props.onScreenThreadInfos}\n- renderItem={this.renderItem}\n- keyExtractor={ThreadPicker.keyExtractor}\n- getItemLayout={ThreadPicker.getItemLayout}\n- ItemSeparatorComponent={ThreadPicker.itemSeperator}\n- style={styles.contents}\n+ <ThreadList\n+ threadInfos={this.props.onScreenThreadInfos}\n+ onSelect={this.threadPicked}\n+ itemStyle={styles.threadListItem}\n/>\n</View>\n);\n}\n- static keyExtractor(threadInfo: ThreadInfo) {\n- return threadInfo.id;\n- }\n-\n- renderItem = (row: { item: ThreadInfo }) => {\n- return (\n- <ThreadPickerThread\n- threadInfo={row.item}\n- threadPicked={this.threadPicked}\n- />\n- );\n- }\n-\n- static getItemLayout(data: ?$ReadOnlyArray<ThreadInfo>, index: number) {\n- return { length: 24, offset: 24 * index, index };\n- }\n-\n- static itemSeperator() {\n- return <View style={styles.itemSeperator} />;\n- }\n-\nthreadPicked = (threadID: string) => {\nthis.props.close();\nconst dateString = this.props.dateString;\n@@ -114,46 +69,22 @@ class ThreadPicker extends React.PureComponent<Props> {\nconst styles = StyleSheet.create({\npicker: {\nflex: 1,\n- marginLeft: 15,\n- marginRight: 15,\n- marginTop: 100,\n- marginBottom: 100,\n+ padding: 12,\nborderRadius: 5,\nbackgroundColor: '#EEEEEE',\n- },\n- header: {\n- borderTopLeftRadius: 5,\n- borderTopRightRadius: 5,\n- backgroundColor: 'white',\n- borderBottomWidth: 1,\n- borderColor: '#CCCCCC',\n- paddingTop: 15,\n- paddingBottom: 14,\n+ marginHorizontal: 10,\n+ marginVertical: 100,\n},\nheaderText: {\n- fontSize: 20,\n+ fontSize: 24,\ntextAlign: 'center',\n- fontWeight: 'bold',\n- color: '#333333',\n- },\n- contents: {\n- flex: 1,\n- },\n- closeButton: {\n- position: 'absolute',\n- top: 5,\n- right: 5,\n- width: 18,\n- height: 18,\n- borderRadius: 3,\n- },\n- closeButtonIcon: {\n- position: 'absolute',\n- left: 3,\n+ color: \"black\",\n+ paddingBottom: 8,\n},\n- itemSeperator: {\n- height: 1,\n- backgroundColor: '#CCCCCC',\n+ threadListItem: {\n+ paddingVertical: 2,\n+ paddingLeft: 10,\n+ paddingRight: 10,\n},\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/thread-list-thread.react.js",
"new_path": "native/components/thread-list-thread.react.js",
"diff": "@@ -65,6 +65,7 @@ const styles = StyleSheet.create({\npaddingRight: 12,\npaddingVertical: 6,\nfontSize: 16,\n+ color: 'black',\n},\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use ThreadList for ThreadPicker on native
Also clean up the style and make it more consistent with other modals |
129,187 | 21.02.2018 01:31:45 | 18,000 | fb866b3fcdeadf2128e6f607ae840cd3f7ff3f58 | JSON.parse any field that is UNION SELECT'd | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/thread-permission-updaters.js",
"new_path": "jserver/src/updaters/thread-permission-updaters.js",
"diff": "@@ -345,10 +345,10 @@ async function recalculateAllPermissions(\n}\nconst userID = row.user.toString();\nconst role = row.role.toString();\n- const oldPermissions = row.permissions;\n- const oldPermissionsForChildren = row.permissions_for_children;\n+ const oldPermissions = JSON.parse(row.permissions);\n+ const oldPermissionsForChildren = JSON.parse(row.permissions_for_children);\nconst permissionsFromParent = JSON.parse(row.permissions_from_parent);\n- const rolePermissions = row.role_permissions;\n+ const rolePermissions = JSON.parse(row.role_permissions);\nconst permissions = makePermissionsBlob(\nrolePermissions,\npermissionsFromParent,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | JSON.parse any field that is UNION SELECT'd |
129,187 | 21.02.2018 19:06:02 | 18,000 | 50e0d7fb2a165258709944e1b6ffb38ae0f5239b | Redo Entry selection logic | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -33,7 +33,7 @@ import _findIndex from 'lodash/fp/findIndex';\nimport _isEqual from 'lodash/fp/isEqual';\nimport _map from 'lodash/fp/map';\nimport _find from 'lodash/fp/find';\n-import _difference from 'lodash/fp/difference';\n+import _differenceWith from 'lodash/fp/differenceWith';\nimport _filter from 'lodash/fp/filter';\nimport _sum from 'lodash/fp/sum';\nimport _pickBy from 'lodash/fp/pickBy';\n@@ -54,7 +54,7 @@ import { simpleNavID } from 'lib/selectors/nav-selectors';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport Modal from 'react-native-modal';\n-import { Entry, InternalEntry } from './entry.react';\n+import { Entry, InternalEntry, entryStyles } from './entry.react';\nimport { contentVerticalOffset, windowHeight } from '../dimensions';\nimport { calendarListData } from '../selectors/calendar-selectors';\nimport { createActiveTabSelector } from '../selectors/nav-selectors';\n@@ -290,6 +290,18 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nconst newTextToMeasure = InnerCalendar.textToMeasureFromListData(\nnewListData,\n);\n+ const newText =\n+ _differenceWith(_isEqual)(newTextToMeasure)(this.state.textToMeasure);\n+ if (newText.length !== 0) {\n+ // We set textHeights to null here since if a future set of text\n+ // came in before we completed text measurement that was a subset\n+ // of the earlier text, we would end up merging directly there, but\n+ // then when the measurement for the middle text came in it would\n+ // override the newer text heights.\n+ this.textHeights = null;\n+ this.setState({ textToMeasure: newTextToMeasure });\n+ return;\n+ }\nlet allTextAlreadyMeasured = false;\nif (this.textHeights) {\n@@ -303,24 +315,11 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nif (allTextAlreadyMeasured) {\nthis.mergeHeightsIntoListData(newListData);\n- return;\n}\n- const newText =\n- _difference(newTextToMeasure)(this.state.textToMeasure);\n- if (newText.length === 0) {\n- // Since we don't have everything in textHeights, but we do have\n- // everything in textToMeasure, we can conclude that we're just\n- // waiting for the measurement to complete and then we'll be good.\n- } else {\n- // We set textHeights to null here since if a future set of text\n- // came in before we completed text measurement that was a subset\n- // of the earlier text, we would end up merging directly there, but\n- // then when the measurement for the middle text came in it would\n- // override the newer text heights.\n- this.textHeights = null;\n- this.setState({ textToMeasure: newTextToMeasure });\n- }\n+ // If we don't have everything in textHeights, but we do have everything in\n+ // textToMeasure, we can conclude that we're just waiting for the\n+ // measurement to complete and then we'll be good.\n}\ncomponentWillUpdate(nextProps: Props, nextState: State) {\n@@ -502,7 +501,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n...item,\nentryInfo: {\n...item.entryInfo,\n- textHeight,\n+ textHeight: Math.ceil(textHeight),\n},\n};\n})(listData);\n@@ -621,7 +620,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n} else if (item.itemType === \"header\") {\nreturn 31;\n} else if (item.itemType === \"entryInfo\") {\n- const verticalPadding = Platform.OS === \"ios\" ? 21 : 20;\n+ const verticalPadding = 10;\nreturn verticalPadding + item.entryInfo.textHeight;\n} else if (item.itemType === \"footer\") {\nreturn 40;\n@@ -688,7 +687,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n<TextHeightMeasurer\ntextToMeasure={this.state.textToMeasure}\nallHeightsMeasuredCallback={this.allHeightsMeasured}\n- style={styles.text}\n+ style={entryStyles.text}\n/>\n<KeyboardAvoidingView\nbehavior={keyboardAvoidingViewBehavior}\n@@ -985,12 +984,6 @@ const styles = StyleSheet.create({\nfontWeight: 'bold',\ncolor: '#555555',\n},\n- text: {\n- left: 15,\n- right: 15,\n- fontSize: 16,\n- fontFamily: 'Arial',\n- },\nloadingIndicator: {\nflex: 1,\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -102,12 +102,12 @@ type Props = {\nsessionID: string,\n) => Promise<DeleteEntryResponse>,\n};\n-type State = {\n+type State = {|\ntext: string,\nloadingStatus: LoadingStatus,\nheight: number,\nthreadInfo: ThreadInfo,\n-};\n+|};\nclass InternalEntry extends React.Component<Props, State> {\nstatic propTypes = {\n@@ -142,7 +142,7 @@ class InternalEntry extends React.Component<Props, State> {\nthis.state = {\ntext: props.entryInfo.text,\nloadingStatus: \"inactive\",\n- height: props.entryInfo.textHeight + 10,\n+ height: props.entryInfo.textHeight,\n// On log out, it's possible for the thread to be deauthorized before\n// the log out animation completes. To avoid having rendering issues in\n// that case, we cache the threadInfo in state and don't reset it when the\n@@ -163,24 +163,23 @@ class InternalEntry extends React.Component<Props, State> {\n(nextProps.entryInfo.text !== this.props.entryInfo.text &&\nnextProps.entryInfo.text !== this.state.text) ||\n(nextProps.entryInfo.textHeight !== this.props.entryInfo.textHeight &&\n- nextProps.entryInfo.textHeight !== (this.state.height - 10))\n+ nextProps.entryInfo.textHeight !== this.state.height)\n) {\n- this.setState({\n+ this.guardedSetState({\ntext: nextProps.entryInfo.text,\n- height: nextProps.entryInfo.textHeight + 10,\n+ height: nextProps.entryInfo.textHeight,\n});\n}\nif (\nnextProps.threadInfo &&\n!_isEqual(nextProps.threadInfo)(this.state.threadInfo)\n) {\n- this.setState({ threadInfo: nextProps.threadInfo });\n+ this.guardedSetState({ threadInfo: nextProps.threadInfo });\n}\nif (!nextProps.focused && this.props.focused) {\nif (this.textInput) {\nthis.textInput.blur();\n}\n- this.onBlur();\n}\n}\n@@ -264,66 +263,77 @@ class InternalEntry extends React.Component<Props, State> {\n</View>\n);\n}\n- const entryStyle = { backgroundColor: `#${this.state.threadInfo.color}` };\n- const textStyle = {\n- color: darkColor ? 'white' : 'black',\n- height: this.state.height,\n+\n+ const textColor = darkColor ? 'white' : 'black';\n+ let textInput;\n+ if (focused) {\n+ const textInputStyle = {\n+ color: textColor,\n+ backgroundColor: `#${this.state.threadInfo.color}`,\n};\n- let text;\n- if (this.props.visible || focused) {\n- text = (\n+ const selectionColor = darkColor ? '#129AFF' : '#036AFF';\n+ textInput = (\n<TextInput\n- style={[styles.text, textStyle]}\n+ style={[styles.textInput, textInputStyle]}\nunderlineColorAndroid=\"transparent\"\nvalue={this.state.text}\nonChangeText={this.onChangeText}\nmultiline={true}\nonBlur={this.onBlur}\n- onFocus={this.onFocus}\n- onContentSizeChange={this.onContentSizeChange}\n+ selectionColor={selectionColor}\nref={this.textInputRef}\n/>\n);\n- } else {\n+ }\n+\n+ const textStyle = {\n+ color: textColor,\n+ };\nconst linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\n- text = (\n+ let rawText = this.state.text;\n+ if (Platform.OS === \"android\" && rawText.slice(-1) === \"\\n\") {\n+ rawText += \" \";\n+ }\n+ const text = (\n<Hyperlink linkDefault={true} linkStyle={linkStyle}>\n- <Text style={[styles.text, textStyle]}>\n- {this.state.text}\n+ <Text\n+ style={[styles.text, textStyle]}\n+ onLayout={this.onTextLayout}\n+ >\n+ {rawText}\n</Text>\n</Hyperlink>\n);\n- }\n- let entry;\n- if (Platform.OS === \"ios\") {\n- // On iOS, we can take the capture away from our child TextInput and\n- // everything still works properly - the keyboard pops open and cursor\n- // appears where the TextInput was pressed. Hooking in here allows us to\n- // speed up our response times to TextInput presses (as onFocus is\n- // painfully slow). On Android, the response time to TextInput onFocus is\n- // faster anyways, and plus stealing the capture here causes problems.\n- entry = (\n- <View\n- style={[styles.entry, entryStyle]}\n- onStartShouldSetResponderCapture={this.onStartShouldSetResponderCapture}\n- onResponderGrant={this.onFocus}\n- onResponderTerminationRequest={this.onResponderTerminationRequest}\n- onResponderTerminate={this.onResponderTerminate}\n- >\n+\n+ const textContainerStyle = {\n+ height: this.state.height,\n+ };\n+ const textContainer = (\n+ <View style={textContainerStyle}>\n{text}\n- {actionLinks}\n+ {textInput}\n</View>\n);\n- } else {\n- entry = (\n- <View style={[styles.entry, entryStyle]}>\n- {text}\n+\n+ const entryStyle = { backgroundColor: `#${this.state.threadInfo.color}` };\n+ const opacity = focused ? 1.0 : 0.6;\n+ const entry = (\n+ <Button\n+ onPress={this.onFocus}\n+ style={[styles.entry, entryStyle]}\n+ androidFormat=\"opacity\"\n+ iosActiveOpacity={opacity}\n+ >\n+ {textContainer}\n{actionLinks}\n+ </Button>\n+ );\n+ return (\n+ <View style={styles.container}>\n+ {entry}\n</View>\n);\n}\n- return <View style={styles.container}>{entry}</View>;\n- }\ntextInputRef = (textInput: ?TextInput) => {\nthis.textInput = textInput;\n@@ -334,15 +344,6 @@ class InternalEntry extends React.Component<Props, State> {\nonFocus = () => this.props.onFocus(entryKey(this.props.entryInfo), true);\n- onStartShouldSetResponderCapture = (\n- event: { nativeEvent: { pageY: number } },\n- ) => event.nativeEvent.pageY < this.state.height + 5;\n-\n- onResponderTerminationRequest = () => true;\n-\n- onResponderTerminate =\n- () => this.props.onFocus(entryKey(this.props.entryInfo), false);\n-\nonBlur = () => {\nif (this.state.text.trim() === \"\") {\nthis.delete(this.props.entryInfo.id);\n@@ -357,16 +358,12 @@ class InternalEntry extends React.Component<Props, State> {\nthis.props.onFocus(entryKey(this.props.entryInfo), false);\n}\n- onContentSizeChange = (\n- event: { nativeEvent: { contentSize: { height: number }}},\n+ onTextLayout = (\n+ event: { nativeEvent: { layout: { height: number }}},\n) => {\n- if (!InternalEntry.isFocused(this.props)) {\n- return;\n- }\n- let height = event.nativeEvent.contentSize.height;\n- // iOS doesn't include the margin on this callback\n- height = Platform.OS === \"ios\" ? height + 10 : height + 5;\n- this.guardedSetState({ height });\n+ this.guardedSetState({\n+ height: Math.ceil(event.nativeEvent.layout.height),\n+ });\n}\nonChangeText = (newText: string) => {\n@@ -564,10 +561,21 @@ const styles = StyleSheet.create({\ntext: {\nfontSize: 16,\npaddingTop: 5,\n- paddingBottom: 4,\n+ paddingBottom: 6,\npaddingLeft: 10,\npaddingRight: 10,\n- marginBottom: 1,\n+ color: '#333333',\n+ fontFamily: 'Arial',\n+ },\n+ textInput: {\n+ position: 'absolute',\n+ top: Platform.OS === \"android\" ? 5 : 0,\n+ bottom: Platform.OS === \"android\" ? 6 : 0,\n+ left: 10,\n+ right: 10,\n+ padding: 0,\n+ margin: 0,\n+ fontSize: 16,\ncolor: '#333333',\nfontFamily: 'Arial',\n},\n@@ -643,4 +651,5 @@ const Entry = connect(\nexport {\nInternalEntry,\nEntry,\n+ styles as entryStyles,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/button.react.js",
"new_path": "native/components/button.react.js",
"diff": "@@ -29,6 +29,7 @@ type Props = {\nchildren?: React.Node,\nandroidBorderlessRipple: bool,\niosFormat: \"highlight\" | \"opacity\",\n+ androidFormat: \"ripple\" | \"highlight\" | \"opacity\",\niosHighlightUnderlayColor: string,\niosActiveOpacity: number,\n};\n@@ -45,12 +46,18 @@ class Button extends React.PureComponent<Props> {\n\"highlight\",\n\"opacity\",\n]),\n+ androidFormat: PropTypes.oneOf([\n+ \"ripple\",\n+ \"highlight\",\n+ \"opacity\",\n+ ]),\niosHighlightUnderlayColor: PropTypes.string,\niosActiveOpacity: PropTypes.number,\n};\nstatic defaultProps = {\nandroidBorderlessRipple: false,\niosFormat: \"opacity\",\n+ androidFormat: \"ripple\",\niosHighlightUnderlayColor: \"#CCCCCCDD\",\niosActiveOpacity: 0.2,\n};\n@@ -58,6 +65,7 @@ class Button extends React.PureComponent<Props> {\nrender() {\nif (\nPlatform.OS === \"android\" &&\n+ this.props.androidFormat === \"ripple\" &&\nPlatform.Version >= ANDROID_VERSION_LOLLIPOP\n) {\nreturn (\n@@ -74,7 +82,14 @@ class Button extends React.PureComponent<Props> {\n</View>\n</TouchableNativeFeedback>\n);\n- } else if (this.props.iosFormat === \"highlight\") {\n+ }\n+ let format = \"opacity\";\n+ if (Platform.OS === \"ios\") {\n+ format = this.props.iosFormat;\n+ } else if (Platform.OS === \"android\" && this.props.androidFormat !== \"ripple\") {\n+ format = this.props.androidFormat;\n+ }\n+ if (format === \"highlight\") {\nconst underlayColor = this.props.iosHighlightUnderlayColor;\nconst child = this.props.children ? this.props.children : <View />;\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/text-height-measurer.react.js",
"new_path": "native/text-height-measurer.react.js",
"diff": "@@ -6,9 +6,12 @@ import type {\nimport React from 'react';\nimport PropTypes from 'prop-types';\n-import { Text, View, StyleSheet } from 'react-native';\n+import { Text, View, StyleSheet, Platform } from 'react-native';\nimport invariant from 'invariant';\nimport _isEmpty from 'lodash/fp/isEmpty';\n+import _intersectionWith from 'lodash/fp/intersectionWith';\n+import _differenceWith from 'lodash/fp/differenceWith';\n+import _isEqual from 'lodash/fp/isEqual';\nconst measureBatchSize = 50;\n@@ -62,25 +65,34 @@ class TextHeightMeasurer extends React.PureComponent<Props, State> {\n}\n// resets this.leftToMeasure and this.nextTextToHeight\n- resetInternalState(newTextToMeasure: TextToMeasure[]) {\n+ resetInternalState(nextTextToMeasure: TextToMeasure[]) {\nthis.leftToMeasure = new Set();\nconst nextNextTextToHeight = new Map();\n+\n+ const newTextToMeasure =\n+ _differenceWith(_isEqual)(nextTextToMeasure)(this.props.textToMeasure);\nfor (let textToMeasure of newTextToMeasure) {\n+ this.leftToMeasure.add(textToMeasure);\n+ }\n+\n+ const existingTextToMeasure =\n+ _intersectionWith(_isEqual)(nextTextToMeasure)(this.props.textToMeasure);\n+ for (let textToMeasure of existingTextToMeasure) {\nconst id = textToMeasure.id;\n- const current = this.currentTextToHeight.get(id);\n- if (current) {\n- nextNextTextToHeight.set(id, current);\n- } else if (this.nextTextToHeight && this.nextTextToHeight.has(id)) {\n- const currentNext = this.nextTextToHeight.get(id);\n- invariant(currentNext, \"has() check said it had it!\");\n- nextNextTextToHeight.set(id, currentNext);\n+ const existingTextToHeight = this.nextTextToHeight\n+ ? this.nextTextToHeight\n+ : this.currentTextToHeight;\n+ const measuredHeight = existingTextToHeight.get(id);\n+ if (measuredHeight !== undefined) {\n+ nextNextTextToHeight.set(id, measuredHeight);\n} else {\nthis.leftToMeasure.add(textToMeasure);\n}\n}\n+\nthis.nextTextToHeight = nextNextTextToHeight;\nif (this.leftToMeasure.size === 0) {\n- this.done(newTextToMeasure);\n+ this.done(nextTextToMeasure);\n} else {\nthis.newBatch();\n}\n@@ -141,13 +153,17 @@ class TextHeightMeasurer extends React.PureComponent<Props, State> {\nconst dummies = Array.from(set).map((textToMeasure: TextToMeasure) => {\nconst style = textToMeasure.style ? textToMeasure.style : this.props.style;\ninvariant(style, \"style should exist for every text being measured!\");\n+ const text =\n+ Platform.OS === \"android\" && textToMeasure.text.slice(-1) === \"\\n\"\n+ ? `${textToMeasure.text} `\n+ : textToMeasure.text;\nreturn (\n<Text\nstyle={[styles.text, style]}\nonLayout={(event) => this.onTextLayout(textToMeasure, event)}\nkey={textToMeasure.id}\n>\n- {textToMeasure.text}\n+ {text}\n</Text>\n);\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Redo Entry selection logic |
129,187 | 21.02.2018 19:37:18 | 18,000 | 130b62ad964dd13c152222a1ea11eff0a84baed8 | Don't keep our own rehydrateConcluded property | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -733,7 +733,7 @@ const isForegroundSelector =\ncreateIsForegroundSelector(LoggedOutModalRouteName);\nconst LoggedOutModal = connect(\n(state: AppState) => ({\n- rehydrateConcluded: state.rehydrateConcluded,\n+ rehydrateConcluded: state._persist && state._persist.rehydrated,\ncookie: state.cookie,\nloggedIn: !!(state.currentUserInfo &&\n!state.currentUserInfo.anonymous && true),\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -42,7 +42,6 @@ import PropTypes from 'prop-types';\nimport NotificationsIOS from 'react-native-notifications';\nimport InAppNotification from 'react-native-in-app-notification';\nimport FCM, { FCMEvent } from 'react-native-fcm';\n-import { REHYDRATE } from 'redux-persist';\nimport { registerConfig } from 'lib/utils/config';\nimport {\n@@ -177,9 +176,6 @@ class AppWithNavigationState extends React.PureComponent<Props> {\ninitialAndroidNotifHandled = false;\ncomponentDidMount() {\n- if (__DEV__ && Platform.OS === \"android\") {\n- this.props.dispatchActionPayload(REHYDRATE, null);\n- }\nNativeAppState.addEventListener('change', this.handleAppStateChange);\nthis.handleInitialURL();\nLinking.addEventListener('url', this.handleURLChange);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -6,6 +6,7 @@ import type { LoadingStatus } from 'lib/types/loading-types';\nimport type { CurrentUserInfo, UserInfo } from 'lib/types/user-types';\nimport type { MessageStore } from 'lib/types/message-types';\nimport type { NavInfo } from './navigation-setup';\n+import type { PersistState } from 'redux-persist/src/types';\nimport React from 'react';\nimport invariant from 'invariant';\n@@ -13,7 +14,7 @@ import thunk from 'redux-thunk';\nimport storage from 'redux-persist/lib/storage';\nimport { createStore, applyMiddleware } from 'redux';\nimport { composeWithDevTools } from 'redux-devtools-extension';\n-import { persistStore, persistReducer, REHYDRATE } from 'redux-persist';\n+import { persistStore, persistReducer } from 'redux-persist';\nimport PropTypes from 'prop-types';\nimport { NavigationActions } from 'react-navigation';\nimport {\n@@ -53,7 +54,7 @@ export type AppState = {|\ncookie: ?string,\ndeviceToken: ?string,\nthreadIDsToNotifIDs: {[threadID: string]: string[]},\n- rehydrateConcluded: bool,\n+ _persist: ?PersistState,\n|};\nconst defaultState = ({\n@@ -78,7 +79,7 @@ const defaultState = ({\ncookie: null,\ndeviceToken: null,\nthreadIDsToNotifIDs: {},\n- rehydrateConcluded: false,\n+ _persist: null,\n}: AppState);\nconst blacklist = __DEV__\n@@ -86,17 +87,15 @@ const blacklist = __DEV__\n'sessionID',\n'lastUserInteraction',\n'loadingStatuses',\n- 'rehydrateConcluded',\n]\n: [\n'sessionID',\n'lastUserInteraction',\n'loadingStatuses',\n- 'rehydrateConcluded',\n'navInfo',\n];\n-function reducer(state: AppState, action: *) {\n+function reducer(state: AppState = defaultState, action: *) {\nconst oldState = state;\nconst navInfo = reduceNavInfo(state, action);\nif (navInfo && navInfo !== state.navInfo) {\n@@ -115,26 +114,7 @@ function reducer(state: AppState, action: *) {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n- rehydrateConcluded: state.rehydrateConcluded,\n- };\n- }\n- if (action.type === REHYDRATE) {\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- threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n- rehydrateConcluded: true,\n+ _persist: state._persist,\n};\n}\nif (\n@@ -159,7 +139,7 @@ function reducer(state: AppState, action: *) {\nstate.threadIDsToNotifIDs,\naction.payload,\n),\n- rehydrateConcluded: state.rehydrateConcluded,\n+ _persist: state._persist,\n};\n}\n// These action type are handled by reduceNavInfo above\n@@ -207,7 +187,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n- rehydrateConcluded: state.rehydrateConcluded,\n+ _persist: state._persist,\n};\n}\nif (\n@@ -240,7 +220,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n- rehydrateConcluded: state.rehydrateConcluded,\n+ _persist: state._persist,\n};\n}\nreturn state;\n@@ -261,7 +241,7 @@ const store = createStore(\npersistConfig,\nreducer,\n),\n- defaultState,\n+ undefined,\ncomposeWithDevTools(\napplyMiddleware(thunk, reactNavigationMiddleware),\n),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't keep our own rehydrateConcluded property |
129,187 | 21.02.2018 20:16:23 | 18,000 | 88155d9e8e7e69101bba2888a92a00e8509b7b80 | Don't include the tab bar height as visible height in scrollToKey on iOS
The keyboard obscures it, but only on iOS, since the tab bar is at the bottom. | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -55,7 +55,7 @@ import { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport Modal from 'react-native-modal';\nimport { Entry, InternalEntry, entryStyles } from './entry.react';\n-import { contentVerticalOffset, windowHeight } from '../dimensions';\n+import { contentVerticalOffset, windowHeight, tabBarSize } from '../dimensions';\nimport { calendarListData } from '../selectors/calendar-selectors';\nimport { createActiveTabSelector } from '../selectors/nav-selectors';\nimport TextHeightMeasurer from '../text-height-measurer.react';\n@@ -63,7 +63,7 @@ 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 { iosKeyboardHeight } from '../dimensions';\n+import { iosKeyboardOffset } from '../dimensions';\nexport type EntryInfoWithHeight = EntryInfo & { textHeight: number };\ntype CalendarItemWithHeight =\n@@ -680,7 +680,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n? \"padding\"\n: undefined;\nconst keyboardVerticalOffset = Platform.OS === \"ios\"\n- ? iosKeyboardHeight\n+ ? iosKeyboardOffset\n: 0;\nreturn (\n<SafeAreaView forceInset={forceInset} style={styles.container}>\n@@ -712,9 +712,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nstatic flatListHeight() {\n- return Platform.OS === \"android\"\n- ? windowHeight - contentVerticalOffset - 50\n- : windowHeight - contentVerticalOffset - 49;\n+ return windowHeight - contentVerticalOffset - tabBarSize;\n}\nstatic initialScrollIndex(data: $ReadOnlyArray<CalendarItemWithHeight>) {\n@@ -811,8 +809,12 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nconst itemHeight = InnerCalendar.itemHeight(data[index]);\nconst entryAdditionalFocusHeight = Platform.OS === \"android\" ? 21 : 20;\nconst itemEnd = itemStart + itemHeight + entryAdditionalFocusHeight;\n- const visibleHeight = InnerCalendar.flatListHeight() -\n- keyboardHeight;\n+ let visibleHeight = InnerCalendar.flatListHeight() - keyboardHeight;\n+ // flatListHeight() factors in the size of the iOS tab bar, but it is hidden\n+ // by the keyboard since it is at the bottom\n+ if (Platform.OS === \"ios\") {\n+ visibleHeight += tabBarSize;\n+ }\ninvariant(\nthis.currentScrollPosition !== undefined &&\nthis.currentScrollPosition !== null,\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,7 @@ 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 { iosKeyboardHeight } from '../dimensions';\n+import { iosKeyboardOffset } from '../dimensions';\nconst floatingActions = [{\ntext: 'Compose',\n@@ -227,7 +227,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardHeight}\n+ keyboardVerticalOffset={iosKeyboardOffset}\n>{content}</KeyboardAvoidingView>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -70,7 +70,7 @@ 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 { iosKeyboardHeight } from '../dimensions';\n+import { iosKeyboardOffset } from '../dimensions';\nimport ThreadVisibility from '../components/thread-visibility.react';\nconst tagInputProps = {\n@@ -333,7 +333,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardHeight}\n+ keyboardVerticalOffset={iosKeyboardOffset}\n>{content}</KeyboardAvoidingView>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -62,7 +62,7 @@ import MessageListHeaderTitle from './message-list-header-title.react';\nimport MessageListHeader from './message-list-header.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport ThreadSettingsButton from './thread-settings-button.react';\n-import { iosKeyboardHeight } from '../dimensions';\n+import { iosKeyboardOffset } from '../dimensions';\ntype NavProp = NavigationScreenProp<NavigationRoute>\n& { state: { params: { threadInfo: ThreadInfo } } };\n@@ -477,7 +477,7 @@ class InnerMessageList extends React.PureComponent<Props, State> {\nconst behavior = Platform.OS === \"ios\" ? \"padding\" : undefined;\nconst keyboardVerticalOffset = Platform.OS === \"ios\"\n- ? iosKeyboardHeight\n+ ? iosKeyboardOffset\n: 0;\nreturn (\n<KeyboardAvoidingView\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -57,7 +57,7 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport UserList from '../../components/user-list.react';\nimport TagInput from '../../components/tag-input.react';\nimport Button from '../../components/button.react';\n-import { iosKeyboardHeight } from '../../dimensions';\n+import { iosKeyboardOffset } from '../../dimensions';\nconst tagInputProps = {\nplaceholder: \"Select users to add\",\n@@ -241,7 +241,7 @@ class AddUsersModal extends React.PureComponent<Props, State> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardHeight}\n+ keyboardVerticalOffset={iosKeyboardOffset}\n>{content}</KeyboardAvoidingView>\n);\n} else {\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": "@@ -18,7 +18,7 @@ import IonIcon from 'react-native-vector-icons/Ionicons';\nimport { visibilityRules } from 'lib/types/thread-types';\n-import { iosKeyboardHeight } from '../../dimensions';\n+import { iosKeyboardOffset } from '../../dimensions';\nimport Button from '../../components/button.react';\nimport { ComposeThreadRouteName } from '../compose-thread.react';\n@@ -75,7 +75,7 @@ class ComposeSubthreadModal extends React.PureComponent<Props> {\n<KeyboardAvoidingView\nstyle={styles.container}\nbehavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardHeight}\n+ keyboardVerticalOffset={iosKeyboardOffset}\n>{content}</KeyboardAvoidingView>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/dimensions.js",
"new_path": "native/dimensions.js",
"diff": "@@ -18,11 +18,14 @@ if (Platform.OS === \"ios\") {\ncontentVerticalOffset = DeviceInfo.isIPhoneX_deprecated ? 44 : 20;\n}\n-const iosKeyboardHeight = DeviceInfo.isIPhoneX_deprecated ? 89 : 65;\n+const iosKeyboardOffset = DeviceInfo.isIPhoneX_deprecated ? 89 : 65;\n+\n+const tabBarSize = Platform.OS === \"android\" ? 50 : 49;\nexport {\nwindowHeight,\nwindowWidth,\ncontentVerticalOffset,\n- iosKeyboardHeight,\n+ iosKeyboardOffset,\n+ tabBarSize,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't include the tab bar height as visible height in scrollToKey on iOS
The keyboard obscures it, but only on iOS, since the tab bar is at the bottom. |
129,187 | 21.02.2018 21:49:42 | 18,000 | c7975665c150f91303b6269eed03ab55915baa92 | Introduce separate "editing" mode from "focused" mode for Entry on native | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -958,7 +958,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nconst entryKey = entryKeys[0];\nconst entryRef = this.entryRefs.get(entryKey);\nif (entryRef) {\n- entryRef.saveFromInputBar();\n+ entryRef.save();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -18,7 +18,7 @@ import type {\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { NavigationParams, NavigationAction } from 'react-navigation';\n-import React from 'react';\n+import * as React from 'react';\nimport {\nView,\nText,\n@@ -103,6 +103,7 @@ type Props = {\n) => Promise<DeleteEntryResponse>,\n};\ntype State = {|\n+ editing: bool,\ntext: string,\nloadingStatus: LoadingStatus,\nheight: number,\n@@ -140,6 +141,7 @@ class InternalEntry extends React.Component<Props, State> {\nsuper(props);\ninvariant(props.threadInfo, \"should be set\");\nthis.state = {\n+ editing: false,\ntext: props.entryInfo.text,\nloadingStatus: \"inactive\",\nheight: props.entryInfo.textHeight,\n@@ -213,8 +215,13 @@ class InternalEntry extends React.Component<Props, State> {\nreturn props.focused || !props.entryInfo.id;\n}\n+ static isEditing(props: Props, state: State) {\n+ return (props.focused && state.editing) || !props.entryInfo.id;\n+ }\n+\nrender() {\nconst focused = InternalEntry.isFocused(this.props);\n+ const editing = InternalEntry.isEditing(this.props, this.state);\nconst darkColor = colorIsDark(this.state.threadInfo.color);\nlet actionLinks = null;\n@@ -222,17 +229,46 @@ class InternalEntry extends React.Component<Props, State> {\nconst actionLinksColor = darkColor ? '#D3D3D3' : '#808080';\nconst actionLinksTextStyle = { color: actionLinksColor };\nconst actionLinksUnderlayColor = darkColor ? \"#AAAAAA88\" : \"#CCCCCCDD\";\n+ let editButtonContent;\n+ if (this.state.editing) {\n+ editButtonContent = (\n+ <React.Fragment>\n+ <Icon\n+ name=\"check\"\n+ size={14}\n+ color={actionLinksColor}\n+ />\n+ <Text style={[styles.leftLinksText, actionLinksTextStyle]}>\n+ SAVE\n+ </Text>\n+ </React.Fragment>\n+ );\n+ } else {\n+ editButtonContent = (\n+ <React.Fragment>\n+ <Icon\n+ name=\"pencil\"\n+ size={12}\n+ color={actionLinksColor}\n+ style={styles.pencilIcon}\n+ />\n+ <Text style={[styles.leftLinksText, actionLinksTextStyle]}>\n+ EDIT\n+ </Text>\n+ </React.Fragment>\n+ );\n+ }\nactionLinks = (\n<View style={styles.actionLinks}>\n<View style={styles.leftLinks}>\n<Button\n- onPress={this.onPressDelete}\n+ onPress={this.delete}\niosFormat=\"highlight\"\niosHighlightUnderlayColor={actionLinksUnderlayColor}\niosActiveOpacity={0.85}\nstyle={styles.button}\n>\n- <View style={styles.deleteButtonContents}>\n+ <View style={styles.buttonContents}>\n<Icon\nname=\"close\"\nsize={14}\n@@ -243,6 +279,17 @@ class InternalEntry extends React.Component<Props, State> {\n</Text>\n</View>\n</Button>\n+ <Button\n+ onPress={this.onPressEdit}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor={actionLinksUnderlayColor}\n+ iosActiveOpacity={0.85}\n+ style={styles.button}\n+ >\n+ <View style={styles.buttonContents}>\n+ {editButtonContent}\n+ </View>\n+ </Button>\n</View>\n<View style={styles.rightLinks}>\n<Button\n@@ -266,7 +313,7 @@ class InternalEntry extends React.Component<Props, State> {\nconst textColor = darkColor ? 'white' : 'black';\nlet textInput;\n- if (focused) {\n+ if (editing) {\nconst textInputStyle = {\ncolor: textColor,\nbackgroundColor: `#${this.state.threadInfo.color}`,\n@@ -316,10 +363,10 @@ class InternalEntry extends React.Component<Props, State> {\n);\nconst entryStyle = { backgroundColor: `#${this.state.threadInfo.color}` };\n- const opacity = focused ? 1.0 : 0.6;\n+ const opacity = editing ? 1.0 : 0.6;\nconst entry = (\n<Button\n- onPress={this.onFocus}\n+ onPress={this.focus}\nstyle={[styles.entry, entryStyle]}\nandroidFormat=\"opacity\"\niosActiveOpacity={opacity}\n@@ -342,20 +389,25 @@ class InternalEntry extends React.Component<Props, State> {\n}\n}\n- onFocus = () => this.props.onFocus(entryKey(this.props.entryInfo), true);\n+ focus = () => this.props.onFocus(entryKey(this.props.entryInfo), true);\n+\n+ blur = () => {\n+ this.setState({ editing: false });\n+ this.props.onFocus(entryKey(this.props.entryInfo), false);\n+ }\nonBlur = () => {\nif (this.state.text.trim() === \"\") {\n- this.delete(this.props.entryInfo.id);\n+ this.dispatchDelete(this.props.entryInfo.id);\n} else if (this.props.entryInfo.text !== this.state.text) {\n- this.save(this.props.entryInfo.id, this.state.text);\n+ this.dispatchSave(this.props.entryInfo.id, this.state.text);\n}\n- this.props.onFocus(entryKey(this.props.entryInfo), false);\n+ this.blur();\n}\n- saveFromInputBar = () => {\n- this.save(this.props.entryInfo.id, this.state.text);\n- this.props.onFocus(entryKey(this.props.entryInfo), false);\n+ save = () => {\n+ this.dispatchSave(this.props.entryInfo.id, this.state.text);\n+ this.blur();\n}\nonTextLayout = (\n@@ -370,7 +422,7 @@ class InternalEntry extends React.Component<Props, State> {\nthis.guardedSetState({ text: newText });\n}\n- save(serverID: ?string, newText: string) {\n+ dispatchSave(serverID: ?string, newText: string) {\nif (this.currentlySaving === newText) {\nreturn;\n}\n@@ -434,11 +486,11 @@ class InternalEntry extends React.Component<Props, State> {\nthis.creating = false;\nif (this.needsUpdateAfterCreation) {\nthis.needsUpdateAfterCreation = false;\n- this.save(response.entryID, this.state.text);\n+ this.dispatchSave(response.entryID, this.state.text);\n}\nif (this.needsDeleteAfterCreation) {\nthis.needsDeleteAfterCreation = false;\n- this.delete(response.entryID);\n+ this.dispatchDelete(response.entryID);\n}\nreturn { ...response, localID };\n} catch(e) {\n@@ -490,11 +542,19 @@ class InternalEntry extends React.Component<Props, State> {\n}\n}\n- onPressDelete = () => {\n- this.delete(this.props.entryInfo.id);\n+ delete = () => {\n+ this.dispatchDelete(this.props.entryInfo.id);\n}\n- delete(serverID: ?string) {\n+ onPressEdit = () => {\n+ if (this.state.editing) {\n+ this.save();\n+ } else {\n+ this.setState({ editing: true });\n+ }\n+ }\n+\n+ dispatchDelete(serverID: ?string) {\nif (this.deleted) {\nreturn;\n}\n@@ -585,7 +645,7 @@ const styles = StyleSheet.create({\njustifyContent: 'space-between',\nmarginTop: -5,\n},\n- deleteButtonContents: {\n+ buttonContents: {\nflex: 1,\nflexDirection: 'row',\n},\n@@ -593,6 +653,7 @@ const styles = StyleSheet.create({\nflex: 1,\nflexDirection: 'row',\njustifyContent: 'flex-start',\n+ paddingHorizontal: 5,\n},\nleftLinksText: {\npaddingLeft: 5,\n@@ -603,14 +664,14 @@ const styles = StyleSheet.create({\nflex: 1,\nflexDirection: 'row',\njustifyContent: 'flex-end',\n+ paddingHorizontal: 5,\n},\nrightLinksText: {\nfontWeight: 'bold',\nfontSize: 12,\n},\nbutton: {\n- paddingHorizontal: 10,\n- paddingVertical: 5,\n+ padding: 5,\n},\ndarkLinkText: {\ncolor: \"#036AFF\",\n@@ -620,6 +681,9 @@ const styles = StyleSheet.create({\ncolor: \"#129AFF\",\ntextDecorationLine: \"underline\",\n},\n+ pencilIcon: {\n+ paddingTop: 1,\n+ },\n});\nregisterFetchKey(saveEntryActionTypes);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -241,7 +241,7 @@ const store = createStore(\npersistConfig,\nreducer,\n),\n- undefined,\n+ defaultState,\ncomposeWithDevTools(\napplyMiddleware(thunk, reactNavigationMiddleware),\n),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Introduce separate "editing" mode from "focused" mode for Entry on native |
129,187 | 21.02.2018 23:46:27 | 18,000 | c560e011cbc47e4e5ba0ccc5a8b2d38e3f1f34bb | Use redux-persist's createMigrate for state versioning and migration | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/redux-migrations.js",
"diff": "+// @flow\n+\n+const migrations = {\n+ /** example\n+ [0]: (state) => ({\n+ ...state,\n+ test: \"hello\",\n+ }), **/\n+};\n+\n+export default migrations;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -14,7 +14,7 @@ import thunk from 'redux-thunk';\nimport storage from 'redux-persist/lib/storage';\nimport { createStore, applyMiddleware } from 'redux';\nimport { composeWithDevTools } from 'redux-devtools-extension';\n-import { persistStore, persistReducer } from 'redux-persist';\n+import { persistStore, persistReducer, createMigrate } from 'redux-persist';\nimport PropTypes from 'prop-types';\nimport { NavigationActions } from 'react-navigation';\nimport {\n@@ -38,6 +38,7 @@ import {\nclearAndroidNotificationActionType,\nreduceThreadIDsToNotifIDs,\n} from './push/android';\n+import migrations from './redux-migrations';\nexport type AppState = {|\nnavInfo: NavInfo,\n@@ -231,6 +232,8 @@ const persistConfig = {\nstorage,\nblacklist,\ndebug: __DEV__,\n+ version: 0,\n+ migrate: createMigrate(migrations, { debug: __DEV__ }),\n};\nconst reactNavigationMiddleware = createReactNavigationReduxMiddleware(\n\"root\",\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use redux-persist's createMigrate for state versioning and migration |
129,187 | 22.02.2018 17:15:29 | 18,000 | 02344c3a19380cba79cca2321cbb2e94e0ca4be2 | Enter edit mode immediately when creating a new entry on native | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -84,7 +84,7 @@ type CalendarItemWithHeight =\ndateString: string,\n};\ntype ExtraData = {\n- focusedEntries: {[key: string]: bool},\n+ activeEntries: {[key: string]: bool},\nvisibleEntries: {[key: string]: bool},\n};\n@@ -205,7 +205,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n? InnerCalendar.textToMeasureFromListData(props.listData)\n: [];\nthis.latestExtraData = {\n- focusedEntries: {},\n+ activeEntries: {},\nvisibleEntries: {},\n};\nthis.state = {\n@@ -276,7 +276,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nif (!newListData) {\nthis.latestExtraData = {\n- focusedEntries: {},\n+ activeEntries: {},\nvisibleEntries: {},\n};\nthis.setState({\n@@ -548,9 +548,10 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nreturn (\n<Entry\nentryInfo={item.entryInfo}\n- focused={!!this.state.extraData.focusedEntries[key]}\n+ active={!!this.state.extraData.activeEntries[key]}\nvisible={!!this.state.extraData.visibleEntries[key]}\n- onFocus={this.onEntryFocus}\n+ makeActive={this.makeActive}\n+ onEnterEditMode={this.onEnterEntryEditMode}\nnavigate={this.props.navigation.navigate}\nentryRef={this.entryRef}\n/>\n@@ -738,45 +739,49 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nthis.entryRefs.set(entryKey, entry);\n}\n- onEntryFocus = (key: string, focused: bool) => {\n+ makeActive = (key: string, focused: bool) => {\nif (!focused) {\n- if (_size(this.state.extraData.focusedEntries) === 0) {\n- if (_size(this.latestExtraData.focusedEntries) !== 0) {\n+ if (_size(this.state.extraData.activeEntries) === 0) {\n+ if (_size(this.latestExtraData.activeEntries) !== 0) {\nthis.latestExtraData = {\nvisibleEntries: this.latestExtraData.visibleEntries,\n- focusedEntries: this.state.extraData.focusedEntries,\n+ activeEntries: this.state.extraData.activeEntries,\n};\n}\nreturn;\n}\nthis.latestExtraData = {\nvisibleEntries: this.latestExtraData.visibleEntries,\n- focusedEntries: {},\n+ activeEntries: {},\n};\nthis.setState({ extraData: this.latestExtraData });\nreturn;\n}\nif (\n- _size(this.state.extraData.focusedEntries) === 1 &&\n- this.state.extraData.focusedEntries[key]\n+ _size(this.state.extraData.activeEntries) === 1 &&\n+ this.state.extraData.activeEntries[key]\n) {\nif (\n- _size(this.latestExtraData.focusedEntries) !== 1 ||\n- !this.latestExtraData.focusedEntries[key]\n+ _size(this.latestExtraData.activeEntries) !== 1 ||\n+ !this.latestExtraData.activeEntries[key]\n) {\nthis.latestExtraData = {\nvisibleEntries: this.latestExtraData.visibleEntries,\n- focusedEntries: this.state.extraData.focusedEntries,\n+ activeEntries: this.state.extraData.activeEntries,\n};\n}\nreturn;\n}\nthis.latestExtraData = {\nvisibleEntries: this.latestExtraData.visibleEntries,\n- focusedEntries: { [key]: true },\n+ activeEntries: { [key]: true },\n};\nthis.setState({ extraData: this.latestExtraData });\n+ }\n+\n+ onEnterEntryEditMode = (entryInfo: EntryInfoWithHeight) => {\n+ const key = entryKey(entryInfo);\nconst keyboardShownHeight = this.keyboardShownHeight;\nif (keyboardShownHeight) {\nthis.scrollToKey(key, keyboardShownHeight);\n@@ -787,10 +792,11 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nkeyboardShow = (event: KeyboardEvent) => {\nconst inputBarHeight = Platform.OS === \"android\" ? 37.7 : 35.5;\n- this.keyboardShownHeight = event.endCoordinates.height + inputBarHeight;\n+ const keyboardShownHeight = event.endCoordinates.height + inputBarHeight;\n+ this.keyboardShownHeight = keyboardShownHeight;\nconst lastEntryKeyFocused = this.lastEntryKeyFocused;\nif (lastEntryKeyFocused) {\n- this.scrollToKey(lastEntryKeyFocused, this.keyboardShownHeight);\n+ this.scrollToKey(lastEntryKeyFocused, keyboardShownHeight);\nthis.lastEntryKeyFocused = null;\n}\n}\n@@ -867,8 +873,14 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\n}\nthis.latestExtraData = {\n- focusedEntries: _pickBy((_, key: string) => visibleEntries[key])\n- (this.latestExtraData.focusedEntries),\n+ activeEntries: _pickBy(\n+ (_, key: string) => {\n+ const item = _find\n+ (item => item.entryInfo && entryKey(item.entryInfo) === key)\n+ (this.state.listDataWithHeights);\n+ return visibleEntries[key] || (item && !item.id);\n+ },\n+ )(this.latestExtraData.activeEntries),\nvisibleEntries,\n};\n@@ -954,7 +966,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nonSaveEntry = () => {\n- const entryKeys = Object.keys(this.latestExtraData.focusedEntries);\n+ const entryKeys = Object.keys(this.latestExtraData.activeEntries);\nif (entryKeys.length === 0) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -76,8 +76,9 @@ import {\ntype Props = {\nentryInfo: EntryInfoWithHeight,\nvisible: bool,\n- focused: bool,\n- onFocus: (entryKey: string, focused: bool) => void,\n+ active: bool,\n+ makeActive: (entryKey: string, active: bool) => void,\n+ onEnterEditMode: (entryInfo: EntryInfoWithHeight) => void,\nnavigate: (\nrouteName: string,\nparams?: NavigationParams,\n@@ -114,8 +115,9 @@ class InternalEntry extends React.Component<Props, State> {\nstatic propTypes = {\nentryInfo: entryInfoPropType.isRequired,\nvisible: PropTypes.bool.isRequired,\n- focused: PropTypes.bool.isRequired,\n- onFocus: PropTypes.func.isRequired,\n+ active: PropTypes.bool.isRequired,\n+ makeActive: PropTypes.func.isRequired,\n+ onEnterEditMode: PropTypes.func.isRequired,\nnavigate: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\nsessionStartingPayload: PropTypes.func.isRequired,\n@@ -141,7 +143,7 @@ class InternalEntry extends React.Component<Props, State> {\nsuper(props);\ninvariant(props.threadInfo, \"should be set\");\nthis.state = {\n- editing: false,\n+ editing: InternalEntry.isFocused(props),\ntext: props.entryInfo.text,\nloadingStatus: \"inactive\",\nheight: props.entryInfo.textHeight,\n@@ -178,7 +180,7 @@ class InternalEntry extends React.Component<Props, State> {\n) {\nthis.guardedSetState({ threadInfo: nextProps.threadInfo });\n}\n- if (!nextProps.focused && this.props.focused) {\n+ if (!nextProps.active && this.props.active) {\nif (this.textInput) {\nthis.textInput.blur();\n}\n@@ -212,11 +214,11 @@ class InternalEntry extends React.Component<Props, State> {\n}\nstatic isFocused(props: Props) {\n- return props.focused || !props.entryInfo.id;\n+ return props.active || !props.entryInfo.id;\n}\nstatic isEditing(props: Props, state: State) {\n- return (props.focused && state.editing) || !props.entryInfo.id;\n+ return (props.active && state.editing) || !props.entryInfo.id;\n}\nrender() {\n@@ -230,7 +232,7 @@ class InternalEntry extends React.Component<Props, State> {\nconst actionLinksTextStyle = { color: actionLinksColor };\nconst actionLinksUnderlayColor = darkColor ? \"#AAAAAA88\" : \"#CCCCCCDD\";\nlet editButtonContent;\n- if (this.state.editing) {\n+ if (editing) {\neditButtonContent = (\n<React.Fragment>\n<Icon\n@@ -319,9 +321,11 @@ class InternalEntry extends React.Component<Props, State> {\nbackgroundColor: `#${this.state.threadInfo.color}`,\n};\nconst selectionColor = darkColor ? '#129AFF' : '#036AFF';\n+ // For why autoFocus is platform-dependant, see comment in enterEditMode\ntextInput = (\n<TextInput\nstyle={[styles.textInput, textInputStyle]}\n+ autoFocus={Platform.OS !== \"android\"}\nunderlineColorAndroid=\"transparent\"\nvalue={this.state.text}\nonChangeText={this.onChangeText}\n@@ -338,7 +342,10 @@ class InternalEntry extends React.Component<Props, State> {\n};\nconst linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\nlet rawText = this.state.text;\n- if (Platform.OS === \"android\" && rawText.slice(-1) === \"\\n\") {\n+ if (\n+ Platform.OS === \"android\" &&\n+ (rawText === \"\" || rawText.slice(-1) === \"\\n\")\n+ ) {\nrawText += \" \";\n}\nconst text = (\n@@ -366,7 +373,7 @@ class InternalEntry extends React.Component<Props, State> {\nconst opacity = editing ? 1.0 : 0.6;\nconst entry = (\n<Button\n- onPress={this.focus}\n+ onPress={this.setActive}\nstyle={[styles.entry, entryStyle]}\nandroidFormat=\"opacity\"\niosActiveOpacity={opacity}\n@@ -384,16 +391,25 @@ class InternalEntry extends React.Component<Props, State> {\ntextInputRef = (textInput: ?TextInput) => {\nthis.textInput = textInput;\n- if (textInput && InternalEntry.isFocused(this.props)) {\n+ if (textInput && InternalEntry.isEditing(this.props, this.state)) {\n+ this.enterEditMode(textInput);\n+ }\n+ }\n+\n+ enterEditMode = (textInput: TextInput) => {\n+ if (Platform.OS === \"android\") {\n+ // On Android autoFocus doesn't seem to work for some reason\nsetTimeout(textInput.focus, 400);\n}\n+ this.setActive();\n+ this.props.onEnterEditMode(this.props.entryInfo);\n}\n- focus = () => this.props.onFocus(entryKey(this.props.entryInfo), true);\n+ setActive = () => this.props.makeActive(entryKey(this.props.entryInfo), true);\n- blur = () => {\n+ setInactive = () => {\nthis.setState({ editing: false });\n- this.props.onFocus(entryKey(this.props.entryInfo), false);\n+ this.props.makeActive(entryKey(this.props.entryInfo), false);\n}\nonBlur = () => {\n@@ -402,12 +418,12 @@ class InternalEntry extends React.Component<Props, State> {\n} else if (this.props.entryInfo.text !== this.state.text) {\nthis.dispatchSave(this.props.entryInfo.id, this.state.text);\n}\n- this.blur();\n+ this.setInactive();\n}\nsave = () => {\nthis.dispatchSave(this.props.entryInfo.id, this.state.text);\n- this.blur();\n+ this.setInactive();\n}\nonTextLayout = (\n@@ -547,7 +563,7 @@ class InternalEntry extends React.Component<Props, State> {\n}\nonPressEdit = () => {\n- if (this.state.editing) {\n+ if (InternalEntry.isEditing(this.props, this.state)) {\nthis.save();\n} else {\nthis.setState({ editing: true });\n"
},
{
"change_type": "MODIFY",
"old_path": "native/text-height-measurer.react.js",
"new_path": "native/text-height-measurer.react.js",
"diff": "@@ -153,10 +153,13 @@ class TextHeightMeasurer extends React.PureComponent<Props, State> {\nconst dummies = Array.from(set).map((textToMeasure: TextToMeasure) => {\nconst style = textToMeasure.style ? textToMeasure.style : this.props.style;\ninvariant(style, \"style should exist for every text being measured!\");\n- const text =\n- Platform.OS === \"android\" && textToMeasure.text.slice(-1) === \"\\n\"\n- ? `${textToMeasure.text} `\n- : textToMeasure.text;\n+ let text = textToMeasure.text;\n+ if (\n+ Platform.OS === \"android\" &&\n+ (text === \"\" || text.slice(-1) === \"\\n\")\n+ ) {\n+ text += \" \";\n+ }\nreturn (\n<Text\nstyle={[styles.text, style]}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Enter edit mode immediately when creating a new entry on native |
129,187 | 22.02.2018 19:48:17 | 18,000 | 87d095df70dd895aaf7159c170ebf2b8f18c2b08 | index.ios.js/index.android.js -> index.js | [
{
"change_type": "MODIFY",
"old_path": "native/__tests__/index.android.js",
"new_path": "native/__tests__/index.android.js",
"diff": "import 'react-native';\nimport React from 'react';\n-import Index from '../index.android.js';\n+import Index from '../index.js';\n// Note: test renderer must be required after react-native.\nimport renderer from 'react-test-renderer';\n"
},
{
"change_type": "MODIFY",
"old_path": "native/__tests__/index.ios.js",
"new_path": "native/__tests__/index.ios.js",
"diff": "import 'react-native';\nimport React from 'react';\n-import Index from '../index.ios.js';\n+import Index from '../index.js';\n// Note: test renderer must be required after react-native.\nimport renderer from 'react-test-renderer';\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -17,7 +17,7 @@ import com.android.build.OutputFile\n* bundleAssetName: \"index.android.bundle\",\n*\n* // the entry file for bundle generation\n- * entryFile: \"index.android.js\",\n+ * entryFile: \"index.js\",\n*\n* // whether to bundle JS and assets in debug mode\n* bundleInDebug: false,\n@@ -73,6 +73,10 @@ import com.android.build.OutputFile\n* ]\n*/\n+project.ext.react = [\n+ entryFile: \"index.js\",\n+]\n+\napply from: \"../../node_modules/react-native/react.gradle\"\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java",
"new_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java",
"diff": "@@ -31,6 +31,11 @@ public class MainApplication extends Application implements ReactApplication {\nnew KeychainPackage()\n);\n}\n+\n+ @Override\n+ protected String getJSMainModuleName() {\n+ return \"index\";\n+ }\n};\n@Override\n"
},
{
"change_type": "DELETE",
"old_path": "native/index.ios.js",
"new_path": null,
"diff": "-// @flow\n-\n-import './app.react';\n"
},
{
"change_type": "RENAME",
"old_path": "native/index.android.js",
"new_path": "native/index.js",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/AppDelegate.m",
"new_path": "native/ios/SquadCal/AppDelegate.m",
"diff": "{\nNSURL *jsCodeLocation;\n- jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index.ios\" fallbackResource:nil];\n+ jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index\" fallbackResource:nil];\nRCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation\nmoduleName:@\"SquadCal\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | index.ios.js/index.android.js -> index.js |
129,187 | 23.02.2018 10:48:35 | 18,000 | 33ab967b6155d477a6cafe551479a54a9c78adfc | Prevent keyboard from dismissing whenever a new entry is created on iOS | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -120,7 +120,8 @@ type State = {\ntextToMeasure: TextToMeasure[],\nlistDataWithHeights: ?$ReadOnlyArray<CalendarItemWithHeight>,\nreadyToShowList: bool,\n- pickerOpenForDateString: ?string,\n+ threadPickerOpen: bool,\n+ pendingNewEntryDateString: ?string,\nextraData: ExtraData,\nscrollToOffsetAfterSuppressingKeyboardDismissal: ?number,\n};\n@@ -187,9 +188,9 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n// For some reason, we have to delay the scrollToToday call after the first\n// scroll upwards on Android. I don't know why. Might only be on the emulator.\nfirstScrollUpOnAndroidComplete = false;\n- // When an entry is focused, we make a note of which one was focused so that\n- // once the keyboard event happens, we know where to move the scrollPos to\n- lastEntryKeyFocused: ?string = null;\n+ // When an entry becomes active, we make a note of its key so that once the\n+ // keyboard event happens, we know where to move the scrollPos to\n+ lastEntryKeyActive: ?string = null;\nkeyboardShowListener: ?Object;\nkeyboardDismissListener: ?Object;\nkeyboardShownHeight: ?number = null;\n@@ -212,7 +213,8 @@ class InnerCalendar extends React.PureComponent<Props, State> {\ntextToMeasure,\nlistDataWithHeights: null,\nreadyToShowList: false,\n- pickerOpenForDateString: null,\n+ threadPickerOpen: false,\n+ pendingNewEntryDateString: null,\nextraData: this.latestExtraData,\nscrollToOffsetAfterSuppressingKeyboardDismissal: null,\n};\n@@ -588,7 +590,10 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nonAdd = (dayString: string) => {\nKeyboard.dismiss();\n- this.setState({ pickerOpenForDateString: dayString });\n+ this.setState({\n+ threadPickerOpen: true,\n+ pendingNewEntryDateString: dayString,\n+ });\n}\nstatic keyExtractor = (item: CalendarItemWithHeight) => {\n@@ -702,12 +707,12 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n<CalendarInputBar onSave={this.onSaveEntry} />\n</KeyboardAvoidingView>\n<Modal\n- isVisible={!!this.state.pickerOpenForDateString}\n+ isVisible={this.state.threadPickerOpen}\nonBackButtonPress={this.closePicker}\nonBackdropPress={this.closePicker}\n>\n<ThreadPicker\n- dateString={this.state.pickerOpenForDateString}\n+ dateString={this.state.pendingNewEntryDateString}\nclose={this.closePicker}\n/>\n</Modal>\n@@ -739,8 +744,8 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nthis.entryRefs.set(entryKey, entry);\n}\n- makeActive = (key: string, focused: bool) => {\n- if (!focused) {\n+ makeActive = (key: string, active: bool) => {\n+ if (!active) {\nif (_size(this.state.extraData.activeEntries) === 0) {\nif (_size(this.latestExtraData.activeEntries) !== 0) {\nthis.latestExtraData = {\n@@ -786,7 +791,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nif (keyboardShownHeight) {\nthis.scrollToKey(key, keyboardShownHeight);\n} else {\n- this.lastEntryKeyFocused = key;\n+ this.lastEntryKeyActive = key;\n}\n}\n@@ -794,10 +799,10 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nconst inputBarHeight = Platform.OS === \"android\" ? 37.7 : 35.5;\nconst keyboardShownHeight = event.endCoordinates.height + inputBarHeight;\nthis.keyboardShownHeight = keyboardShownHeight;\n- const lastEntryKeyFocused = this.lastEntryKeyFocused;\n- if (lastEntryKeyFocused) {\n- this.scrollToKey(lastEntryKeyFocused, keyboardShownHeight);\n- this.lastEntryKeyFocused = null;\n+ const lastEntryKeyActive = this.lastEntryKeyActive;\n+ if (lastEntryKeyActive) {\n+ this.scrollToKey(lastEntryKeyActive, keyboardShownHeight);\n+ this.lastEntryKeyActive = null;\n}\n}\n@@ -805,19 +810,19 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nthis.keyboardShownHeight = null;\n}\n- scrollToKey(lastEntryKeyFocused: string, keyboardHeight: number) {\n+ scrollToKey(lastEntryKeyActive: string, keyboardHeight: number) {\nconst data = this.state.listDataWithHeights;\ninvariant(data, \"should be set\");\nconst index = _findIndex(\n(item: CalendarItemWithHeight) =>\n- InnerCalendar.keyExtractor(item) === lastEntryKeyFocused,\n+ InnerCalendar.keyExtractor(item) === lastEntryKeyActive,\n)(data);\nconst itemStart = InnerCalendar.heightOfItems(\ndata.filter((_, i) => i < index),\n);\nconst itemHeight = InnerCalendar.itemHeight(data[index]);\n- const entryAdditionalFocusHeight = Platform.OS === \"android\" ? 21 : 20;\n- const itemEnd = itemStart + itemHeight + entryAdditionalFocusHeight;\n+ const entryAdditionalActiveHeight = Platform.OS === \"android\" ? 21 : 20;\n+ const itemEnd = itemStart + itemHeight + entryAdditionalActiveHeight;\nlet visibleHeight = InnerCalendar.flatListHeight() - keyboardHeight;\n// flatListHeight() factors in the size of the iOS tab bar, but it is hidden\n// by the keyboard since it is at the bottom\n@@ -962,7 +967,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n}\nclosePicker = () => {\n- this.setState({ pickerOpenForDateString: null });\n+ this.setState({ threadPickerOpen: false });\n}\nonSaveEntry = () => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -29,6 +29,7 @@ import {\nAlert,\nLayoutAnimation,\nKeyboard,\n+ InteractionManager,\n} from 'react-native';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\n@@ -143,7 +144,7 @@ class InternalEntry extends React.Component<Props, State> {\nsuper(props);\ninvariant(props.threadInfo, \"should be set\");\nthis.state = {\n- editing: InternalEntry.isFocused(props),\n+ editing: InternalEntry.isActive(props),\ntext: props.entryInfo.text,\nloadingStatus: \"inactive\",\nheight: props.entryInfo.textHeight,\n@@ -162,8 +163,10 @@ class InternalEntry extends React.Component<Props, State> {\n}\ncomponentWillReceiveProps(nextProps: Props) {\n+ const wasActive = InternalEntry.isActive(this.props);\n+ const willBeActive = InternalEntry.isActive(nextProps);\nif (\n- !InternalEntry.isFocused(nextProps) &&\n+ !willBeActive &&\n(nextProps.entryInfo.text !== this.props.entryInfo.text &&\nnextProps.entryInfo.text !== this.state.text) ||\n(nextProps.entryInfo.textHeight !== this.props.entryInfo.textHeight &&\n@@ -180,12 +183,10 @@ class InternalEntry extends React.Component<Props, State> {\n) {\nthis.guardedSetState({ threadInfo: nextProps.threadInfo });\n}\n- if (!nextProps.active && this.props.active) {\n- if (this.textInput) {\n+ if (!willBeActive && wasActive && this.textInput) {\nthis.textInput.blur();\n}\n}\n- }\nshouldComponentUpdate(nextProps: Props, nextState: State) {\nconst omitEntryInfo = _omit([\"entryInfo\"]);\n@@ -195,10 +196,14 @@ class InternalEntry extends React.Component<Props, State> {\n}\ncomponentWillUpdate(nextProps: Props, nextState: State) {\n- if (\n- nextState.height !== this.state.height ||\n- InternalEntry.isFocused(nextProps) !== InternalEntry.isFocused(this.props)\n- ) {\n+ const wasActive = InternalEntry.isActive(this.props);\n+ const willBeActive = InternalEntry.isActive(nextProps);\n+ const wasEditing = InternalEntry.isEditing(this.props, this.state);\n+ const willBeEditing = InternalEntry.isEditing(nextProps, nextState);\n+ if (!willBeEditing && wasEditing && this.textInput) {\n+ this.textInput.blur();\n+ }\n+ if (nextState.height !== this.state.height || willBeActive !== wasActive) {\nLayoutAnimation.easeInEaseOut();\n}\n}\n@@ -213,7 +218,7 @@ class InternalEntry extends React.Component<Props, State> {\nthis.props.entryRef(entryKey(this.props.entryInfo), null);\n}\n- static isFocused(props: Props) {\n+ static isActive(props: Props) {\nreturn props.active || !props.entryInfo.id;\n}\n@@ -222,12 +227,12 @@ class InternalEntry extends React.Component<Props, State> {\n}\nrender() {\n- const focused = InternalEntry.isFocused(this.props);\n+ const active = InternalEntry.isActive(this.props);\nconst editing = InternalEntry.isEditing(this.props, this.state);\nconst darkColor = colorIsDark(this.state.threadInfo.color);\nlet actionLinks = null;\n- if (focused) {\n+ if (active) {\nconst actionLinksColor = darkColor ? '#D3D3D3' : '#808080';\nconst actionLinksTextStyle = { color: actionLinksColor };\nconst actionLinksUnderlayColor = darkColor ? \"#AAAAAA88\" : \"#CCCCCCDD\";\n@@ -321,11 +326,9 @@ class InternalEntry extends React.Component<Props, State> {\nbackgroundColor: `#${this.state.threadInfo.color}`,\n};\nconst selectionColor = darkColor ? '#129AFF' : '#036AFF';\n- // For why autoFocus is platform-dependant, see comment in enterEditMode\ntextInput = (\n<TextInput\nstyle={[styles.textInput, textInputStyle]}\n- autoFocus={Platform.OS !== \"android\"}\nunderlineColorAndroid=\"transparent\"\nvalue={this.state.text}\nonChangeText={this.onChangeText}\n@@ -397,12 +400,13 @@ class InternalEntry extends React.Component<Props, State> {\n}\nenterEditMode = (textInput: TextInput) => {\n- if (Platform.OS === \"android\") {\n- // On Android autoFocus doesn't seem to work for some reason\n- setTimeout(textInput.focus, 400);\n- }\nthis.setActive();\nthis.props.onEnterEditMode(this.props.entryInfo);\n+ // For some reason if we don't do this the keyboard immediately dismisses\n+ // after focus\n+ InteractionManager.runAfterInteractions(() => {\n+ setTimeout(textInput.focus);\n+ });\n}\nsetActive = () => this.props.makeActive(entryKey(this.props.entryInfo), true);\n@@ -445,8 +449,8 @@ class InternalEntry extends React.Component<Props, State> {\nthis.currentlySaving = newText;\nif (newText.trim() === \"\") {\n- // We don't save the empty string, since as soon as the element loses\n- // focus it'll get deleted\n+ // We don't save the empty string, since as soon as the element becomes\n+ // inactive it'll get deleted\nreturn;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Prevent keyboard from dismissing whenever a new entry is created on iOS |
129,187 | 23.02.2018 11:18:33 | 18,000 | c472eb5de98aad7020667eafffd942555e7dc43b | Set entries to inactive if calendar whitespace pressed on native | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -26,6 +26,7 @@ import {\nKeyboard,\nLayoutAnimation,\nKeyboardAvoidingView,\n+ TouchableWithoutFeedback,\n} from 'react-native';\nimport { SafeAreaView } from 'react-navigation';\nimport Icon from 'react-native-vector-icons/FontAwesome';\n@@ -544,7 +545,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nif (item.itemType === \"loader\") {\nreturn <ListLoadingIndicator />;\n} else if (item.itemType === \"header\") {\n- return InnerCalendar.renderSectionHeader(row);\n+ return this.renderSectionHeader(row);\n} else if (item.itemType === \"entryInfo\") {\nconst key = entryKey(item.entryInfo);\nreturn (\n@@ -555,6 +556,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nmakeActive={this.makeActive}\nonEnterEditMode={this.onEnterEntryEditMode}\nnavigate={this.props.navigation.navigate}\n+ onPressWhitespace={this.makeAllEntriesInactive}\nentryRef={this.entryRef}\n/>\n);\n@@ -564,27 +566,31 @@ class InnerCalendar extends React.PureComponent<Props, State> {\ninvariant(false, \"renderItem conditions should be exhaustive\");\n}\n- static renderSectionHeader = (row: { item: CalendarItemWithHeight }) => {\n+ renderSectionHeader = (row: { item: CalendarItemWithHeight }) => {\ninvariant(row.item.itemType === \"header\", \"itemType should be header\");\nlet date = prettyDate(row.item.dateString);\nif (dateString(new Date()) === row.item.dateString) {\ndate += \" (today)\";\n}\nreturn (\n+ <TouchableWithoutFeedback onPress={this.makeAllEntriesInactive}>\n<View style={styles.sectionHeader}>\n- <View>\n<Text style={styles.sectionHeaderText}>\n{date}\n</Text>\n</View>\n- </View>\n+ </TouchableWithoutFeedback>\n);\n}\nrenderSectionFooter = (row: { item: CalendarItemWithHeight }) => {\ninvariant(row.item.itemType === \"footer\", \"itemType should be footer\");\nreturn (\n- <SectionFooter dateString={row.item.dateString} onAdd={this.onAdd} />\n+ <SectionFooter\n+ dateString={row.item.dateString}\n+ onAdd={this.onAdd}\n+ onPressWhitespace={this.makeAllEntriesInactive}\n+ />\n);\n}\n@@ -744,8 +750,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nthis.entryRefs.set(entryKey, entry);\n}\n- makeActive = (key: string, active: bool) => {\n- if (!active) {\n+ makeAllEntriesInactive = () => {\nif (_size(this.state.extraData.activeEntries) === 0) {\nif (_size(this.latestExtraData.activeEntries) !== 0) {\nthis.latestExtraData = {\n@@ -760,6 +765,11 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nactiveEntries: {},\n};\nthis.setState({ extraData: this.latestExtraData });\n+ }\n+\n+ makeActive = (key: string, active: bool) => {\n+ if (!active) {\n+ this.makeAllEntriesInactive();\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -85,6 +85,7 @@ type Props = {\nparams?: NavigationParams,\naction?: NavigationAction,\n) => bool,\n+ onPressWhitespace: () => void,\nentryRef: (entryKey: string, entry: ?InternalEntry) => void,\n// Redux state\nthreadInfo: ThreadInfo,\n@@ -120,6 +121,8 @@ class InternalEntry extends React.Component<Props, State> {\nmakeActive: PropTypes.func.isRequired,\nonEnterEditMode: PropTypes.func.isRequired,\nnavigate: PropTypes.func.isRequired,\n+ onPressWhitespace: PropTypes.func.isRequired,\n+ entryRef: PropTypes.func.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\nsessionStartingPayload: PropTypes.func.isRequired,\nsessionID: PropTypes.func.isRequired,\n@@ -340,10 +343,6 @@ class InternalEntry extends React.Component<Props, State> {\n);\n}\n- const textStyle = {\n- color: textColor,\n- };\n- const linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\nlet rawText = this.state.text;\nif (\nPlatform.OS === \"android\" &&\n@@ -351,7 +350,21 @@ class InternalEntry extends React.Component<Props, State> {\n) {\nrawText += \" \";\n}\n- const text = (\n+ const textStyle = { color: textColor };\n+ const linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\n+ const textContainerStyle = { height: this.state.height };\n+ const entryStyle = { backgroundColor: `#${this.state.threadInfo.color}` };\n+ const opacity = editing ? 1.0 : 0.6;\n+ return (\n+ <TouchableWithoutFeedback onPress={this.props.onPressWhitespace}>\n+ <View style={styles.container}>\n+ <Button\n+ onPress={this.setActive}\n+ style={[styles.entry, entryStyle]}\n+ androidFormat=\"opacity\"\n+ iosActiveOpacity={opacity}\n+ >\n+ <View style={textContainerStyle}>\n<Hyperlink linkDefault={true} linkStyle={linkStyle}>\n<Text\nstyle={[styles.text, textStyle]}\n@@ -360,35 +373,12 @@ class InternalEntry extends React.Component<Props, State> {\n{rawText}\n</Text>\n</Hyperlink>\n- );\n-\n- const textContainerStyle = {\n- height: this.state.height,\n- };\n- const textContainer = (\n- <View style={textContainerStyle}>\n- {text}\n{textInput}\n</View>\n- );\n-\n- const entryStyle = { backgroundColor: `#${this.state.threadInfo.color}` };\n- const opacity = editing ? 1.0 : 0.6;\n- const entry = (\n- <Button\n- onPress={this.setActive}\n- style={[styles.entry, entryStyle]}\n- androidFormat=\"opacity\"\n- iosActiveOpacity={opacity}\n- >\n- {textContainer}\n{actionLinks}\n</Button>\n- );\n- return (\n- <View style={styles.container}>\n- {entry}\n</View>\n+ </TouchableWithoutFeedback>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/section-footer.react.js",
"new_path": "native/calendar/section-footer.react.js",
"diff": "@@ -5,6 +5,7 @@ import {\nView,\nText,\nStyleSheet,\n+ TouchableWithoutFeedback,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport PropTypes from 'prop-types';\n@@ -14,16 +15,19 @@ import Button from '../components/button.react';\ntype Props = {\ndateString: string,\nonAdd: (dateString: string) => void,\n+ onPressWhitespace: () => void,\n};\nclass SectionFooter extends React.PureComponent<Props> {\nstatic propTypes = {\ndateString: PropTypes.string.isRequired,\nonAdd: PropTypes.func.isRequired,\n+ onPressWhitespace: PropTypes.func.isRequired,\n};\nrender() {\nreturn (\n+ <TouchableWithoutFeedback onPress={this.props.onPressWhitespace}>\n<View style={styles.sectionFooter}>\n<Button\nonPress={this.onSubmit}\n@@ -37,6 +41,7 @@ class SectionFooter extends React.PureComponent<Props> {\n</View>\n</Button>\n</View>\n+ </TouchableWithoutFeedback>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Set entries to inactive if calendar whitespace pressed on native |
129,187 | 23.02.2018 18:09:26 | 18,000 | 424f20284050b4850bb3268ecf2cf400c81ac0d6 | Hopefully final calendar fixes | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -769,7 +769,21 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nmakeActive = (key: string, active: bool) => {\nif (!active) {\n- this.makeAllEntriesInactive();\n+ const activeKeys = Object.keys(this.latestExtraData.activeEntries);\n+ if (activeKeys.length === 0) {\n+ if (Object.keys(this.state.extraData.activeEntries).length !== 0) {\n+ this.setState({ extraData: this.latestExtraData });\n+ }\n+ return;\n+ }\n+ const activeKey = activeKeys[0];\n+ if (activeKey === key) {\n+ this.latestExtraData = {\n+ visibleEntries: this.latestExtraData.visibleEntries,\n+ activeEntries: {},\n+ };\n+ this.setState({ extraData: this.latestExtraData });\n+ }\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -186,8 +186,9 @@ class InternalEntry extends React.Component<Props, State> {\n) {\nthis.guardedSetState({ threadInfo: nextProps.threadInfo });\n}\n- if (!willBeActive && wasActive && this.textInput) {\n+ if (!nextProps.active && wasActive && this.textInput) {\nthis.textInput.blur();\n+ this.setInactive();\n}\n}\n@@ -236,7 +237,7 @@ class InternalEntry extends React.Component<Props, State> {\nconst darkColor = colorIsDark(this.state.threadInfo.color);\nlet actionLinks = null;\nif (active) {\n- const actionLinksColor = darkColor ? '#D3D3D3' : '#808080';\n+ const actionLinksColor = darkColor ? '#D3D3D3' : '#404040';\nconst actionLinksTextStyle = { color: actionLinksColor };\nconst actionLinksUnderlayColor = darkColor ? \"#AAAAAA88\" : \"#CCCCCCDD\";\nlet editButtonContent;\n@@ -344,10 +345,7 @@ class InternalEntry extends React.Component<Props, State> {\n}\nlet rawText = this.state.text;\n- if (\n- Platform.OS === \"android\" &&\n- (rawText === \"\" || rawText.slice(-1) === \"\\n\")\n- ) {\n+ if (rawText === \"\" || rawText.slice(-1) === \"\\n\") {\nrawText += \" \";\n}\nconst textStyle = { color: textColor };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Hopefully final calendar fixes |
129,187 | 24.02.2018 18:58:04 | 18,000 | ee6272daae1726f543ba715dff0febed4132c38b | Pass cookie in request body from call_node.php | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/activity-responders.js",
"new_path": "jserver/src/responders/activity-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type { Viewer } from '../session/viewer';\nimport type {\nActivityUpdate,\n@@ -31,10 +30,9 @@ const inputValidator = t.list(t.union([\nasync function updateActivityResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<UpdateActivityResult> {\n- const updates: $ReadOnlyArray<ActivityUpdate> = (req.body: any);\n+ const updates: $ReadOnlyArray<ActivityUpdate> = body;\nif (!inputValidator.is(updates)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/device-responders.js",
"new_path": "jserver/src/responders/device-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type { DeviceTokenUpdateRequest } from 'lib/types/device-types';\nimport type { Viewer } from '../session/viewer';\n@@ -18,10 +17,9 @@ const deviceTokenUpdateRequestInputValidator = tShape({\nasync function deviceTokenUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<void> {\n- const deviceTokenUpdateRequest: DeviceTokenUpdateRequest = (req.body: any);\n+ const deviceTokenUpdateRequest: DeviceTokenUpdateRequest = body;\nif (!deviceTokenUpdateRequestInputValidator.is(deviceTokenUpdateRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/entry-responders.js",
"new_path": "jserver/src/responders/entry-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type { Viewer } from '../session/viewer';\nimport type {\nCalendarQuery,\n@@ -39,10 +38,9 @@ const entryQueryInputValidator = tShape({\nasync function entryFetchResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<FetchEntryInfosResponse> {\n- const entryQuery: CalendarQuery = (req.body: any);\n+ const entryQuery: CalendarQuery = body;\nif (!entryQueryInputValidator.is(entryQuery)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -67,10 +65,9 @@ const entryRevisionHistoryFetchInputValidator = tShape({\nasync function entryRevisionFetchResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<FetchEntryRevisionInfosResult> {\n- const entryRevisionHistoryFetch: EntryRevisionHistoryFetch = (req.body: any);\n+ const entryRevisionHistoryFetch: EntryRevisionHistoryFetch = body;\nif (!entryRevisionHistoryFetchInputValidator.is(entryRevisionHistoryFetch)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -92,10 +89,9 @@ const createEntryRequestInputValidator = tShape({\nasync function entryCreationResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<SaveEntryResult> {\n- const createEntryRequest: CreateEntryRequest = (req.body: any);\n+ const createEntryRequest: CreateEntryRequest = body;\nif (!createEntryRequestInputValidator.is(createEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -113,10 +109,9 @@ const saveEntryRequestInputValidator = tShape({\nasync function entryUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<SaveEntryResult> {\n- const saveEntryRequest: SaveEntryRequest = (req.body: any);\n+ const saveEntryRequest: SaveEntryRequest = body;\nif (!saveEntryRequestInputValidator.is(saveEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -133,10 +128,9 @@ const deleteEntryRequestInputValidator = tShape({\nasync function entryDeletionResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<DeleteEntryResponse> {\n- const deleteEntryRequest: DeleteEntryRequest = (req.body: any);\n+ const deleteEntryRequest: DeleteEntryRequest = body;\nif (!deleteEntryRequestInputValidator.is(deleteEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -152,10 +146,9 @@ const restoreEntryRequestInputValidator = tShape({\nasync function entryRestorationResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<RestoreEntryResponse> {\n- const restoreEntryRequest: RestoreEntryRequest = (req.body: any);\n+ const restoreEntryRequest: RestoreEntryRequest = body;\nif (!restoreEntryRequestInputValidator.is(restoreEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/handlers.js",
"new_path": "jserver/src/responders/handlers.js",
"diff": "@@ -16,7 +16,7 @@ function jsonHandler(responder: Responder) {\nreturn async (req: $Request, res: $Response) => {\ntry {\nconst viewer = await fetchViewerFromRequest(req);\n- const result = await responder(viewer, req, res);\n+ const result = await responder(viewer, req.body.input);\nif (res.headersSent) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/message-responders.js",
"new_path": "jserver/src/responders/message-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type { Viewer } from '../session/viewer';\nimport {\nmessageType,\n@@ -29,10 +28,9 @@ const sendTextMessageRequestInputValidator = tShape({\nasync function textMessageCreationResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<SendTextMessageResponse> {\n- const sendTextMessageRequest: SendTextMessageRequest = (req.body: any);\n+ const sendTextMessageRequest: SendTextMessageRequest = body;\nif (!sendTextMessageRequestInputValidator.is(sendTextMessageRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -65,10 +63,9 @@ const fetchMessageInfosRequestInputValidator = tShape({\nasync function messageFetchResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<FetchMessageInfosResult> {\n- const fetchMessageInfosRequest: FetchMessageInfosRequest = (req.body: any);\n+ const fetchMessageInfosRequest: FetchMessageInfosRequest = body;\nif (!fetchMessageInfosRequestInputValidator.is(fetchMessageInfosRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/ping-responders.js",
"new_path": "jserver/src/responders/ping-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type { PingRequest, PingResponse } from 'lib/types/ping-types';\nimport { defaultNumberPerThread } from 'lib/types/message-types';\nimport type { Viewer } from '../session/viewer';\n@@ -26,10 +25,9 @@ const pingRequestInputValidator = tShape({\nasync function pingResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<PingResponse> {\n- const pingRequest: PingRequest = (req.body: any);\n+ const pingRequest: PingRequest = body;\nif (!pingRequestInputValidator.is(pingRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/search-responders.js",
"new_path": "jserver/src/responders/search-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type {\nUserSearchRequest,\nUserSearchResult,\n@@ -20,10 +19,9 @@ const userSearchRequestInputValidator = tShape({\nasync function userSearchResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<UserSearchResult> {\n- const userSearchRequest: UserSearchRequest = (req.body: any);\n+ const userSearchRequest: UserSearchRequest = body;\nif (!userSearchRequestInputValidator.is(userSearchRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/thread-responders.js",
"new_path": "jserver/src/responders/thread-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport {\ntype ThreadDeletionRequest,\ntype RoleChangeRequest,\n@@ -39,10 +38,9 @@ const threadDeletionRequestInputValidator = tShape({\nasync function threadDeletionResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<void> {\n- const threadDeletionRequest: ThreadDeletionRequest = (req.body: any);\n+ const threadDeletionRequest: ThreadDeletionRequest = body;\nif (!threadDeletionRequestInputValidator.is(threadDeletionRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -64,10 +62,9 @@ const roleChangeRequestInputValidator = tShape({\nasync function roleUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<ChangeThreadSettingsResult> {\n- const roleChangeRequest: RoleChangeRequest = (req.body: any);\n+ const roleChangeRequest: RoleChangeRequest = body;\nif (!roleChangeRequestInputValidator.is(roleChangeRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -82,10 +79,9 @@ const removeMembersRequestInputValidator = tShape({\nasync function memberRemovalResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<ChangeThreadSettingsResult> {\n- const removeMembersRequest: RemoveMembersRequest = (req.body: any);\n+ const removeMembersRequest: RemoveMembersRequest = body;\nif (!removeMembersRequestInputValidator.is(removeMembersRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -99,10 +95,9 @@ const leaveThreadRequestInputValidator = tShape({\nasync function threadLeaveResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<LeaveThreadResult> {\n- const leaveThreadRequest: LeaveThreadRequest = (req.body: any);\n+ const leaveThreadRequest: LeaveThreadRequest = body;\nif (!leaveThreadRequestInputValidator.is(leaveThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -126,10 +121,9 @@ const updateThreadRequestInputValidator = tShape({\nasync function threadUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<ChangeThreadSettingsResult> {\n- const updateThreadRequest: UpdateThreadRequest = (req.body: any);\n+ const updateThreadRequest: UpdateThreadRequest = body;\nif (!updateThreadRequestInputValidator.is(updateThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -148,10 +142,9 @@ const newThreadRequestInputValidator = tShape({\n});\nasync function threadCreationResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<NewThreadResult> {\n- const newThreadRequest: NewThreadRequest = (req.body: any);\n+ const newThreadRequest: NewThreadRequest = body;\nif (!newThreadRequestInputValidator.is(newThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -165,10 +158,9 @@ const joinThreadRequestInputValidator = tShape({\n});\nasync function threadJoinResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<ThreadJoinResult> {\n- const threadJoinRequest: ThreadJoinRequest = (req.body: any);\n+ const threadJoinRequest: ThreadJoinRequest = body;\nif (!joinThreadRequestInputValidator.is(threadJoinRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type {\nSubscriptionUpdateRequest,\nSubscriptionUpdateResponse,\n@@ -32,10 +31,9 @@ const subscriptionUpdateRequestInputValidator = tShape({\nasync function userSubscriptionUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<SubscriptionUpdateResponse> {\n- const subscriptionUpdateRequest: SubscriptionUpdateRequest = (req.body: any);\n+ const subscriptionUpdateRequest: SubscriptionUpdateRequest = body;\nif (!subscriptionUpdateRequestInputValidator.is(subscriptionUpdateRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -57,10 +55,9 @@ const accountUpdateInputValidator = tShape({\nasync function accountUpdateResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<void> {\n- const accountUpdate: AccountUpdate = (req.body: any);\n+ const accountUpdate: AccountUpdate = body;\nif (!accountUpdateInputValidator.is(accountUpdate)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -70,8 +67,7 @@ async function accountUpdateResponder(\nasync function sendVerificationEmailResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<void> {\nawait checkAndSendVerificationEmail(viewer);\n}\n@@ -82,10 +78,9 @@ const resetPasswordRequestInputValidator = tShape({\nasync function sendPasswordResetEmailResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<void> {\n- const resetPasswordRequest: PasswordResetRequest = (req.body: any);\n+ const resetPasswordRequest: PasswordResetRequest = body;\nif (!resetPasswordRequestInputValidator.is(resetPasswordRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -95,8 +90,7 @@ async function sendPasswordResetEmailResponder(\nasync function logOutResponder(\nviewer: Viewer,\n- req: $Request,\n- res: $Response,\n+ body: any,\n): Promise<LogOutResponse> {\nif (viewer.loggedIn) {\nconst [ anonymousViewerData ] = await Promise.all([\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/verification-responders.js",
"new_path": "jserver/src/responders/verification-responders.js",
"diff": "// @flow\n-import type { $Response, $Request } from 'express';\nimport type {\nCodeVerificationRequest,\nHandleVerificationCodeResult,\n} from 'lib/types/verify-types';\n+import type { Viewer } from '../session/viewer';\nimport t from 'tcomb';\n@@ -20,10 +20,10 @@ const codeVerificationRequestInputValidator = tShape({\n});\nasync function codeVerificationResponder(\n- req: $Request,\n- res: $Response,\n+ viewer: Viewer,\n+ body: any,\n): Promise<HandleVerificationCodeResult> {\n- const codeVerificationRequest: CodeVerificationRequest = (req.body: any);\n+ const codeVerificationRequest: CodeVerificationRequest = body;\nif (!codeVerificationRequestInputValidator.is(codeVerificationRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/session/cookies.js",
"new_path": "jserver/src/session/cookies.js",
"diff": "@@ -122,9 +122,9 @@ async function fetchViewerFromRequestBody(req: $Request): Promise<?Viewer> {\n}\nasync function fetchViewerFromRequest(req: $Request): Promise<Viewer> {\n- let viewer = await fetchViewerFromCookieData(req.cookies);\n+ let viewer = await fetchViewerFromRequestBody(req);\nif (!viewer) {\n- viewer = await fetchViewerFromRequestBody(req);\n+ viewer = await fetchViewerFromCookieData(req.cookies);\n}\nif (!viewer) {\nthrow new ServerError(\"no_cookie\");\n"
},
{
"change_type": "MODIFY",
"old_path": "server/call_node.php",
"new_path": "server/call_node.php",
"diff": "@@ -38,9 +38,12 @@ function proxy_to_node($path) {\nasync_start();\nif (isset($_POST['input'])) {\n- $payload = fix_bools($_POST['input']);\n+ $payload = array('input' => fix_bools($_POST['input']));\n} else {\n- $payload = (object)array();\n+ $payload = array('input' => (object)array());\n+ }\n+ if (isset($_POST['cookie'])) {\n+ $payload['cookie'] = $_POST['cookie'];\n}\nasync_end(call_node($path, $payload));\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Pass cookie in request body from call_node.php |
129,187 | 25.02.2018 15:44:53 | 18,000 | 948686c2f45474e7c40796f20575ae02f5bc1849 | First param to responders is input, not body
Also initially render 11 items (10 threads) in chat home screen | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/activity-responders.js",
"new_path": "jserver/src/responders/activity-responders.js",
"diff": "@@ -30,9 +30,9 @@ const inputValidator = t.list(t.union([\nasync function updateActivityResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<UpdateActivityResult> {\n- const updates: $ReadOnlyArray<ActivityUpdate> = body;\n+ const updates: $ReadOnlyArray<ActivityUpdate> = input;\nif (!inputValidator.is(updates)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/device-responders.js",
"new_path": "jserver/src/responders/device-responders.js",
"diff": "@@ -17,9 +17,9 @@ const deviceTokenUpdateRequestInputValidator = tShape({\nasync function deviceTokenUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<void> {\n- const deviceTokenUpdateRequest: DeviceTokenUpdateRequest = body;\n+ const deviceTokenUpdateRequest: DeviceTokenUpdateRequest = input;\nif (!deviceTokenUpdateRequestInputValidator.is(deviceTokenUpdateRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/entry-responders.js",
"new_path": "jserver/src/responders/entry-responders.js",
"diff": "@@ -38,9 +38,9 @@ const entryQueryInputValidator = tShape({\nasync function entryFetchResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<FetchEntryInfosResponse> {\n- const entryQuery: CalendarQuery = body;\n+ const entryQuery: CalendarQuery = input;\nif (!entryQueryInputValidator.is(entryQuery)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -65,9 +65,9 @@ const entryRevisionHistoryFetchInputValidator = tShape({\nasync function entryRevisionFetchResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<FetchEntryRevisionInfosResult> {\n- const entryRevisionHistoryFetch: EntryRevisionHistoryFetch = body;\n+ const entryRevisionHistoryFetch: EntryRevisionHistoryFetch = input;\nif (!entryRevisionHistoryFetchInputValidator.is(entryRevisionHistoryFetch)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -89,9 +89,9 @@ const createEntryRequestInputValidator = tShape({\nasync function entryCreationResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<SaveEntryResult> {\n- const createEntryRequest: CreateEntryRequest = body;\n+ const createEntryRequest: CreateEntryRequest = input;\nif (!createEntryRequestInputValidator.is(createEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -109,9 +109,9 @@ const saveEntryRequestInputValidator = tShape({\nasync function entryUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<SaveEntryResult> {\n- const saveEntryRequest: SaveEntryRequest = body;\n+ const saveEntryRequest: SaveEntryRequest = input;\nif (!saveEntryRequestInputValidator.is(saveEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -128,9 +128,9 @@ const deleteEntryRequestInputValidator = tShape({\nasync function entryDeletionResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<DeleteEntryResponse> {\n- const deleteEntryRequest: DeleteEntryRequest = body;\n+ const deleteEntryRequest: DeleteEntryRequest = input;\nif (!deleteEntryRequestInputValidator.is(deleteEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -146,9 +146,9 @@ const restoreEntryRequestInputValidator = tShape({\nasync function entryRestorationResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<RestoreEntryResponse> {\n- const restoreEntryRequest: RestoreEntryRequest = body;\n+ const restoreEntryRequest: RestoreEntryRequest = input;\nif (!restoreEntryRequestInputValidator.is(restoreEntryRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/message-responders.js",
"new_path": "jserver/src/responders/message-responders.js",
"diff": "@@ -28,9 +28,9 @@ const sendTextMessageRequestInputValidator = tShape({\nasync function textMessageCreationResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<SendTextMessageResponse> {\n- const sendTextMessageRequest: SendTextMessageRequest = body;\n+ const sendTextMessageRequest: SendTextMessageRequest = input;\nif (!sendTextMessageRequestInputValidator.is(sendTextMessageRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -63,9 +63,9 @@ const fetchMessageInfosRequestInputValidator = tShape({\nasync function messageFetchResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<FetchMessageInfosResult> {\n- const fetchMessageInfosRequest: FetchMessageInfosRequest = body;\n+ const fetchMessageInfosRequest: FetchMessageInfosRequest = input;\nif (!fetchMessageInfosRequestInputValidator.is(fetchMessageInfosRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/ping-responders.js",
"new_path": "jserver/src/responders/ping-responders.js",
"diff": "@@ -25,9 +25,9 @@ const pingRequestInputValidator = tShape({\nasync function pingResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<PingResponse> {\n- const pingRequest: PingRequest = body;\n+ const pingRequest: PingRequest = input;\nif (!pingRequestInputValidator.is(pingRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/search-responders.js",
"new_path": "jserver/src/responders/search-responders.js",
"diff": "@@ -19,9 +19,9 @@ const userSearchRequestInputValidator = tShape({\nasync function userSearchResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<UserSearchResult> {\n- const userSearchRequest: UserSearchRequest = body;\n+ const userSearchRequest: UserSearchRequest = input;\nif (!userSearchRequestInputValidator.is(userSearchRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/thread-responders.js",
"new_path": "jserver/src/responders/thread-responders.js",
"diff": "@@ -38,9 +38,9 @@ const threadDeletionRequestInputValidator = tShape({\nasync function threadDeletionResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<void> {\n- const threadDeletionRequest: ThreadDeletionRequest = body;\n+ const threadDeletionRequest: ThreadDeletionRequest = input;\nif (!threadDeletionRequestInputValidator.is(threadDeletionRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -62,9 +62,9 @@ const roleChangeRequestInputValidator = tShape({\nasync function roleUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<ChangeThreadSettingsResult> {\n- const roleChangeRequest: RoleChangeRequest = body;\n+ const roleChangeRequest: RoleChangeRequest = input;\nif (!roleChangeRequestInputValidator.is(roleChangeRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -79,9 +79,9 @@ const removeMembersRequestInputValidator = tShape({\nasync function memberRemovalResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<ChangeThreadSettingsResult> {\n- const removeMembersRequest: RemoveMembersRequest = body;\n+ const removeMembersRequest: RemoveMembersRequest = input;\nif (!removeMembersRequestInputValidator.is(removeMembersRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -95,9 +95,9 @@ const leaveThreadRequestInputValidator = tShape({\nasync function threadLeaveResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<LeaveThreadResult> {\n- const leaveThreadRequest: LeaveThreadRequest = body;\n+ const leaveThreadRequest: LeaveThreadRequest = input;\nif (!leaveThreadRequestInputValidator.is(leaveThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -121,9 +121,9 @@ const updateThreadRequestInputValidator = tShape({\nasync function threadUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<ChangeThreadSettingsResult> {\n- const updateThreadRequest: UpdateThreadRequest = body;\n+ const updateThreadRequest: UpdateThreadRequest = input;\nif (!updateThreadRequestInputValidator.is(updateThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -142,9 +142,9 @@ const newThreadRequestInputValidator = tShape({\n});\nasync function threadCreationResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<NewThreadResult> {\n- const newThreadRequest: NewThreadRequest = body;\n+ const newThreadRequest: NewThreadRequest = input;\nif (!newThreadRequestInputValidator.is(newThreadRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -158,9 +158,9 @@ const joinThreadRequestInputValidator = tShape({\n});\nasync function threadJoinResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<ThreadJoinResult> {\n- const threadJoinRequest: ThreadJoinRequest = body;\n+ const threadJoinRequest: ThreadJoinRequest = input;\nif (!joinThreadRequestInputValidator.is(threadJoinRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -36,9 +36,9 @@ const subscriptionUpdateRequestInputValidator = tShape({\nasync function userSubscriptionUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<SubscriptionUpdateResponse> {\n- const subscriptionUpdateRequest: SubscriptionUpdateRequest = body;\n+ const subscriptionUpdateRequest: SubscriptionUpdateRequest = input;\nif (!subscriptionUpdateRequestInputValidator.is(subscriptionUpdateRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -60,9 +60,9 @@ const accountUpdateInputValidator = tShape({\nasync function accountUpdateResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<void> {\n- const accountUpdate: AccountUpdate = body;\n+ const accountUpdate: AccountUpdate = input;\nif (!accountUpdateInputValidator.is(accountUpdate)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -72,7 +72,7 @@ async function accountUpdateResponder(\nasync function sendVerificationEmailResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<void> {\nawait checkAndSendVerificationEmail(viewer);\n}\n@@ -83,9 +83,9 @@ const resetPasswordRequestInputValidator = tShape({\nasync function sendPasswordResetEmailResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<void> {\n- const resetPasswordRequest: PasswordResetRequest = body;\n+ const resetPasswordRequest: PasswordResetRequest = input;\nif (!resetPasswordRequestInputValidator.is(resetPasswordRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n@@ -95,7 +95,7 @@ async function sendPasswordResetEmailResponder(\nasync function logOutResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<LogOutResponse> {\nif (viewer.loggedIn) {\nconst [ anonymousViewerData ] = await Promise.all([\n@@ -118,9 +118,9 @@ const deleteAccountRequestInputValidator = tShape({\nasync function accountDeletionResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<LogOutResponse> {\n- const deleteAccountRequest: DeleteAccountRequest = body;\n+ const deleteAccountRequest: DeleteAccountRequest = input;\nif (!deleteAccountRequestInputValidator.is(deleteAccountRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/verification-responders.js",
"new_path": "jserver/src/responders/verification-responders.js",
"diff": "@@ -21,9 +21,9 @@ const codeVerificationRequestInputValidator = tShape({\nasync function codeVerificationResponder(\nviewer: Viewer,\n- body: any,\n+ input: any,\n): Promise<HandleVerificationCodeResult> {\n- const codeVerificationRequest: CodeVerificationRequest = body;\n+ const codeVerificationRequest: CodeVerificationRequest = input;\nif (!codeVerificationRequestInputValidator.is(codeVerificationRequest)) {\nthrow new ServerError('invalid_parameters');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -217,6 +217,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nkeyExtractor={InnerChatThreadList.keyExtractor}\ngetItemLayout={InnerChatThreadList.getItemLayout}\nextraData={this.props.viewerID}\n+ initialNumToRender={11}\nstyle={styles.flatList}\n/>\n{floatingAction}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | First param to responders is input, not body
Also initially render 11 items (10 threads) in chat home screen |
129,187 | 25.02.2018 16:36:38 | 18,000 | 47087030d409e79e084990f2320bad359fdf9ccf | register.php -> jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "@@ -18,6 +18,7 @@ import {\nsendPasswordResetEmailResponder,\nlogOutResponder,\naccountDeletionResponder,\n+ accountCreationResponder,\n} from './responders/user-responders';\nimport { userSearchResponder } from './responders/search-responders';\nimport {\n@@ -73,6 +74,7 @@ const jsonEndpoints = {\n'ping': pingResponder,\n'log_out': logOutResponder,\n'delete_account': accountDeletionResponder,\n+ 'create_account': accountCreationResponder,\n};\nfor (let endpoint in jsonEndpoints) {\nconst responder = jsonEndpoints[endpoint];\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/creators/account-creator.js",
"diff": "+// @flow\n+\n+import type {\n+ RegisterResponse,\n+ RegisterRequest,\n+} from 'lib/types/user-types';\n+import type { Viewer } from '../session/viewer';\n+\n+import bcrypt from 'twin-bcrypt';\n+\n+import {\n+ validUsernameRegex,\n+ validEmailRegex,\n+} from 'lib/shared/account-regexes';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\n+import { pool, SQL } from '../database';\n+import createIDs from './id-creator';\n+import { createNewUserCookie, deleteCookie } from '../session/cookies';\n+import { sendEmailAddressVerificationEmail } from '../emails/verification';\n+\n+async function createAccount(\n+ viewer: Viewer,\n+ request: RegisterRequest,\n+): Promise<RegisterResponse> {\n+ if (request.password.trim() === \"\") {\n+ throw new ServerError('empty_password');\n+ }\n+ if (request.username.search(validUsernameRegex) === -1) {\n+ throw new ServerError('invalid_username');\n+ }\n+ if (request.email.search(validEmailRegex) === -1) {\n+ throw new ServerError('invalid_email');\n+ }\n+\n+ const usernameQuery = SQL`\n+ SELECT COUNT(id) AS count\n+ FROM users\n+ WHERE LCASE(username) = LCASE(${request.username})\n+ `;\n+ const emailQuery = SQL`\n+ SELECT COUNT(id) AS count\n+ FROM users\n+ WHERE LCASE(email) = LCASE(${request.email})\n+ `;\n+ const [ [ usernameResult ], [ emailResult ] ] = await Promise.all([\n+ pool.query(usernameQuery),\n+ pool.query(emailQuery),\n+ ]);\n+ if (usernameResult[0].count !== 0) {\n+ throw new ServerError('username_taken');\n+ }\n+ if (emailResult[0].count !== 0) {\n+ throw new ServerError('email_taken');\n+ }\n+\n+ const hash = bcrypt.hashSync(request.password);\n+ const time = Date.now();\n+ const [ id ] = await createIDs(\"users\", 1);\n+ const newUserRow = [id, request.username, hash, request.email, time];\n+ const newUserQuery = SQL`\n+ INSERT INTO users(id, username, hash, email, creation_time)\n+ VALUES ${[newUserRow]}\n+ `;\n+ const [ userViewerData ] = await Promise.all([\n+ createNewUserCookie(id),\n+ deleteCookie(viewer.getData()),\n+ pool.query(newUserQuery),\n+ sendEmailAddressVerificationEmail(\n+ id,\n+ request.username,\n+ request.email,\n+ true,\n+ ),\n+ ]);\n+ viewer.setNewCookie(userViewerData);\n+\n+ return { id };\n+}\n+\n+export default createAccount;\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -8,6 +8,8 @@ import type {\nAccountUpdate,\nLogOutResponse,\nDeleteAccountRequest,\n+ RegisterResponse,\n+ RegisterRequest,\n} from 'lib/types/user-types';\nimport type { PasswordResetRequest } from 'lib/types/account-types';\nimport type { Viewer } from '../session/viewer';\n@@ -25,6 +27,7 @@ import {\nimport { tShape } from '../utils/tcomb-utils';\nimport { createNewAnonymousCookie, deleteCookie } from '../session/cookies';\nimport { deleteAccount } from '../deleters/account-deleters';\n+import createAccount from '../creators/account-creator';\nconst subscriptionUpdateRequestInputValidator = tShape({\nthreadID: t.String,\n@@ -128,6 +131,24 @@ async function accountDeletionResponder(\nreturn await deleteAccount(viewer, deleteAccountRequest);\n}\n+const registerRequestInputValidator = tShape({\n+ username: t.String,\n+ email: t.String,\n+ password: t.String,\n+});\n+\n+async function accountCreationResponder(\n+ viewer: Viewer,\n+ input: any,\n+): Promise<RegisterResponse> {\n+ const registerRequest: RegisterRequest = input;\n+ if (!registerRequestInputValidator.is(registerRequest)) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+\n+ return await createAccount(viewer, registerRequest);\n+}\n+\nexport {\nuserSubscriptionUpdateResponder,\naccountUpdateResponder,\n@@ -135,4 +156,5 @@ export {\nsendPasswordResetEmailResponder,\nlogOutResponder,\naccountDeletionResponder,\n+ accountCreationResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/session/cookies.js",
"new_path": "jserver/src/session/cookies.js",
"diff": "import type { $Response, $Request } from 'express';\nimport type { UserInfo, CurrentUserInfo } from 'lib/types/user-types';\nimport type { RawThreadInfo } from 'lib/types/thread-types';\n-import type { ViewerData, AnonymousViewerData } from './viewer';\n+import type { ViewerData, AnonymousViewerData, UserViewerData } from './viewer';\nimport invariant from 'invariant';\nimport bcrypt from 'twin-bcrypt';\n@@ -18,7 +18,7 @@ import { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport urlFacts from '../../facts/url';\nimport createIDs from '../creators/id-creator';\n-const { baseDomain, basePath } = urlFacts;\n+const { baseDomain, basePath, https } = urlFacts;\nconst cookieLifetime = 30*24*60*60*1000; // in milliseconds\nconst cookieSource = Object.freeze({\n@@ -140,6 +140,14 @@ type CookieChange = {|\ncookie?: string,\n|};\n+const domainAsURL = new url.URL(baseDomain);\n+const cookieOptions = {\n+ domain: domainAsURL.hostname,\n+ path: basePath,\n+ httpOnly: true,\n+ secure: https,\n+};\n+\nasync function addCookieChangeInfoToResult(\nviewer: Viewer,\nres: $Response,\n@@ -161,21 +169,16 @@ async function addCookieChangeInfoToResult(\nif (viewer.initializationSource === cookieSource.BODY) {\ncookieChange.cookie = viewer.cookiePairString;\n} else {\n- const domainAsURL = new url.URL(baseDomain);\n- const domain = domainAsURL.hostname;\nres.cookie(\nviewer.cookieName,\nviewer.cookieString,\n{\n+ ...cookieOptions,\nmaxAge: cookieLifetime,\n- domain,\n- path: basePath,\n- httpOnly: true,\n- secure: true,\n},\n);\nif (viewer.cookieName !== viewer.initialCookieName) {\n- res.clearCookie(viewer.initialCookieName);\n+ res.clearCookie(viewer.initialCookieName, cookieOptions);\n}\n}\nresult.cookieChange = cookieChange;\n@@ -209,10 +212,31 @@ async function deleteCookie(viewerData: ViewerData): Promise<void> {\n`);\n}\n+async function createNewUserCookie(userID: string): Promise<UserViewerData> {\n+ const time = Date.now();\n+ const cookiePassword = crypto.randomBytes(32).toString('hex');\n+ const cookieHash = bcrypt.hashSync(cookiePassword);\n+ const [ cookieID ] = await createIDs(\"cookies\", 1);\n+ const cookieRow = [cookieID, cookieHash, userID, time, time, 0];\n+ const query = SQL`\n+ INSERT INTO cookies(id, hash, user, creation_time, last_update, last_ping)\n+ VALUES ${[cookieRow]}\n+ `;\n+ await pool.query(query);\n+ return {\n+ loggedIn: true,\n+ id: userID,\n+ userID,\n+ cookieID,\n+ cookiePassword,\n+ };\n+}\n+\nexport {\ncookieType,\nfetchViewerFromRequest,\naddCookieChangeInfoToResult,\ncreateNewAnonymousCookie,\ndeleteCookie,\n+ createNewUserCookie,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/actions/user-actions.js",
"new_path": "lib/actions/user-actions.js",
"diff": "@@ -73,7 +73,11 @@ async function register(\nemail: string,\npassword: string,\n): Promise<LoggedInUserInfo> {\n- const result = await fetchJSON('register.php', { username, email, password });\n+ const result = await fetchJSON('register.php', { input: {\n+ username,\n+ email,\n+ password,\n+ }});\nreturn { id: result.id, username, email, emailVerified: false };\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/user-types.js",
"new_path": "lib/types/user-types.js",
"diff": "@@ -84,3 +84,13 @@ export type LogOutResult = {|\nexport type DeleteAccountRequest = {|\npassword: string,\n|};\n+\n+export type RegisterRequest = {|\n+ username: string,\n+ email: string,\n+ password: string,\n+|};\n+\n+export type RegisterResponse = {|\n+ id: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/call_node.php",
"new_path": "server/call_node.php",
"diff": "@@ -24,9 +24,11 @@ function call_node($path, $blob) {\n$result = curl_exec($ch);\n$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);\n$header_array = explode(\"\\r\\n\", substr($result, 0, $header_size));\n+ $first_header = true;\nforeach ($header_array as $header) {\nif (strpos($header, \"Set-Cookie: \") === 0) {\n- header($header);\n+ header($header, $first_header);\n+ $first_header = false;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/register.php",
"new_path": "server/register.php",
"diff": "<?php\n-require_once('async_lib.php');\n-require_once('config.php');\n-require_once('auth.php');\n-require_once('verify_lib.php');\n+require_once('call_node.php');\n-async_start();\n-\n-if (\n- !isset($_POST['username']) ||\n- !isset($_POST['email']) ||\n- !isset($_POST['password'])\n-) {\n- async_end(array(\n- 'error' => 'invalid_parameters',\n- ));\n-}\n-$username = $_POST['username'];\n-$email = $_POST['email'];\n-$password = $_POST['password'];\n-if (trim($password) === '') {\n- async_end(array(\n- 'error' => 'empty_password',\n- ));\n-}\n-\n-$valid_username_regex = \"/^[a-zA-Z0-9-_]+$/\";\n-if (!preg_match($valid_username_regex, $username)) {\n- async_end(array(\n- 'error' => 'invalid_username',\n- ));\n-}\n-\n-$valid_email_regex = \"/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+\".\n- \"@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\".\n- \"(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/\";\n-if (!preg_match($valid_email_regex, $email)) {\n- async_end(array(\n- 'error' => 'invalid_email',\n- ));\n-}\n-\n-$username = $conn->real_escape_string($username);\n-$email = $conn->real_escape_string($email);\n-\n-$result = $conn->query(\n- \"SELECT COUNT(id) AS count FROM users \".\n- \"WHERE LCASE(username) = LCASE('$username')\"\n-);\n-$matching_username_row = $result->fetch_assoc();\n-if ($matching_username_row['count'] !== '0') {\n- async_end(array(\n- 'error' => 'username_taken',\n- ));\n-}\n-$result = $conn->query(\n- \"SELECT COUNT(id) AS count FROM users WHERE LCASE(email) = LCASE('$email')\"\n-);\n-$matching_email_row = $result->fetch_assoc();\n-if ($matching_email_row['count'] !== '0') {\n- async_end(array(\n- 'error' => 'email_taken',\n- ));\n-}\n-\n-$hash = password_hash($password, PASSWORD_BCRYPT);\n-$time = round(microtime(true) * 1000); // in milliseconds\n-$conn->query(\"INSERT INTO ids(table_name) VALUES('users')\");\n-$id = $conn->insert_id;\n-$conn->query(\n- \"INSERT INTO users(id, username, hash, email, creation_time) \".\n- \"VALUES ($id, '$username', '$hash', '$email', $time)\"\n-);\n-\n-create_user_cookie($id);\n-\n-verify_email($id, $username, $email, true);\n-\n-async_end(array(\n- 'id' => (string)$id,\n- 'success' => true,\n-));\n+proxy_to_node('create_account');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | register.php -> jserver |
129,187 | 25.02.2018 18:43:43 | 18,000 | e40c3c82eab8f6b8c8bd6f77dc7646b7c0011539 | Don't include null/undefined UserInfos in fetchThreadInfos result | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/fetchers/thread-fetchers.js",
"new_path": "jserver/src/fetchers/thread-fetchers.js",
"diff": "@@ -133,7 +133,10 @@ async function fetchThreadInfos(\nif (threadInfo) {\nthreadInfos[threadID] = threadInfo;\nfor (let member of threadInfo.members) {\n- userInfos[member.id] = serverResult.userInfos[member.id];\n+ const userInfo = serverResult.userInfos[member.id];\n+ if (userInfo) {\n+ userInfos[member.id] = userInfo;\n+ }\n}\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't include null/undefined UserInfos in fetchThreadInfos result |
129,187 | 25.02.2018 23:27:46 | 18,000 | 5f1f2b8e9cbfd7782f2a2c951c9b58b322fb3dda | Handle cookie invalidation in jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/creators/account-creator.js",
"new_path": "jserver/src/creators/account-creator.js",
"diff": "@@ -64,7 +64,7 @@ async function createAccount(\n`;\nconst [ userViewerData ] = await Promise.all([\ncreateNewUserCookie(id),\n- deleteCookie(viewer.getData()),\n+ deleteCookie(viewer.getData().cookieID),\npool.query(newUserQuery),\nsendEmailAddressVerificationEmail(\nid,\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/user-responders.js",
"new_path": "jserver/src/responders/user-responders.js",
"diff": "@@ -119,7 +119,7 @@ async function logOutResponder(\nif (viewer.loggedIn) {\nconst [ anonymousViewerData ] = await Promise.all([\ncreateNewAnonymousCookie(),\n- deleteCookie(viewer.getData()),\n+ deleteCookie(viewer.getData().cookieID),\n]);\nviewer.setNewCookie(anonymousViewerData);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/session/cookies.js",
"new_path": "jserver/src/session/cookies.js",
"diff": "@@ -5,7 +5,6 @@ import 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 invariant from 'invariant';\nimport bcrypt from 'twin-bcrypt';\nimport url from 'url';\nimport crypto from 'crypto';\n@@ -24,6 +23,7 @@ const cookieLifetime = 30*24*60*60*1000; // in milliseconds\nconst cookieSource = Object.freeze({\nBODY: 0,\nHEADER: 1,\n+ GENERATED: 2,\n});\nexport type CookieSource = $Values<typeof cookieSource>;\nconst cookieType = Object.freeze({\n@@ -32,26 +32,46 @@ const cookieType = Object.freeze({\n});\ntype CookieType = $Values<typeof cookieType>;\n-async function fetchUserViewer(cookie: string, source: CookieSource) {\n+type FetchViewerResult =\n+ | {| type: \"valid\", viewer: Viewer |}\n+ | {| type: \"nonexistant\", cookieName: string, source: CookieSource |}\n+ | {|\n+ type: \"invalidated\",\n+ cookieName: string,\n+ cookieID: string,\n+ source: CookieSource,\n+ |};\n+\n+async function fetchUserViewer(\n+ cookie: string,\n+ source: CookieSource,\n+): Promise<FetchViewerResult> {\nconst [ cookieID, cookiePassword ] = cookie.split(':');\n- invariant(cookieID && cookiePassword, `invalid cookie ${cookie}`);\n+ if (!cookieID || !cookiePassword) {\n+ return { type: \"nonexistant\", cookieName: cookieType.USER, source };\n+ }\nconst query = SQL`\nSELECT hash, user, last_update FROM cookies\nWHERE id = ${cookieID} AND user IS NOT NULL\n`;\nconst [ result ] = await pool.query(query);\n+ if (result.length === 0) {\n+ return { type: \"nonexistant\", cookieName: cookieType.USER, source };\n+ }\nconst cookieRow = result[0];\n- invariant(cookieRow, `invalid user cookie ID ${cookieID}`);\n- invariant(\n- bcrypt.compareSync(cookiePassword, cookieRow.hash),\n- `invalid cookie password for user cookie ID ${cookieID}`,\n- );\n- invariant(\n- cookieRow.last_update + cookieLifetime > Date.now(),\n- `user cookie ID ${cookieID} is expired`,\n- );\n+ if (\n+ !bcrypt.compareSync(cookiePassword, cookieRow.hash) ||\n+ cookieRow.last_update + cookieLifetime <= Date.now()\n+ ) {\n+ return {\n+ type: \"invalidated\",\n+ cookieName: cookieType.USER,\n+ cookieID,\n+ source,\n+ };\n+ }\nconst userID = cookieRow.user.toString();\n- return new Viewer(\n+ const viewer = new Viewer(\n{\nloggedIn: true,\nid: userID,\n@@ -61,27 +81,38 @@ async function fetchUserViewer(cookie: string, source: CookieSource) {\n},\nsource,\n);\n+ return { type: \"valid\", viewer };\n}\n-async function fetchAnonymousViewer(cookie: string, source: CookieSource) {\n+async function fetchAnonymousViewer(\n+ cookie: string,\n+ source: CookieSource,\n+): Promise<FetchViewerResult> {\nconst [ cookieID, cookiePassword ] = cookie.split(':');\n- invariant(cookieID && cookiePassword, `invalid cookie ${cookie}`);\n+ if (!cookieID || !cookiePassword) {\n+ return { type: \"nonexistant\", cookieName: cookieType.ANONYMOUS, source };\n+ }\nconst query = SQL`\nSELECT last_update, hash FROM cookies\nWHERE id = ${cookieID} AND user IS NULL\n`;\nconst [ result ] = await pool.query(query);\n+ if (result.length === 0) {\n+ return { type: \"nonexistant\", cookieName: cookieType.ANONYMOUS, source };\n+ }\nconst cookieRow = result[0];\n- invariant(cookieRow, `invalid anonymous cookie ID ${cookieID}`);\n- invariant(\n- bcrypt.compareSync(cookiePassword, cookieRow.hash),\n- `invalid cookie password for anonymous cookie ID ${cookieID}`,\n- );\n- invariant(\n- cookieRow.last_update + cookieLifetime > Date.now(),\n- `anonymous cookie ID ${cookieID} is expired`,\n- );\n- return new Viewer(\n+ if (\n+ !bcrypt.compareSync(cookiePassword, cookieRow.hash) ||\n+ cookieRow.last_update + cookieLifetime <= Date.now()\n+ ) {\n+ return {\n+ type: \"invalidated\",\n+ cookieName: cookieType.ANONYMOUS,\n+ cookieID,\n+ source,\n+ };\n+ }\n+ const viewer = new Viewer(\n{\nloggedIn: false,\nid: cookieID,\n@@ -90,6 +121,7 @@ async function fetchAnonymousViewer(cookie: string, source: CookieSource) {\n},\nsource,\n);\n+ return { type: \"valid\", viewer };\n}\n// This function is meant to consume a cookie that has already been processed.\n@@ -97,7 +129,7 @@ async function fetchAnonymousViewer(cookie: string, source: CookieSource) {\n// doesn't the cookie's last_update timestamp.\nasync function fetchViewerFromCookieData(\ncookieData: {[cookieName: string]: string},\n-): Promise<?Viewer> {\n+): Promise<?FetchViewerResult> {\nif (cookieData.user) {\nreturn await fetchUserViewer(cookieData.user, cookieSource.HEADER);\n} else if (cookieData.anonymous) {\n@@ -106,7 +138,9 @@ async function fetchViewerFromCookieData(\nreturn null;\n}\n-async function fetchViewerFromRequestBody(req: $Request): Promise<?Viewer> {\n+async function fetchViewerFromRequestBody(\n+ req: $Request,\n+): Promise<?FetchViewerResult> {\nconst body = (req.body: any);\nconst cookiePair = body.cookie;\nif (!cookiePair || !(typeof cookiePair === \"string\")) {\n@@ -122,12 +156,26 @@ async function fetchViewerFromRequestBody(req: $Request): Promise<?Viewer> {\n}\nasync function fetchViewerFromRequest(req: $Request): Promise<Viewer> {\n- let viewer = await fetchViewerFromRequestBody(req);\n- if (!viewer) {\n- viewer = await fetchViewerFromCookieData(req.cookies);\n+ let result = await fetchViewerFromRequestBody(req);\n+ if (!result) {\n+ result = await fetchViewerFromCookieData(req.cookies);\n+ }\n+ if (result && result.type === \"valid\") {\n+ return result.viewer;\n}\n- if (!viewer) {\n- throw new ServerError(\"no_cookie\");\n+\n+ const [ anonymousViewerData ] = await Promise.all([\n+ createNewAnonymousCookie(),\n+ result && result.invalidated\n+ ? deleteCookie(result.cookieID)\n+ : null,\n+ ]);\n+ const source = result ? result.source : cookieSource.GENERATED;\n+ const viewer = new Viewer(anonymousViewerData, source);\n+ if (result) {\n+ viewer.cookieChanged = true;\n+ viewer.cookieInvalidated = true;\n+ viewer.initialCookieName = result.cookieName;\n}\nreturn viewer;\n}\n@@ -203,12 +251,12 @@ async function createNewAnonymousCookie(): Promise<AnonymousViewerData> {\n};\n}\n-async function deleteCookie(viewerData: ViewerData): Promise<void> {\n+async function deleteCookie(cookieID: string): Promise<void> {\nawait pool.query(SQL`\nDELETE c, i\nFROM cookies c\nLEFT JOIN ids i ON i.id = c.id\n- WHERE c.id = ${viewerData.cookieID}\n+ WHERE c.id = ${cookieID}\n`);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Handle cookie invalidation in jserver |
129,187 | 26.02.2018 12:32:11 | 18,000 | 0affca5410b69bf9d172e3aa88ff5a6801eb9b41 | Factor out handleCodeVerificationRequest in jserver | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/models/verification.js",
"new_path": "jserver/src/models/verification.js",
"diff": "// @flow\n-import { type VerifyField, assertVerifyField } from 'lib/types/verify-types';\n+import {\n+ type VerifyField,\n+ verifyField,\n+ assertVerifyField,\n+ type VerificationResult,\n+} from 'lib/types/verify-types';\nimport crypto from 'crypto';\nimport bcrypt from 'twin-bcrypt';\n@@ -80,8 +85,37 @@ async function clearVerifyCodes(result: CodeVerification) {\nawait pool.query(deleteQuery);\n}\n+async function handleCodeVerificationRequest(\n+ code: string,\n+): Promise<?VerificationResult> {\n+ const result = await verifyCode(code);\n+ const { userID, field } = result;\n+ if (field === verifyField.EMAIL) {\n+ const query = SQL`UPDATE users SET email_verified = 1 WHERE id = ${userID}`;\n+ await Promise.all([\n+ pool.query(query),\n+ clearVerifyCodes(result),\n+ ]);\n+ return { field: verifyField.EMAIL, userID };\n+ } else if (field === verifyField.RESET_PASSWORD) {\n+ const usernameQuery = SQL`SELECT username FROM users WHERE id = ${userID}`;\n+ const [ usernameResult ] = await pool.query(usernameQuery);\n+ if (usernameResult.length === 0) {\n+ throw new ServerError('invalid_code');\n+ }\n+ const usernameRow = usernameResult[0];\n+ return {\n+ field: verifyField.RESET_PASSWORD,\n+ userID,\n+ resetPasswordUsername: usernameRow.username,\n+ };\n+ }\n+ return null;\n+}\n+\nexport {\ncreateVerificationCode,\nverifyCode,\nclearVerifyCodes,\n+ handleCodeVerificationRequest,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/verification-responders.js",
"new_path": "jserver/src/responders/verification-responders.js",
"diff": "@@ -12,7 +12,7 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport { verifyField } from 'lib/types/verify-types';\nimport { tShape } from '../utils/tcomb-utils';\n-import { verifyCode, clearVerifyCodes } from '../models/verification';\n+import { handleCodeVerificationRequest } from '../models/verification';\nimport { pool, SQL } from '../database';\nconst codeVerificationRequestInputValidator = tShape({\n@@ -28,26 +28,21 @@ async function codeVerificationResponder(\nthrow new ServerError('invalid_parameters');\n}\n- const result = await verifyCode(codeVerificationRequest.code);\n- const { userID, field } = result;\n- if (field === verifyField.EMAIL) {\n- const query = SQL`UPDATE users SET email_verified = 1 WHERE id = ${userID}`;\n- await Promise.all([\n- pool.query(query),\n- clearVerifyCodes(result),\n- ]);\n- return { verifyField: field };\n- } else if (field === verifyField.RESET_PASSWORD) {\n- const usernameQuery = SQL`SELECT username FROM users WHERE id = ${userID}`;\n- const [ usernameResult ] = await pool.query(usernameQuery);\n- if (usernameResult.length === 0) {\n- throw new ServerError('invalid_code');\n- }\n- const usernameRow = usernameResult[0];\n- return { verifyField: field, resetPasswordUsername: usernameRow.username };\n- } else {\n+ const result = await handleCodeVerificationRequest(\n+ codeVerificationRequest.code,\n+ );\n+ if (!result) {\nthrow new ServerError('unhandled_field');\n}\n+ if (result.field === verifyField.EMAIL) {\n+ return { verifyField: result.field };\n+ } else if (result.field === verifyField.RESET_PASSWORD) {\n+ return {\n+ verifyField: result.field,\n+ resetPasswordUsername: result.resetPasswordUsername,\n+ };\n+ }\n+ throw new ServerError('unhandled_field');\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/verify-types.js",
"new_path": "lib/types/verify-types.js",
"diff": "@@ -21,6 +21,10 @@ export type CodeVerificationRequest = {|\ncode: string,\n|};\n+export type VerificationResult =\n+ | {| field: 0, userID: string |}\n+ | {| field: 1, userID: string, resetPasswordUsername: string |};\n+\nexport type HandleVerificationCodeResult = {|\nverifyField: VerifyField,\nresetPasswordUsername?: string,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Factor out handleCodeVerificationRequest in jserver |
129,187 | 26.02.2018 14:57:02 | 18,000 | b1134eeba3ac19203d6c097cc4dcd1f98065ccee | Get rid of PingRequest.clientSupportsMessages
We'll track `last_ping` regardless of this. (It's not currently being used anywhere anyways.) | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/ping-responders.js",
"new_path": "jserver/src/responders/ping-responders.js",
"diff": "@@ -20,7 +20,6 @@ const pingRequestInputValidator = tShape({\ncalendarQuery: entryQueryInputValidator,\nlastPing: t.Number,\nwatchedIDs: t.list(t.String),\n- clientSupportsMessages: t.Boolean,\n});\nasync function pingResponder(\n@@ -67,11 +66,7 @@ async function pingResponder(\n]);\n// Do this one separately in case any of the above throw an exception\n- await updateActivityTime(\n- viewer,\n- newPingTime,\n- pingRequest.clientSupportsMessages,\n- );\n+ await updateActivityTime(viewer, newPingTime);\nconst userInfos: any = Object.values({\n...messagesResult.userInfos,\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/updaters/activity-updaters.js",
"new_path": "jserver/src/updaters/activity-updaters.js",
"diff": "@@ -202,27 +202,30 @@ async function checkThreadsFocused(\nreturn focusedThreadUserPairs;\n}\n-async function updateActivityTime(\n- viewer: Viewer,\n- time: number,\n- clientSupportsMessages: bool,\n-): Promise<void> {\n- if (!viewer.loggedIn) {\n- return;\n- }\n-\n+// This function updates tables that track recent activity.\n+// - We have a `last_ping` column in the cookies table just to track when a user\n+// has last interacted with SquadCal.\n+// - The `focused` table tracks which chat threads are currently in view for a\n+// given cookie. We track this so that if a user is currently viewing a\n+// thread's messages, then notification on that thread are not sent. This\n+// function does not add new rows to the `focused` table, but instead extends\n+// currently active rows for the current cookie. This is a no-op for clients\n+// that don't have any rows in the focused table (such as web, currently).\n+async function updateActivityTime(viewer: Viewer, time: number): Promise<void> {\nconst promises = [];\n+\n+ const cookieQuery = SQL`\n+ UPDATE cookies SET last_ping = ${time} WHERE id = ${viewer.cookieID}\n+ `;\n+ promises.push(pool.query(cookieQuery));\n+\n+ if (viewer.loggedIn) {\nconst focusedQuery = SQL`\nUPDATE focused\nSET time = ${time}\nWHERE user = ${viewer.userID} AND cookie = ${viewer.cookieID}\n`;\npromises.push(pool.query(focusedQuery));\n- if (clientSupportsMessages) {\n- const cookieQuery = SQL`\n- UPDATE cookies SET last_ping = ${time} WHERE id = ${viewer.cookieID}\n- `;\n- promises.push(pool.query(cookieQuery));\n}\nawait Promise.all(promises);\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/actions/ping-actions.js",
"new_path": "lib/actions/ping-actions.js",
"diff": "@@ -26,7 +26,6 @@ async function ping(\ncalendarQuery,\nlastPing,\nwatchedIDs,\n- clientSupportsMessages: getConfig().clientSupportsMessages,\n});\nreturn {\nthreadInfos: response.threadInfos,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/ping-types.js",
"new_path": "lib/types/ping-types.js",
"diff": "@@ -17,7 +17,6 @@ export type PingRequest = {|\ncalendarQuery: CalendarQuery,\nlastPing: number,\nwatchedIDs: $ReadOnlyArray<string>,\n- clientSupportsMessages: bool,\n|};\nexport type PingResponse = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/config.js",
"new_path": "lib/utils/config.js",
"diff": "@@ -13,7 +13,6 @@ export type Config = {\ngetNewCookie: ?((response: Object) => Promise<?string>),\nsetCookieOnRequest: bool,\ncalendarRangeInactivityLimit: ?number,\n- clientSupportsMessages: bool,\n};\nlet registeredConfig: ?Config = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -111,7 +111,6 @@ registerConfig({\n},\nsetCookieOnRequest: true,\ncalendarRangeInactivityLimit: sessionInactivityLimit,\n- clientSupportsMessages: true,\n});\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\n"
},
{
"change_type": "MODIFY",
"old_path": "web/script.js",
"new_path": "web/script.js",
"diff": "@@ -68,7 +68,6 @@ registerConfig({\nsetCookieOnRequest: false,\n// Never reset the calendar range\ncalendarRangeInactivityLimit: null,\n- clientSupportsMessages: false,\n});\nconst entryInfos = _keyBy('id')(entry_infos);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Get rid of PingRequest.clientSupportsMessages
We'll track `last_ping` regardless of this. (It's not currently being used anywhere anyways.) |
129,187 | 26.02.2018 15:30:01 | 18,000 | 542a9d418e472d6481d477c0666cb1554e652b19 | Initial jserver home code | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -11,3 +11,4 @@ jserver/dist\njserver/node_modules/*\njserver/secrets\njserver/facts\n+jserver/fonts\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/.well-known/apple-app-site-association",
"diff": "+{\n+ \"webcredentials\": {\n+ \"apps\": [ \"6BF4H9TU5U.org.squadcal.app\" ],\n+ },\n+ \"applinks\": {\n+ \"apps\": [],\n+ \"details\": [\n+ {\n+ \"appID\": \"6BF4H9TU5U.org.squadcal.app\",\n+ \"paths\": [ \"*\" ],\n+ },\n+ ],\n+ },\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/.well-known/assetlinks.json",
"diff": "+[\n+ {\n+ \"relation\": [\n+ \"delegate_permission/common.handle_all_urls\"\n+ ],\n+ \"target\": {\n+ \"namespace\": \"android_app\",\n+ \"package_name\": \"org.squadcal\",\n+ \"sha256_cert_fingerprints\": [\n+ \"A8:81:32:91:5C:9A:D9:9E:14:68:1B:10:EA:5D:4E:D0:62:D0:BF:13:15:77:AA:BF:1D:C9:E6:67:ED:AD:E7:6F\"\n+ ]\n+ }\n+ }\n+]\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/compiled",
"diff": "+../web/dist/\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/flow-typed/npm/common-tags_v1.4.x.js",
"diff": "+// flow-typed signature: e60dc0f96d7d55734050073860bea369\n+// flow-typed version: de4764766b/common-tags_v1.4.x/flow_>=v0.25.x\n+\n+/**\n+ * @flow\n+ */\n+\n+declare module \"common-tags\" {\n+ declare type TaggedTemplate = (\n+ strings: Array<string>,\n+ ...interpolations: Array<any>\n+ ) => string;\n+\n+ declare type TemplateTransformer = {\n+ onSubstitution?: (substitution: string, resultSoFar: string) => string,\n+ onEndResult?: (endResult: string) => string\n+ };\n+\n+ // Built-in tagged template literals\n+ declare export var html: TaggedTemplate;\n+ declare export var source: TaggedTemplate;\n+ declare export var codeBlock: TaggedTemplate;\n+ declare export var safeHtml: TaggedTemplate;\n+ declare export var oneLine: TaggedTemplate;\n+ declare export var oneLineTrim: TaggedTemplate;\n+ declare export var oneLineCommaLists: TaggedTemplate;\n+ declare export var oneLineCommaListsOr: TaggedTemplate;\n+ declare export var oneLineCommaListsAnd: TaggedTemplate;\n+ declare export var stripIndent: TaggedTemplate;\n+ declare export var stripIndents: TaggedTemplate;\n+ declare export var inlineLists: TaggedTemplate;\n+ declare export var oneLineInlineLists: TaggedTemplate;\n+ declare export var commaLists: TaggedTemplate;\n+ declare export var commaListsOr: TaggedTemplate;\n+ declare export var commaListsAnd: TaggedTemplate;\n+\n+ // Class for creating a new tagged template literal\n+ declare export class TemplateTag {\n+ constructor(): TemplateTag;\n+ constructor(transformers: Array<TemplateTransformer>): TemplateTag;\n+ constructor(...transformers: Array<TemplateTransformer>): TemplateTag;\n+ }\n+\n+ // Built-in transformers\n+ declare export var trimResultTransformer: (\n+ side?: \"left\" | \"right\"\n+ ) => TemplateTransformer;\n+\n+ declare export var stripIndentTransformer: (\n+ type?: \"initial\" | \"all\"\n+ ) => TemplateTransformer;\n+\n+ declare export var replaceResultTransformer: (\n+ replaceWhat: string | RegExp,\n+ replaceWith: string\n+ ) => TemplateTransformer;\n+\n+ declare export var replaceSubstitutionTransformer: (\n+ replaceWhat: string | RegExp,\n+ replaceWith: string\n+ ) => TemplateTransformer;\n+\n+ declare export var inlineArrayTransformer: (opts?: {\n+ separator?: string,\n+ conjunction?: string\n+ }) => TemplateTransformer;\n+\n+ declare export var splitStringTransformer: (\n+ splitBy: string\n+ ) => TemplateTransformer;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/flow-typed/npm/lib_vx.x.x.js",
"new_path": "jserver/flow-typed/npm/lib_vx.x.x.js",
"diff": "-// flow-typed signature: bcec5b90e23067909f08826cb31176ed\n+// flow-typed signature: 7f0701b2913a5ef2721905c2e97182bc\n// flow-typed version: <<STUB>>/lib_v0.0.1/flow_v0.64.0\n/**\n@@ -226,6 +226,10 @@ declare module 'lib/shared/user-utils' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/account-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/activity-types' {\ndeclare module.exports: any;\n}\n@@ -262,6 +266,10 @@ declare module 'lib/types/redux-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/search-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/subscription-types' {\ndeclare module.exports: any;\n}\n@@ -318,10 +326,6 @@ declare module 'lib/utils/url-utils' {\ndeclare module.exports: any;\n}\n-declare module 'lib/utils/verify-utils' {\n- declare module.exports: any;\n-}\n-\n// Filename aliases\ndeclare module 'lib/actions/device-actions.js' {\ndeclare module.exports: $Exports<'lib/actions/device-actions'>;\n@@ -476,6 +480,9 @@ declare module 'lib/shared/typeahead-text.js' {\ndeclare module 'lib/shared/user-utils.js' {\ndeclare module.exports: $Exports<'lib/shared/user-utils'>;\n}\n+declare module 'lib/types/account-types.js' {\n+ declare module.exports: $Exports<'lib/types/account-types'>;\n+}\ndeclare module 'lib/types/activity-types.js' {\ndeclare module.exports: $Exports<'lib/types/activity-types'>;\n}\n@@ -503,6 +510,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/search-types.js' {\n+ declare module.exports: $Exports<'lib/types/search-types'>;\n+}\ndeclare module 'lib/types/subscription-types.js' {\ndeclare module.exports: $Exports<'lib/types/subscription-types'>;\n}\n@@ -545,6 +555,3 @@ declare module 'lib/utils/text-utils.js' {\ndeclare module 'lib/utils/url-utils.js' {\ndeclare module.exports: $Exports<'lib/utils/url-utils'>;\n}\n-declare module 'lib/utils/verify-utils.js' {\n- declare module.exports: $Exports<'lib/utils/verify-utils'>;\n-}\n"
},
{
"change_type": "ADD",
"old_path": "jserver/images/ajax-loader.gif",
"new_path": "jserver/images/ajax-loader.gif",
"diff": "Binary files /dev/null and b/jserver/images/ajax-loader.gif differ\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/package.json",
"new_path": "jserver/package.json",
"diff": "\"postinstall\": \"cd ../; npx flow-mono create-symlinks jserver/.flowconfig\",\n\"babel\": \"babel src/ --out-dir dist/ --ignore 'lib/flow-typed','lib/node_modules','lib/package.json','lib/package-lock.json' --copy-files\",\n\"prod\": \"node --experimental-modules --loader ./loader.mjs dist/app\",\n- \"dev\": \"concurrently \\\"npm run babel -- --watch\\\" \\\"nodemon -e js,json --watch dist --experimental-modules --loader ./loader.mjs dist/app\\\"\"\n+ \"dev\": \"NODE_ENV=dev concurrently \\\"npm run babel -- --watch\\\" \\\"nodemon -e js,json --watch dist --experimental-modules --loader ./loader.mjs dist/app\\\"\"\n},\n\"author\": \"\",\n\"license\": \"ISC\",\n},\n\"dependencies\": {\n\"apn\": \"^2.2.0\",\n- \"body-parser\": \"^1.18.2\",\n+ \"common-tags\": \"^1.7.2\",\n\"cookie-parser\": \"^1.4.3\",\n\"express\": \"^4.16.2\",\n\"firebase-admin\": \"^5.7.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/app.js",
"new_path": "jserver/src/app.js",
"diff": "// @flow\nimport express from 'express';\n-import bodyParser from 'body-parser';\nimport cookieParser from 'cookie-parser';\nimport { jsonHandler } from './responders/handlers';\n@@ -44,10 +43,22 @@ import {\nthreadJoinResponder,\n} from './responders/thread-responders';\nimport { pingResponder } from './responders/ping-responders';\n+import { websiteResponder } from './responders/website-responders';\n-const app = express();\n-app.use(bodyParser.json());\n-app.use(cookieParser());\n+const server = express();\n+server.use(express.json());\n+server.use(cookieParser());\n+server.use('/images', express.static('images'));\n+server.use('/fonts', express.static('fonts'));\n+server.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+server.use('/compiled', express.static('compiled'));\nconst jsonEndpoints = {\n'update_activity': updateActivityResponder,\n@@ -82,7 +93,9 @@ const jsonEndpoints = {\n};\nfor (let endpoint in jsonEndpoints) {\nconst responder = jsonEndpoints[endpoint];\n- app.post(`/${endpoint}`, jsonHandler(responder));\n+ server.post(`/${endpoint}`, jsonHandler(responder));\n}\n-app.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n+server.get('*', websiteResponder);\n+\n+server.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/handlers.js",
"new_path": "jserver/src/responders/handlers.js",
"diff": "@@ -6,9 +6,8 @@ import type { Viewer } from '../session/viewer';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport {\n- fetchViewerFromRequest,\n- addCookieChangeInfoToResult,\n- addCookieInfoToResponse,\n+ fetchViewerForJSONRequest,\n+ addCookieToJSONResponse,\n} from '../session/cookies';\ntype Responder = (viewer: Viewer, input: any) => Promise<*>;\n@@ -16,7 +15,7 @@ type Responder = (viewer: Viewer, input: any) => Promise<*>;\nfunction jsonHandler(responder: Responder) {\nreturn async (req: $Request, res: $Response) => {\ntry {\n- const viewer = await fetchViewerFromRequest(req);\n+ const viewer = await fetchViewerForJSONRequest(req);\nif (!req.body || typeof req.body !== \"object\") {\nthrow new ServerError('invalid_parameters');\n}\n@@ -24,11 +23,7 @@ function jsonHandler(responder: Responder) {\nif (res.headersSent) {\nreturn;\n}\n- if (viewer.cookieChanged) {\n- await addCookieChangeInfoToResult(viewer, res, result);\n- } else {\n- await addCookieInfoToResponse(viewer, res);\n- }\n+ await addCookieToJSONResponse(viewer, res, result);\nres.json({ success: true, ...result });\n} catch (e) {\nconsole.warn(e);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jserver/src/responders/website-responders.js",
"diff": "+// @flow\n+\n+import type { $Response, $Request } from 'express';\n+\n+import html from 'common-tags/lib/html';\n+\n+import { ServerError } from 'lib/utils/fetch-utils';\n+import {\n+ startDateForYearAndMonth,\n+ endDateForYearAndMonth,\n+} from 'lib/utils/date-utils';\n+import { defaultNumberPerThread } from 'lib/types/message-types';\n+\n+import {\n+ fetchViewerForHomeRequest,\n+ addCookieToHomeResponse,\n+} from '../session/cookies';\n+import { Viewer } from '../session/viewer';\n+import { handleCodeVerificationRequest } from '../models/verification';\n+import { fetchMessageInfos } from '../fetchers/message-fetchers';\n+import { verifyThreadID, fetchThreadInfos } from '../fetchers/thread-fetchers';\n+import { fetchEntryInfos } from '../fetchers/entry-fetchers';\n+import { fetchCurrentUserInfo } from '../fetchers/user-fetchers';\n+import { updateActivityTime } from '../updaters/activity-updaters';\n+import urlFacts from '../../facts/url';\n+\n+const { basePath } = urlFacts;\n+\n+async function websiteResponder(req: $Request, res: $Response) {\n+ try {\n+ const viewer = await fetchViewerForHomeRequest(req);\n+ const rendered = await renderHTML(viewer, req.url);\n+ addCookieToHomeResponse(viewer, res);\n+ res.send(rendered);\n+ } catch (e) {\n+ console.warn(e);\n+ if (!res.headersSent) {\n+ res.status(500).send(e.message);\n+ }\n+ }\n+}\n+\n+async function renderHTML(viewer: Viewer, url: string): Promise<string> {\n+ const urlInfo = parseURL(url);\n+\n+ const calendarQuery = {\n+ startDate: startDateForYearAndMonth(urlInfo.year, urlInfo.month),\n+ endDate: endDateForYearAndMonth(urlInfo.year, urlInfo.month),\n+ navID: urlInfo.home ? \"home\" : urlInfo.threadID,\n+ };\n+ const threadSelectionCriteria = { joinedThreads: true };\n+ const serverTime = Date.now();\n+\n+ const [\n+ { threadInfos, userInfos: threadUserInfos },\n+ currentUserInfo,\n+ { rawEntryInfos, userInfos: entryUserInfos },\n+ { rawMessageInfos, truncationStatuses, userInfos: messageUserInfos },\n+ verificationResult,\n+ ] = await Promise.all([\n+ fetchThreadInfos(viewer),\n+ fetchCurrentUserInfo(viewer),\n+ fetchEntryInfos(viewer, calendarQuery),\n+ fetchMessageInfos(\n+ viewer,\n+ threadSelectionCriteria,\n+ defaultNumberPerThread,\n+ ),\n+ urlInfo.verificationCode\n+ ? handleCodeVerificationRequest(urlInfo.verificationCode)\n+ : null,\n+ ]);\n+ const userInfos = {\n+ ...messageUserInfos,\n+ ...entryUserInfos,\n+ ...threadUserInfos,\n+ };\n+ if (urlInfo.threadID && !threadInfos[urlInfo.threadID]) {\n+ const validThreadID = await verifyThreadID(urlInfo.threadID);\n+ if (!validThreadID) {\n+ throw new ServerError(\"invalid_thread_id\");\n+ }\n+ }\n+\n+ // Do this one separately in case any of the above throw an exception\n+ await updateActivityTime(viewer, serverTime);\n+\n+ // handle verificationCode\n+\n+ const fontsURL = process.env.NODE_ENV === \"dev\"\n+ ? \"fonts/local-fonts.css\"\n+ : \"https://fonts.googleapis.com/css?family=Open+Sans:300,600%7CAnaheim\";\n+ const jsURL = process.env.NODE_ENV === \"dev\"\n+ ? \"compiled/dev.build.js\"\n+ : \"compiled/prod.build.js\";\n+ return html`\n+ <html lang=\"en\" class=\"no-js\">\n+ <head>\n+ <meta charset=\"utf-8\" />\n+ <title>SquadCal</title>\n+ <base href=\"${basePath}\" />\n+ <link rel=\"stylesheet\" type=\"text/css\" href=\"${fontsURL}\" />\n+ <script>\n+ </script>\n+ </head>\n+ <body>\n+ <div id=\"react-root\" />\n+ <script src=\"${jsURL}\"></script>\n+ </body>\n+ </html>\n+ `;\n+}\n+\n+type BaseURLInfo = {| year: number, month: number, verificationCode: ?string |};\n+type URLInfo =\n+ | {| ...BaseURLInfo, home: true, threadID: null |}\n+ | {| ...BaseURLInfo, home: false, threadID: string |};\n+\n+const yearRegex = new RegExp(\"/year/([0-9]+)(/|$)\", 'i');\n+const monthRegex = new RegExp(\"/month/([0-9]+)(/|$)\", 'i');\n+const threadRegex = new RegExp(\"/thread/([0-9]+)(/|$)\", 'i');\n+const homeRegex = new RegExp(\"/home(/|$)\", 'i');\n+const verifyRegex = new RegExp(\"/verify/([a-f0-9]+)(/|$)\", 'i');\n+\n+function parseURL(url: string): URLInfo {\n+ const yearMatches = yearRegex.exec(url);\n+ const monthMatches = monthRegex.exec(url);\n+ const threadMatches = threadRegex.exec(url);\n+ const homeMatches = homeRegex.exec(url);\n+ const verifyMatches = verifyRegex.exec(url);\n+\n+ const year = yearMatches\n+ ? parseInt(yearMatches[1])\n+ : new Date().getFullYear();\n+ const month = monthMatches\n+ ? parseInt(monthMatches[1])\n+ : new Date().getMonth() + 1;\n+ if (month < 1 || month > 12) {\n+ throw new ServerError(\"invalid_month\");\n+ }\n+ const verificationCode = verifyMatches ? verifyMatches[1] : null;\n+\n+ if (!homeMatches && threadMatches) {\n+ const threadID = parseInt(threadMatches[1]).toString();\n+ return { year, month, home: false, threadID, verificationCode };\n+ } else {\n+ return { year, month, home: true, threadID: null, verificationCode };\n+ }\n+}\n+\n+export {\n+ websiteResponder,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "jserver/src/session/cookies.js",
"new_path": "jserver/src/session/cookies.js",
"diff": "@@ -158,11 +158,20 @@ async function fetchViewerFromRequestBody(\nreturn null;\n}\n-async function fetchViewerFromRequest(req: $Request): Promise<Viewer> {\n+async function fetchViewerForJSONRequest(req: $Request): Promise<Viewer> {\nlet result = await fetchViewerFromRequestBody(req);\nif (!result) {\nresult = await fetchViewerFromCookieData(req.cookies);\n}\n+ return await handleFetchViewerResult(result);\n+}\n+\n+async function fetchViewerForHomeRequest(req: $Request): Promise<Viewer> {\n+ const result = await fetchViewerFromCookieData(req.cookies);\n+ return await handleFetchViewerResult(result);\n+}\n+\n+async function handleFetchViewerResult(result: ?FetchViewerResult) {\nif (result && result.type === \"valid\") {\nreturn result.viewer;\n}\n@@ -292,17 +301,25 @@ async function createNewUserCookie(userID: string): Promise<UserViewerData> {\n};\n}\n-async function addCookieInfoToResponse(\n+async function extendCookieLifespan(cookieID: string) {\n+ const time = Date.now();\n+ const query = SQL`\n+ UPDATE cookies SET last_update = ${time} WHERE id = ${cookieID}\n+ `;\n+ await pool.query(query);\n+}\n+\n+async function addCookieToJSONResponse(\nviewer: Viewer,\nres: $Response,\n+ result: Object,\n) {\n- let time = viewer.getData().insertionTime;\n- if (!time) {\n- time = Date.now();\n- const extendLifespanQuery = SQL`\n- UPDATE cookies SET last_update = ${time} WHERE id = ${viewer.cookieID}\n- `;\n- await pool.query(extendLifespanQuery);\n+ if (viewer.cookieChanged) {\n+ await addCookieChangeInfoToResult(viewer, res, result);\n+ return;\n+ }\n+ if (!viewer.getData().insertionTime) {\n+ extendCookieLifespan(viewer.cookieID);\n}\nif (viewer.initializationSource !== cookieSource.BODY) {\nres.cookie(\n@@ -316,12 +333,30 @@ async function addCookieInfoToResponse(\n}\n}\n+function addCookieToHomeResponse(viewer: Viewer, res: $Response) {\n+ if (!viewer.getData().insertionTime) {\n+ extendCookieLifespan(viewer.cookieID);\n+ }\n+ res.cookie(\n+ viewer.cookieName,\n+ viewer.cookieString,\n+ {\n+ ...cookieOptions,\n+ maxAge: cookieLifetime,\n+ },\n+ );\n+ if (viewer.cookieName !== viewer.initialCookieName) {\n+ res.clearCookie(viewer.initialCookieName, cookieOptions);\n+ }\n+}\n+\nexport {\ncookieType,\n- fetchViewerFromRequest,\n- addCookieChangeInfoToResult,\n+ fetchViewerForJSONRequest,\n+ fetchViewerForHomeRequest,\ncreateNewAnonymousCookie,\ndeleteCookie,\ncreateNewUserCookie,\n- addCookieInfoToResponse,\n+ addCookieToJSONResponse,\n+ addCookieToHomeResponse,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -1493,7 +1493,7 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:\nversion \"4.11.8\"\nresolved \"https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f\"\n-body-parser@1.18.2, body-parser@^1.18.2:\n+body-parser@1.18.2:\nversion \"1.18.2\"\nresolved \"https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454\"\ndependencies:\n@@ -2095,6 +2095,12 @@ commander@~2.13.0:\nversion \"2.13.0\"\nresolved \"https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c\"\n+common-tags@^1.7.2:\n+ version \"1.7.2\"\n+ resolved \"https://registry.yarnpkg.com/common-tags/-/common-tags-1.7.2.tgz#24d9768c63d253a56ecff93845b44b4df1d52771\"\n+ dependencies:\n+ babel-runtime \"^6.26.0\"\n+\ncommondir@^1.0.1:\nversion \"1.0.1\"\nresolved \"https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b\"\n@@ -7376,12 +7382,6 @@ react-native-onepassword@^1.0.6:\ndependencies:\n\"1PasswordExtension\" \"git+https://github.com/jjshammas/onepassword-app-extension.git\"\n-react-native-safe-area-view@^0.6.0:\n- version \"0.6.0\"\n- resolved \"https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.6.0.tgz#ce01eb27905a77780219537e0f53fe9c783a8b3d\"\n- dependencies:\n- hoist-non-react-statics \"^2.3.1\"\n-\nreact-native-safe-area-view@^0.7.0:\nversion \"0.7.0\"\nresolved \"https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.7.0.tgz#38f5ab9368d6ef9e5d18ab64212938af3ec39421\"\n@@ -7477,18 +7477,6 @@ react-navigation-redux-helpers@^1.0.1:\ndependencies:\ninvariant \"^2.2.2\"\n-react-navigation@^1.0.3:\n- version \"1.0.3\"\n- resolved \"https://registry.yarnpkg.com/react-navigation/-/react-navigation-1.0.3.tgz#1687ea67a72a382633b01e7afda88582ebc3b5f9\"\n- dependencies:\n- clamp \"^1.0.1\"\n- hoist-non-react-statics \"^2.2.0\"\n- path-to-regexp \"^1.7.0\"\n- prop-types \"^15.5.10\"\n- react-native-drawer-layout-polyfill \"^1.3.2\"\n- react-native-safe-area-view \"^0.6.0\"\n- react-native-tab-view \"^0.0.74\"\n-\nreact-navigation@^1.1.2:\nversion \"1.1.2\"\nresolved \"https://registry.yarnpkg.com/react-navigation/-/react-navigation-1.1.2.tgz#6e041b8a3cd0f5266072df0b52a55117892875f2\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Initial jserver home code |
129,187 | 27.02.2018 22:40:35 | 18,000 | 008a65baea3ec970706ce3eb20984daf4b92f146 | Allow configuring baseRoutePath separately
`baseRoutePath` affects the prefix of the input URLs node/express expects to get | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/server.js",
"new_path": "jserver/src/server.js",
"diff": "@@ -49,7 +49,7 @@ import { pingResponder } from './responders/ping-responders';\nimport { websiteResponder } from './responders/website-responders';\nimport urlFacts from '../facts/url';\n-const { basePath } = urlFacts;\n+const { baseRoutePath } = urlFacts;\nconst server = express();\nserver.use(express.json());\n@@ -107,5 +107,5 @@ for (let endpoint in jsonEndpoints) {\nrouter.get('*', websiteResponder);\n-server.use(basePath, router);\n+server.use(baseRoutePath, router);\nserver.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Allow configuring baseRoutePath separately
`baseRoutePath` affects the prefix of the input URLs node/express expects to get |
129,187 | 27.02.2018 23:57:37 | 18,000 | 5cb8e6ca7589079cf005ba827f51bde5f6235bf2 | Stop website table from taking whole page | [
{
"change_type": "MODIFY",
"old_path": "jserver/src/responders/website-responders.js",
"new_path": "jserver/src/responders/website-responders.js",
"diff": "@@ -177,7 +177,7 @@ async function renderHTML(viewer: Viewer, url: string): Promise<string> {\nhref=\"compiled/prod.build.css\"\n/>`;\nreturn html`\n- <html lang=\"en\" class=\"no-js\">\n+ <html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n<title>SquadCal</title>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/dist/prod.build.css",
"new_path": "web/dist/prod.build.css",
"diff": "-header,tr{font-family:Anaheim,sans-serif}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;background-color:#fffaf0}a{text-decoration:none;color:#2a5db0}input[type=password],input[type=text],textarea{-webkit-appearance:none;-moz-appearance:none;-webkit-border-radius:0;border:1px solid #ddd;border-radius:1px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}input[type=submit]{-webkit-appearance:none;-moz-appearance:none;-webkit-border-radius:0}input[type=submit]::-moz-focus-inner{border:0;padding:0}table{height:100%;width:100%;table-layout:fixed}textarea.style__entry-text--Z3Yoi{background:none;width:100%;outline:none;border:none;resize:none;overflow:auto;overflow-y:hidden;padding-right:15px;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:11px}*{padding:0;margin:0}header{height:42px}td.style__day--3Rz-S{background-color:#fff;position:relative;vertical-align:top;line-height:0;cursor:text;height:120px}td.style__day--3Rz-S>div.style__entry-container--877Fx{overflow:auto;height:120px}td.style__day--3Rz-S>div.style__focused-entry-container--2uWgW{height:100px!important}div.style__entry-container--877Fx>div.style__entry-container-spacer--16G0j{height:13px}div.style__entry--3_6gh{padding:5px;box-shadow:inset 0 0 0 2px #fff;border-radius:5px;position:relative}div.style__dark-entry--2dc_a,div.style__dark-entry--2dc_a textarea.style__entry-text--Z3Yoi{color:#fff}div.style__dark-entry--2dc_a div.style__action-links--2fUa6>a{color:#d3d3d3}div.style__dark-entry--2dc_a div.style__action-links--2fUa6>a:hover{color:#fff}img.style__entry-loading--AAfKP{position:absolute;top:6px;right:5px;width:12px}span.style__entry-loading--AAfKP{position:absolute;top:13px;right:5px;font-size:16px;width:6px}div.style__action-links--2fUa6{line-height:90%;margin-top:3px;font-size:16px}div.style__day-action-links--pyNpz{padding-left:3px;margin-bottom:1px}div.style__action-links--2fUa6 a+a{margin-left:6px}span.style__action-links-text--37mv2{font-family:Open Sans,sans-serif;font-weight:600;font-size:11px;position:relative;bottom:1px;padding-left:5px}span.style__right-action-links--3kgPm{float:right;text-overflow:ellipsis;white-space:nowrap;max-width:100%;display:inline-block;overflow:hidden}div.style__action-links--2fUa6 svg{fill:gray;width:10px;height:10px}div.style__action-links--2fUa6 svg.style__history--kGNzt{position:relative;top:1px}div.style__dark-entry--2dc_a div.style__action-links--2fUa6 svg{fill:#d3d3d3}div.style__action-links--2fUa6 a:hover svg{fill:#000}div.style__dark-entry--2dc_a div.style__action-links--2fUa6 a:hover svg{fill:#fff}div.style__focused-entry--2R2PY{z-index:3!important}div.style__action-links--2fUa6 a{color:gray}div.style__action-links--2fUa6 a:hover{color:#000}td.style__day--3Rz-S>h2{position:absolute;bottom:2px;right:3px;color:#fee5ac;font-size:32px;line-height:32px;z-index:1}td.style__current-day--2Vq_I>h2{color:#ff944d}h1{position:absolute;padding-left:4px}div.style__upper-right--1Wv0N{position:absolute;padding:6px;right:0}div.style__thread-nav--3jCxJ{padding:3px 12px;z-index:2;position:relative;border-radius:5px;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600;font-size:15px;cursor:pointer;float:left}div.style__thread-nav-null-state--inM1p{z-index:4;cursor:default}div.style__thread-nav-current--3qCZ8{min-width:170px;padding:2px 0}div.style__thread-nav-active--Mp4Yo div.style__thread-nav-current--3qCZ8{cursor:default}svg.style__search-vector--1y3RA{fill:#000;float:left;height:24px;width:24px;margin-right:3px;margin-bottom:-7px;cursor:pointer}div.style__thread-nav-null-state--inM1p>div.style__thread-nav-current--3qCZ8>img{cursor:default}div.style__typeahead-container--ZAVWb{overflow:hidden}input.style__typeahead---jVQ-{padding:0;border:none;background-color:transparent;font-family:Open Sans,sans-serif;font-weight:600;font-size:15px;width:125px}div.style__thread-nav-active--Mp4Yo input.style__typeahead---jVQ-{width:100%}input.style__typeahead---jVQ-:focus{outline-width:0}span.style__thread-nav-symbols--1TcxY{padding-left:10px;float:right;width:8px}svg.style__thread-nav-first-symbol--2DEuX{position:absolute;top:5px;height:12px;width:7px}svg.style__thread-nav-second-symbol--J5B2t{position:absolute;top:14px;height:12px;width:7px}div.style__thread-nav-dropdown--hsHpW{border-top:1px solid #c8c8c8;margin-top:3px;padding-top:3px;width:400px;cursor:default}div.style__thread-nav-option-pane--18u4x{padding:2px 0}div.style__thread-nav-option-pane-header--17OZd{border-bottom:1px solid #c8c8c8;padding:0 0 0 4px;text-transform:uppercase;color:#777;font-family:Open Sans,sans-serif;font-size:9px;position:relative}div.style__thread-nav-option--pe2vI{cursor:pointer;padding-left:28px;padding-bottom:6px;padding-top:3px;position:relative}div.style__thread-nav-option-name--3edRD{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}ul.style__thread-nav-option-buttons--1hTtl{text-transform:uppercase;font-family:Open Sans,sans-serif;font-size:9px;list-style-type:none;float:right;padding-left:10px;padding-right:4px}ul.style__thread-nav-option-buttons--1hTtl>li{list-style-type:none;display:inline-block}ul.style__thread-nav-option-buttons--1hTtl>li+li:before{content:\"\\B7\";padding:0 3px}ul.style__thread-nav-option-buttons--1hTtl a:hover{text-decoration:underline}.style__thread-nav-option-buttons-loading--1mcA4{position:relative;padding-left:3px;top:2px;right:3px;width:10px;font-size:14px}span.style__loading-indicator-error--3rllh{font-weight:700;color:red;line-height:0}div.style__thread-nav-option-description--_ahC6{font-size:11px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;color:#444;padding-top:4px}div.style__thread-nav-frozen-option--1LFBw,div.style__thread-nav-option--pe2vI:hover{background-color:#e8e8e8}div.style__thread-nav-open-option--qMtEQ{cursor:default}div.style__thread-nav-no-results--iQJn4{text-align:center;font-style:italic;color:#777;padding-top:3px;font-size:12px}div.style__thread-nav-color-preview--3QhpW{width:12px;height:12px;left:6px;position:absolute;top:7px;border:1px solid #d3d3d3;border-radius:2px}div.style__thread-nav-pager--3BO6-{position:absolute;top:0;right:0}a.style__thread-nav-pager-button--1J-GY{vertical-align:top}svg.style__thread-nav-pager-svg--2aAv_{display:inline-block;fill:#777;width:13px;height:13px}a.style__thread-nav-pager-button--1J-GY>svg.style__thread-nav-pager-svg--2aAv_{fill:#2a5db0}span.style__thread-nav-pager-status--1zJff{vertical-align:top}h2.style__upper-center--23QDz{text-align:center}h2.style__upper-center--23QDz>a.style__previous-month-link--1-H8z{position:absolute;left:50%;margin-left:-100px}h2.style__upper-center--23QDz>a.style__next-month-link--1VbTv{position:absolute;right:50%;margin-right:-100px}div.style__lower-left--k_T4L{position:fixed;left:-1px;bottom:-1px;padding:0 6px;z-index:3;border-radius:0 5px 0 0;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600}div.style__lower-left-null-state--2b-9l{z-index:4}div.style__account-button--2WABg{padding:3px 4px 3px 8px;font-size:0}div.style__account-button--2WABg>span{font-size:16px}div.style__account-menu--24Dmp{outline:none}div.style__account-menu--24Dmp>div{border-bottom:1px solid #c8c8c8;padding:3px 4px 3px 8px}span.style__username--3-Wx_{display:inline-block;color:#2a5db0;cursor:pointer}svg.style__account-caret--1IkNx{padding-left:6px;fill:#2a5db0;cursor:pointer;height:10px;width:10px}div.style__modal-overlay--2r12A{position:fixed;left:0;top:0;z-index:3;width:100%;height:100%;background-color:rgba(0,0,0,.4);overflow:auto}div.style__small-modal-overlay--oBODp{padding-top:100px}div.style__large-modal-overlay--2SAuH{padding-top:50px}div.style__modal--22Sm9{position:relative;background-color:#fff;margin:auto;box-shadow:0 4px 20px rgba(0,0,0,.3),0 0 0 1px rgba(0,0,0,.1);border-radius:3px;max-width:330px}div.style__large-modal--gVblj{max-width:500px}span.style__modal-close--1NLJd{float:right;font-size:32px;font-weight:300;line-height:26px}span.style__modal-close--1NLJd:hover{color:#000;cursor:pointer}div.style__modal-header--3LDhL{padding:6px;background-color:#fee5ac;border-top-left-radius:3px;border-top-right-radius:3px;font-family:Open Sans,sans-serif}div.style__modal-header--3LDhL>h2{font-size:22px;font-weight:300}div.style__modal-body--3vkc_{padding:6px;width:100%;box-sizing:border-box}div.style__modal-body--3vkc_ p{padding:1px 3px 4px;font-size:14px;text-align:center}div.style__modal-body--3vkc_ p.style__form-pre-footer--2BAMk{padding-top:5px;font-size:12px;font-style:italic}div.style__modal-body--3vkc_ input,div.style__modal-body--3vkc_ textarea{margin:3px}div.style__modal-body--3vkc_ input[type=password],div.style__modal-body--3vkc_ input[type=text],div.style__modal-body--3vkc_ textarea{font-size:14px;padding:1px;width:175px}div.style__large-modal--gVblj div.style__modal-body--3vkc_ input[type=password],div.style__large-modal--gVblj div.style__modal-body--3vkc_ input[type=text],div.style__large-modal--gVblj div.style__modal-body--3vkc_ textarea{width:275px}div.style__modal-body--3vkc_ input[type=submit]{padding:3px 9px;font-size:12px;margin-right:3px;border-radius:3px;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600;color:#444;margin-top:1px;cursor:pointer}div.style__modal-body--3vkc_ input[type=submit]:hover{text-decoration:underline}div.style__modal-body--3vkc_ input[type=submit]:disabled{cursor:auto;text-decoration:none;color:#999}div.style__modal-body--3vkc_ div.style__form-title--1UXQV{display:inline-block;text-align:right;padding-right:5px;padding-top:5px;font-size:14px;font-family:Open Sans,sans-serif;font-weight:600;vertical-align:top;width:110px}div.style__large-modal--gVblj div.style__modal-body--3vkc_ div.style__form-title--1UXQV{width:140px}div.style__modal-body--3vkc_ div.style__form-content--exkyC{display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px}div.style__modal-body--3vkc_ div.style__form-subtitle--3a0Zr{font-size:12px;padding-left:4px;font-style:italic}div.style__form-enum-selector--2ihOZ{display:inline-block;padding-bottom:4px}div.style__form-enum-selector--2ihOZ>div.style__form-enum-container--2uC_1{padding-top:5px}div.style__form-enum-selector--2ihOZ>div.style__form-enum-container--2uC_1>input{vertical-align:top;margin-top:4px}div.style__form-enum-selector--2ihOZ div.style__form-enum-option--WtiUu{font-weight:700;display:inline-block;font-size:15px;font-family:Open Sans,sans-serif;font-weight:600;padding-left:3px}div.style__form-enum-selector--2ihOZ span.style__form-enum-description--2QWm-{display:block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;font-size:13px;max-width:260px;color:gray}div.style__form-enum-selector--2ihOZ div.style__form-enum-password--30J0G{margin-left:-5px}div.style__form-enum-selector--2ihOZ div.style__form-enum-password--30J0G>input[type=password]{width:257px}div.style__color-title--2akqJ{margin-top:4px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq{margin-top:5px;padding-top:3px;border-top:2px solid #efefef;min-height:26px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq span.style__modal-form-error--1-PtI{display:inline-block;font-size:14px;color:red;font-style:italic;padding-top:5px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq span.style__form-submit--2puj6{display:inline-block;float:right}div.style__form-text--1PUCm>div.style__form-title--1UXQV{vertical-align:initial}div.style__form-text--1PUCm>div.style__form-content--exkyC{margin-left:3px;margin-bottom:3px}div.style__form-text--1PUCm>div.style__form-float-title--1aqLL{float:left;text-align:right;padding-right:5px;font-size:14px;font-family:Open Sans,sans-serif;font-weight:600;width:110px}div.style__form-text--1PUCm>div.style__form-float-content--3AIF1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;padding:1px 20px 3px 4px;margin-top:5px}.style__verified-status-true--3VBnj{color:green}.style__verified-status-false--2Ax7d{color:red}.style__hidden--3Wgyn{display:none}.style__italic--3zZuj{font-style:italic}div.style__history-modal-body--19dYB{position:relative;height:240px;overflow:hidden}img.style__history-loading--1ncSj{position:absolute;right:6px;top:5px}span.style__history-loading--1ncSj{position:absolute;line-height:16px;font-size:16px;right:12px;top:6px}div.style__entry-history--3JUCQ{position:absolute;width:100%;top:27px;box-sizing:border-box}div.style__entry-history-visible--24Jd5{left:0}div.style__entry-history-invisible--Fi8pf{left:100%}@keyframes style__entry-history-visible-animation--1LKbn{0%{left:100%}to{left:0}}div.style__entry-history-visible-animate--1Bc6W{left:0;animation-name:style__entry-history-visible-animation--1LKbn;animation-duration:.5s}@keyframes style__entry-history-invisible-animation--2I_d0{0%{left:0}to{left:100%}}div.style__entry-history-invisible-animate--1kTif{left:100%;animation-name:style__entry-history-invisible-animation--2I_d0;animation-duration:.5s}div.style__history-header--A6jEo{position:absolute;left:0;top:0;width:100%;padding:5px;font-size:12px;font-family:Open Sans,sans-serif;font-weight:600;background-color:#f4f4f4;box-sizing:border-box}a.style__all-history-button--3W-QE{position:absolute;top:5px;left:7px}span.style__history-date--1riIe{float:left;width:100%;text-align:center}div.style__entry-history--3JUCQ ul{overflow:auto;height:211px}div.style__entry-history--3JUCQ li{border-bottom:2px solid #d3d3d3;margin:5px;padding-bottom:8px;padding-top:1px}div.style__entry-history--3JUCQ li:last-child{border-bottom:none}span.style__entry-author--3xhRt{float:left;padding-left:11px;font-size:12px;color:gray;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:50%;box-sizing:border-box}span.style__entry-username--2vUz5{color:#2a5db0}time.style__entry-time--2bQER{float:right;padding-right:11px;font-size:12px;color:gray}span.style__entry-thread--3JNqV{float:right;padding-right:11px;font-size:12px;font-family:Open Sans,sans-serif;font-weight:600;margin-top:-2px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:50%;padding-left:10px;box-sizing:border-box}div.style__clear--QO98A{clear:both}div.style__entry-history-entry--1v7Uf{margin:5px;font-size:13px;word-break:break-all;white-space:pre-wrap}div.style__day-history--1GK6a{position:absolute;width:100%;top:27px;box-sizing:border-box}div.style__day-history-visible--33YbJ{left:0}div.style__day-history-invisible--1y0LO{left:-100%}@keyframes style__day-history-visible-animation--I3Dhr{0%{left:-100%}to{left:0}}div.style__day-history-visible-animate--2xLPu{left:0;animation-name:style__day-history-visible-animation--I3Dhr;animation-duration:.5s}@keyframes style__day-history-invisible-animation--1Ysqo{0%{left:0}to{left:-100%}}div.style__day-history-invisible-animate--NTu7V{left:-100%;animation-name:style__day-history-invisible-animation--1Ysqo;animation-duration:.5s}div.style__day-history--1GK6a ul{overflow:auto;height:211px}div.style__day-history--1GK6a li{padding-bottom:2px}div.style__day-history--1GK6a li:last-child{padding-bottom:8px}span.style__deleted-entry--3-gNv{float:left;padding-top:2px;padding-left:11px;font-size:12px;line-height:17px}span.style__deleted-entry-label--3FLlY{color:red;font-style:italic}span.style__restore-entry-label--18XjI{padding-left:5px}img.style__restore-loading--rnpa2{position:relative;top:2px;left:5px;width:12px}span.style__restore-loading--rnpa2{position:relative;top:2px;left:7px;font-size:15px}a.style__revision-history-button--2y5ge{float:right;padding-top:2px;padding-right:11px;font-size:12px;font-weight:700}div.style__entry-history-deleted--NCoz-,div.style__entry-history-restored--3hSUh{font-style:italic;font-size:13px;padding-left:11px}div.style__entry-history-deleted--NCoz-{color:red}div.style__pick-thread--3yl54{position:absolute;left:4px;bottom:20px;box-shadow:0 8px 16px 0 rgba(0,0,0,.3);z-index:1;font-family:Open Sans,sans-serif;font-weight:600;background-color:#fff;border-radius:3px;white-space:nowrap;line-height:normal;font-size:12px;cursor:pointer;outline:none}span.style__select-thread--3QFgC{color:#000;display:inline-block;overflow:hidden;text-overflow:ellipsis;width:110px}div.style__pick-thread--3yl54>div.style__pick-thread-option--KNZ_8{border-bottom:1px solid #d3d3d3;padding:1px 10px 1px 25px;position:relative}div.style__pick-thread--3yl54>div.style__pick-thread-option--KNZ_8:hover{background-color:#f2f2f2}div.style__pick-thread--3yl54>div:last-child{border-bottom:none}div.style__color-preview--e9mlv{width:12px;height:12px;left:6px;position:absolute;top:4px;border:1px solid #d3d3d3;border-radius:2px}div.style__select-thread-name--Gs092{padding-top:1px}div.style__thread-picker-pager-container--1xVyI{text-align:center;height:15px;margin-top:-2px;cursor:default;background-color:#eaeaea;position:relative;border-radius:0 0 3px 3px}div.style__thread-picker-pager--1ZaAO{position:relative;top:-2px}span.style__thread-picker-pager-status--3Sak_{text-transform:uppercase;color:#777;font-family:Open Sans,sans-serif;font-size:9px}svg.style__thread-picker-pager-svg--3KwvB{fill:#777;vertical-align:middle;width:13px;height:13px}a.style__thread-picker-pager-button--2eZro>svg.style__thread-picker-pager-svg--3KwvB{fill:#2a5db0}div.style__edit-thread-color-container--1WU3p{margin-top:-5px}div.style__form-textarea-container--1MHxS{margin-top:1px}div.style__edit-thread-privacy-container--2jH85{margin-bottom:6px}div.style__edit-thread-account-password--ni4zr{border-top:2px solid #efefef;padding-top:4px;margin-top:2px}div.style__user-settings-current-password--30PeC{border-top:2px solid #efefef;padding-top:4px;margin-top:5px}div.style__modal-body--3vkc_ p.style__confirm-account-password--qLFag{padding:3px 0 5px;font-style:italic;font-size:13px;color:#777}ul.style__tab-panel--IvN_H{background-color:#f4f4f4;padding-left:10px;padding-top:5px}ul.style__tab-panel--IvN_H li{display:inline-block;list-style-type:none;font-family:Open Sans,sans-serif;font-size:13px;font-weight:600;cursor:pointer;padding:3px 10px}ul.style__tab-panel--IvN_H li.style__current-tab--2dkNs{background-color:#fff;border-radius:5px 5px 0 0;cursor:default}ul.style__tab-panel--IvN_H li>a{color:#555}ul.style__tab-panel--IvN_H li.style__current-tab--2dkNs>a{color:#123a7b;cursor:default}ul.style__tab-panel--IvN_H li.style__delete-tab--cOPrs>a{color:red!important}div.style__new-thread-privacy-container--3WhE5{margin-bottom:3px;margin-top:-6px}img.style__page-loading--2_FtC{margin-top:8px;margin-right:10px;float:left}span.style__page-loading--2_FtC{margin-top:16px;margin-right:10px;font-size:28px;float:left}div.style__thread-password-entry-input-container--1jxMV{overflow:hidden;padding-right:6px}input.style__thread-password-entry-input--1Z06c{font-size:14px;padding:2px;width:100%;margin-top:5px;border-radius:3px}input.style__thread-password-entry-input--1Z06c:focus{outline:none}input.style__thread-password-entry-submit--2w_ob{float:right;padding:3px 5px;font-size:9px;margin-right:3px;border-radius:3px;border:1px solid #c8c8c8;background-color:#f8f8f8;text-transform:uppercase;font-family:Open Sans,sans-serif;font-weight:600;color:#777;margin-top:6px;margin-left:3px;cursor:pointer}input.style__thread-password-entry-submit--2w_ob:hover{text-decoration:underline}input.style__thread-password-entry-submit--2w_ob:disabled{cursor:auto;text-decoration:none;color:#999}img.style__thread-pasword-entry-loading--2y9SI{float:right;width:14px;padding:9px 1px 0 3px}span.style__thread-pasword-entry-loading--2y9SI{float:right;line-height:14px;padding:9px 3px 0 5px}div.style__color-picker-container--3EBRt{outline:none;position:relative}div.style__color-picker-button--22iR5{margin:6px 3px;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;border:1px solid #a9a9a9;background:#eee;color:#333;vertical-align:middle;border-radius:3px}div.style__color-picker-preview--1eoRI{width:25px;height:16px;border:1px solid #222;margin-right:5px;float:left;z-index:0}div.style__color-picker-down-symbol--2ZZxu{padding:1px 0;height:16px;line-height:16px;float:left;font-size:10px}div.style__color-picker-selector--L9oAL{position:absolute;left:4px;top:34px}div.style__intro-modal--Js0YI{padding:10px 21px 12px;border-radius:5px;border:1px solid #c8c8c8;background-color:#f8f8f8;width:310px;position:fixed;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin-top:100px;box-shadow:2px 3px 6px 0 rgba(0,0,0,.1)}\n\\ No newline at end of file\n+header,tr{font-family:Anaheim,sans-serif}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;background-color:#fffaf0}a{text-decoration:none;color:#2a5db0}input[type=password],input[type=text],textarea{-webkit-appearance:none;-moz-appearance:none;-webkit-border-radius:0;border:1px solid #ddd;border-radius:1px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}input[type=submit]{-webkit-appearance:none;-moz-appearance:none;-webkit-border-radius:0}input[type=submit]::-moz-focus-inner{border:0;padding:0}table{width:100%;table-layout:fixed}textarea.style__entry-text--Z3Yoi{background:none;width:100%;outline:none;border:none;resize:none;overflow:auto;overflow-y:hidden;padding-right:15px;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:11px}*{padding:0;margin:0}header{height:42px}td.style__day--3Rz-S{background-color:#fff;position:relative;vertical-align:top;line-height:0;cursor:text;height:120px}td.style__day--3Rz-S>div.style__entry-container--877Fx{overflow:auto;height:120px}td.style__day--3Rz-S>div.style__focused-entry-container--2uWgW{height:100px!important}div.style__entry-container--877Fx>div.style__entry-container-spacer--16G0j{height:13px}div.style__entry--3_6gh{padding:5px;box-shadow:inset 0 0 0 2px #fff;border-radius:5px;position:relative}div.style__dark-entry--2dc_a,div.style__dark-entry--2dc_a textarea.style__entry-text--Z3Yoi{color:#fff}div.style__dark-entry--2dc_a div.style__action-links--2fUa6>a{color:#d3d3d3}div.style__dark-entry--2dc_a div.style__action-links--2fUa6>a:hover{color:#fff}img.style__entry-loading--AAfKP{position:absolute;top:6px;right:5px;width:12px}span.style__entry-loading--AAfKP{position:absolute;top:13px;right:5px;font-size:16px;width:6px}div.style__action-links--2fUa6{line-height:90%;margin-top:3px;font-size:16px}div.style__day-action-links--pyNpz{padding-left:3px;margin-bottom:1px}div.style__action-links--2fUa6 a+a{margin-left:6px}span.style__action-links-text--37mv2{font-family:Open Sans,sans-serif;font-weight:600;font-size:11px;position:relative;bottom:1px;padding-left:5px}span.style__right-action-links--3kgPm{float:right;text-overflow:ellipsis;white-space:nowrap;max-width:100%;display:inline-block;overflow:hidden}div.style__action-links--2fUa6 svg{fill:gray;width:10px;height:10px}div.style__action-links--2fUa6 svg.style__history--kGNzt{position:relative;top:1px}div.style__dark-entry--2dc_a div.style__action-links--2fUa6 svg{fill:#d3d3d3}div.style__action-links--2fUa6 a:hover svg{fill:#000}div.style__dark-entry--2dc_a div.style__action-links--2fUa6 a:hover svg{fill:#fff}div.style__focused-entry--2R2PY{z-index:3!important}div.style__action-links--2fUa6 a{color:gray}div.style__action-links--2fUa6 a:hover{color:#000}td.style__day--3Rz-S>h2{position:absolute;bottom:2px;right:3px;color:#fee5ac;font-size:32px;line-height:32px;z-index:1}td.style__current-day--2Vq_I>h2{color:#ff944d}h1{position:absolute;padding-left:4px}div.style__upper-right--1Wv0N{position:absolute;padding:6px;right:0}div.style__thread-nav--3jCxJ{padding:3px 12px;z-index:2;position:relative;border-radius:5px;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600;font-size:15px;cursor:pointer;float:left}div.style__thread-nav-null-state--inM1p{z-index:4;cursor:default}div.style__thread-nav-current--3qCZ8{min-width:170px;padding:2px 0}div.style__thread-nav-active--Mp4Yo div.style__thread-nav-current--3qCZ8{cursor:default}svg.style__search-vector--1y3RA{fill:#000;float:left;height:24px;width:24px;margin-right:3px;margin-bottom:-7px;cursor:pointer}div.style__thread-nav-null-state--inM1p>div.style__thread-nav-current--3qCZ8>img{cursor:default}div.style__typeahead-container--ZAVWb{overflow:hidden}input.style__typeahead---jVQ-{padding:0;border:none;background-color:transparent;font-family:Open Sans,sans-serif;font-weight:600;font-size:15px;width:125px}div.style__thread-nav-active--Mp4Yo input.style__typeahead---jVQ-{width:100%}input.style__typeahead---jVQ-:focus{outline-width:0}span.style__thread-nav-symbols--1TcxY{padding-left:10px;float:right;width:8px}svg.style__thread-nav-first-symbol--2DEuX{position:absolute;top:5px;height:12px;width:7px}svg.style__thread-nav-second-symbol--J5B2t{position:absolute;top:14px;height:12px;width:7px}div.style__thread-nav-dropdown--hsHpW{border-top:1px solid #c8c8c8;margin-top:3px;padding-top:3px;width:400px;cursor:default}div.style__thread-nav-option-pane--18u4x{padding:2px 0}div.style__thread-nav-option-pane-header--17OZd{border-bottom:1px solid #c8c8c8;padding:0 0 0 4px;text-transform:uppercase;color:#777;font-family:Open Sans,sans-serif;font-size:9px;position:relative}div.style__thread-nav-option--pe2vI{cursor:pointer;padding-left:28px;padding-bottom:6px;padding-top:3px;position:relative}div.style__thread-nav-option-name--3edRD{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}ul.style__thread-nav-option-buttons--1hTtl{text-transform:uppercase;font-family:Open Sans,sans-serif;font-size:9px;list-style-type:none;float:right;padding-left:10px;padding-right:4px}ul.style__thread-nav-option-buttons--1hTtl>li{list-style-type:none;display:inline-block}ul.style__thread-nav-option-buttons--1hTtl>li+li:before{content:\"\\B7\";padding:0 3px}ul.style__thread-nav-option-buttons--1hTtl a:hover{text-decoration:underline}.style__thread-nav-option-buttons-loading--1mcA4{position:relative;padding-left:3px;top:2px;right:3px;width:10px;font-size:14px}span.style__loading-indicator-error--3rllh{font-weight:700;color:red;line-height:0}div.style__thread-nav-option-description--_ahC6{font-size:11px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;color:#444;padding-top:4px}div.style__thread-nav-frozen-option--1LFBw,div.style__thread-nav-option--pe2vI:hover{background-color:#e8e8e8}div.style__thread-nav-open-option--qMtEQ{cursor:default}div.style__thread-nav-no-results--iQJn4{text-align:center;font-style:italic;color:#777;padding-top:3px;font-size:12px}div.style__thread-nav-color-preview--3QhpW{width:12px;height:12px;left:6px;position:absolute;top:7px;border:1px solid #d3d3d3;border-radius:2px}div.style__thread-nav-pager--3BO6-{position:absolute;top:0;right:0}a.style__thread-nav-pager-button--1J-GY{vertical-align:top}svg.style__thread-nav-pager-svg--2aAv_{display:inline-block;fill:#777;width:13px;height:13px}a.style__thread-nav-pager-button--1J-GY>svg.style__thread-nav-pager-svg--2aAv_{fill:#2a5db0}span.style__thread-nav-pager-status--1zJff{vertical-align:top}h2.style__upper-center--23QDz{text-align:center}h2.style__upper-center--23QDz>a.style__previous-month-link--1-H8z{position:absolute;left:50%;margin-left:-100px}h2.style__upper-center--23QDz>a.style__next-month-link--1VbTv{position:absolute;right:50%;margin-right:-100px}div.style__lower-left--k_T4L{position:fixed;left:-1px;bottom:-1px;padding:0 6px;z-index:3;border-radius:0 5px 0 0;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600}div.style__lower-left-null-state--2b-9l{z-index:4}div.style__account-button--2WABg{padding:3px 4px 3px 8px;font-size:0}div.style__account-button--2WABg>span{font-size:16px}div.style__account-menu--24Dmp{outline:none}div.style__account-menu--24Dmp>div{border-bottom:1px solid #c8c8c8;padding:3px 4px 3px 8px}span.style__username--3-Wx_{display:inline-block;color:#2a5db0;cursor:pointer}svg.style__account-caret--1IkNx{padding-left:6px;fill:#2a5db0;cursor:pointer;height:10px;width:10px}div.style__modal-overlay--2r12A{position:fixed;left:0;top:0;z-index:3;width:100%;height:100%;background-color:rgba(0,0,0,.4);overflow:auto}div.style__small-modal-overlay--oBODp{padding-top:100px}div.style__large-modal-overlay--2SAuH{padding-top:50px}div.style__modal--22Sm9{position:relative;background-color:#fff;margin:auto;box-shadow:0 4px 20px rgba(0,0,0,.3),0 0 0 1px rgba(0,0,0,.1);border-radius:3px;max-width:330px}div.style__large-modal--gVblj{max-width:500px}span.style__modal-close--1NLJd{float:right;font-size:32px;font-weight:300;line-height:26px}span.style__modal-close--1NLJd:hover{color:#000;cursor:pointer}div.style__modal-header--3LDhL{padding:6px;background-color:#fee5ac;border-top-left-radius:3px;border-top-right-radius:3px;font-family:Open Sans,sans-serif}div.style__modal-header--3LDhL>h2{font-size:22px;font-weight:300}div.style__modal-body--3vkc_{padding:6px;width:100%;box-sizing:border-box}div.style__modal-body--3vkc_ p{padding:1px 3px 4px;font-size:14px;text-align:center}div.style__modal-body--3vkc_ p.style__form-pre-footer--2BAMk{padding-top:5px;font-size:12px;font-style:italic}div.style__modal-body--3vkc_ input,div.style__modal-body--3vkc_ textarea{margin:3px}div.style__modal-body--3vkc_ input[type=password],div.style__modal-body--3vkc_ input[type=text],div.style__modal-body--3vkc_ textarea{font-size:14px;padding:1px;width:175px}div.style__large-modal--gVblj div.style__modal-body--3vkc_ input[type=password],div.style__large-modal--gVblj div.style__modal-body--3vkc_ input[type=text],div.style__large-modal--gVblj div.style__modal-body--3vkc_ textarea{width:275px}div.style__modal-body--3vkc_ input[type=submit]{padding:3px 9px;font-size:12px;margin-right:3px;border-radius:3px;border:1px solid #c8c8c8;background-color:#f8f8f8;font-family:Open Sans,sans-serif;font-weight:600;color:#444;margin-top:1px;cursor:pointer}div.style__modal-body--3vkc_ input[type=submit]:hover{text-decoration:underline}div.style__modal-body--3vkc_ input[type=submit]:disabled{cursor:auto;text-decoration:none;color:#999}div.style__modal-body--3vkc_ div.style__form-title--1UXQV{display:inline-block;text-align:right;padding-right:5px;padding-top:5px;font-size:14px;font-family:Open Sans,sans-serif;font-weight:600;vertical-align:top;width:110px}div.style__large-modal--gVblj div.style__modal-body--3vkc_ div.style__form-title--1UXQV{width:140px}div.style__modal-body--3vkc_ div.style__form-content--exkyC{display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px}div.style__modal-body--3vkc_ div.style__form-subtitle--3a0Zr{font-size:12px;padding-left:4px;font-style:italic}div.style__form-enum-selector--2ihOZ{display:inline-block;padding-bottom:4px}div.style__form-enum-selector--2ihOZ>div.style__form-enum-container--2uC_1{padding-top:5px}div.style__form-enum-selector--2ihOZ>div.style__form-enum-container--2uC_1>input{vertical-align:top;margin-top:4px}div.style__form-enum-selector--2ihOZ div.style__form-enum-option--WtiUu{font-weight:700;display:inline-block;font-size:15px;font-family:Open Sans,sans-serif;font-weight:600;padding-left:3px}div.style__form-enum-selector--2ihOZ span.style__form-enum-description--2QWm-{display:block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;font-size:13px;max-width:260px;color:gray}div.style__form-enum-selector--2ihOZ div.style__form-enum-password--30J0G{margin-left:-5px}div.style__form-enum-selector--2ihOZ div.style__form-enum-password--30J0G>input[type=password]{width:257px}div.style__color-title--2akqJ{margin-top:4px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq{margin-top:5px;padding-top:3px;border-top:2px solid #efefef;min-height:26px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq span.style__modal-form-error--1-PtI{display:inline-block;font-size:14px;color:red;font-style:italic;padding-top:5px}div.style__modal-body--3vkc_ div.style__form-footer--e2GTq span.style__form-submit--2puj6{display:inline-block;float:right}div.style__form-text--1PUCm>div.style__form-title--1UXQV{vertical-align:initial}div.style__form-text--1PUCm>div.style__form-content--exkyC{margin-left:3px;margin-bottom:3px}div.style__form-text--1PUCm>div.style__form-float-title--1aqLL{float:left;text-align:right;padding-right:5px;font-size:14px;font-family:Open Sans,sans-serif;font-weight:600;width:110px}div.style__form-text--1PUCm>div.style__form-float-content--3AIF1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;padding:1px 20px 3px 4px;margin-top:5px}.style__verified-status-true--3VBnj{color:green}.style__verified-status-false--2Ax7d{color:red}.style__hidden--3Wgyn{display:none}.style__italic--3zZuj{font-style:italic}div.style__history-modal-body--19dYB{position:relative;height:240px;overflow:hidden}img.style__history-loading--1ncSj{position:absolute;right:6px;top:5px}span.style__history-loading--1ncSj{position:absolute;line-height:16px;font-size:16px;right:12px;top:6px}div.style__entry-history--3JUCQ{position:absolute;width:100%;top:27px;box-sizing:border-box}div.style__entry-history-visible--24Jd5{left:0}div.style__entry-history-invisible--Fi8pf{left:100%}@keyframes style__entry-history-visible-animation--1LKbn{0%{left:100%}to{left:0}}div.style__entry-history-visible-animate--1Bc6W{left:0;animation-name:style__entry-history-visible-animation--1LKbn;animation-duration:.5s}@keyframes style__entry-history-invisible-animation--2I_d0{0%{left:0}to{left:100%}}div.style__entry-history-invisible-animate--1kTif{left:100%;animation-name:style__entry-history-invisible-animation--2I_d0;animation-duration:.5s}div.style__history-header--A6jEo{position:absolute;left:0;top:0;width:100%;padding:5px;font-size:12px;font-family:Open Sans,sans-serif;font-weight:600;background-color:#f4f4f4;box-sizing:border-box}a.style__all-history-button--3W-QE{position:absolute;top:5px;left:7px}span.style__history-date--1riIe{float:left;width:100%;text-align:center}div.style__entry-history--3JUCQ ul{overflow:auto;height:211px}div.style__entry-history--3JUCQ li{border-bottom:2px solid #d3d3d3;margin:5px;padding-bottom:8px;padding-top:1px}div.style__entry-history--3JUCQ li:last-child{border-bottom:none}span.style__entry-author--3xhRt{float:left;padding-left:11px;font-size:12px;color:gray;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:50%;box-sizing:border-box}span.style__entry-username--2vUz5{color:#2a5db0}time.style__entry-time--2bQER{float:right;padding-right:11px;font-size:12px;color:gray}span.style__entry-thread--3JNqV{float:right;padding-right:11px;font-size:12px;font-family:Open Sans,sans-serif;font-weight:600;margin-top:-2px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:50%;padding-left:10px;box-sizing:border-box}div.style__clear--QO98A{clear:both}div.style__entry-history-entry--1v7Uf{margin:5px;font-size:13px;word-break:break-all;white-space:pre-wrap}div.style__day-history--1GK6a{position:absolute;width:100%;top:27px;box-sizing:border-box}div.style__day-history-visible--33YbJ{left:0}div.style__day-history-invisible--1y0LO{left:-100%}@keyframes style__day-history-visible-animation--I3Dhr{0%{left:-100%}to{left:0}}div.style__day-history-visible-animate--2xLPu{left:0;animation-name:style__day-history-visible-animation--I3Dhr;animation-duration:.5s}@keyframes style__day-history-invisible-animation--1Ysqo{0%{left:0}to{left:-100%}}div.style__day-history-invisible-animate--NTu7V{left:-100%;animation-name:style__day-history-invisible-animation--1Ysqo;animation-duration:.5s}div.style__day-history--1GK6a ul{overflow:auto;height:211px}div.style__day-history--1GK6a li{padding-bottom:2px}div.style__day-history--1GK6a li:last-child{padding-bottom:8px}span.style__deleted-entry--3-gNv{float:left;padding-top:2px;padding-left:11px;font-size:12px;line-height:17px}span.style__deleted-entry-label--3FLlY{color:red;font-style:italic}span.style__restore-entry-label--18XjI{padding-left:5px}img.style__restore-loading--rnpa2{position:relative;top:2px;left:5px;width:12px}span.style__restore-loading--rnpa2{position:relative;top:2px;left:7px;font-size:15px}a.style__revision-history-button--2y5ge{float:right;padding-top:2px;padding-right:11px;font-size:12px;font-weight:700}div.style__entry-history-deleted--NCoz-,div.style__entry-history-restored--3hSUh{font-style:italic;font-size:13px;padding-left:11px}div.style__entry-history-deleted--NCoz-{color:red}div.style__pick-thread--3yl54{position:absolute;left:4px;bottom:20px;box-shadow:0 8px 16px 0 rgba(0,0,0,.3);z-index:1;font-family:Open Sans,sans-serif;font-weight:600;background-color:#fff;border-radius:3px;white-space:nowrap;line-height:normal;font-size:12px;cursor:pointer;outline:none}span.style__select-thread--3QFgC{color:#000;display:inline-block;overflow:hidden;text-overflow:ellipsis;width:110px}div.style__pick-thread--3yl54>div.style__pick-thread-option--KNZ_8{border-bottom:1px solid #d3d3d3;padding:1px 10px 1px 25px;position:relative}div.style__pick-thread--3yl54>div.style__pick-thread-option--KNZ_8:hover{background-color:#f2f2f2}div.style__pick-thread--3yl54>div:last-child{border-bottom:none}div.style__color-preview--e9mlv{width:12px;height:12px;left:6px;position:absolute;top:4px;border:1px solid #d3d3d3;border-radius:2px}div.style__select-thread-name--Gs092{padding-top:1px}div.style__thread-picker-pager-container--1xVyI{text-align:center;height:15px;margin-top:-2px;cursor:default;background-color:#eaeaea;position:relative;border-radius:0 0 3px 3px}div.style__thread-picker-pager--1ZaAO{position:relative;top:-2px}span.style__thread-picker-pager-status--3Sak_{text-transform:uppercase;color:#777;font-family:Open Sans,sans-serif;font-size:9px}svg.style__thread-picker-pager-svg--3KwvB{fill:#777;vertical-align:middle;width:13px;height:13px}a.style__thread-picker-pager-button--2eZro>svg.style__thread-picker-pager-svg--3KwvB{fill:#2a5db0}div.style__edit-thread-color-container--1WU3p{margin-top:-5px}div.style__form-textarea-container--1MHxS{margin-top:1px}div.style__edit-thread-privacy-container--2jH85{margin-bottom:6px}div.style__edit-thread-account-password--ni4zr{border-top:2px solid #efefef;padding-top:4px;margin-top:2px}div.style__user-settings-current-password--30PeC{border-top:2px solid #efefef;padding-top:4px;margin-top:5px}div.style__modal-body--3vkc_ p.style__confirm-account-password--qLFag{padding:3px 0 5px;font-style:italic;font-size:13px;color:#777}ul.style__tab-panel--IvN_H{background-color:#f4f4f4;padding-left:10px;padding-top:5px}ul.style__tab-panel--IvN_H li{display:inline-block;list-style-type:none;font-family:Open Sans,sans-serif;font-size:13px;font-weight:600;cursor:pointer;padding:3px 10px}ul.style__tab-panel--IvN_H li.style__current-tab--2dkNs{background-color:#fff;border-radius:5px 5px 0 0;cursor:default}ul.style__tab-panel--IvN_H li>a{color:#555}ul.style__tab-panel--IvN_H li.style__current-tab--2dkNs>a{color:#123a7b;cursor:default}ul.style__tab-panel--IvN_H li.style__delete-tab--cOPrs>a{color:red!important}div.style__new-thread-privacy-container--3WhE5{margin-bottom:3px;margin-top:-6px}img.style__page-loading--2_FtC{margin-top:8px;margin-right:10px;float:left}span.style__page-loading--2_FtC{margin-top:16px;margin-right:10px;font-size:28px;float:left}div.style__thread-password-entry-input-container--1jxMV{overflow:hidden;padding-right:6px}input.style__thread-password-entry-input--1Z06c{font-size:14px;padding:2px;width:100%;margin-top:5px;border-radius:3px}input.style__thread-password-entry-input--1Z06c:focus{outline:none}input.style__thread-password-entry-submit--2w_ob{float:right;padding:3px 5px;font-size:9px;margin-right:3px;border-radius:3px;border:1px solid #c8c8c8;background-color:#f8f8f8;text-transform:uppercase;font-family:Open Sans,sans-serif;font-weight:600;color:#777;margin-top:6px;margin-left:3px;cursor:pointer}input.style__thread-password-entry-submit--2w_ob:hover{text-decoration:underline}input.style__thread-password-entry-submit--2w_ob:disabled{cursor:auto;text-decoration:none;color:#999}img.style__thread-pasword-entry-loading--2y9SI{float:right;width:14px;padding:9px 1px 0 3px}span.style__thread-pasword-entry-loading--2y9SI{float:right;line-height:14px;padding:9px 3px 0 5px}div.style__color-picker-container--3EBRt{outline:none;position:relative}div.style__color-picker-button--22iR5{margin:6px 3px;overflow:hidden;cursor:pointer;padding:4px;display:inline-block;border:1px solid #a9a9a9;background:#eee;color:#333;vertical-align:middle;border-radius:3px}div.style__color-picker-preview--1eoRI{width:25px;height:16px;border:1px solid #222;margin-right:5px;float:left;z-index:0}div.style__color-picker-down-symbol--2ZZxu{padding:1px 0;height:16px;line-height:16px;float:left;font-size:10px}div.style__color-picker-selector--L9oAL{position:absolute;left:4px;top:34px}div.style__intro-modal--Js0YI{padding:10px 21px 12px;border-radius:5px;border:1px solid #c8c8c8;background-color:#f8f8f8;width:310px;position:fixed;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin-top:100px;box-shadow:2px 3px 6px 0 rgba(0,0,0,.1)}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -32,7 +32,6 @@ input[type='submit']::-moz-focus-inner {\n}\ntable {\n- height: 100%;\nwidth: 100%;\ntable-layout: fixed;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Stop website table from taking whole page |
129,187 | 28.02.2018 00:59:11 | 18,000 | b25b01da2283c37478345e387d3062c9938cbeea | Forgot one small Redux prop... | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -139,6 +139,7 @@ async function renderHTML(viewer: Viewer, url: string): Promise<string> {\nloadingStatuses: {},\ncookie: undefined,\ndeviceToken: null,\n+ typeaheadRecommendedThreads: [],\n}: AppState),\n);\nconst routerContext = {};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Forgot one small Redux prop... |
129,187 | 28.02.2018 11:39:32 | 18,000 | 0357237f3368631d3a2a1e6da792287e3b668cd0 | Initial version of a native error boundary | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -146,6 +146,7 @@ android {\n}\ndependencies {\n+ compile project(':react-native-exit-app')\ncompile project(':react-native-fcm')\ncompile 'com.google.firebase:firebase-core:10.0.1'\ncompile project(':react-native-vector-icons')\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java",
"new_path": "native/android/app/src/main/java/org/squadcal/MainApplication.java",
"diff": "@@ -3,6 +3,7 @@ package org.squadcal;\nimport android.app.Application;\nimport com.facebook.react.ReactApplication;\n+import com.github.wumke.RNExitApp.RNExitAppPackage;\nimport com.evollu.react.fcm.FIRMessagingPackage;\nimport com.oblador.vectoricons.VectorIconsPackage;\nimport com.oblador.keychain.KeychainPackage;\n@@ -26,6 +27,7 @@ public class MainApplication extends Application implements ReactApplication {\nprotected List<ReactPackage> getPackages() {\nreturn Arrays.<ReactPackage>asList(\nnew MainReactPackage(),\n+ new RNExitAppPackage(),\nnew FIRMessagingPackage(),\nnew VectorIconsPackage(),\nnew KeychainPackage()\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/settings.gradle",
"new_path": "native/android/settings.gradle",
"diff": "rootProject.name = 'SquadCal'\n+include ':react-native-exit-app'\n+project(':react-native-exit-app').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exit-app/android')\ninclude ':react-native-fcm'\nproject(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android')\ninclude ':react-native-vector-icons'\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -21,6 +21,7 @@ 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 type { ErrorInfo, ErrorData } from './crash.react';\nimport React from 'react';\nimport { Provider, connect } from 'react-redux';\n@@ -83,20 +84,21 @@ import {\nclearAndroidNotificationActionType,\n} from './push/android';\nimport NotificationBody from './push/notification-body.react';\n+import Crash from './crash.react';\nlet urlPrefix;\nif (!__DEV__) {\nurlPrefix = \"https://squadcal.org/\";\n} else if (Platform.OS === \"android\") {\n// This is a magic IP address that forwards to the emulator's host\n- urlPrefix = \"http://10.0.2.2/~ashoat/squadcal/\";\n+ urlPrefix = \"http://10.0.2.2/squadcal/\";\n// Uncomment below and update IP address if testing on physical device\n- //urlPrefix = \"http://192.168.1.4/~ashoat/squadcal/\";\n+ //urlPrefix = \"http://192.168.1.4/squadcal/\";\n} else if (Platform.OS === \"ios\") {\n// Since iOS is simulated and not emulated, we can use localhost\n- urlPrefix = \"http://localhost/~ashoat/squadcal/\";\n+ urlPrefix = \"http://localhost/squadcal/\";\n// Uncomment below and update IP address if testing on physical device\n- //urlPrefix = \"http://192.168.1.4/~ashoat/squadcal/\";\n+ //urlPrefix = \"http://192.168.1.4/squadcal/\";\n} else {\ninvariant(false, \"unsupported platform\");\n}\n@@ -147,7 +149,10 @@ type Props = {\ndeviceType: DeviceType,\n) => Promise<string>,\n};\n-class AppWithNavigationState extends React.PureComponent<Props> {\n+type State = {|\n+ errorData: ?ErrorData,\n+|};\n+class AppWithNavigationState extends React.PureComponent<Props, State> {\nstatic propTypes = {\ncookie: PropTypes.string,\n@@ -173,6 +178,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nandroidNotifListener: ?Object = null;\nandroidRefreshTokenListener: ?Object = null;\ninitialAndroidNotifHandled = false;\n+ state = {\n+ errorData: null,\n+ };\ncomponentDidMount() {\nNativeAppState.addEventListener('change', this.handleAppStateChange);\n@@ -546,6 +554,10 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\n}\n+ componentDidCatch(error: Error, info: ErrorInfo) {\n+ this.setState({ errorData: { error, info } });\n+ }\n+\nping = () => {\nconst startingPayload = this.props.pingStartingPayload();\nif (\n@@ -634,6 +646,11 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\nrender() {\n+ if (this.state.errorData) {\n+ return (\n+ <Crash errorData={this.state.errorData} />\n+ );\n+ }\nconst navigation: NavigationScreenProp<any> = addNavigationHelpers({\ndispatch: this.props.dispatch,\nstate: this.props.navigationState,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/crash.react.js",
"diff": "+// @flow\n+\n+import React from 'react';\n+import { View, Text, Platform, StyleSheet, ScrollView } from 'react-native';\n+import Icon from 'react-native-vector-icons/FontAwesome';\n+import _shuffle from 'lodash/fp/shuffle';\n+import ExitApp from 'react-native-exit-app';\n+\n+import Button from './components/button.react';\n+import { persistor } from './redux-setup';\n+\n+export type ErrorInfo = { componentStack: string };\n+export type ErrorData = {| error: Error, info: ErrorInfo |};\n+\n+const errorTitles = [\n+ \"Oh no!!\",\n+ \"Womp womp womp...\",\n+];\n+\n+type Props = {|\n+ errorData: ErrorData,\n+|};\n+class Crash extends React.PureComponent<Props> {\n+\n+ errorTitle = _shuffle(errorTitles)[0];\n+\n+ render() {\n+ return (\n+ <View style={styles.container}>\n+ <Icon name=\"bug\" size={32} color=\"red\" />\n+ <Text style={styles.header}>{this.errorTitle}</Text>\n+ <Text style={styles.text}>I'm sorry, but the app crashed.</Text>\n+ <Text style={styles.text}>\n+ Here's some text that's probably not helpful:\n+ </Text>\n+ <ScrollView style={styles.scrollView}>\n+ <Text style={styles.errorText}>\n+ {this.props.errorData.error.message}\n+ </Text>\n+ </ScrollView>\n+ <View style={styles.buttons}>\n+ <Button onPress={this.onPressKill} style={styles.button}>\n+ <Text style={styles.buttonText}>Kill the app</Text>\n+ </Button>\n+ <Button onPress={this.onPressWipe} style={styles.button}>\n+ <Text style={styles.buttonText}>Wipe state and kill app</Text>\n+ </Button>\n+ </View>\n+ </View>\n+ );\n+ }\n+\n+ onPressKill = () => {\n+ ExitApp.exitApp();\n+ }\n+\n+ onPressWipe = () => {\n+ persistor.purge();\n+ ExitApp.exitApp();\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ flex: 1,\n+ justifyContent: \"center\",\n+ alignItems: 'center',\n+ },\n+ header: {\n+ fontSize: 24,\n+ paddingBottom: 24,\n+ },\n+ text: {\n+ paddingBottom: 24,\n+ },\n+ errorText: {\n+ fontFamily: Platform.select({\n+ ios: \"Menlo\",\n+ android: \"Roboto\",\n+ default: \"monospace\",\n+ }),\n+ },\n+ scrollView: {\n+ flex: 1,\n+ maxHeight: 200,\n+ paddingHorizontal: 50,\n+ marginBottom: 24,\n+ },\n+ buttons: {\n+ flexDirection: \"row\",\n+ },\n+ button: {\n+ backgroundColor: \"#FF0000\",\n+ borderRadius: 5,\n+ paddingVertical: 5,\n+ paddingHorizontal: 10,\n+ marginHorizontal: 10,\n+ },\n+ buttonText: {\n+ color: \"white\",\n+ fontSize: 16,\n+ },\n+});\n+\n+export default Crash;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/lib_vx.x.x.js",
"new_path": "native/flow-typed/npm/lib_vx.x.x.js",
"diff": "-// flow-typed signature: 92bb348d313ffc88d7b6d48021652c54\n+// flow-typed signature: 5cf4e8d952395adddff5a9aa3c04488b\n// flow-typed version: <<STUB>>/lib_v0.0.1/flow_v0.61.0\n/**\n@@ -226,6 +226,10 @@ declare module 'lib/shared/user-utils' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/account-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/activity-types' {\ndeclare module.exports: any;\n}\n@@ -234,6 +238,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@@ -262,6 +270,10 @@ declare module 'lib/types/redux-types' {\ndeclare module.exports: any;\n}\n+declare module 'lib/types/search-types' {\n+ declare module.exports: any;\n+}\n+\ndeclare module 'lib/types/subscription-types' {\ndeclare module.exports: any;\n}\n@@ -318,10 +330,6 @@ declare module 'lib/utils/url-utils' {\ndeclare module.exports: any;\n}\n-declare module 'lib/utils/verify-utils' {\n- declare module.exports: any;\n-}\n-\n// Filename aliases\ndeclare module 'lib/actions/device-actions.js' {\ndeclare module.exports: $Exports<'lib/actions/device-actions'>;\n@@ -476,12 +484,18 @@ declare module 'lib/shared/typeahead-text.js' {\ndeclare module 'lib/shared/user-utils.js' {\ndeclare module.exports: $Exports<'lib/shared/user-utils'>;\n}\n+declare module 'lib/types/account-types.js' {\n+ declare module.exports: $Exports<'lib/types/account-types'>;\n+}\ndeclare module 'lib/types/activity-types.js' {\ndeclare module.exports: $Exports<'lib/types/activity-types'>;\n}\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@@ -503,6 +517,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/search-types.js' {\n+ declare module.exports: $Exports<'lib/types/search-types'>;\n+}\ndeclare module 'lib/types/subscription-types.js' {\ndeclare module.exports: $Exports<'lib/types/subscription-types'>;\n}\n@@ -545,6 +562,3 @@ declare module 'lib/utils/text-utils.js' {\ndeclare module 'lib/utils/url-utils.js' {\ndeclare module.exports: $Exports<'lib/utils/url-utils'>;\n}\n-declare module 'lib/utils/verify-utils.js' {\n- declare module.exports: $Exports<'lib/utils/verify-utils'>;\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/lodash_v4.x.x.js",
"new_path": "native/flow-typed/npm/lodash_v4.x.x.js",
"diff": "-// flow-typed signature: 8cfd8555501c152cb770f913e5d69906\n-// flow-typed version: a7fde2f5d1/lodash_v4.x.x/flow_>=v0.55.x <=v0.62.x\n+// flow-typed signature: 2aa4c73f85e9dfa81f161e7edb6e4d6e\n+// flow-typed version: 8c150a1c24/lodash_v4.x.x/flow_>=v0.55.x <=v0.62.x\ndeclare module \"lodash\" {\ndeclare type __CurriedFunction1<A, R, AA: A> = (...r: [AA]) => R;\n@@ -1369,10 +1369,8 @@ declare module \"lodash\" {\n// NaN is a number instead of its own type, otherwise it would behave like null/void\ndefaultTo<T1: number, T2>(value: T1, defaultValue: T2): T1 | T2;\ndefaultTo<T1: void | null, T2>(value: T1, defaultValue: T2): T2;\n- flow: $ComposeReverse;\n- flow(funcs?: Array<Function>): Function;\n- flowRight: $Compose;\n- flowRight(funcs?: Array<Function>): Function;\n+ flow: ($ComposeReverse & (funcs: Array<Function>) => Function);\n+ flowRight: ($Compose & (funcs: Array<Function>) => Function);\nidentity<T>(value: T): T;\niteratee(func?: any): Function;\nmatches(source?: ?Object): Function;\n@@ -3120,14 +3118,10 @@ declare module \"lodash/fp\" {\ndefaultTo<T1: number, T2>(defaultValue: T2, value: T1): T1 | T2;\ndefaultTo<T1: void | null, T2>(defaultValue: T2): (value: T1) => T2;\ndefaultTo<T1: void | null, T2>(defaultValue: T2, value: T1): T2;\n- flow: $ComposeReverse;\n- flow(funcs: Array<Function>): Function;\n- pipe: $ComposeReverse;\n- pipe(funcs: Array<Function>): Function;\n- flowRight: $Compose;\n- flowRight(funcs: Array<Function>): Function;\n- compose: $Compose;\n- compose(funcs: Array<Function>): Function;\n+ flow: ($ComposeReverse & (funcs: Array<Function>) => Function);\n+ pipe: ($ComposeReverse & (funcs: Array<Function>) => Function);\n+ flowRight: ($Compose & (funcs: Array<Function>) => Function);\n+ compose: ($Compose & (funcs: Array<Function>) => Function);\nidentity<T>(value: T): T;\niteratee(func: any): Function;\nmatches(source: Object): (object: Object) => boolean;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/flow-typed/npm/react-native-exit-app_vx.x.x.js",
"diff": "+// flow-typed signature: d9be43a7323acf7535c9cc9b1f54e978\n+// flow-typed version: <<STUB>>/react-native-exit-app_v^1.0.0/flow_v0.61.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'react-native-exit-app'\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 'react-native-exit-app' {\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+\n+\n+// Filename aliases\n+declare module 'react-native-exit-app/index' {\n+ declare module.exports: $Exports<'react-native-exit-app'>;\n+}\n+declare module 'react-native-exit-app/index.js' {\n+ declare module.exports: $Exports<'react-native-exit-app'>;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/flow-typed/npm/react-native-hyperlink_vx.x.x.js",
"diff": "+// flow-typed signature: 5c012a9e29f13e11da3a16af200d869d\n+// flow-typed version: <<STUB>>/react-native-hyperlink_vgit+https://git@github.com/ashoat/react-native-hyperlink.git#both/flow_v0.61.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'react-native-hyperlink'\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 'react-native-hyperlink' {\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 'react-native-hyperlink/dist/index' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-native-hyperlink/src/Hyperlink' {\n+ declare module.exports: any;\n+}\n+\n+// Filename aliases\n+declare module 'react-native-hyperlink/dist/index.js' {\n+ declare module.exports: $Exports<'react-native-hyperlink/dist/index'>;\n+}\n+declare module 'react-native-hyperlink/src/Hyperlink.js' {\n+ declare module.exports: $Exports<'react-native-hyperlink/src/Hyperlink'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"new_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"diff": "-// flow-typed signature: 2ec149f998c0e60bacc18810504a8499\n-// flow-typed version: 061d4cda47/react-navigation_v1.x.x/flow_>=v0.60.x\n+// flow-typed signature: ecb76745a94f4ec4dff2ff9090351482\n+// flow-typed version: 23b9c2c70c/react-navigation_v1.x.x/flow_>=v0.60.x\n// @flow\n@@ -756,7 +756,7 @@ declare module 'react-navigation' {\ntoString: () => string,\n},\ninit: {\n- (payload: { params?: NavigationParams }): NavigationInitAction,\n+ (payload?: { params?: NavigationParams }): NavigationInitAction,\ntoString: () => string,\n},\nnavigate: {\n@@ -952,7 +952,9 @@ declare module 'react-navigation' {\n};\ndeclare export var SafeAreaView: React$ComponentType<_SafeAreaViewProps>;\n- declare export var Header: React$ComponentType<HeaderProps>;\n+ declare export class Header<P: HeaderProps, S> extends React$Component<P, S> {\n+ static HEIGHT: number\n+ }\ndeclare type _HeaderTitleProps = {\nchildren: React$Node,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"diff": "};\nobjectVersion = 46;\nobjects = {\n-\n/* Begin PBXBuildFile section */\n00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };\n00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };\nA1145AA76F5B4EF5B3ACB31D /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E4E90F44E9F4420080594671 /* MaterialIcons.ttf */; };\nAFA44E75249D4766A4ED74C7 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2D04F3CCBAFF4A8184206FAC /* Octicons.ttf */; };\nFA7F2215AD7646E2BE985BF3 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AE31AFFF88FB4112A29ADE33 /* SimpleLineIcons.ttf */; };\n+ 62E897586C0F47F7AFADFE11 /* libRNExitApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95EA49951E064ECB9B1999EA /* libRNExitApp.a */; };\n/* End PBXBuildFile section */\n/* Begin PBXContainerItemProxy section */\nE7D7D614C3184B1BB95EE661 /* OnePassword.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = OnePassword.xcodeproj; path = \"../node_modules/react-native-onepassword/OnePassword.xcodeproj\"; sourceTree = \"<group>\"; };\nEA40FBBA484449FAA8915A48 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Foundation.ttf\"; sourceTree = \"<group>\"; };\nEBD8879422144B0188A8336F /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Zocial.ttf\"; sourceTree = \"<group>\"; };\n+ 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */ = {isa = PBXFileReference; name = \"RNExitApp.xcodeproj\"; path = \"../node_modules/react-native-exit-app/ios/RNExitApp.xcodeproj\"; sourceTree = \"<group>\"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };\n+ 95EA49951E064ECB9B1999EA /* libRNExitApp.a */ = {isa = PBXFileReference; name = \"libRNExitApp.a\"; path = \"libRNExitApp.a\"; sourceTree = \"<group>\"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };\n/* End PBXFileReference section */\n/* Begin PBXFrameworksBuildPhase section */\n00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,\n139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,\n7F033BB61F01B5E400700D63 /* libOnePassword.a in Frameworks */,\n+ 62E897586C0F47F7AFADFE11 /* libRNExitApp.a in Frameworks */,\n);\nrunOnlyForDeploymentPostprocessing = 0;\n};\nE7D7D614C3184B1BB95EE661 /* OnePassword.xcodeproj */,\n95EEFC35D4D14053ACA7E064 /* RNKeychain.xcodeproj */,\n143FA99006A442AFB7B24B3A /* RNNotifications.xcodeproj */,\n+ 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */,\n);\nname = Libraries;\nsourceTree = \"<group>\";\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nOTHER_LDFLAGS = (\n\"-ObjC\",\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nOTHER_LDFLAGS = (\n\"-ObjC\",\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nOTHER_LDFLAGS = (\n\"-ObjC\",\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nOTHER_LDFLAGS = (\n\"-ObjC\",\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nPRODUCT_BUNDLE_IDENTIFIER = \"com.facebook.REACT.SquadCal-tvOSTests\";\nPRODUCT_NAME = \"$(TARGET_NAME)\";\n\"$(inherited)\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n\"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n+ \"\\\"$(SRCROOT)/$(TARGET_NAME)\\\"\",\n);\nPRODUCT_BUNDLE_IDENTIFIER = \"com.facebook.REACT.SquadCal-tvOSTests\";\nPRODUCT_NAME = \"$(TARGET_NAME)\";\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"lodash\": \"^4.17.5\",\n\"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-floating-action\": \"^1.9.0\",\n\"react-native-hyperlink\": \"git+https://git@github.com/ashoat/react-native-hyperlink.git#both\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -7327,6 +7327,10 @@ react-native-drawer-layout@1.3.2:\ndependencies:\nreact-native-dismiss-keyboard \"1.0.0\"\n+react-native-exit-app@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/react-native-exit-app/-/react-native-exit-app-1.0.0.tgz#a2fbb121d902e6967cd8a365fe8453e5c4bc3172\"\n+\nreact-native-fcm@^11.2.0:\nversion \"11.3.1\"\nresolved \"https://registry.yarnpkg.com/react-native-fcm/-/react-native-fcm-11.3.1.tgz#eae59deb3972d19fdd8d8b52da18984377276e84\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Initial version of a native error boundary |
129,187 | 01.03.2018 11:36:51 | 18,000 | 592d01b87f4f9dccc5341f055ffefc4c716c8635 | Initial crash reporting from native along with server support | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/actions/report-actions.js",
"diff": "+// @flow\n+\n+import type { FetchJSON } from '../utils/fetch-json';\n+import type {\n+ ErrorReportCreationRequest,\n+ ErrorReportCreationResponse,\n+} from '../types/report-types';\n+\n+const sendErrorReportActionTypes = Object.freeze({\n+ started: \"SEND_ERROR_REPORT_STARTED\",\n+ success: \"SEND_ERROR_REPORT_SUCCESS\",\n+ failed: \"SEND_ERROR_REPORT_FAILED\",\n+});\n+async function sendErrorReport(\n+ fetchJSON: FetchJSON,\n+ request: ErrorReportCreationRequest,\n+): Promise<ErrorReportCreationResponse> {\n+ const response = await fetchJSON('create_error_report', request);\n+ return { id: response.id };\n+}\n+\n+export {\n+ sendErrorReportActionTypes,\n+ sendErrorReport,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/user-utils.js",
"new_path": "lib/shared/user-utils.js",
"diff": "@@ -13,6 +13,11 @@ function stringForUser(user: RelativeUserInfo | RelativeMemberInfo): string {\n}\n}\n+function isStaff(userID: string) {\n+ return userID === \"256\";\n+}\n+\nexport {\nstringForUser,\n+ isStaff,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/endpoints.js",
"new_path": "lib/types/endpoints.js",
"diff": "@@ -30,5 +30,7 @@ export const endpoint = Object.freeze({\nCREATE_ACCOUNT: 'create_account',\nLOG_IN: 'log_in',\nUPDATE_PASSWORD: 'update_password',\n+ CREATE_ERROR_REPORT: 'create_error_report',\n+ FETCH_ERROR_REPORT_INFOS: 'fetch_error_report_infos',\n});\nexport type Endpoint = $Values<typeof endpoint>;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -45,6 +45,7 @@ import type {\n} from './message-types';\nimport type { SetCookiePayload } from '../utils/action-utils';\nimport type { UpdateActivityResult } from '../types/activity-types';\n+import type { ErrorReportCreationResponse } from '../types/report-types';\nexport type BaseAppState = {\n// This \"+\" means that navInfo can be a sub-type of BaseNavInfo. As a result,\n@@ -488,6 +489,18 @@ export type BaseAction =\n|} | {|\ntype: \"HANDLE_VERIFICATION_CODE_SUCCESS\",\nloadingInfo: LoadingInfo,\n+ |} | {|\n+ type: \"SEND_ERROR_REPORT_STARTED\",\n+ loadingInfo: LoadingInfo,\n+ |} | {|\n+ type: \"SEND_ERROR_REPORT_FAILED\",\n+ error: true,\n+ payload: Error,\n+ loadingInfo: LoadingInfo,\n+ |} | {|\n+ type: \"SEND_ERROR_REPORT_SUCCESS\",\n+ payload: ErrorReportCreationResponse,\n+ loadingInfo: LoadingInfo,\n|};\nexport type ActionPayload\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/types/report-types.js",
"diff": "+// @flow\n+\n+import type { BaseAppState, BaseAction } from './redux-types';\n+import type { UserInfo } from './user-types';\n+import type { DeviceType } from './device-types';\n+\n+export type ErrorInfo = { componentStack: string };\n+export type ErrorData = {| error: Error, info: ErrorInfo |};\n+export type FlatErrorData = {| errorMessage: string, componentStack: string |};\n+\n+export type ErrorReportCreationRequest = {|\n+ deviceType: DeviceType,\n+ errors: $ReadOnlyArray<FlatErrorData>,\n+ preloadedState: BaseAppState,\n+ currentState: BaseAppState,\n+ actions: $ReadOnlyArray<BaseAction>,\n+ codeVersion: number,\n+ stateVersion: number,\n+|};\n+\n+export type ErrorReportCreationResponse = {|\n+ id: string,\n+|};\n+\n+export type ErrorReportInfo = {|\n+ id: string,\n+ viewerID: string,\n+ deviceType: DeviceType,\n+ creationTime: number,\n+ codeVersion: number,\n+ stateVersion: number,\n+|};\n+\n+export type FetchErrorReportInfosRequest = {|\n+ cursor: ?string,\n+|};\n+\n+export type FetchErrorReportInfosResponse = {|\n+ reports: $ReadOnlyArray<ErrorReportInfo>,\n+ userInfos: $ReadOnlyArray<UserInfo>,\n+|};\n+\n+export type ErrorReport = {|\n+ ...ErrorReportCreationRequest,\n+ viewerID: string,\n+ creationTime: number,\n+ id: string,\n+|};\n+\n+export type ReduxToolsImport = {|\n+ preloadedState: BaseAppState,\n+ payload: $ReadOnlyArray<BaseAction>,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -21,7 +21,7 @@ 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 type { ErrorInfo, ErrorData } from './crash.react';\n+import type { ErrorInfo, ErrorData } from 'lib/types/report-types';\nimport React from 'react';\nimport { Provider, connect } from 'react-redux';\n@@ -150,7 +150,7 @@ type Props = {\n) => Promise<string>,\n};\ntype State = {|\n- errorData: ?ErrorData,\n+ errorData: $ReadOnlyArray<ErrorData>,\n|};\nclass AppWithNavigationState extends React.PureComponent<Props, State> {\n@@ -179,7 +179,7 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\nandroidRefreshTokenListener: ?Object = null;\ninitialAndroidNotifHandled = false;\nstate = {\n- errorData: null,\n+ errorData: [],\n};\ncomponentDidMount() {\n@@ -555,7 +555,12 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\ncomponentDidCatch(error: Error, info: ErrorInfo) {\n- this.setState({ errorData: { error, info } });\n+ this.setState((prevState, props) => ({\n+ errorData: [\n+ ...prevState.errorData,\n+ { error, info },\n+ ],\n+ }));\n}\nping = () => {\n@@ -646,7 +651,7 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\nrender() {\n- if (this.state.errorData) {\n+ if (this.state.errorData.length > 0) {\nreturn (\n<Crash errorData={this.state.errorData} />\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "// @flow\n-import React from 'react';\n-import { View, Text, Platform, StyleSheet, ScrollView } from 'react-native';\n+import type {\n+ ErrorReportCreationRequest,\n+ ErrorReportCreationResponse,\n+} from 'lib/types/report-types';\n+import type { DispatchActionPromise } from 'lib/utils/action-utils';\n+import type { AppState } from './redux-setup';\n+import type { ErrorData } from 'lib/types/report-types';\n+\n+import * as React from 'react';\n+import {\n+ View,\n+ Text,\n+ Platform,\n+ StyleSheet,\n+ ScrollView,\n+ ActivityIndicator,\n+ Clipboard,\n+} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport _shuffle from 'lodash/fp/shuffle';\nimport ExitApp from 'react-native-exit-app';\n+import PropTypes from 'prop-types';\n+import { connect } from 'react-redux';\n+import invariant from 'invariant';\n-import Button from './components/button.react';\n-import { persistor } from './redux-setup';\n+import {\n+ includeDispatchActionProps,\n+ bindServerCalls,\n+} from 'lib/utils/action-utils';\n+import {\n+ sendErrorReportActionTypes,\n+ sendErrorReport,\n+} from 'lib/actions/report-actions';\n-export type ErrorInfo = { componentStack: string };\n-export type ErrorData = {| error: Error, info: ErrorInfo |};\n+import Button from './components/button.react';\n+import { store, persistor, persistConfig } from './redux-setup';\n+import reduxLogger from './redux-logger';\nconst errorTitles = [\n\"Oh no!!\",\n\"Womp womp womp...\",\n];\n-type Props = {|\n- errorData: ErrorData,\n+type Props = {\n+ errorData: $ReadOnlyArray<ErrorData>,\n+ // Redux dispatch functions\n+ dispatchActionPromise: DispatchActionPromise,\n+ // async functions that hit server APIs\n+ sendErrorReport: (\n+ request: ErrorReportCreationRequest,\n+ ) => Promise<ErrorReportCreationResponse>,\n+};\n+type State = {|\n+ errorReportID: ?string,\n|};\n-class Crash extends React.PureComponent<Props> {\n+class Crash extends React.PureComponent<Props, State> {\n+ static propTypes = {\n+ errorData: PropTypes.arrayOf(PropTypes.shape({\n+ error: PropTypes.object.isRequired,\n+ info: PropTypes.shape({\n+ componentStack: PropTypes.string.isRequired,\n+ }).isRequired,\n+ })).isRequired,\n+ dispatchActionPromise: PropTypes.func.isRequired,\n+ sendErrorReport: PropTypes.func.isRequired,\n+ };\nerrorTitle = _shuffle(errorTitles)[0];\n+ state = {\n+ errorReportID: null,\n+ };\n+\n+ componentDidMount() {\n+ this.props.dispatchActionPromise(\n+ sendErrorReportActionTypes,\n+ this.sendReport(),\n+ );\n+ }\nrender() {\n+ const errorText = [...this.props.errorData]\n+ .reverse()\n+ .map(errorData => errorData.error.message)\n+ .join(\"\\n\");\n+ let crashID;\n+ if (this.state.errorReportID) {\n+ crashID = (\n+ <React.Fragment>\n+ <Text style={styles.errorReportIDText}>\n+ {this.state.errorReportID}\n+ </Text>\n+ <Button onPress={this.onCopyCrashReportID}>\n+ <Text style={styles.copyCrashReportIDButtonText}>\n+ (Copy)\n+ </Text>\n+ </Button>\n+ </React.Fragment>\n+ );\n+ } else {\n+ crashID = <ActivityIndicator size=\"small\" />;\n+ }\nreturn (\n<View style={styles.container}>\n<Icon name=\"bug\" size={32} color=\"red\" />\n<Text style={styles.header}>{this.errorTitle}</Text>\n<Text style={styles.text}>I'm sorry, but the app crashed.</Text>\n+ <View style={styles.crashID}>\n+ <Text style={styles.crashIDText}>Crash report ID:</Text>\n+ <View style={styles.errorReportID}>\n+ {crashID}\n+ </View>\n+ </View>\n<Text style={styles.text}>\nHere's some text that's probably not helpful:\n</Text>\n<ScrollView style={styles.scrollView}>\n<Text style={styles.errorText}>\n- {this.props.errorData.error.message}\n+ {errorText}\n</Text>\n</ScrollView>\n<View style={styles.buttons}>\n@@ -50,6 +132,22 @@ class Crash extends React.PureComponent<Props> {\n);\n}\n+ async sendReport() {\n+ const result = await this.props.sendErrorReport({\n+ deviceType: Platform.OS,\n+ errors: this.props.errorData.map(data => ({\n+ errorMessage: data.error.message,\n+ componentStack: data.info.componentStack,\n+ })),\n+ preloadedState: reduxLogger.preloadedState,\n+ currentState: store.getState(),\n+ actions: reduxLogger.lastNActions,\n+ codeVersion: 0,\n+ stateVersion: persistConfig.version,\n+ });\n+ this.setState({ errorReportID: result.id });\n+ }\n+\nonPressKill = () => {\nExitApp.exitApp();\n}\n@@ -59,6 +157,11 @@ class Crash extends React.PureComponent<Props> {\nExitApp.exitApp();\n}\n+ onCopyCrashReportID = () => {\n+ invariant(this.state.errorReportID, \"should be set\");\n+ Clipboard.setString(this.state.errorReportID);\n+ }\n+\n}\nconst styles = StyleSheet.create({\n@@ -68,16 +171,18 @@ const styles = StyleSheet.create({\nalignItems: 'center',\n},\nheader: {\n+ color: 'black',\nfontSize: 24,\npaddingBottom: 24,\n},\ntext: {\n- paddingBottom: 24,\n+ color: 'black',\n+ paddingBottom: 12,\n},\nerrorText: {\n+ color: 'black',\nfontFamily: Platform.select({\nios: \"Menlo\",\n- android: \"Roboto\",\ndefault: \"monospace\",\n}),\n},\n@@ -86,6 +191,7 @@ const styles = StyleSheet.create({\nmaxHeight: 200,\npaddingHorizontal: 50,\nmarginBottom: 24,\n+ marginTop: 12,\n},\nbuttons: {\nflexDirection: \"row\",\n@@ -101,6 +207,33 @@ const styles = StyleSheet.create({\ncolor: \"white\",\nfontSize: 16,\n},\n+ crashID: {\n+ paddingTop: 2,\n+ paddingBottom: 12,\n+ flexDirection: 'row',\n+ },\n+ crashIDText: {\n+ color: 'black',\n+ paddingRight: 8,\n+ },\n+ copyCrashReportIDButtonText: {\n+ color: 'black',\n+ color: '#036AFF',\n+ },\n+ errorReportID: {\n+ flexDirection: 'row',\n+ height: 20,\n+ },\n+ errorReportIDText: {\n+ color: 'black',\n+ paddingRight: 8,\n+ },\n});\n-export default Crash;\n+export default connect(\n+ (state: AppState) => ({\n+ cookie: state.cookie,\n+ }),\n+ includeDispatchActionProps,\n+ bindServerCalls({ sendErrorReport }),\n+)(Crash);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/redux-logger.js",
"diff": "+// @flow\n+\n+import type { AppState } from './redux-setup';\n+\n+class ReduxLogger {\n+\n+ static n = 20;\n+ lastNActions = [];\n+ lastNStates = [];\n+\n+ get preloadedState(): AppState {\n+ return this.lastNStates[0];\n+ }\n+\n+ addAction(action: *, state: AppState) {\n+ if (this.lastNActions.length === ReduxLogger.n) {\n+ this.lastNActions.shift();\n+ this.lastNStates.shift();\n+ }\n+ this.lastNActions.push(action);\n+ this.lastNStates.push(state);\n+ }\n+\n+}\n+\n+const reduxLogger = new ReduxLogger();\n+\n+export default reduxLogger;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -39,6 +39,7 @@ import {\nreduceThreadIDsToNotifIDs,\n} from './push/android';\nimport migrations from './redux-migrations';\n+import reduxLogger from './redux-logger';\nexport type AppState = {|\nnavInfo: NavInfo,\n@@ -227,6 +228,13 @@ function validateState(oldState: AppState, state: AppState): AppState {\nreturn state;\n}\n+const reduxLoggerMiddleware = store => next => action => {\n+ // We want the state before the action\n+ const state = store.getState();\n+ reduxLogger.addAction(action, state);\n+ return next(action);\n+};\n+\nconst persistConfig = {\nkey: 'root',\nstorage,\n@@ -246,7 +254,7 @@ const store = createStore(\n),\ndefaultState,\ncomposeWithDevTools(\n- applyMiddleware(thunk, reactNavigationMiddleware),\n+ applyMiddleware(thunk, reactNavigationMiddleware, reduxLoggerMiddleware),\n),\n);\nconst persistor = persistStore(store);\n@@ -254,4 +262,5 @@ const persistor = persistStore(store);\nexport {\nstore,\npersistor,\n+ persistConfig,\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/creators/error-report-creator.js",
"diff": "+// @flow\n+\n+import type { Viewer } from '../session/viewer';\n+import type {\n+ ErrorReportCreationRequest,\n+ ErrorReportCreationResponse,\n+} from 'lib/types/report-types';\n+\n+import { pool, SQL } from '../database';\n+import createIDs from './id-creator';\n+\n+async function createErrorReport(\n+ viewer: Viewer,\n+ errorReport: ErrorReportCreationRequest,\n+): Promise<ErrorReportCreationResponse> {\n+ const [ id ] = await createIDs(\"reports\", 1);\n+ const { deviceType, ...report } = errorReport;\n+ const row = [\n+ id,\n+ viewer.id,\n+ deviceType,\n+ JSON.stringify(report),\n+ Date.now(),\n+ ];\n+ const query = SQL`\n+ INSERT INTO reports (id, user, platform, report, creation_time)\n+ VALUES ${[row]}\n+ `;\n+ await pool.query(query);\n+ return { id };\n+}\n+\n+export default createErrorReport;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/fetchers/report-fetchers.js",
"diff": "+// @flow\n+\n+import type { Viewer } from '../session/viewer';\n+import type {\n+ FetchErrorReportInfosResponse,\n+ FetchErrorReportInfosRequest,\n+ ReduxToolsImport,\n+} from 'lib/types/report-types';\n+\n+import { ServerError } from 'lib/utils/fetch-utils';\n+import { isStaff } from 'lib/shared/user-utils';\n+\n+import { pool, SQL } from '../database';\n+\n+async function fetchErrorReportInfos(\n+ viewer: Viewer,\n+ request: FetchErrorReportInfosRequest,\n+): Promise<FetchErrorReportInfosResponse> {\n+ if (!viewer.loggedIn || !isStaff(viewer.userID)) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\n+ const query = SQL`\n+ SELECT r.id, r.user, r.platform, r.report, r.creation_time, u.username\n+ FROM reports r\n+ LEFT JOIN users u ON u.id = r.user\n+ `;\n+ if (request.cursor) {\n+ query.append(SQL`WHERE r.id < ${request.cursor} `);\n+ }\n+ query.append(SQL`ORDER BY r.id DESC`);\n+ const [ result ] = await pool.query(query);\n+\n+ const reports = [];\n+ const userInfos = {};\n+ for (let row of result) {\n+ const viewerID = row.user.toString();\n+ reports.push({\n+ id: row.id.toString(),\n+ viewerID,\n+ deviceType: row.platform,\n+ creationTime: row.creation_time,\n+ codeVersion: row.report.codeVersion,\n+ stateVersion: row.report.stateVersion,\n+ });\n+ if (row.username) {\n+ userInfos[viewerID] = {\n+ id: viewerID,\n+ username: row.username,\n+ };\n+ }\n+ }\n+ const userInfoArray: any = Object.values(userInfos);\n+\n+ return { reports, userInfos: userInfoArray };\n+}\n+\n+async function fetchReduxToolsImport(\n+ viewer: Viewer,\n+ id: string,\n+): Promise<ReduxToolsImport> {\n+ if (!viewer.loggedIn || !isStaff(viewer.userID)) {\n+ throw new ServerError('invalid_credentials');\n+ }\n+\n+ const query = SQL`\n+ SELECT user, report, creation_time\n+ FROM reports\n+ WHERE id = ${id}\n+ `;\n+ const [ result ] = await pool.query(query);\n+ if (result.length === 0) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const row = result[0];\n+\n+ return {\n+ preloadedState: row.report.preloadedState,\n+ payload: row.report.actions,\n+ };\n+}\n+\n+export {\n+ fetchErrorReportInfos,\n+ fetchReduxToolsImport,\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/responders/report-responders.js",
"diff": "+// @flow\n+\n+import type {\n+ ErrorReportCreationResponse,\n+ ErrorReportCreationRequest,\n+ FetchErrorReportInfosResponse,\n+ FetchErrorReportInfosRequest,\n+} from 'lib/types/report-types';\n+import type { Viewer } from '../session/viewer';\n+\n+import t from 'tcomb';\n+\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\n+import { tShape } from '../utils/tcomb-utils';\n+import createErrorReport from '../creators/error-report-creator';\n+import { fetchErrorReportInfos } from '../fetchers/report-fetchers';\n+\n+const errorReportCreationRequestInputValidator = tShape({\n+ deviceType: t.enums.of(['ios', 'android']),\n+ errors: t.list(tShape({\n+ errorMessage: t.String,\n+ componentStack: t.String,\n+ })),\n+ preloadedState: t.Object,\n+ currentState: t.Object,\n+ actions: t.list(t.Object),\n+ codeVersion: t.Number,\n+ stateVersion: t.Number,\n+});\n+\n+async function errorReportCreationResponder(\n+ viewer: Viewer,\n+ input: any,\n+): Promise<ErrorReportCreationResponse> {\n+ const request: ErrorReportCreationRequest = input;\n+ if (!errorReportCreationRequestInputValidator.is(request)) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ return await createErrorReport(viewer, request);\n+}\n+\n+const fetchErrorReportInfosRequestInputValidator = tShape({\n+ cursor: t.maybe(t.String),\n+});\n+\n+async function errorReportFetchInfosResponder(\n+ viewer: Viewer,\n+ input: any,\n+): Promise<FetchErrorReportInfosResponse> {\n+ const request: FetchErrorReportInfosRequest = input;\n+ if (!fetchErrorReportInfosRequestInputValidator.is(request)) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ return await fetchErrorReportInfos(viewer, request);\n+}\n+\n+export {\n+ errorReportCreationResponder,\n+ errorReportFetchInfosResponder,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -47,12 +47,16 @@ import {\n} from './responders/thread-responders';\nimport { pingResponder } from './responders/ping-responders';\nimport { websiteResponder } from './responders/website-responders';\n+import {\n+ errorReportCreationResponder,\n+ errorReportFetchInfosResponder,\n+} from './responders/report-responders';\nimport urlFacts from '../facts/url';\nconst { baseRoutePath } = urlFacts;\nconst server = express();\n-server.use(express.json());\n+server.use(express.json({ limit: \"50mb\" }));\nserver.use(cookieParser());\nconst router = express.Router();\n@@ -98,6 +102,8 @@ const jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'create_account': accountCreationResponder,\n'log_in': logInResponder,\n'update_password': passwordUpdateResponder,\n+ 'create_error_report': errorReportCreationResponder,\n+ 'fetch_error_report_infos': errorReportFetchInfosResponder,\n};\nfor (let endpoint in jsonEndpoints) {\n// $FlowFixMe Flow thinks endpoint is string\n"
},
{
"change_type": "MODIFY",
"old_path": "web/dist/app.build.js",
"new_path": "web/dist/app.build.js",
"diff": "@@ -10095,6 +10095,8 @@ function assertVerifyField(ourVerifyField) {\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\"use strict\";\n+\n+\nconst rehydrateActionType = \"persist/REHYDRATE\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = rehydrateActionType;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Initial crash reporting from native along with server support |
129,187 | 01.03.2018 13:43:04 | 18,000 | 145fba3373890a28b0842001c2bfc69627a054c9 | Server endpoint to allow downloading error reports
Also make sure the error report doesn't include rehydrate action | [
{
"change_type": "MODIFY",
"old_path": "native/redux-logger.js",
"new_path": "native/redux-logger.js",
"diff": "import type { AppState } from './redux-setup';\n+import { REHYDRATE } from 'redux-persist';\n+\nclass ReduxLogger {\nstatic n = 20;\n@@ -13,6 +15,13 @@ class ReduxLogger {\n}\naddAction(action: *, state: AppState) {\n+ if (action.type === REHYDRATE) {\n+ // redux-persist can't handle replaying REHYDRATE\n+ // https://github.com/rt2zz/redux-persist/issues/743\n+ this.lastNActions = [];\n+ this.lastNStates = [];\n+ return;\n+ }\nif (this.lastNActions.length === ReduxLogger.n) {\nthis.lastNActions.shift();\nthis.lastNStates.shift();\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -7,6 +7,7 @@ import type {\nFetchErrorReportInfosRequest,\n} from 'lib/types/report-types';\nimport type { Viewer } from '../session/viewer';\n+import type { $Response, $Request } from 'express';\nimport t from 'tcomb';\n@@ -14,7 +15,11 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport { tShape } from '../utils/tcomb-utils';\nimport createErrorReport from '../creators/error-report-creator';\n-import { fetchErrorReportInfos } from '../fetchers/report-fetchers';\n+import {\n+ fetchErrorReportInfos,\n+ fetchReduxToolsImport,\n+} from '../fetchers/report-fetchers';\n+import { fetchViewerForJSONRequest } from '../session/cookies';\nconst errorReportCreationRequestInputValidator = tShape({\ndeviceType: t.enums.of(['ios', 'android']),\n@@ -55,7 +60,37 @@ async function errorReportFetchInfosResponder(\nreturn await fetchErrorReportInfos(viewer, request);\n}\n+async function errorReportDownloadHandler(\n+ req: $Request,\n+ res: $Response,\n+): Promise<void> {\n+ try {\n+ const viewer = await fetchViewerForJSONRequest(req);\n+ const id = req.params.reportID;\n+ if (!id) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const result = await fetchReduxToolsImport(viewer, id);\n+ res.set(\"Content-Disposition\", `attachment; filename=report-${id}.json`);\n+ res.json({\n+ preloadedState: JSON.stringify(result.preloadedState),\n+ payload: JSON.stringify(result.payload),\n+ });\n+ } catch (e) {\n+ console.warn(e);\n+ if (res.headersSent) {\n+ return;\n+ }\n+ if (e instanceof ServerError) {\n+ res.json({ error: e.message, ...e.result });\n+ } else {\n+ res.status(500).send(e.message);\n+ }\n+ }\n+}\n+\nexport {\nerrorReportCreationResponder,\nerrorReportFetchInfosResponder,\n+ errorReportDownloadHandler,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -50,6 +50,7 @@ import { websiteResponder } from './responders/website-responders';\nimport {\nerrorReportCreationResponder,\nerrorReportFetchInfosResponder,\n+ errorReportDownloadHandler,\n} from './responders/report-responders';\nimport urlFacts from '../facts/url';\n@@ -111,6 +112,7 @@ for (let endpoint in jsonEndpoints) {\nrouter.post(`/${endpoint}`, jsonHandler(responder));\n}\n+router.get('/download_error_report/:reportID', errorReportDownloadHandler);\nrouter.get('*', websiteResponder);\nserver.use(baseRoutePath, router);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Server endpoint to allow downloading error reports
Also make sure the error report doesn't include rehydrate action |
129,187 | 01.03.2018 14:15:29 | 18,000 | 5b4dd63aad39269a2776d0d57cb58a33a7db4886 | Use ErrorUtils.setGlobalHandler to capture all JS exceptions | [
{
"change_type": "MODIFY",
"old_path": "lib/types/report-types.js",
"new_path": "lib/types/report-types.js",
"diff": "@@ -5,8 +5,11 @@ import type { UserInfo } from './user-types';\nimport type { DeviceType } from './device-types';\nexport type ErrorInfo = { componentStack: string };\n-export type ErrorData = {| error: Error, info: ErrorInfo |};\n-export type FlatErrorData = {| errorMessage: string, componentStack: string |};\n+export type ErrorData = {| error: Error, info?: ErrorInfo |};\n+export type FlatErrorData = {|\n+ errorMessage: string,\n+ componentStack?: ?string,\n+|};\nexport type ErrorReportCreationRequest = {|\ndeviceType: DeviceType,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -115,6 +115,15 @@ registerConfig({\ncalendarRangeInactivityLimit: sessionInactivityLimit,\n});\n+let appInstance = null;\n+const defaultHandler = global.ErrorUtils.getGlobalHandler();\n+global.ErrorUtils.setGlobalHandler((error) => {\n+ defaultHandler(error);\n+ if (appInstance) {\n+ appInstance.reportError(error);\n+ }\n+});\n+\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\ntype NativeDispatch = Dispatch\n@@ -183,6 +192,7 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n};\ncomponentDidMount() {\n+ appInstance = this;\nNativeAppState.addEventListener('change', this.handleAppStateChange);\nthis.handleInitialURL();\nLinking.addEventListener('url', this.handleURLChange);\n@@ -273,6 +283,7 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\ncomponentWillUnmount() {\n+ appInstance = null;\nNativeAppState.removeEventListener('change', this.handleAppStateChange);\nLinking.removeEventListener('url', this.handleURLChange);\nif (this.activePingSubscription) {\n@@ -563,6 +574,15 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}));\n}\n+ reportError(error: Error) {\n+ this.setState((prevState, props) => ({\n+ errorData: [\n+ ...prevState.errorData,\n+ { error },\n+ ],\n+ }));\n+ }\n+\nping = () => {\nconst startingPayload = this.props.pingStartingPayload();\nif (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "@@ -62,7 +62,7 @@ class Crash extends React.PureComponent<Props, State> {\nerror: PropTypes.object.isRequired,\ninfo: PropTypes.shape({\ncomponentStack: PropTypes.string.isRequired,\n- }).isRequired,\n+ }),\n})).isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\nsendErrorReport: PropTypes.func.isRequired,\n@@ -137,7 +137,7 @@ class Crash extends React.PureComponent<Props, State> {\ndeviceType: Platform.OS,\nerrors: this.props.errorData.map(data => ({\nerrorMessage: data.error.message,\n- componentStack: data.info.componentStack,\n+ componentStack: data.info && data.info.componentStack,\n})),\npreloadedState: reduxLogger.preloadedState,\ncurrentState: store.getState(),\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -25,7 +25,7 @@ const errorReportCreationRequestInputValidator = tShape({\ndeviceType: t.enums.of(['ios', 'android']),\nerrors: t.list(tShape({\nerrorMessage: t.String,\n- componentStack: t.String,\n+ componentStack: t.maybe(t.String),\n})),\npreloadedState: t.Object,\ncurrentState: t.Object,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use ErrorUtils.setGlobalHandler to capture all JS exceptions |
129,187 | 01.03.2018 14:46:23 | 18,000 | 8c8b68afba2bd9b5d421c27e4472c4ba36ce6ee0 | Move ErrorBoundary up above App
This way we can catch exceptions in App as well | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -21,7 +21,6 @@ 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 type { ErrorInfo, ErrorData } from 'lib/types/report-types';\nimport React from 'react';\nimport { Provider, connect } from 'react-redux';\n@@ -84,7 +83,7 @@ import {\nclearAndroidNotificationActionType,\n} from './push/android';\nimport NotificationBody from './push/notification-body.react';\n-import Crash from './crash.react';\n+import ErrorBoundary from './error-boundary.react';\nlet urlPrefix;\nif (!__DEV__) {\n@@ -115,15 +114,6 @@ registerConfig({\ncalendarRangeInactivityLimit: sessionInactivityLimit,\n});\n-let appInstance = null;\n-const defaultHandler = global.ErrorUtils.getGlobalHandler();\n-global.ErrorUtils.setGlobalHandler((error) => {\n- defaultHandler(error);\n- if (appInstance) {\n- appInstance.reportError(error);\n- }\n-});\n-\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\ntype NativeDispatch = Dispatch\n@@ -158,10 +148,7 @@ type Props = {\ndeviceType: DeviceType,\n) => Promise<string>,\n};\n-type State = {|\n- errorData: $ReadOnlyArray<ErrorData>,\n-|};\n-class AppWithNavigationState extends React.PureComponent<Props, State> {\n+class AppWithNavigationState extends React.PureComponent<Props> {\nstatic propTypes = {\ncookie: PropTypes.string,\n@@ -187,12 +174,8 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\nandroidNotifListener: ?Object = null;\nandroidRefreshTokenListener: ?Object = null;\ninitialAndroidNotifHandled = false;\n- state = {\n- errorData: [],\n- };\ncomponentDidMount() {\n- appInstance = this;\nNativeAppState.addEventListener('change', this.handleAppStateChange);\nthis.handleInitialURL();\nLinking.addEventListener('url', this.handleURLChange);\n@@ -283,7 +266,6 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\ncomponentWillUnmount() {\n- appInstance = null;\nNativeAppState.removeEventListener('change', this.handleAppStateChange);\nLinking.removeEventListener('url', this.handleURLChange);\nif (this.activePingSubscription) {\n@@ -565,24 +547,6 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\n}\n- componentDidCatch(error: Error, info: ErrorInfo) {\n- this.setState((prevState, props) => ({\n- errorData: [\n- ...prevState.errorData,\n- { error, info },\n- ],\n- }));\n- }\n-\n- reportError(error: Error) {\n- this.setState((prevState, props) => ({\n- errorData: [\n- ...prevState.errorData,\n- { error },\n- ],\n- }));\n- }\n-\nping = () => {\nconst startingPayload = this.props.pingStartingPayload();\nif (\n@@ -671,11 +635,6 @@ class AppWithNavigationState extends React.PureComponent<Props, State> {\n}\nrender() {\n- if (this.state.errorData.length > 0) {\n- return (\n- <Crash errorData={this.state.errorData} />\n- );\n- }\nconst navigation: NavigationScreenProp<any> = addNavigationHelpers({\ndispatch: this.props.dispatch,\nstate: this.props.navigationState,\n@@ -733,6 +692,8 @@ const ConnectedAppWithNavigationState = connect(\nconst App = (props: {}) =>\n<Provider store={store}>\n+ <ErrorBoundary>\n<ConnectedAppWithNavigationState />\n+ </ErrorBoundary>\n</Provider>;\nAppRegistry.registerComponent('SquadCal', () => App);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "@@ -141,7 +141,7 @@ class Crash extends React.PureComponent<Props, State> {\n})),\npreloadedState: reduxLogger.preloadedState,\ncurrentState: store.getState(),\n- actions: reduxLogger.lastNActions,\n+ actions: reduxLogger.actions,\ncodeVersion: 0,\nstateVersion: persistConfig.version,\n});\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/error-boundary.react.js",
"diff": "+// @flow\n+\n+import type { ErrorInfo, ErrorData } from 'lib/types/report-types';\n+\n+import * as React from 'react';\n+\n+import Crash from './crash.react';\n+\n+let instance = null;\n+const defaultHandler = global.ErrorUtils.getGlobalHandler();\n+global.ErrorUtils.setGlobalHandler((error) => {\n+ defaultHandler(error);\n+ if (instance) {\n+ instance.reportError(error);\n+ }\n+});\n+\n+type Props = {|\n+ children: React.Node,\n+|};\n+type State = {|\n+ errorData: $ReadOnlyArray<ErrorData>,\n+|};\n+class ErrorBoundary extends React.PureComponent<Props, State> {\n+\n+ state = {\n+ errorData: [],\n+ };\n+\n+ componentDidMount() {\n+ instance = this;\n+ }\n+\n+ componentWillUnmount() {\n+ instance = null;\n+ }\n+\n+ componentDidCatch(error: Error, info: ErrorInfo) {\n+ this.setState((prevState, props) => ({\n+ errorData: [\n+ ...prevState.errorData,\n+ { error, info },\n+ ],\n+ }));\n+ }\n+\n+ reportError(error: Error) {\n+ this.setState((prevState, props) => ({\n+ errorData: [\n+ ...prevState.errorData,\n+ { error },\n+ ],\n+ }));\n+ }\n+\n+ render() {\n+ if (this.state.errorData.length > 0) {\n+ return (\n+ <Crash errorData={this.state.errorData} />\n+ );\n+ }\n+ return this.props.children;\n+ }\n+\n+}\n+\n+export default ErrorBoundary;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-logger.js",
"new_path": "native/redux-logger.js",
"diff": "@@ -14,13 +14,19 @@ class ReduxLogger {\nreturn this.lastNStates[0];\n}\n+ get actions(): Array<*> {\n+ return [...this.lastNActions];\n+ }\n+\naddAction(action: *, state: AppState) {\n- if (action.type === REHYDRATE) {\n+ if (\n+ this.lastNActions.length > 0 &&\n+ this.lastNActions[this.lastNActions.length - 1].type === REHYDRATE\n+ ) {\n// redux-persist can't handle replaying REHYDRATE\n// https://github.com/rt2zz/redux-persist/issues/743\nthis.lastNActions = [];\nthis.lastNStates = [];\n- return;\n}\nif (this.lastNActions.length === ReduxLogger.n) {\nthis.lastNActions.shift();\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -98,6 +98,12 @@ const blacklist = __DEV__\n];\nfunction reducer(state: AppState = defaultState, action: *) {\n+ if (action.type === \"crash\") {\n+ return {\n+ ...state,\n+ crash: true,\n+ };\n+ }\nconst oldState = state;\nconst navInfo = reduceNavInfo(state, action);\nif (navInfo && navInfo !== state.navInfo) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move ErrorBoundary up above App
This way we can catch exceptions in App as well |
129,187 | 05.03.2018 12:41:04 | 18,000 | ecc96e5c171e164eae7906c32a331c1154531f33 | Hide IntroModal until we know screen dimensions on web
This way it doesn't initially load in a weird position | [
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -261,10 +261,10 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\naction.type === setCookieActionType\n) {\nconst filteredNavigationState = filterChatScreensForThreadInfos(\n- navInfoState.navigationState,\n+ navigationState,\naction.payload.threadInfos,\n);\n- if (navInfoState.navigationState !== filteredNavigationState) {\n+ if (navigationState !== filteredNavigationState) {\nnavInfoState = {\nstartDate: navInfoState.startDate,\nendDate: navInfoState.endDate,\n@@ -281,7 +281,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nendDate: navInfoState.endDate,\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\n- navigationState: handleURL(navInfoState.navigationState, action.payload),\n+ navigationState: handleURL(navigationState, action.payload),\n};\n} else if (\naction.type === logInActionTypes.success ||\n@@ -294,7 +294,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\nnavigationState: removeModals(\n- navInfoState.navigationState,\n+ navigationState,\naccountModals,\n),\n};\n@@ -312,7 +312,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\nnavigationState: removeModalsIfPingIndicatesLoggedIn(\n- navInfoState.navigationState,\n+ navigationState,\naction.payload,\n),\n};\n@@ -323,7 +323,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\nnavigationState: popChatScreensForThreadID(\n- navInfoState.navigationState,\n+ navigationState,\naction.payload,\n),\n};\n@@ -334,7 +334,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\nnavigationState: replaceChatStackWithThread(\n- navInfoState.navigationState,\n+ navigationState,\naction.payload.newThreadInfo,\nstate.currentUserInfo && state.currentUserInfo.id,\nstate.userInfos,\n@@ -347,7 +347,7 @@ function reduceNavInfo(state: AppState, action: *): NavInfo {\nhome: navInfoState.home,\nthreadID: navInfoState.threadID,\nnavigationState: handleNotificationPress(\n- navInfoState.navigationState,\n+ navigationState,\naction.payload,\nstate.currentUserInfo && state.currentUserInfo.id,\nstate.userInfos,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -140,7 +140,7 @@ async function renderHTML(viewer: Viewer, url: string): Promise<string> {\ncookie: undefined,\ndeviceToken: null,\ntypeaheadRecommendedThreads: null,\n- windowDimensions: { width: 1680, height: 848 },\n+ windowDimensions: { width: 0, height: 0 },\n}: AppState),\n);\nconst routerContext = {};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Hide IntroModal until we know screen dimensions on web
This way it doesn't initially load in a weird position |
129,187 | 05.03.2018 13:27:15 | 18,000 | 768550959db5c534ed713e5abf1e70ee4676168f | Have node assert that the request is secure if facts/url.json indicates it is | [
{
"change_type": "MODIFY",
"old_path": "server/src/session/cookies.js",
"new_path": "server/src/session/cookies.js",
"diff": "@@ -16,6 +16,7 @@ import { Viewer } from './viewer';\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport urlFacts from '../../facts/url';\nimport createIDs from '../creators/id-creator';\n+import { assertSecureRequest } from '../utils/security-utils';\nconst { baseDomain, basePath, https } = urlFacts;\n@@ -159,6 +160,7 @@ async function fetchViewerFromRequestBody(\n}\nasync function fetchViewerForJSONRequest(req: $Request): Promise<Viewer> {\n+ assertSecureRequest(req);\nlet result = await fetchViewerFromRequestBody(req);\nif (!result) {\nresult = await fetchViewerFromCookieData(req.cookies);\n@@ -167,6 +169,7 @@ async function fetchViewerForJSONRequest(req: $Request): Promise<Viewer> {\n}\nasync function fetchViewerForHomeRequest(req: $Request): Promise<Viewer> {\n+ assertSecureRequest(req);\nconst result = await fetchViewerFromCookieData(req.cookies);\nreturn await handleFetchViewerResult(result);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/utils/security-utils.js",
"diff": "+// @flow\n+\n+import type { $Request } from 'express';\n+\n+import urlFacts from '../../facts/url';\n+\n+const { https } = urlFacts;\n+\n+function assertSecureRequest(req: $Request) {\n+ if (https && req.get(\"X-Forwarded-SSL\") !== \"on\") {\n+ throw new Error(\"insecure request\");\n+ }\n+}\n+\n+export {\n+ assertSecureRequest,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Have node assert that the request is secure if facts/url.json indicates it is |
129,187 | 05.03.2018 14:39:49 | 18,000 | f2a8e9e72c45640058730db4ca456ff160d526d1 | Introduce validateInput
Now incorrect input will be included in `ServerError` payload on server and client | [
{
"change_type": "MODIFY",
"old_path": "lib/types/history-types.js",
"new_path": "lib/types/history-types.js",
"diff": "@@ -42,6 +42,9 @@ export const historyRevisionInfoPropType = PropTypes.shape({\nthreadID: PropTypes.string.isRequired,\n});\n+export type FetchEntryRevisionInfosRequest = {|\n+ id: string,\n+|};\nexport type FetchEntryRevisionInfosResult = {|\nresult: $ReadOnlyArray<HistoryRevisionInfo>,\n|};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/activity-responders.js",
"new_path": "server/src/responders/activity-responders.js",
"diff": "@@ -8,10 +8,8 @@ import type {\nimport t from 'tcomb';\n-import { ServerError } from 'lib/utils/fetch-utils';\n-\nimport { activityUpdater } from '../updaters/activity-updaters';\n-import { tBool, tShape } from '../utils/tcomb-utils';\n+import { validateInput, tBool, tShape } from '../utils/validation-utils';\nconst inputValidator = tShape({\nupdates: t.list(t.union([\n@@ -34,12 +32,9 @@ async function updateActivityResponder(\nviewer: Viewer,\ninput: any,\n): Promise<UpdateActivityResult> {\n- const updateActivityRequest: UpdateActivityRequest = input;\n- if (!inputValidator.is(updateActivityRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await activityUpdater(viewer, updateActivityRequest);\n+ const request: UpdateActivityRequest = input;\n+ validateInput(inputValidator, request);\n+ return await activityUpdater(viewer, request);\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/device-responders.js",
"new_path": "server/src/responders/device-responders.js",
"diff": "@@ -5,10 +5,8 @@ import type { Viewer } from '../session/viewer';\nimport t from 'tcomb';\n-import { ServerError } from 'lib/utils/fetch-utils';\n-\nimport { deviceTokenUpdater } from '../updaters/device-token-updaters';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nconst deviceTokenUpdateRequestInputValidator = tShape({\ndeviceType: t.enums.of(['ios', 'android']),\n@@ -19,11 +17,9 @@ async function deviceTokenUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<void> {\n- const deviceTokenUpdateRequest: DeviceTokenUpdateRequest = input;\n- if (!deviceTokenUpdateRequestInputValidator.is(deviceTokenUpdateRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n- await deviceTokenUpdater(viewer, deviceTokenUpdateRequest);\n+ const request: DeviceTokenUpdateRequest = input;\n+ validateInput(deviceTokenUpdateRequestInputValidator, request);\n+ await deviceTokenUpdater(viewer, request);\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/entry-responders.js",
"new_path": "server/src/responders/entry-responders.js",
"diff": "@@ -12,14 +12,17 @@ import type {\nFetchEntryInfosResponse,\nSaveEntryResult,\n} from 'lib/types/entry-types';\n-import type { FetchEntryRevisionInfosResult } from 'lib/types/history-types';\n+import type {\n+ FetchEntryRevisionInfosResult,\n+ FetchEntryRevisionInfosRequest,\n+} from 'lib/types/history-types';\nimport t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport { threadPermissions } from 'lib/types/thread-types';\n-import { tShape, tDate } from '../utils/tcomb-utils';\n+import { validateInput, tShape, tDate } from '../utils/validation-utils';\nimport { verifyThreadID } from '../fetchers/thread-fetchers';\nimport {\nfetchEntryInfos,\n@@ -40,25 +43,20 @@ async function entryFetchResponder(\nviewer: Viewer,\ninput: any,\n): Promise<FetchEntryInfosResponse> {\n- const entryQuery: CalendarQuery = input;\n- if (!entryQueryInputValidator.is(entryQuery)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ const request: CalendarQuery = input;\n+ validateInput(entryQueryInputValidator, request);\n- let validNav = entryQuery.navID === \"home\";\n+ let validNav = request.navID === \"home\";\nif (!validNav) {\n- validNav = await verifyThreadID(entryQuery.navID);\n+ validNav = await verifyThreadID(request.navID);\n}\nif (!validNav) {\nthrow new ServerError('invalid_parameters');\n}\n- return await fetchEntryInfos(viewer, entryQuery);\n+ return await fetchEntryInfos(viewer, request);\n}\n-type EntryRevisionHistoryFetch = {|\n- id: string,\n-|};\nconst entryRevisionHistoryFetchInputValidator = tShape({\nid: t.String,\n});\n@@ -67,15 +65,9 @@ async function entryRevisionFetchResponder(\nviewer: Viewer,\ninput: any,\n): Promise<FetchEntryRevisionInfosResult> {\n- const entryRevisionHistoryFetch: EntryRevisionHistoryFetch = input;\n- if (!entryRevisionHistoryFetchInputValidator.is(entryRevisionHistoryFetch)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- const entryHistory = await fetchEntryRevisionInfo(\n- viewer,\n- entryRevisionHistoryFetch.id,\n- );\n+ const request: FetchEntryRevisionInfosRequest = input;\n+ validateInput(entryRevisionHistoryFetchInputValidator, request);\n+ const entryHistory = await fetchEntryRevisionInfo(viewer, request.id);\nreturn { result: entryHistory };\n}\n@@ -91,12 +83,9 @@ async function entryCreationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<SaveEntryResult> {\n- const createEntryRequest: CreateEntryRequest = input;\n- if (!createEntryRequestInputValidator.is(createEntryRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await createEntry(viewer, createEntryRequest);\n+ const request: CreateEntryRequest = input;\n+ validateInput(createEntryRequestInputValidator, request);\n+ return await createEntry(viewer, request);\n}\nconst saveEntryRequestInputValidator = tShape({\n@@ -111,12 +100,9 @@ async function entryUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<SaveEntryResult> {\n- const saveEntryRequest: SaveEntryRequest = input;\n- if (!saveEntryRequestInputValidator.is(saveEntryRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await updateEntry(viewer, saveEntryRequest);\n+ const request: SaveEntryRequest = input;\n+ validateInput(saveEntryRequestInputValidator, request);\n+ return await updateEntry(viewer, request);\n}\nconst deleteEntryRequestInputValidator = tShape({\n@@ -130,12 +116,9 @@ async function entryDeletionResponder(\nviewer: Viewer,\ninput: any,\n): Promise<DeleteEntryResponse> {\n- const deleteEntryRequest: DeleteEntryRequest = input;\n- if (!deleteEntryRequestInputValidator.is(deleteEntryRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await deleteEntry(viewer, deleteEntryRequest);\n+ const request: DeleteEntryRequest = input;\n+ validateInput(deleteEntryRequestInputValidator, request);\n+ return await deleteEntry(viewer, request);\n}\nconst restoreEntryRequestInputValidator = tShape({\n@@ -148,12 +131,9 @@ async function entryRestorationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<RestoreEntryResponse> {\n- const restoreEntryRequest: RestoreEntryRequest = input;\n- if (!restoreEntryRequestInputValidator.is(restoreEntryRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await restoreEntry(viewer, restoreEntryRequest);\n+ const request: RestoreEntryRequest = input;\n+ validateInput(restoreEntryRequestInputValidator, request);\n+ return await restoreEntry(viewer, request);\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/message-responders.js",
"new_path": "server/src/responders/message-responders.js",
"diff": "@@ -17,7 +17,7 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport { threadPermissions } from 'lib/types/thread-types';\nimport createMessages from '../creators/message-creator';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport { checkThreadPermission } from '../fetchers/thread-fetchers';\nimport { fetchMessageInfos } from '../fetchers/message-fetchers';\n@@ -30,14 +30,12 @@ async function textMessageCreationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<SendTextMessageResponse> {\n- const sendTextMessageRequest: SendTextMessageRequest = input;\n- if (!sendTextMessageRequestInputValidator.is(sendTextMessageRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ const request: SendTextMessageRequest = input;\n+ validateInput(sendTextMessageRequestInputValidator, request);\nconst hasPermission = await checkThreadPermission(\nviewer,\n- sendTextMessageRequest.threadID,\n+ request.threadID,\nthreadPermissions.VOICED,\n);\nif (!hasPermission) {\n@@ -46,10 +44,10 @@ async function textMessageCreationResponder(\nconst messageData = {\ntype: messageType.TEXT,\n- threadID: sendTextMessageRequest.threadID,\n+ threadID: request.threadID,\ncreatorID: viewer.id,\ntime: Date.now(),\n- text: sendTextMessageRequest.text,\n+ text: request.text,\n};\nconst rawMessageInfos = await createMessages([messageData]);\n@@ -65,17 +63,12 @@ async function messageFetchResponder(\nviewer: Viewer,\ninput: any,\n): Promise<FetchMessageInfosResult> {\n- const fetchMessageInfosRequest: FetchMessageInfosRequest = input;\n- if (!fetchMessageInfosRequestInputValidator.is(fetchMessageInfosRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n+ const request: FetchMessageInfosRequest = input;\n+ validateInput(fetchMessageInfosRequestInputValidator, request);\nreturn await fetchMessageInfos(\nviewer,\n- { threadCursors: fetchMessageInfosRequest.cursors },\n- fetchMessageInfosRequest.numberPerThread\n- ? fetchMessageInfosRequest.numberPerThread\n- : defaultNumberPerThread,\n+ { threadCursors: request.cursors },\n+ request.numberPerThread ? request.numberPerThread : defaultNumberPerThread,\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -8,7 +8,7 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport { entryQueryInputValidator } from './entry-responders';\nimport { fetchMessageInfosSince } from '../fetchers/message-fetchers';\nimport { verifyThreadID, fetchThreadInfos } from '../fetchers/thread-fetchers';\n@@ -26,12 +26,10 @@ async function pingResponder(\nviewer: Viewer,\ninput: any,\n): Promise<PingResponse> {\n- const pingRequest: PingRequest = input;\n- if (!pingRequestInputValidator.is(pingRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ const request: PingRequest = input;\n+ validateInput(pingRequestInputValidator, request);\n- const navID = pingRequest.calendarQuery.navID;\n+ const navID = request.calendarQuery.navID;\nlet validNav = navID === \"home\";\nif (!validNav) {\nvalidNav = await verifyThreadID(navID);\n@@ -43,7 +41,7 @@ async function pingResponder(\nconst newPingTime = Date.now();\nconst threadCursors = {};\n- for (let watchedThreadID of pingRequest.watchedIDs) {\n+ for (let watchedThreadID of request.watchedIDs) {\nthreadCursors[watchedThreadID] = null;\n}\nconst threadSelectionCriteria = { threadCursors, joinedThreads: true };\n@@ -57,11 +55,11 @@ async function pingResponder(\nfetchMessageInfosSince(\nviewer,\nthreadSelectionCriteria,\n- pingRequest.lastPing,\n+ request.lastPing,\ndefaultNumberPerThread,\n),\nfetchThreadInfos(viewer),\n- fetchEntryInfos(viewer, pingRequest.calendarQuery),\n+ fetchEntryInfos(viewer, request.calendarQuery),\nfetchCurrentUserInfo(viewer),\n]);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -13,7 +13,7 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport createErrorReport from '../creators/error-report-creator';\nimport {\nfetchErrorReportInfos,\n@@ -39,9 +39,7 @@ async function errorReportCreationResponder(\ninput: any,\n): Promise<ErrorReportCreationResponse> {\nconst request: ErrorReportCreationRequest = input;\n- if (!errorReportCreationRequestInputValidator.is(request)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ validateInput(errorReportCreationRequestInputValidator, request);\nreturn await createErrorReport(viewer, request);\n}\n@@ -54,9 +52,7 @@ async function errorReportFetchInfosResponder(\ninput: any,\n): Promise<FetchErrorReportInfosResponse> {\nconst request: FetchErrorReportInfosRequest = input;\n- if (!fetchErrorReportInfosRequestInputValidator.is(request)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ validateInput(fetchErrorReportInfosRequestInputValidator, request);\nreturn await fetchErrorReportInfos(viewer, request);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/search-responders.js",
"new_path": "server/src/responders/search-responders.js",
"diff": "@@ -8,9 +8,7 @@ import type { Viewer } from '../session/viewer';\nimport t from 'tcomb';\n-import { ServerError } from 'lib/utils/fetch-utils';\n-\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport { searchForUsers } from '../search/users';\nconst userSearchRequestInputValidator = tShape({\n@@ -21,13 +19,9 @@ async function userSearchResponder(\nviewer: Viewer,\ninput: any,\n): Promise<UserSearchResult> {\n- const userSearchRequest: UserSearchRequest = input;\n- if (!userSearchRequestInputValidator.is(userSearchRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- const searchResults = await searchForUsers(userSearchRequest);\n-\n+ const request: UserSearchRequest = input;\n+ validateInput(userSearchRequestInputValidator, request);\n+ const searchResults = await searchForUsers(request);\nreturn { userInfos: searchResults };\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/thread-responders.js",
"new_path": "server/src/responders/thread-responders.js",
"diff": "@@ -18,9 +18,12 @@ import type { Viewer } from '../session/viewer';\nimport t from 'tcomb';\n-import { ServerError } from 'lib/utils/fetch-utils';\n-\n-import { tShape, tNumEnum, tColor } from '../utils/tcomb-utils';\n+import {\n+ validateInput,\n+ tShape,\n+ tNumEnum,\n+ tColor,\n+} from '../utils/validation-utils';\nimport { deleteThread } from '../deleters/thread-deleters';\nimport {\nupdateRole,\n@@ -40,12 +43,9 @@ async function threadDeletionResponder(\nviewer: Viewer,\ninput: any,\n): Promise<void> {\n- const threadDeletionRequest: ThreadDeletionRequest = input;\n- if (!threadDeletionRequestInputValidator.is(threadDeletionRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- await deleteThread(viewer, threadDeletionRequest);\n+ const request: ThreadDeletionRequest = input;\n+ validateInput(threadDeletionRequestInputValidator, request);\n+ await deleteThread(viewer, request);\n}\nconst roleChangeRequestInputValidator = tShape({\n@@ -64,12 +64,9 @@ async function roleUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<ChangeThreadSettingsResult> {\n- const roleChangeRequest: RoleChangeRequest = input;\n- if (!roleChangeRequestInputValidator.is(roleChangeRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await updateRole(viewer, roleChangeRequest);\n+ const request: RoleChangeRequest = input;\n+ validateInput(roleChangeRequestInputValidator, request);\n+ return await updateRole(viewer, request);\n}\nconst removeMembersRequestInputValidator = tShape({\n@@ -81,12 +78,9 @@ async function memberRemovalResponder(\nviewer: Viewer,\ninput: any,\n): Promise<ChangeThreadSettingsResult> {\n- const removeMembersRequest: RemoveMembersRequest = input;\n- if (!removeMembersRequestInputValidator.is(removeMembersRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await removeMembers(viewer, removeMembersRequest);\n+ const request: RemoveMembersRequest = input;\n+ validateInput(removeMembersRequestInputValidator, request);\n+ return await removeMembers(viewer, request);\n}\nconst leaveThreadRequestInputValidator = tShape({\n@@ -97,12 +91,9 @@ async function threadLeaveResponder(\nviewer: Viewer,\ninput: any,\n): Promise<LeaveThreadResult> {\n- const leaveThreadRequest: LeaveThreadRequest = input;\n- if (!leaveThreadRequestInputValidator.is(leaveThreadRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await leaveThread(viewer, leaveThreadRequest);\n+ const request: LeaveThreadRequest = input;\n+ validateInput(leaveThreadRequestInputValidator, request);\n+ return await leaveThread(viewer, request);\n}\nconst updateThreadRequestInputValidator = tShape({\n@@ -123,12 +114,9 @@ async function threadUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<ChangeThreadSettingsResult> {\n- const updateThreadRequest: UpdateThreadRequest = input;\n- if (!updateThreadRequestInputValidator.is(updateThreadRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await updateThread(viewer, updateThreadRequest);\n+ const request: UpdateThreadRequest = input;\n+ validateInput(updateThreadRequestInputValidator, request);\n+ return await updateThread(viewer, request);\n}\nconst newThreadRequestInputValidator = tShape({\n@@ -144,12 +132,9 @@ async function threadCreationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<NewThreadResult> {\n- const newThreadRequest: NewThreadRequest = input;\n- if (!newThreadRequestInputValidator.is(newThreadRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await createThread(viewer, newThreadRequest);\n+ const request: NewThreadRequest = input;\n+ validateInput(newThreadRequestInputValidator, request);\n+ return await createThread(viewer, request);\n}\nconst joinThreadRequestInputValidator = tShape({\n@@ -160,12 +145,9 @@ async function threadJoinResponder(\nviewer: Viewer,\ninput: any,\n): Promise<ThreadJoinResult> {\n- const threadJoinRequest: ThreadJoinRequest = input;\n- if (!joinThreadRequestInputValidator.is(threadJoinRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await joinThread(viewer, threadJoinRequest);\n+ const request: ThreadJoinRequest = input;\n+ validateInput(joinThreadRequestInputValidator, request);\n+ return await joinThread(viewer, request);\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/user-responders.js",
"new_path": "server/src/responders/user-responders.js",
"diff": "@@ -31,7 +31,7 @@ import {\ncheckAndSendPasswordResetEmail,\nupdatePassword,\n} from '../updaters/account-updaters';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport {\ncreateNewAnonymousCookie,\ncreateNewUserCookie,\n@@ -57,15 +57,9 @@ async function userSubscriptionUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<SubscriptionUpdateResponse> {\n- const subscriptionUpdateRequest: SubscriptionUpdateRequest = input;\n- if (!subscriptionUpdateRequestInputValidator.is(subscriptionUpdateRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- const threadSubscription = await userSubscriptionUpdater(\n- viewer,\n- subscriptionUpdateRequest,\n- );\n+ const request: SubscriptionUpdateRequest = input;\n+ validateInput(subscriptionUpdateRequestInputValidator, request);\n+ const threadSubscription = await userSubscriptionUpdater(viewer, request);\nreturn { threadSubscription };\n}\n@@ -81,12 +75,9 @@ async function accountUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<void> {\n- const accountUpdate: AccountUpdate = input;\n- if (!accountUpdateInputValidator.is(accountUpdate)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- await accountUpdater(viewer, accountUpdate);\n+ const request: AccountUpdate = input;\n+ validateInput(accountUpdateInputValidator, request);\n+ await accountUpdater(viewer, request);\n}\nasync function sendVerificationEmailResponder(\n@@ -104,12 +95,9 @@ async function sendPasswordResetEmailResponder(\nviewer: Viewer,\ninput: any,\n): Promise<void> {\n- const resetPasswordRequest: ResetPasswordRequest = input;\n- if (!resetPasswordRequestInputValidator.is(resetPasswordRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- await checkAndSendPasswordResetEmail(resetPasswordRequest);\n+ const request: ResetPasswordRequest = input;\n+ validateInput(resetPasswordRequestInputValidator, request);\n+ await checkAndSendPasswordResetEmail(request);\n}\nasync function logOutResponder(\n@@ -139,12 +127,9 @@ async function accountDeletionResponder(\nviewer: Viewer,\ninput: any,\n): Promise<LogOutResponse> {\n- const deleteAccountRequest: DeleteAccountRequest = input;\n- if (!deleteAccountRequestInputValidator.is(deleteAccountRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await deleteAccount(viewer, deleteAccountRequest);\n+ const request: DeleteAccountRequest = input;\n+ validateInput(deleteAccountRequestInputValidator, request);\n+ return await deleteAccount(viewer, request);\n}\nconst registerRequestInputValidator = tShape({\n@@ -157,12 +142,9 @@ async function accountCreationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<RegisterResponse> {\n- const registerRequest: RegisterRequest = input;\n- if (!registerRequestInputValidator.is(registerRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await createAccount(viewer, registerRequest);\n+ const request: RegisterRequest = input;\n+ validateInput(registerRequestInputValidator, request);\n+ return await createAccount(viewer, request);\n}\nconst logInRequestInputValidator = tShape({\n@@ -176,12 +158,10 @@ async function logInResponder(\nviewer: Viewer,\ninput: any,\n): Promise<LogInResponse> {\n- const logInRequest: LogInRequest = input;\n- if (!logInRequestInputValidator.is(logInRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ const request: LogInRequest = input;\n+ validateInput(logInRequestInputValidator, request);\n- const calendarQuery = logInRequest.calendarQuery;\n+ const calendarQuery = request.calendarQuery;\nconst promises = {};\nif (calendarQuery && calendarQuery.navID !== \"home\") {\npromises.validThreadID = verifyThreadID(calendarQuery.navID);\n@@ -189,8 +169,8 @@ async function logInResponder(\nconst userQuery = SQL`\nSELECT id, hash, username, email, email_verified\nFROM users\n- WHERE LCASE(username) = LCASE(${logInRequest.usernameOrEmail})\n- OR LCASE(email) = LCASE(${logInRequest.usernameOrEmail})\n+ WHERE LCASE(username) = LCASE(${request.usernameOrEmail})\n+ OR LCASE(email) = LCASE(${request.usernameOrEmail})\n`;\npromises.userQuery = pool.query(userQuery);\nconst {\n@@ -205,7 +185,7 @@ async function logInResponder(\nthrow new ServerError('invalid_parameters');\n}\nconst userRow = userResult[0];\n- if (!bcrypt.compareSync(logInRequest.password, userRow.hash)) {\n+ if (!bcrypt.compareSync(request.password, userRow.hash)) {\nthrow new ServerError('invalid_credentials');\n}\nconst id = userRow.id.toString();\n@@ -215,7 +195,7 @@ async function logInResponder(\nconst newPingTime = Date.now();\nconst threadCursors = {};\n- for (let watchedThreadID of logInRequest.watchedIDs) {\n+ for (let watchedThreadID of request.watchedIDs) {\nthreadCursors[watchedThreadID] = null;\n}\nconst threadSelectionCriteria = { threadCursors, joinedThreads: true };\n@@ -263,12 +243,9 @@ async function passwordUpdateResponder(\nviewer: Viewer,\ninput: any,\n): Promise<LogInResponse> {\n- const updatePasswordRequest: UpdatePasswordRequest = input;\n- if (!updatePasswordRequestInputValidator.is(updatePasswordRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n-\n- return await updatePassword(viewer, updatePasswordRequest);\n+ const request: UpdatePasswordRequest = input;\n+ validateInput(updatePasswordRequestInputValidator, request);\n+ return await updatePassword(viewer, request);\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/verification-responders.js",
"new_path": "server/src/responders/verification-responders.js",
"diff": "@@ -11,7 +11,7 @@ import t from 'tcomb';\nimport { ServerError } from 'lib/utils/fetch-utils';\nimport { verifyField } from 'lib/types/verify-types';\n-import { tShape } from '../utils/tcomb-utils';\n+import { validateInput, tShape } from '../utils/validation-utils';\nimport { handleCodeVerificationRequest } from '../models/verification';\nimport { pool, SQL } from '../database';\n@@ -23,14 +23,10 @@ async function codeVerificationResponder(\nviewer: Viewer,\ninput: any,\n): Promise<HandleVerificationCodeResult> {\n- const codeVerificationRequest: CodeVerificationRequest = input;\n- if (!codeVerificationRequestInputValidator.is(codeVerificationRequest)) {\n- throw new ServerError('invalid_parameters');\n- }\n+ const request: CodeVerificationRequest = input;\n+ validateInput(codeVerificationRequestInputValidator, request);\n- const result = await handleCodeVerificationRequest(\n- codeVerificationRequest.code,\n- );\n+ const result = await handleCodeVerificationRequest(request.code);\nif (!result) {\nthrow new ServerError('unhandled_field');\n}\n"
},
{
"change_type": "RENAME",
"old_path": "server/src/utils/tcomb-utils.js",
"new_path": "server/src/utils/validation-utils.js",
"diff": "import t from 'tcomb';\n+import { ServerError } from 'lib/utils/fetch-utils';\n+\n+function validateInput(inputValidator: *, input: *) {\n+ if (!inputValidator.is(input)) {\n+ throw new ServerError('invalid_parameters', { input });\n+ }\n+}\n+\nfunction tBool(value: bool) {\nreturn t.irreducible('true', x => x === value);\n}\n@@ -32,6 +40,7 @@ const tDate = tRegex(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/);\nconst tColor = tRegex(/^[a-fA-F0-9]{6}$/); // we don't include # char\nexport {\n+ validateInput,\ntBool,\ntShape,\ntRegex,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Introduce validateInput
Now incorrect input will be included in `ServerError` payload on server and client |
129,187 | 05.03.2018 15:23:24 | 18,000 | 1ccbe27bd956b67fbd0098152e811c40e9cea394 | Introduce handlers for website and download
Also make sure to hide SQL error messages from client | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/handlers.js",
"new_path": "server/src/responders/handlers.js",
"diff": "@@ -8,9 +8,14 @@ import { ServerError } from 'lib/utils/fetch-utils';\nimport {\nfetchViewerForJSONRequest,\naddCookieToJSONResponse,\n+ fetchViewerForHomeRequest,\n+ addCookieToHomeResponse,\n} from '../session/cookies';\nexport type JSONResponder = (viewer: Viewer, input: any) => Promise<*>;\n+export type DownloadResponder\n+ = (viewer: Viewer, req: $Request, res: $Response) => Promise<void>;\n+export type HTMLResponder = (viewer: Viewer, url: string) => Promise<string>;\nfunction jsonHandler(responder: JSONResponder) {\nreturn async (req: $Request, res: $Response) => {\n@@ -27,16 +32,51 @@ function jsonHandler(responder: JSONResponder) {\nawait addCookieToJSONResponse(viewer, res, result);\nres.json({ success: true, ...result });\n} catch (e) {\n- console.warn(e);\n+ handleException(e, res);\n+ }\n+ };\n+}\n+\n+function downloadHandler(responder: DownloadResponder) {\n+ return async (req: $Request, res: $Response) => {\n+ try {\n+ const viewer = await fetchViewerForJSONRequest(req);\n+ await responder(viewer, req, res);\n+ } catch (e) {\n+ handleException(e, res);\n+ }\n+ };\n+}\n+\n+function getMessageForException(error: Error) {\n+ return error.sqlMessage ? \"database error\" : error.message;\n+}\n+\n+function handleException(error: Error, res: $Response) {\n+ console.warn(error);\nif (res.headersSent) {\nreturn;\n}\n- if (e instanceof ServerError && e.payload) {\n- res.json({ error: e.message, payload: e.payload });\n- } else if (e instanceof ServerError) {\n- res.json({ error: e.message });\n+ if (error instanceof ServerError && error.payload) {\n+ res.json({ error: error.message, payload: error.payload });\n+ } else if (error instanceof ServerError) {\n+ res.json({ error: error.message });\n} else {\n- res.status(500).send(e.message);\n+ res.status(500).send(getMessageForException(error));\n+ }\n+}\n+\n+function htmlHandler(responder: HTMLResponder) {\n+ return async (req: $Request, res: $Response) => {\n+ try {\n+ const viewer = await fetchViewerForHomeRequest(req);\n+ const rendered = await responder(viewer, req.url);\n+ addCookieToHomeResponse(viewer, res);\n+ res.send(rendered);\n+ } catch (e) {\n+ console.warn(e);\n+ if (!res.headersSent) {\n+ res.status(500).send(getMessageForException(e));\n}\n}\n};\n@@ -44,4 +84,6 @@ function jsonHandler(responder: JSONResponder) {\nexport {\njsonHandler,\n+ downloadHandler,\n+ htmlHandler,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -57,11 +57,10 @@ async function errorReportFetchInfosResponder(\n}\nasync function errorReportDownloadHandler(\n+ viewer: Viewer,\nreq: $Request,\nres: $Response,\n): Promise<void> {\n- try {\n- const viewer = await fetchViewerForJSONRequest(req);\nconst id = req.params.reportID;\nif (!id) {\nthrow new ServerError('invalid_parameters');\n@@ -72,19 +71,6 @@ async function errorReportDownloadHandler(\npreloadedState: JSON.stringify(result.preloadedState),\npayload: JSON.stringify(result.payload),\n});\n- } catch (e) {\n- console.warn(e);\n- if (res.headersSent) {\n- return;\n- }\n- if (e instanceof ServerError && e.payload) {\n- res.json({ error: e.message, payload: e.payload });\n- } else if (e instanceof ServerError) {\n- res.json({ error: e.message });\n- } else {\n- res.status(500).send(e.message);\n- }\n- }\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -26,10 +26,6 @@ import { verifyField } from 'lib/types/verify-types';\nimport * as ReduxSetup from 'web/redux-setup';\nimport App from 'web/dist/app.build';\n-import {\n- fetchViewerForHomeRequest,\n- addCookieToHomeResponse,\n-} from '../session/cookies';\nimport { Viewer } from '../session/viewer';\nimport { handleCodeVerificationRequest } from '../models/verification';\nimport { fetchMessageInfos } from '../fetchers/message-fetchers';\n@@ -45,21 +41,7 @@ const { AppContainer } = ReactHotLoader;\nconst { Provider } = ReactRedux;\nconst { reducer } = ReduxSetup;\n-async function websiteResponder(req: $Request, res: $Response) {\n- try {\n- const viewer = await fetchViewerForHomeRequest(req);\n- const rendered = await renderHTML(viewer, req.url);\n- addCookieToHomeResponse(viewer, res);\n- res.send(rendered);\n- } catch (e) {\n- console.warn(e);\n- if (!res.headersSent) {\n- res.status(500).send(e.message);\n- }\n- }\n-}\n-\n-async function renderHTML(viewer: Viewer, url: string): Promise<string> {\n+async function websiteResponder(viewer: Viewer, url: string): Promise<string> {\nconst urlInfo = parseURL(url);\nconst calendarQuery = {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -6,7 +6,11 @@ import type { Endpoint } from 'lib/types/endpoints';\nimport express from 'express';\nimport cookieParser from 'cookie-parser';\n-import { jsonHandler } from './responders/handlers';\n+import {\n+ jsonHandler,\n+ downloadHandler,\n+ htmlHandler,\n+} from './responders/handlers';\nimport {\ntextMessageCreationResponder,\nmessageFetchResponder,\n@@ -112,8 +116,11 @@ for (let endpoint in jsonEndpoints) {\nrouter.post(`/${endpoint}`, jsonHandler(responder));\n}\n-router.get('/download_error_report/:reportID', errorReportDownloadHandler);\n-router.get('*', websiteResponder);\n+router.get(\n+ '/download_error_report/:reportID',\n+ downloadHandler(errorReportDownloadHandler),\n+);\n+router.get('*', htmlHandler(websiteResponder));\nserver.use(baseRoutePath, router);\nserver.listen(parseInt(process.env.PORT) || 3000, 'localhost');\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Introduce handlers for website and download
Also make sure to hide SQL error messages from client |
129,187 | 06.03.2018 17:45:32 | 18,000 | fe267c73e98d959536cdccd3e57b3a9755d95fd2 | Refine experience when not a thread member | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -425,7 +425,6 @@ export default connect(\nconst parentThreadID = ownProps.threadInfo.parentThreadID;\nif (parentThreadID) {\nparentThreadInfo = threadInfoSelector(state)[parentThreadID];\n- invariant(parentThreadInfo, \"parent thread should exist\");\n}\nreturn {\nparentThreadInfo,\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": "@@ -45,6 +45,16 @@ class ThreadSettingsParent extends React.PureComponent<Props> {\n</Text>\n</Button>\n);\n+ } else if (this.props.threadInfo.parentThreadID) {\n+ parent = (\n+ <Text style={[\n+ styles.currentValue,\n+ styles.currentValueText,\n+ styles.noParent,\n+ ]}>\n+ Secret parent\n+ </Text>\n+ );\n} else {\nparent = (\n<Text style={[\n@@ -101,6 +111,7 @@ const styles = StyleSheet.create({\n},\nnoParent: {\nfontStyle: 'italic',\n+ paddingLeft: 2,\n},\nparentThreadLink: {\ncolor: \"#036AFF\",\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/thread-fetchers.js",
"new_path": "server/src/fetchers/thread-fetchers.js",
"diff": "@@ -97,7 +97,11 @@ async function fetchServerThreadInfos(\n// Basically we only want to return users that are either a member of this\n// thread, or are a \"parent admin\". We approximate \"parent admin\" by\n// looking for the PERMISSION_CHANGE_ROLE permission.\n- if (row.role || allPermissions[threadPermissions.CHANGE_ROLE].value) {\n+ if (\n+ userID === viewer.id ||\n+ row.role ||\n+ allPermissions[threadPermissions.CHANGE_ROLE].value\n+ ) {\nthreadInfos[threadID].members.push(member);\nif (row.username) {\nuserInfos[userID] = {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/thread-responders.js",
"new_path": "server/src/responders/thread-responders.js",
"diff": "@@ -134,7 +134,6 @@ async function threadCreationResponder(\n): Promise<NewThreadResult> {\nconst request: NewThreadRequest = input;\nvalidateInput(newThreadRequestInputValidator, request);\n- console.log(input);\nreturn await createThread(viewer, request);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Refine experience when not a thread member |
129,187 | 06.03.2018 18:17:40 | 18,000 | c437e811790bcb468a97ec45c2df1be804e04ec0 | Delete all cookies with corresponding device token on log out | [
{
"change_type": "MODIFY",
"old_path": "lib/types/device-types.js",
"new_path": "lib/types/device-types.js",
"diff": "@@ -6,3 +6,8 @@ export type DeviceTokenUpdateRequest = {|\ndeviceType: DeviceType,\ndeviceToken: string,\n|};\n+\n+export type DeviceTokens = {|\n+ ios?: ?string,\n+ android?: ?string,\n+|};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/fetchers/device-token-fetchers.js",
"diff": "+// @flow\n+\n+import type { DeviceTokens } from 'lib/types/device-types';\n+\n+import { ServerError } from 'lib/utils/errors';\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function fetchDeviceTokensForCookie(\n+ cookieID: string,\n+): Promise<DeviceTokens> {\n+ const query = SQL`\n+ SELECT ios_device_token, android_device_token\n+ FROM cookies\n+ WHERE id = ${cookieID}\n+ `;\n+ const [ result ] = await dbQuery(query);\n+ if (result.length === 0) {\n+ throw new ServerError('invalid_cookie');\n+ }\n+ const row = result[0];\n+ return {\n+ ios: row.ios_device_token,\n+ android: row.android_device_token,\n+ };\n+}\n+\n+export {\n+ fetchDeviceTokensForCookie,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/user-responders.js",
"new_path": "server/src/responders/user-responders.js",
"diff": "@@ -36,6 +36,7 @@ import {\ncreateNewAnonymousCookie,\ncreateNewUserCookie,\ndeleteCookie,\n+ deleteCookiesWithDeviceTokens,\n} from '../session/cookies';\nimport { deleteAccount } from '../deleters/account-deleters';\nimport createAccount from '../creators/account-creator';\n@@ -44,6 +45,7 @@ import { verifyThreadID } from '../fetchers/thread-fetchers';\nimport { dbQuery, SQL } from '../database';\nimport { fetchMessageInfos } from '../fetchers/message-fetchers';\nimport { fetchEntryInfos } from '../fetchers/entry-fetchers';\n+import { fetchDeviceTokensForCookie } from '../fetchers/device-token-fetchers';\nconst subscriptionUpdateRequestInputValidator = tShape({\nthreadID: t.String,\n@@ -104,10 +106,14 @@ async function logOutResponder(\nviewer: Viewer,\ninput: any,\n): Promise<LogOutResponse> {\n+ const cookieID = viewer.getData().cookieID;\nif (viewer.loggedIn) {\n+ const deviceTokens = await fetchDeviceTokensForCookie(cookieID);\nconst [ anonymousViewerData ] = await Promise.all([\ncreateNewAnonymousCookie(),\n- deleteCookie(viewer.getData().cookieID),\n+ deleteCookiesWithDeviceTokens(viewer.userID, deviceTokens),\n+ // deleteCookiesWithDeviceTokens should delete it, but just in case...\n+ deleteCookie(cookieID),\n]);\nviewer.setNewCookie(anonymousViewerData);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/session/cookies.js",
"new_path": "server/src/session/cookies.js",
"diff": "@@ -4,6 +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 } from 'lib/types/device-types';\nimport bcrypt from 'twin-bcrypt';\nimport url from 'url';\n@@ -11,7 +12,7 @@ import crypto from 'crypto';\nimport { ServerError } from 'lib/utils/errors';\n-import { dbQuery, SQL } from '../database';\n+import { dbQuery, SQL, mergeOrConditions } from '../database';\nimport { Viewer } from './viewer';\nimport { fetchThreadInfos } from '../fetchers/thread-fetchers';\nimport urlFacts from '../../facts/url';\n@@ -283,6 +284,30 @@ async function deleteCookie(cookieID: string): Promise<void> {\n`);\n}\n+async function deleteCookiesWithDeviceTokens(\n+ userID: string,\n+ deviceTokens: DeviceTokens,\n+): Promise<void> {\n+ const conditions = [];\n+ if (deviceTokens.ios) {\n+ conditions.push(SQL`ios_device_token = ${deviceTokens.ios}`);\n+ }\n+ if (deviceTokens.android) {\n+ conditions.push(SQL`android_device_token = ${deviceTokens.android}`);\n+ }\n+ if (conditions.length === 0) {\n+ return;\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+ await dbQuery(query);\n+}\n+\nasync function createNewUserCookie(userID: string): Promise<UserViewerData> {\nconst time = Date.now();\nconst cookiePassword = crypto.randomBytes(32).toString('hex');\n@@ -359,6 +384,7 @@ export {\nfetchViewerForHomeRequest,\ncreateNewAnonymousCookie,\ndeleteCookie,\n+ deleteCookiesWithDeviceTokens,\ncreateNewUserCookie,\naddCookieToJSONResponse,\naddCookieToHomeResponse,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Delete all cookies with corresponding device token on log out |
129,187 | 06.03.2018 18:26:36 | 18,000 | bedf03529a4174c1476c374162c7981f44cdb8f6 | Refine text position of join thread button on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -339,10 +339,12 @@ const styles = StyleSheet.create({\njoinButton: {\nmarginHorizontal: 12,\nmarginVertical: 3,\n- paddingVertical: 3,\n+ paddingTop: 3,\n+ paddingBottom: 5,\nflex: 1,\nbackgroundColor: '#44CC99FF',\nborderRadius: 5,\n+ justifyContent: 'center',\n},\njoinButtonText: {\nfontSize: 20,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Refine text position of join thread button on native |
129,187 | 07.03.2018 11:35:34 | 18,000 | 51ede0d81d473313240070735d7aaa2b13566603 | Update react-navigation libdef | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "import type {\nNavigationState,\n- PossiblyDeprecatedNavigationAction,\n+ NavigationAction,\nNavigationScreenProp,\n} from 'react-navigation';\nimport type { Dispatch } from 'lib/types/redux-types';\n@@ -116,8 +116,7 @@ registerConfig({\nconst reactNavigationAddListener = createReduxBoundAddListener(\"root\");\n-type NativeDispatch = Dispatch\n- & ((action: PossiblyDeprecatedNavigationAction) => boolean);\n+type NativeDispatch = Dispatch & ((action: NavigationAction) => boolean);\ntype Props = {\n// Redux state\n"
},
{
"change_type": "MODIFY",
"old_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"new_path": "native/flow-typed/npm/react-navigation_v1.x.x.js",
"diff": "-// flow-typed signature: ecb76745a94f4ec4dff2ff9090351482\n-// flow-typed version: 23b9c2c70c/react-navigation_v1.x.x/flow_>=v0.60.x\n-\n// @flow\ndeclare module 'react-navigation' {\n@@ -51,6 +48,15 @@ declare module 'react-navigation' {\n// react-native/Libraries/Animated/src/nodes/AnimatedValue.js\ndeclare type AnimatedValue = Object;\n+ declare type HeaderForceInset = {\n+ horizontal?: string,\n+ vertical?: string,\n+ left?: string,\n+ right?: string,\n+ top?: string,\n+ bottom?: string,\n+ };\n+\n/**\n* Next, all the type declarations\n*/\n@@ -74,25 +80,11 @@ declare module 'react-navigation' {\nkey?: string,\n|};\n- declare type DeprecatedNavigationNavigateAction = {|\n- type: 'Navigate',\n- routeName: string,\n- params?: NavigationParams,\n-\n- // The action to run inside the sub-router\n- action?: NavigationNavigateAction | DeprecatedNavigationNavigateAction,\n- |};\n-\ndeclare export type NavigationBackAction = {|\ntype: 'Navigation/BACK',\nkey?: ?string,\n|};\n- declare type DeprecatedNavigationBackAction = {|\n- type: 'Back',\n- key?: ?string,\n- |};\n-\ndeclare export type NavigationSetParamsAction = {|\ntype: 'Navigation/SET_PARAMS',\n@@ -103,26 +95,11 @@ declare module 'react-navigation' {\nparams: NavigationParams,\n|};\n- declare type DeprecatedNavigationSetParamsAction = {|\n- type: 'SetParams',\n-\n- // The key of the route where the params should be set\n- key: string,\n-\n- // The new params to merge into the existing route params\n- params: NavigationParams,\n- |};\n-\ndeclare export type NavigationInitAction = {|\ntype: 'Navigation/INIT',\nparams?: NavigationParams,\n|};\n- declare type DeprecatedNavigationInitAction = {|\n- type: 'Init',\n- params?: NavigationParams,\n- |};\n-\ndeclare export type NavigationResetAction = {|\ntype: 'Navigation/RESET',\nindex: number,\n@@ -130,25 +107,11 @@ declare module 'react-navigation' {\nactions: Array<NavigationNavigateAction>,\n|};\n- declare type DeprecatedNavigationResetAction = {|\n- type: 'Reset',\n- index: number,\n- key?: ?string,\n- actions: Array<\n- NavigationNavigateAction | DeprecatedNavigationNavigateAction\n- >,\n- |};\n-\ndeclare export type NavigationUriAction = {|\ntype: 'Navigation/URI',\nuri: string,\n|};\n- declare type DeprecatedNavigationUriAction = {|\n- type: 'Uri',\n- uri: string,\n- |};\n-\ndeclare export type NavigationReplaceAction = {|\n+type: 'Navigation/REPLACE',\n+key: string,\n@@ -184,17 +147,6 @@ declare module 'react-navigation' {\n| NavigationSetParamsAction\n| NavigationResetAction;\n- declare type DeprecatedNavigationAction =\n- | DeprecatedNavigationInitAction\n- | DeprecatedNavigationNavigateAction\n- | DeprecatedNavigationBackAction\n- | DeprecatedNavigationSetParamsAction\n- | DeprecatedNavigationResetAction;\n-\n- declare export type PossiblyDeprecatedNavigationAction =\n- | NavigationAction\n- | DeprecatedNavigationAction;\n-\n/**\n* NavigationState is a tree of routes for a single navigator, where each\n* child route may either be a NavigationScreenRoute or a\n@@ -335,10 +287,12 @@ declare module 'react-navigation' {\nnavigationOptions?: ?NavigationScreenConfig<Options>,\n};\n- declare export type NavigationRouteConfig = {\n+ declare export type NavigationRouteConfig =\n+ | NavigationComponent\n+ | ({\nnavigationOptions?: NavigationScreenConfig<*>,\npath?: string,\n- } & NavigationScreenRouteConfig;\n+ } & NavigationScreenRouteConfig);\ndeclare export type NavigationScreenRouteConfig =\n| {\n@@ -381,6 +335,7 @@ declare module 'react-navigation' {\ndeclare export type NavigationStackScreenOptions = NavigationScreenOptions & {\nheader?: ?(React$Node | (HeaderProps => React$Node)),\n+ headerTransparent?: boolean,\nheaderTitle?: string | React$Node | React$ElementType,\nheaderTitleStyle?: AnimatedTextStyleProp,\nheaderTitleAllowFontScaling?: boolean,\n@@ -393,6 +348,8 @@ declare module 'react-navigation' {\nheaderPressColorAndroid?: string,\nheaderRight?: React$Node,\nheaderStyle?: ViewStyleProp,\n+ headerForceInset?: HeaderForceInset,\n+ headerBackground?: React$Node | React$ElementType,\ngesturesEnabled?: boolean,\ngestureResponseDistance?: { vertical?: number, horizontal?: number },\ngestureDirection?: 'default' | 'inverted',\n@@ -403,11 +360,13 @@ declare module 'react-navigation' {\ninitialRouteParams?: NavigationParams,\npaths?: NavigationPathsConfig,\nnavigationOptions?: NavigationScreenConfig<*>,\n+ initialRouteKey?: string,\n|};\ndeclare export type NavigationStackViewConfig = {|\nmode?: 'card' | 'modal',\nheaderMode?: HeaderMode,\n+ headerTransitionPreset?: 'fade-in-place' | 'uikit',\ncardStyle?: ViewStyleProp,\ntransitionConfig?: () => TransitionConfig,\nonTransitionStart?: () => void,\n@@ -479,7 +438,7 @@ declare module 'react-navigation' {\n*/\ndeclare export type NavigationDispatch = (\n- action: PossiblyDeprecatedNavigationAction\n+ action: NavigationAction\n) => boolean;\ndeclare export type NavigationProp<S> = {\n@@ -498,7 +457,7 @@ declare module 'react-navigation' {\ntype: EventType,\naction: NavigationAction,\nstate: NavigationState,\n- lastState: NavigationState,\n+ lastState: ?NavigationState,\n};\ndeclare export type NavigationEventCallback = (\n@@ -543,29 +502,6 @@ declare module 'react-navigation' {\nnavigationOptions?: O,\n}>;\n- //declare export type NavigationNavigatorProps<O: {}, S: {}> =\n- // | {}\n- // | { navigation: NavigationScreenProp<S> }\n- // | { screenProps: {} }\n- // | { navigationOptions: O }\n- // | {\n- // navigation: NavigationScreenProp<S>,\n- // screenProps: {},\n- // }\n- // | {\n- // navigation: NavigationScreenProp<S>,\n- // navigationOptions: O,\n- // }\n- // | {\n- // screenProps: {},\n- // navigationOptions: O,\n- // }\n- // | {\n- // navigation: NavigationScreenProp<S>,\n- // screenProps: {},\n- // navigationOptions: O,\n- // };\n-\n/**\n* Navigation container\n*/\n@@ -581,7 +517,7 @@ declare module 'react-navigation' {\ndeclare export type NavigationContainerProps<S: {}, O: {}> = $Shape<{\nuriPrefix?: string | RegExp,\n- onNavigationStateChange?: (\n+ onNavigationStateChange?: ?(\nNavigationState,\nNavigationState,\nNavigationAction\n@@ -752,7 +688,7 @@ declare module 'react-navigation' {\nSET_PARAMS: 'Navigation/SET_PARAMS',\nURI: 'Navigation/URI',\nback: {\n- (payload: { key?: ?string }): NavigationBackAction,\n+ (payload?: { key?: ?string }): NavigationBackAction,\ntoString: () => string,\n},\ninit: {\n@@ -786,9 +722,6 @@ declare module 'react-navigation' {\n(payload: { uri: string }): NavigationUriAction,\ntoString: () => string,\n},\n- mapDeprecatedActionAndWarn: (\n- action: PossiblyDeprecatedNavigationAction\n- ) => NavigationAction,\n};\ndeclare type _RouterProp<S: NavigationState, O: {}> = {\n@@ -832,6 +765,8 @@ declare module 'react-navigation' {\ndeclare type _TabNavigatorConfig = {|\n...NavigationTabRouterConfig,\n..._TabViewConfig,\n+ lazy?: boolean,\n+ removeClippedSubviews?: boolean,\ncontainerOptions?: void,\n|};\ndeclare export function TabNavigator(\n@@ -843,9 +778,6 @@ declare module 'react-navigation' {\ndrawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open',\ndrawerWidth?: number | (() => number),\ndrawerPosition?: 'left' | 'right',\n- drawerOpenRoute?: string,\n- drawerCloseRoute?: string,\n- drawerToggleRoute?: string,\ncontentComponent?: React$ElementType,\ncontentOptions?: {},\nstyle?: ViewStyleProp,\n@@ -947,14 +879,14 @@ declare module 'react-navigation' {\nvertical?: _SafeAreaViewForceInsetValue,\nhorizontal?: _SafeAreaViewForceInsetValue,\n},\n- children: React$Node,\n+ children?: React$Node,\nstyle?: AnimatedViewStyleProp,\n};\ndeclare export var SafeAreaView: React$ComponentType<_SafeAreaViewProps>;\n- declare export class Header<P: HeaderProps, S> extends React$Component<P, S> {\n- static HEIGHT: number\n- }\n+ declare export var Header: React$ComponentType<HeaderProps> & {\n+ HEIGHT: number,\n+ };\ndeclare type _HeaderTitleProps = {\nchildren: React$Node,\n@@ -980,9 +912,6 @@ declare module 'react-navigation' {\ndrawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open',\ndrawerWidth: number | (() => number),\ndrawerPosition: 'left' | 'right',\n- drawerOpenRoute: string,\n- drawerCloseRoute: string,\n- drawerToggleRoute: string,\ncontentComponent: React$ElementType,\ncontentOptions?: {},\nstyle?: ViewStyleProp,\n@@ -1019,6 +948,8 @@ declare module 'react-navigation' {\nitemsContainerStyle?: ViewStyleProp,\nitemStyle?: ViewStyleProp,\nlabelStyle?: TextStyleProp,\n+ activeLabelStyle?: TextStyleProp,\n+ inactiveLabelStyle?: TextStyleProp,\niconContainerStyle?: ViewStyleProp,\ndrawerPosition: 'left' | 'right',\n};\n@@ -1099,9 +1030,12 @@ declare module 'react-navigation' {\ndeclare export var TabBarBottom: React$ComponentType<_TabBarBottomProps>;\ndeclare type _NavigationInjectedProps = {\n- navigation: NavigationScreenProp<NavigationState>,\n+ navigation: NavigationScreenProp<NavigationStateRoute>,\n};\ndeclare export function withNavigation<T: {}>(\nComponent: React$ComponentType<T & _NavigationInjectedProps>\n): React$ComponentType<T>;\n+ declare export function withNavigationFocus<T: {}>(\n+ Component: React$ComponentType<T & _NavigationInjectedProps>\n+ ): React$ComponentType<T>;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Update react-navigation libdef |
129,187 | 07.03.2018 14:28:05 | 18,000 | 375dca67f2ca634c7ba0b5d8b69d3484753f7bf8 | Build info on native | [
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "@@ -35,7 +35,8 @@ import {\n} from 'lib/actions/report-actions';\nimport Button from './components/button.react';\n-import { store, persistor, persistConfig } from './redux-setup';\n+import { store, persistor } from './redux-setup';\n+import { persistConfig, codeVersion } from './persist';\nimport reduxLogger from './redux-logger';\nconst errorTitles = [\n@@ -142,7 +143,7 @@ class Crash extends React.PureComponent<Props, State> {\npreloadedState: reduxLogger.preloadedState,\ncurrentState: store.getState(),\nactions: reduxLogger.actions,\n- codeVersion: 0,\n+ codeVersion,\nstateVersion: persistConfig.version,\n});\nthis.setState({ errorReportID: result.id });\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/build-info.react.js",
"diff": "+// @flow\n+\n+import React from 'react';\n+import { StyleSheet, View, Text, ScrollView } from 'react-native';\n+\n+import { persistConfig, codeVersion } from '../persist';\n+\n+type Props = {|\n+|};\n+class BuildInfo extends React.PureComponent<Props> {\n+\n+ static navigationOptions = {\n+ headerTitle: \"Build info\",\n+ };\n+\n+ render() {\n+ return (\n+ <ScrollView contentContainerStyle={styles.scrollView}>\n+ <View style={styles.section}>\n+ <View style={styles.row}>\n+ <Text style={styles.label}>Release</Text>\n+ <Text style={styles.releaseText}>ALPHA</Text>\n+ </View>\n+ <View style={styles.row}>\n+ <Text style={styles.label}>Code version</Text>\n+ <Text style={styles.text}>{codeVersion}</Text>\n+ </View>\n+ <View style={styles.row}>\n+ <Text style={styles.label}>State version</Text>\n+ <Text style={styles.text}>{persistConfig.version}</Text>\n+ </View>\n+ </View>\n+ <View style={styles.section}>\n+ <View style={styles.row}>\n+ <Text style={styles.thanksText}>\n+ Thank you for helping to test the alpha!\n+ </Text>\n+ </View>\n+ </View>\n+ </ScrollView>\n+ );\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ scrollView: {\n+ paddingTop: 24,\n+ },\n+ section: {\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ paddingVertical: 6,\n+ paddingHorizontal: 24,\n+ marginBottom: 24,\n+ },\n+ row: {\n+ flexDirection: 'row',\n+ justifyContent: 'space-between',\n+ paddingVertical: 6,\n+ },\n+ label: {\n+ fontSize: 16,\n+ color: \"#888888\",\n+ paddingRight: 12,\n+ },\n+ releaseText: {\n+ fontSize: 16,\n+ color: 'red',\n+ },\n+ text: {\n+ fontSize: 16,\n+ color: 'black',\n+ },\n+ thanksText: {\n+ flex: 1,\n+ fontSize: 16,\n+ color: 'black',\n+ textAlign: 'center',\n+ },\n+});\n+\n+const BuildInfoRouteName = 'BuildInfo';\n+\n+export {\n+ BuildInfo,\n+ BuildInfoRouteName,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/delete-account.react.js",
"new_path": "native/more/delete-account.react.js",
"diff": "@@ -62,9 +62,9 @@ class InnerDeleteAccount extends React.PureComponent<Props, State> {\ndispatchActionPromise: PropTypes.func.isRequired,\ndeleteAccount: PropTypes.func.isRequired,\n};\n- static navigationOptions = ({ navigation }) => ({\n+ static navigationOptions = {\nheaderTitle: \"Delete account\",\n- });\n+ };\nmounted = false;\npasswordInput: ?TextInput;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -23,6 +23,7 @@ import { connect } from 'react-redux';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\nimport { SafeAreaView } from 'react-navigation';\n+import Icon from 'react-native-vector-icons/Ionicons';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport {\n@@ -46,6 +47,7 @@ import EditSettingButton from '../components/edit-setting-button.react';\nimport { EditEmailRouteName } from './edit-email.react';\nimport { EditPasswordRouteName } from './edit-password.react';\nimport { DeleteAccountRouteName } from './delete-account.react';\n+import { BuildInfoRouteName} from './build-info.react';\nconst forceInset = { top: 'always', bottom: 'never' };\n@@ -167,6 +169,22 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n/>\n</View>\n</View>\n+ <View style={styles.unpaddedSection}>\n+ <Button\n+ onPress={this.onPressBuildInfo}\n+ style={styles.submenuButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ onPress={this.onPressBuildInfo}\n+ >\n+ <Text style={styles.submenuText}>Build info</Text>\n+ <Icon\n+ name=\"ios-arrow-forward\"\n+ size={20}\n+ color=\"#036AFF\"\n+ />\n+ </Button>\n+ </View>\n<View style={styles.unpaddedSection}>\n<Button\nonPress={this.onPressDeleteAccount}\n@@ -259,6 +277,10 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nthis.props.navigation.navigate(DeleteAccountRouteName);\n}\n+ onPressBuildInfo = () => {\n+ this.props.navigation.navigate(BuildInfoRouteName);\n+ }\n+\n}\nconst styles = StyleSheet.create({\n@@ -359,6 +381,15 @@ const styles = StyleSheet.create({\ncolor: \"#AA0000\",\nflex: 1,\n},\n+ submenuButton: {\n+ flexDirection: 'row',\n+ paddingHorizontal: 24,\n+ paddingVertical: 12,\n+ },\n+ submenuText: {\n+ fontSize: 16,\n+ flex: 1,\n+ },\n});\nregisterFetchKey(logOutActionTypes);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more.react.js",
"new_path": "native/more/more.react.js",
"diff": "@@ -9,6 +9,7 @@ import { MoreScreen, MoreScreenRouteName } from './more-screen.react';\nimport { EditEmail, EditEmailRouteName } from './edit-email.react';\nimport { EditPassword, EditPasswordRouteName } from './edit-password.react';\nimport { DeleteAccount, DeleteAccountRouteName } from './delete-account.react';\n+import { BuildInfo, BuildInfoRouteName } from './build-info.react';\nconst More = StackNavigator(\n{\n@@ -16,6 +17,7 @@ const More = StackNavigator(\n[EditEmailRouteName]: { screen: EditEmail },\n[EditPasswordRouteName]: { screen: EditPassword },\n[DeleteAccountRouteName]: { screen: DeleteAccount },\n+ [BuildInfoRouteName]: { screen: BuildInfo },\n},\n{\nnavigationOptions: ({ navigation }) => ({\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/persist.js",
"diff": "+// @flow\n+\n+import storage from 'redux-persist/lib/storage';\n+import { createMigrate } from 'redux-persist';\n+\n+const blacklist = __DEV__\n+ ? [\n+ 'sessionID',\n+ 'lastUserInteraction',\n+ 'loadingStatuses',\n+ ]\n+ : [\n+ 'sessionID',\n+ 'lastUserInteraction',\n+ 'loadingStatuses',\n+ 'navInfo',\n+ ];\n+\n+const migrations = {\n+ /** example\n+ [0]: (state) => ({\n+ ...state,\n+ test: \"hello\",\n+ }), **/\n+};\n+\n+const persistConfig = {\n+ key: 'root',\n+ storage,\n+ blacklist,\n+ debug: __DEV__,\n+ version: 0,\n+ migrate: createMigrate(migrations, { debug: __DEV__ }),\n+};\n+\n+const codeVersion = 0;\n+\n+export {\n+ persistConfig,\n+ codeVersion,\n+};\n"
},
{
"change_type": "DELETE",
"old_path": "native/redux-migrations.js",
"new_path": null,
"diff": "-// @flow\n-\n-const migrations = {\n- /** example\n- [0]: (state) => ({\n- ...state,\n- test: \"hello\",\n- }), **/\n-};\n-\n-export default migrations;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -11,10 +11,9 @@ import type { PersistState } from 'redux-persist/src/types';\nimport React from 'react';\nimport invariant from 'invariant';\nimport thunk from 'redux-thunk';\n-import storage from 'redux-persist/lib/storage';\nimport { createStore, applyMiddleware } from 'redux';\nimport { composeWithDevTools } from 'redux-devtools-extension';\n-import { persistStore, persistReducer, createMigrate } from 'redux-persist';\n+import { persistStore, persistReducer } from 'redux-persist';\nimport PropTypes from 'prop-types';\nimport { NavigationActions } from 'react-navigation';\nimport {\n@@ -38,7 +37,7 @@ import {\nclearAndroidNotificationActionType,\nreduceThreadIDsToNotifIDs,\n} from './push/android';\n-import migrations from './redux-migrations';\n+import { persistConfig } from './persist';\nimport reduxLogger from './redux-logger';\nexport type AppState = {|\n@@ -84,19 +83,6 @@ const defaultState = ({\n_persist: null,\n}: AppState);\n-const blacklist = __DEV__\n- ? [\n- 'sessionID',\n- 'lastUserInteraction',\n- 'loadingStatuses',\n- ]\n- : [\n- 'sessionID',\n- 'lastUserInteraction',\n- 'loadingStatuses',\n- 'navInfo',\n- ];\n-\nfunction reducer(state: AppState = defaultState, action: *) {\nif (action.type === \"crash\") {\nreturn {\n@@ -241,23 +227,12 @@ const reduxLoggerMiddleware = store => next => action => {\nreturn next(action);\n};\n-const persistConfig = {\n- key: 'root',\n- storage,\n- blacklist,\n- debug: __DEV__,\n- version: 0,\n- migrate: createMigrate(migrations, { debug: __DEV__ }),\n-};\nconst reactNavigationMiddleware = createReactNavigationReduxMiddleware(\n\"root\",\n(state: AppState) => state.navInfo.navigationState,\n);\nconst store = createStore(\n- persistReducer(\n- persistConfig,\n- reducer,\n- ),\n+ persistReducer(persistConfig, reducer),\ndefaultState,\ncomposeWithDevTools(\napplyMiddleware(thunk, reactNavigationMiddleware, reduxLoggerMiddleware),\n@@ -268,5 +243,4 @@ const persistor = persistStore(store);\nexport {\nstore,\npersistor,\n- persistConfig,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Build info on native |
129,187 | 07.03.2018 14:52:08 | 18,000 | 0e45ee64b8500c1e126eb7c5804835a1c6cfda81 | Dev tools on native | [
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "@@ -35,8 +35,8 @@ import {\n} from 'lib/actions/report-actions';\nimport Button from './components/button.react';\n-import { store, persistor } from './redux-setup';\n-import { persistConfig, codeVersion } from './persist';\n+import { store } from './redux-setup';\n+import { persistConfig, codeVersion, getPersistor } from './persist';\nimport reduxLogger from './redux-logger';\nconst errorTitles = [\n@@ -154,7 +154,7 @@ class Crash extends React.PureComponent<Props, State> {\n}\nonPressWipe = () => {\n- persistor.purge();\n+ getPersistor().purge();\nExitApp.exitApp();\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/dev-tools.react.js",
"diff": "+// @flow\n+\n+import React from 'react';\n+import { StyleSheet, View, Text, ScrollView } from 'react-native';\n+import ExitApp from 'react-native-exit-app';\n+\n+import Button from '../components/button.react';\n+import { getPersistor } from '../persist';\n+\n+type Props = {|\n+|};\n+class DevTools extends React.PureComponent<Props> {\n+\n+ static navigationOptions = {\n+ headerTitle: \"Developer tools\",\n+ };\n+\n+ render() {\n+ return (\n+ <ScrollView contentContainerStyle={styles.scrollView}>\n+ <View style={styles.slightlyPaddedSection}>\n+ <Button\n+ onPress={this.onPressCrash}\n+ style={styles.redButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.redText}>Trigger a crash</Text>\n+ </Button>\n+ <View style={styles.hr} />\n+ <Button\n+ onPress={this.onPressKill}\n+ style={styles.redButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.redText}>Kill the app</Text>\n+ </Button>\n+ <View style={styles.hr} />\n+ <Button\n+ onPress={this.onPressWipe}\n+ style={styles.redButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.redText}>Wipe state and kill app</Text>\n+ </Button>\n+ </View>\n+ </ScrollView>\n+ );\n+ }\n+\n+ onPressCrash = () => {\n+ throw new Error(\"User triggered crash through dev menu!\");\n+ }\n+\n+ onPressKill = () => {\n+ ExitApp.exitApp();\n+ }\n+\n+ onPressWipe = () => {\n+ getPersistor().purge();\n+ ExitApp.exitApp();\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ scrollView: {\n+ paddingTop: 24,\n+ },\n+ slightlyPaddedSection: {\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ marginBottom: 24,\n+ paddingVertical: 2,\n+ },\n+ redButton: {\n+ paddingHorizontal: 24,\n+ paddingVertical: 10,\n+ },\n+ redText: {\n+ fontSize: 16,\n+ color: \"#AA0000\",\n+ flex: 1,\n+ },\n+ hr: {\n+ height: 1,\n+ backgroundColor: \"#CCCCCC\",\n+ marginHorizontal: 15,\n+ },\n+});\n+\n+const DevToolsRouteName = 'DevTools';\n+\n+export {\n+ DevTools,\n+ DevToolsRouteName,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -48,6 +48,7 @@ import { EditEmailRouteName } from './edit-email.react';\nimport { EditPasswordRouteName } from './edit-password.react';\nimport { DeleteAccountRouteName } from './delete-account.react';\nimport { BuildInfoRouteName} from './build-info.react';\n+import { DevToolsRouteName} from './dev-tools.react';\nconst forceInset = { top: 'always', bottom: 'never' };\n@@ -169,13 +170,12 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n/>\n</View>\n</View>\n- <View style={styles.unpaddedSection}>\n+ <View style={styles.slightlyPaddedSection}>\n<Button\nonPress={this.onPressBuildInfo}\nstyle={styles.submenuButton}\niosFormat=\"highlight\"\niosHighlightUnderlayColor=\"#EEEEEEDD\"\n- onPress={this.onPressBuildInfo}\n>\n<Text style={styles.submenuText}>Build info</Text>\n<Icon\n@@ -184,6 +184,19 @@ class InnerMoreScreen extends React.PureComponent<Props> {\ncolor=\"#036AFF\"\n/>\n</Button>\n+ <Button\n+ onPress={this.onPressDevTools}\n+ style={styles.submenuButton}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.submenuText}>Developer tools</Text>\n+ <Icon\n+ name=\"ios-arrow-forward\"\n+ size={20}\n+ color=\"#036AFF\"\n+ />\n+ </Button>\n</View>\n<View style={styles.unpaddedSection}>\n<Button\n@@ -281,6 +294,10 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nthis.props.navigation.navigate(BuildInfoRouteName);\n}\n+ onPressDevTools = () => {\n+ this.props.navigation.navigate(DevToolsRouteName);\n+ }\n+\n}\nconst styles = StyleSheet.create({\n@@ -306,6 +323,14 @@ const styles = StyleSheet.create({\nborderColor: \"#CCCCCC\",\nmarginBottom: 24,\n},\n+ slightlyPaddedSection: {\n+ backgroundColor: 'white',\n+ borderTopWidth: 1,\n+ borderBottomWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ marginBottom: 24,\n+ paddingVertical: 6,\n+ },\nrow: {\nflex: 1,\nflexDirection: 'row',\n@@ -384,7 +409,7 @@ const styles = StyleSheet.create({\nsubmenuButton: {\nflexDirection: 'row',\npaddingHorizontal: 24,\n- paddingVertical: 12,\n+ paddingVertical: 6,\n},\nsubmenuText: {\nfontSize: 16,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more.react.js",
"new_path": "native/more/more.react.js",
"diff": "@@ -10,6 +10,7 @@ import { EditEmail, EditEmailRouteName } from './edit-email.react';\nimport { EditPassword, EditPasswordRouteName } from './edit-password.react';\nimport { DeleteAccount, DeleteAccountRouteName } from './delete-account.react';\nimport { BuildInfo, BuildInfoRouteName } from './build-info.react';\n+import { DevTools, DevToolsRouteName } from './dev-tools.react';\nconst More = StackNavigator(\n{\n@@ -18,6 +19,7 @@ const More = StackNavigator(\n[EditPasswordRouteName]: { screen: EditPassword },\n[DeleteAccountRouteName]: { screen: DeleteAccount },\n[BuildInfoRouteName]: { screen: BuildInfo },\n+ [DevToolsRouteName]: { screen: DevTools },\n},\n{\nnavigationOptions: ({ navigation }) => ({\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "import storage from 'redux-persist/lib/storage';\nimport { createMigrate } from 'redux-persist';\n+import invariant from 'invariant';\nconst blacklist = __DEV__\n? [\n@@ -35,7 +36,21 @@ const persistConfig = {\nconst codeVersion = 0;\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+// access the persistor to purge its state.\n+let storedPersistor = null;\n+function setPersistor(persistor: *) {\n+ storedPersistor = persistor;\n+}\n+function getPersistor() {\n+ invariant(storedPersistor, \"should be set\");\n+ return storedPersistor;\n+}\n+\nexport {\npersistConfig,\ncodeVersion,\n+ setPersistor,\n+ getPersistor,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -37,7 +37,7 @@ import {\nclearAndroidNotificationActionType,\nreduceThreadIDsToNotifIDs,\n} from './push/android';\n-import { persistConfig } from './persist';\n+import { persistConfig, setPersistor } from './persist';\nimport reduxLogger from './redux-logger';\nexport type AppState = {|\n@@ -239,8 +239,8 @@ const store = createStore(\n),\n);\nconst persistor = persistStore(store);\n+setPersistor(persistor);\nexport {\nstore,\n- persistor,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Dev tools on native |
129,187 | 08.03.2018 19:55:04 | 18,000 | 3d91fefaeec11dbe4cd93e3cded9b14b1426bb72 | Add custom server selection to native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -21,8 +21,6 @@ import React from 'react';\nimport {\nView,\nStyleSheet,\n- Platform,\n- KeyboardAvoidingView,\nText,\nActivityIndicator,\nAlert,\n@@ -53,7 +51,8 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport UserList from '../../components/user-list.react';\nimport TagInput from '../../components/tag-input.react';\nimport Button from '../../components/button.react';\n-import { iosKeyboardOffset } from '../../dimensions';\n+import KeyboardAvoidingModal\n+ from '../../components/keyboard-avoiding-modal.react';\nconst tagInputProps = {\nplaceholder: \"Select users to add\",\n@@ -209,8 +208,11 @@ class AddUsersModal extends React.PureComponent<Props, State> {\n);\n}\n- const content = (\n- <View style={styles.modal}>\n+ return (\n+ <KeyboardAvoidingModal\n+ containerStyle={styles.container}\n+ style={styles.modal}\n+ >\n<TagInput\nvalue={this.state.userInfoInputArray}\nonChange={this.onChangeTagInput}\n@@ -230,19 +232,8 @@ class AddUsersModal extends React.PureComponent<Props, State> {\n{cancelButton}\n{addButton}\n</View>\n- </View>\n+ </KeyboardAvoidingModal>\n);\n- if (Platform.OS === \"ios\") {\n- return (\n- <KeyboardAvoidingView\n- style={styles.container}\n- behavior=\"padding\"\n- keyboardVerticalOffset={iosKeyboardOffset}\n- >{content}</KeyboardAvoidingView>\n- );\n- } else {\n- return <View style={styles.container}>{content}</View>;\n- }\n}\ntagInputRef = (tagInput: ?TagInput<AccountUserInfo>) => {\n@@ -371,14 +362,9 @@ class AddUsersModal extends React.PureComponent<Props, State> {\nconst styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n- marginHorizontal: 15,\n- marginTop: 100,\n},\nmodal: {\nflex: 1,\n- padding: 12,\n- borderRadius: 5,\n- backgroundColor: '#EEEEEE',\n},\nbuttons: {\nflexDirection: 'row',\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/keyboard-avoiding-modal.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import * as React from 'react';\n+import {\n+ StyleSheet,\n+ View,\n+ Platform,\n+ KeyboardAvoidingView,\n+ ViewPropTypes,\n+} from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+import { iosKeyboardOffset } from '../dimensions';\n+\n+type Props = {|\n+ children?: React.Node,\n+ style?: StyleObj,\n+ containerStyle?: StyleObj,\n+|};\n+class KeyboardAvoidingModal extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ children: PropTypes.node,\n+ style: ViewPropTypes.style,\n+ containerStyle: ViewPropTypes.style,\n+ };\n+\n+ render() {\n+ const content = (\n+ <View style={[styles.modal, this.props.style]}>\n+ {this.props.children}\n+ </View>\n+ );\n+ if (Platform.OS === \"ios\") {\n+ return (\n+ <KeyboardAvoidingView\n+ style={[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+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ marginHorizontal: 15,\n+ marginTop: 100,\n+ },\n+ modal: {\n+ padding: 12,\n+ borderRadius: 5,\n+ backgroundColor: '#EEEEEE',\n+ },\n+});\n+\n+export default KeyboardAvoidingModal;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/more/custom-server-selector.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+import {\n+ StyleSheet,\n+ View,\n+ Text,\n+ TextInput,\n+} from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+import Button from '../components/button.react';\n+import KeyboardAvoidingModal from '../components/keyboard-avoiding-modal.react';\n+\n+type Props = {|\n+ currentCustomServer: ?string,\n+ onCompleteInput: (customServer: string) => void,\n+|};\n+type State = {|\n+ customServer: string,\n+|};\n+class CustomServerSelector extends React.PureComponent<Props, State> {\n+\n+ static propTypes = {\n+ currentCustomServer: PropTypes.string,\n+ onCompleteInput: PropTypes.func.isRequired,\n+ };\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.state = {\n+ customServer: this.props.currentCustomServer\n+ ? this.props.currentCustomServer\n+ : \"\",\n+ };\n+ }\n+\n+ render() {\n+ return (\n+ <KeyboardAvoidingModal\n+ containerStyle={styles.container}\n+ style={styles.modal}\n+ >\n+ <TextInput\n+ style={styles.textInput}\n+ underlineColorAndroid=\"transparent\"\n+ value={this.state.customServer}\n+ onChangeText={this.onChangeCustomServer}\n+ autoFocus={true}\n+ />\n+ <Button\n+ onPress={this.onPressGo}\n+ style={styles.button}\n+ >\n+ <Text style={styles.buttonText}>Go</Text>\n+ </Button>\n+ </KeyboardAvoidingModal>\n+ );\n+ }\n+\n+ onChangeCustomServer = (newCustomServer: string) => {\n+ this.setState({ customServer: newCustomServer });\n+ }\n+\n+ onPressGo = () => {\n+ this.props.onCompleteInput(this.state.customServer);\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ justifyContent: 'flex-end',\n+ },\n+ modal: {\n+ marginBottom: 20,\n+ flexDirection: 'row',\n+ },\n+ textInput: {\n+ padding: 0,\n+ margin: 0,\n+ fontSize: 16,\n+ color: '#333333',\n+ flex: 1,\n+ },\n+ button: {\n+ backgroundColor: \"#88BB88\",\n+ marginVertical: 2,\n+ marginHorizontal: 2,\n+ borderRadius: 5,\n+ paddingVertical: 4,\n+ paddingHorizontal: 12,\n+ },\n+ buttonText: {\n+ fontSize: 18,\n+ textAlign: 'center',\n+ color: \"white\",\n+ },\n+});\n+\n+export default CustomServerSelector;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/dev-tools.react.js",
"new_path": "native/more/dev-tools.react.js",
"diff": "import type { AppState } from '../redux-setup';\nimport type { DispatchActionPayload } from 'lib/utils/action-utils';\n-import React from 'react';\n+import * as React from 'react';\nimport { StyleSheet, View, Text, ScrollView, Platform } from 'react-native';\nimport ExitApp from 'react-native-exit-app';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport PropTypes from 'prop-types';\n+import Modal from 'react-native-modal';\nimport { connect } from 'lib/utils/redux-utils';\nimport { setURLPrefix } from 'lib/utils/url-utils';\nimport Button from '../components/button.react';\nimport { getPersistor } from '../persist';\n-import { serverOptions } from '../utils/url-utils';\n+import { serverOptions, setCustomServer } from '../utils/url-utils';\n+import CustomServerSelector from './custom-server-selector.react';\n+\n+const ServerIcon = (props: {||}) => (\n+ <Icon\n+ name=\"md-checkmark\"\n+ size={20}\n+ color=\"#008800\"\n+ style={styles.icon}\n+ />\n+);\ntype Props = {|\n// Redux state\nurlPrefix: string,\n+ customServer: ?string,\n// Redux dispatch functions\ndispatchActionPayload: DispatchActionPayload,\n|};\n-class InnerDevTools extends React.PureComponent<Props> {\n+type State = {|\n+ customServerModalOpen: bool,\n+|};\n+class InnerDevTools extends React.PureComponent<Props, State> {\nstatic propTypes = {\nurlPrefix: PropTypes.string.isRequired,\n+ customServer: PropTypes.string,\ndispatchActionPayload: PropTypes.func.isRequired,\n};\nstatic navigationOptions = {\nheaderTitle: \"Developer tools\",\n};\n+ state = {\n+ customServerModalOpen: false,\n+ };\nrender() {\n- let firstServerButtonProcessed = false;\nconst serverButtons = [];\nfor (let server of serverOptions) {\n- let icon = null;\n- if (server === this.props.urlPrefix) {\n- icon = (\n- <Icon\n- name=\"md-checkmark\"\n- size={20}\n- color=\"#036AFF\"\n- style={styles.icon}\n- />\n- );\n- }\n- if (firstServerButtonProcessed) {\n- serverButtons.push(<View style={styles.hr} key={`hr${server}`} />);\n- }\n+ const icon = server === this.props.urlPrefix\n+ ? <ServerIcon />\n+ : null;\nserverButtons.push(\n<Button\nonPress={() => this.onSelectServer(server)}\nstyle={styles.row}\niosFormat=\"highlight\"\niosHighlightUnderlayColor=\"#EEEEEEDD\"\n- key={server}\n+ key={`server${server}`}\n>\n- <Text style={styles.text}>{server}</Text>\n+ <Text style={styles.serverText}>{server}</Text>\n{icon}\n</Button>\n);\n- firstServerButtonProcessed = true;\n+ serverButtons.push(<View style={styles.hr} key={`hr${server}`} />);\n}\n+ const customServerLabel = this.props.customServer\n+ ? (\n+ <Text>\n+ <Text style={styles.customServerLabel}>{\"custom: \"}</Text>\n+ <Text style={styles.serverText}>{this.props.customServer}</Text>\n+ </Text>\n+ )\n+ : (\n+ <Text style={[\n+ styles.customServerLabel,\n+ styles.serverContainer,\n+ ]}>custom</Text>\n+ );\n+ const customServerIcon = this.props.customServer === this.props.urlPrefix\n+ ? <ServerIcon />\n+ : null;\n+ serverButtons.push(\n+ <Button\n+ onPress={this.onSelectCustomServer}\n+ style={styles.row}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ key=\"customServer\"\n+ >\n+ {customServerLabel}\n+ {customServerIcon}\n+ </Button>\n+ );\nreturn (\n+ <View>\n<ScrollView contentContainerStyle={styles.scrollView}>\n<View style={styles.slightlyPaddedSection}>\n<Button\n@@ -100,6 +136,17 @@ class InnerDevTools extends React.PureComponent<Props> {\n{serverButtons}\n</View>\n</ScrollView>\n+ <Modal\n+ isVisible={this.state.customServerModalOpen}\n+ onBackButtonPress={this.closeCustomServerModal}\n+ onBackdropPress={this.closeCustomServerModal}\n+ >\n+ <CustomServerSelector\n+ currentCustomServer={this.props.customServer}\n+ onCompleteInput={this.onCompleteCustomServerInput}\n+ />\n+ </Modal>\n+ </View>\n);\n}\n@@ -117,8 +164,28 @@ class InnerDevTools extends React.PureComponent<Props> {\n}\nonSelectServer = (server: string) => {\n+ if (server !== this.props.urlPrefix) {\nthis.props.dispatchActionPayload(setURLPrefix, server);\n}\n+ }\n+\n+ onSelectCustomServer = () => {\n+ this.setState({ customServerModalOpen: true });\n+ }\n+\n+ closeCustomServerModal = () => {\n+ this.setState({ customServerModalOpen: false });\n+ }\n+\n+ onCompleteCustomServerInput = (customServer: string) => {\n+ if (customServer !== this.props.urlPrefix) {\n+ this.props.dispatchActionPayload(setURLPrefix, customServer);\n+ }\n+ if (customServer && customServer != this.props.customServer) {\n+ this.props.dispatchActionPayload(setCustomServer, customServer);\n+ }\n+ this.setState({ customServerModalOpen: false });\n+ }\n}\n@@ -157,12 +224,19 @@ const styles = StyleSheet.create({\nfontWeight: \"400\",\ncolor: \"#888888\",\n},\n- text: {\n+ customServerLabel: {\n+ color: \"#888888\",\nfontSize: 16,\n+ },\n+ serverText: {\n+ color: 'black',\n+ fontSize: 16,\n+ },\n+ serverContainer: {\nflex: 1,\n},\nicon: {\n- lineHeight: 18,\n+ lineHeight: Platform.OS === \"ios\" ? 18 : 20,\n},\n});\n@@ -170,6 +244,7 @@ const DevToolsRouteName = 'DevTools';\nconst DevTools = connect(\n(state: AppState) => ({\nurlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\n}),\nnull,\ntrue,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -408,6 +408,7 @@ const styles = StyleSheet.create({\npaddingVertical: 6,\n},\nsubmenuText: {\n+ color: 'black',\nfontSize: 16,\nflex: 1,\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -39,7 +39,11 @@ import {\n} from './push/android';\nimport { persistConfig, setPersistor } from './persist';\nimport reduxLogger from './redux-logger';\n-import { defaultURLPrefix } from './utils/url-utils';\n+import {\n+ defaultURLPrefix,\n+ natServer,\n+ setCustomServer,\n+} from './utils/url-utils';\nexport type AppState = {|\nnavInfo: NavInfo,\n@@ -56,6 +60,7 @@ export type AppState = {|\ncookie: ?string,\ndeviceToken: ?string,\nurlPrefix: string,\n+ customServer: ?string,\nthreadIDsToNotifIDs: {[threadID: string]: string[]},\n_persist: ?PersistState,\n|};\n@@ -82,6 +87,7 @@ const defaultState = ({\ncookie: null,\ndeviceToken: null,\nurlPrefix: defaultURLPrefix(),\n+ customServer: natServer,\nthreadIDsToNotifIDs: {},\n_persist: null,\n}: AppState);\n@@ -111,6 +117,7 @@ function reducer(state: AppState = defaultState, action: *) {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nurlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n_persist: state._persist,\n};\n@@ -134,12 +141,33 @@ function reducer(state: AppState = defaultState, action: *) {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nurlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\nthreadIDsToNotifIDs: reduceThreadIDsToNotifIDs(\nstate.threadIDsToNotifIDs,\naction.payload,\n),\n_persist: state._persist,\n};\n+ } else if (action.type === setCustomServer) {\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: action.payload,\n+ threadIDsToNotifIDs: state.threadIDsToNotifIDs,\n+ _persist: state._persist,\n+ };\n}\n// These action type are handled by reduceNavInfo above\nif (\n@@ -186,6 +214,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nurlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n_persist: state._persist,\n};\n@@ -220,6 +249,7 @@ function validateState(oldState: AppState, state: AppState): AppState {\ncookie: state.cookie,\ndeviceToken: state.deviceToken,\nurlPrefix: state.urlPrefix,\n+ customServer: state.customServer,\nthreadIDsToNotifIDs: state.threadIDsToNotifIDs,\n_persist: state._persist,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/utils/url-utils.js",
"new_path": "native/utils/url-utils.js",
"diff": "@@ -26,7 +26,6 @@ function defaultURLPrefix() {\nconst serverOptions = [\nproductionServer,\n- natServer,\n];\nif (Platform.OS === \"android\") {\nserverOptions.push(localhostServerFromAndroidEmulator);\n@@ -34,7 +33,11 @@ if (Platform.OS === \"android\") {\nserverOptions.push(localhostServer);\n}\n+const setCustomServer = \"SET_CUSTOM_SERVER\";\n+\nexport {\ndefaultURLPrefix,\nserverOptions,\n+ natServer,\n+ setCustomServer,\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/package.json",
"new_path": "server/package.json",
"diff": "\"main\": \"dist/server\",\n\"scripts\": {\n\"postinstall\": \"cd ../; npx flow-mono create-symlinks server/.flowconfig\",\n- \"babel\": \"babel src/ --out-dir dist/ --ignore 'lib/flow-typed','lib/node_modules','lib/package.json','web/flow-typed','web/node_modules','web/package.json','web/dist/hot','web/dist/dev.build.js','web/dist/prod.build.js','web/dist/prod.build.css' --copy-files\",\n+ \"babel\": \"babel src/ --out-dir dist/ --ignore 'lib/flow-typed','lib/node_modules','lib/package.json','web/flow-typed','web/node_modules','web/package.json','web/dist/hot','web/dist/dev.build.js','web/dist/prod.build.js','web/dist/prod.build.css','web/webpack.config.js' --copy-files\",\n\"prod\": \"node --experimental-modules --loader ./loader.mjs dist/server\",\n\"dev\": \"NODE_ENV=dev concurrently \\\"npm run babel -- --watch\\\" \\\"nodemon -e js,json --watch dist --experimental-modules --loader ./loader.mjs dist/server\\\"\"\n},\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add custom server selection to native |
129,187 | 08.03.2018 20:24:18 | 18,000 | 3309cb1b9ecad77145a67258328ed9beeaa719bd | Fix Entry deletion on blur
(Also give `redux-persist` some time to purge state before exiting.) | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -998,7 +998,7 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nconst entryKey = entryKeys[0];\nconst entryRef = this.entryRefs.get(entryKey);\nif (entryRef) {\n- entryRef.save();\n+ entryRef.completeEdit();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -184,7 +184,7 @@ class InternalEntry extends React.Component<Props, State> {\n}\nif (!nextProps.active && wasActive && this.textInput) {\nthis.textInput.blur();\n- this.setInactive();\n+ this.completeEdit();\n}\n}\n@@ -395,23 +395,22 @@ class InternalEntry extends React.Component<Props, State> {\nsetActive = () => this.props.makeActive(entryKey(this.props.entryInfo), true);\n- setInactive = () => {\n- this.setState({ editing: false });\n+ completeEdit = () => {\n+ this.onBlur();\n+ this.guardedSetState({ editing: false });\nthis.props.makeActive(entryKey(this.props.entryInfo), false);\n}\nonBlur = () => {\nif (this.state.text.trim() === \"\") {\n- this.dispatchDelete(this.props.entryInfo.id);\n+ this.delete();\n} else if (this.props.entryInfo.text !== this.state.text) {\n- this.dispatchSave(this.props.entryInfo.id, this.state.text);\n+ this.save();\n}\n- this.setInactive();\n}\nsave = () => {\nthis.dispatchSave(this.props.entryInfo.id, this.state.text);\n- this.setInactive();\n}\nonTextLayout = (\n@@ -552,9 +551,9 @@ class InternalEntry extends React.Component<Props, State> {\nonPressEdit = () => {\nif (InternalEntry.isEditing(this.props, this.state)) {\n- this.save();\n+ this.completeEdit();\n} else {\n- this.setState({ editing: true });\n+ this.guardedSetState({ editing: true });\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/dev-tools.react.js",
"new_path": "native/more/dev-tools.react.js",
"diff": "@@ -12,6 +12,7 @@ import Modal from 'react-native-modal';\nimport { connect } from 'lib/utils/redux-utils';\nimport { setURLPrefix } from 'lib/utils/url-utils';\n+import sleep from 'lib/utils/sleep';\nimport Button from '../components/button.react';\nimport { getPersistor } from '../persist';\n@@ -158,8 +159,9 @@ class InnerDevTools extends React.PureComponent<Props, State> {\nExitApp.exitApp();\n}\n- onPressWipe = () => {\n+ onPressWipe = async () => {\ngetPersistor().purge();\n+ await sleep(50);\nExitApp.exitApp();\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix Entry deletion on blur
(Also give `redux-persist` some time to purge state before exiting.) |
129,187 | 08.03.2018 20:41:40 | 18,000 | 4191502b437106fc9287da520412b5cadb443e74 | Some visual refinements on More tab | [
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"diff": "};\nobjectVersion = 46;\nobjects = {\n+\n/* Begin PBXBuildFile section */\n00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };\n00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };\n2E5ADC2BAEA24F1AAD81E147 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EBD8879422144B0188A8336F /* Zocial.ttf */; };\n569C48070423498795574595 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3430816A291640AEACA13234 /* EvilIcons.ttf */; };\n5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };\n+ 62E897586C0F47F7AFADFE11 /* libRNExitApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95EA49951E064ECB9B1999EA /* libRNExitApp.a */; };\n781ED432789E4AFC93FA578A /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E94F1BD692B4E6EBE1BFBFB /* Entypo.ttf */; };\n7E350429243446AAA3856078 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8D919BA72D8545CBBBF6B74F /* MaterialCommunityIcons.ttf */; };\n7F033BB61F01B5E400700D63 /* libOnePassword.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FB58AD41E80C21000B4C1B1 /* libOnePassword.a */; };\nA1145AA76F5B4EF5B3ACB31D /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E4E90F44E9F4420080594671 /* MaterialIcons.ttf */; };\nAFA44E75249D4766A4ED74C7 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2D04F3CCBAFF4A8184206FAC /* Octicons.ttf */; };\nFA7F2215AD7646E2BE985BF3 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AE31AFFF88FB4112A29ADE33 /* SimpleLineIcons.ttf */; };\n- 62E897586C0F47F7AFADFE11 /* libRNExitApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 95EA49951E064ECB9B1999EA /* libRNExitApp.a */; };\n/* End PBXBuildFile section */\n/* Begin PBXContainerItemProxy section */\nremoteGlobalIDString = 2D02E47A1E0B4A5D006451C7;\nremoteInfo = \"SquadCal-tvOS\";\n};\n- 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {\n- isa = PBXContainerItemProxy;\n- containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;\n- proxyType = 2;\n- remoteGlobalIDString = ADD01A681E09402E00F6D226;\n- remoteInfo = \"RCTBlob-tvOS\";\n- };\n- 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {\n- isa = PBXContainerItemProxy;\n- containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;\n- proxyType = 2;\n- remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;\n- remoteInfo = fishhook;\n- };\n- 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {\n- isa = PBXContainerItemProxy;\n- containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;\n- proxyType = 2;\n- remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;\n- remoteInfo = \"fishhook-tvOS\";\n- };\n3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = {\nisa = PBXContainerItemProxy;\ncontainerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;\nremoteGlobalIDString = 2D2A28881D9B049200D4039D;\nremoteInfo = \"RCTWebSocket-tvOS\";\n};\n- 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = {\n- isa = PBXContainerItemProxy;\n- containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;\n- proxyType = 2;\n- remoteGlobalIDString = 2D2A28131D9B038B00D4039D;\n- remoteInfo = \"React-tvOS\";\n- };\n3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = {\nisa = PBXContainerItemProxy;\ncontainerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;\nremoteGlobalIDString = 139D7E881E25C6D100323FB7;\nremoteInfo = \"double-conversion\";\n};\n+ 7F3DD3FE20521A4B00A0D652 /* PBXContainerItemProxy */ = {\n+ isa = PBXContainerItemProxy;\n+ containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;\n+ proxyType = 2;\n+ remoteGlobalIDString = 2D2A28131D9B038B00D4039D;\n+ remoteInfo = \"React-tvOS\";\n+ };\n+ 7F3DD40020521A4B00A0D652 /* PBXContainerItemProxy */ = {\n+ isa = PBXContainerItemProxy;\n+ containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;\n+ proxyType = 2;\n+ remoteGlobalIDString = EBF21BDC1FC498900052F4D5;\n+ remoteInfo = jsinspector;\n+ };\n+ 7F3DD40220521A4B00A0D652 /* PBXContainerItemProxy */ = {\n+ isa = PBXContainerItemProxy;\n+ containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;\n+ proxyType = 2;\n+ remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;\n+ remoteInfo = \"jsinspector-tvOS\";\n+ };\n+ 7F3DD40A20521A4C00A0D652 /* PBXContainerItemProxy */ = {\n+ isa = PBXContainerItemProxy;\n+ containerPortal = 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */;\n+ proxyType = 2;\n+ remoteGlobalIDString = 15209BEF1D250F63000D0F44;\n+ remoteInfo = RNExitApp;\n+ };\n7F407AEA1FF1D826006997C8 /* PBXContainerItemProxy */ = {\nisa = PBXContainerItemProxy;\ncontainerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;\n143FA99006A442AFB7B24B3A /* RNNotifications.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = RNNotifications.xcodeproj; path = \"../node_modules/react-native-notifications/RNNotifications/RNNotifications.xcodeproj\"; sourceTree = \"<group>\"; };\n146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = React.xcodeproj; path = \"../node_modules/react-native/React/React.xcodeproj\"; sourceTree = \"<group>\"; };\n1E94F1BD692B4E6EBE1BFBFB /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Entypo.ttf\"; sourceTree = \"<group>\"; };\n+ 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = RNExitApp.xcodeproj; path = \"../node_modules/react-native-exit-app/ios/RNExitApp.xcodeproj\"; sourceTree = \"<group>\"; };\n2D02E47B1E0B4A5D006451C7 /* SquadCal-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = \"SquadCal-tvOS.app\"; sourceTree = BUILT_PRODUCTS_DIR; };\n2D02E4901E0B4A5D006451C7 /* SquadCal-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SquadCal-tvOSTests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n2D04F3CCBAFF4A8184206FAC /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Octicons.ttf\"; sourceTree = \"<group>\"; };\n+ 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };\n3430816A291640AEACA13234 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf\"; sourceTree = \"<group>\"; };\n4AB1FC0EFD3A4ED1A082E32F /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf\"; sourceTree = \"<group>\"; };\n4ACC468F28D944F293B91ACC /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf\"; sourceTree = \"<group>\"; };\n- 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };\n5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RCTAnimation.xcodeproj; path = \"../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj\"; sourceTree = \"<group>\"; };\n78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RCTLinking.xcodeproj; path = \"../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj\"; sourceTree = \"<group>\"; };\n7FB58ABB1E7F6BC600B4C1B1 /* Anaheim-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"Anaheim-Regular.ttf\"; sourceTree = \"<group>\"; };\n7FCFD8BD1E81B8DF00629B0E /* SquadCal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = SquadCal.entitlements; path = SquadCal/SquadCal.entitlements; sourceTree = \"<group>\"; };\n832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RCTText.xcodeproj; path = \"../node_modules/react-native/Libraries/Text/RCTText.xcodeproj\"; sourceTree = \"<group>\"; };\n8D919BA72D8545CBBBF6B74F /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf\"; sourceTree = \"<group>\"; };\n+ 95EA49951E064ECB9B1999EA /* libRNExitApp.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNExitApp.a; sourceTree = \"<group>\"; };\n95EEFC35D4D14053ACA7E064 /* RNKeychain.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = RNKeychain.xcodeproj; path = \"../node_modules/react-native-keychain/RNKeychain.xcodeproj\"; sourceTree = \"<group>\"; };\nAE31AFFF88FB4112A29ADE33 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf\"; sourceTree = \"<group>\"; };\nC3BA31E561EB497494D7882F /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = RNVectorIcons.xcodeproj; path = \"../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj\"; sourceTree = \"<group>\"; };\nE7D7D614C3184B1BB95EE661 /* OnePassword.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = \"wrapper.pb-project\"; name = OnePassword.xcodeproj; path = \"../node_modules/react-native-onepassword/OnePassword.xcodeproj\"; sourceTree = \"<group>\"; };\nEA40FBBA484449FAA8915A48 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Foundation.ttf\"; sourceTree = \"<group>\"; };\nEBD8879422144B0188A8336F /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = \"../node_modules/react-native-vector-icons/Fonts/Zocial.ttf\"; sourceTree = \"<group>\"; };\n- 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */ = {isa = PBXFileReference; name = \"RNExitApp.xcodeproj\"; path = \"../node_modules/react-native-exit-app/ios/RNExitApp.xcodeproj\"; sourceTree = \"<group>\"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };\n- 95EA49951E064ECB9B1999EA /* libRNExitApp.a */ = {isa = PBXFileReference; name = \"libRNExitApp.a\"; path = \"libRNExitApp.a\"; sourceTree = \"<group>\"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };\n/* End PBXFileReference section */\n/* Begin PBXFrameworksBuildPhase section */\nisa = PBXFrameworksBuildPhase;\nbuildActionMask = 2147483647;\nfiles = (\n- 2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */,\n2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */,\n2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,\n2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,\n3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,\n7F407AEB1FF1D826006997C8 /* libfishhook.a */,\n7F407AED1FF1D826006997C8 /* libfishhook-tvOS.a */,\n- 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */,\n- 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */,\n);\nname = Products;\nsourceTree = \"<group>\";\nisa = PBXGroup;\nchildren = (\n146834041AC3E56700842450 /* libReact.a */,\n+ 7F3DD3FF20521A4B00A0D652 /* libReact.a */,\n3DAD3EA51DF850E9000B6D8A /* libyoga.a */,\n3DAD3EA71DF850E9000B6D8A /* libyoga.a */,\n3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */,\n3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,\n3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,\n3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,\n+ 7F3DD40120521A4B00A0D652 /* libjsinspector.a */,\n+ 7F3DD40320521A4B00A0D652 /* libjsinspector-tvOS.a */,\n7F033BB01F01B5E100700D63 /* libthird-party.a */,\n7F474C821F833FCA00B71135 /* libthird-party.a */,\n7F033BB21F01B5E100700D63 /* libdouble-conversion.a */,\nname = Products;\nsourceTree = \"<group>\";\n};\n+ 7F3DD40720521A4C00A0D652 /* Products */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 7F3DD40B20521A4C00A0D652 /* libRNExitApp.a */,\n+ );\n+ name = Products;\n+ sourceTree = \"<group>\";\n+ };\n7F5B10C02005349C00FE096A /* Recovered References */ = {\nisa = PBXGroup;\nchildren = (\n+ 95EA49951E064ECB9B1999EA /* libRNExitApp.a */,\n);\nname = \"Recovered References\";\nsourceTree = \"<group>\";\nname = Products;\nsourceTree = \"<group>\";\n};\n- ADBDB9201DFEBF0600ED6528 /* Products */ = {\n- isa = PBXGroup;\n- children = (\n- ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */,\n- 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */,\n- );\n- name = Products;\n- sourceTree = \"<group>\";\n- };\n/* End PBXGroup section */\n/* Begin PBXNativeTarget section */\nProductGroup = 146834001AC3E56700842450 /* Products */;\nProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;\n},\n+ {\n+ ProductGroup = 7F3DD40720521A4C00A0D652 /* Products */;\n+ ProjectRef = 220AE3F9742647538AAD1DD7 /* RNExitApp.xcodeproj */;\n+ },\n{\nProductGroup = 7FEB2DCE1E8D64D200C4B763 /* Products */;\nProjectRef = 95EEFC35D4D14053ACA7E064 /* RNKeychain.xcodeproj */;\nremoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;\nsourceTree = BUILT_PRODUCTS_DIR;\n};\n- 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */ = {\n- isa = PBXReferenceProxy;\n- fileType = archive.ar;\n- path = \"libRCTBlob-tvOS.a\";\n- remoteRef = 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */;\n- sourceTree = BUILT_PRODUCTS_DIR;\n- };\n- 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */ = {\n- isa = PBXReferenceProxy;\n- fileType = archive.ar;\n- path = libfishhook.a;\n- remoteRef = 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */;\n- sourceTree = BUILT_PRODUCTS_DIR;\n- };\n- 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */ = {\n- isa = PBXReferenceProxy;\n- fileType = archive.ar;\n- path = \"libfishhook-tvOS.a\";\n- remoteRef = 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */;\n- sourceTree = BUILT_PRODUCTS_DIR;\n- };\n3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {\nisa = PBXReferenceProxy;\nfileType = archive.ar;\nremoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */;\nsourceTree = BUILT_PRODUCTS_DIR;\n};\n- 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = {\n- isa = PBXReferenceProxy;\n- fileType = archive.ar;\n- path = libReact.a;\n- remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */;\n- sourceTree = BUILT_PRODUCTS_DIR;\n- };\n3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = {\nisa = PBXReferenceProxy;\nfileType = archive.ar;\nremoteRef = 7F033BB11F01B5E100700D63 /* PBXContainerItemProxy */;\nsourceTree = BUILT_PRODUCTS_DIR;\n};\n+ 7F3DD3FF20521A4B00A0D652 /* libReact.a */ = {\n+ isa = PBXReferenceProxy;\n+ fileType = archive.ar;\n+ path = libReact.a;\n+ remoteRef = 7F3DD3FE20521A4B00A0D652 /* PBXContainerItemProxy */;\n+ sourceTree = BUILT_PRODUCTS_DIR;\n+ };\n+ 7F3DD40120521A4B00A0D652 /* libjsinspector.a */ = {\n+ isa = PBXReferenceProxy;\n+ fileType = archive.ar;\n+ path = libjsinspector.a;\n+ remoteRef = 7F3DD40020521A4B00A0D652 /* PBXContainerItemProxy */;\n+ sourceTree = BUILT_PRODUCTS_DIR;\n+ };\n+ 7F3DD40320521A4B00A0D652 /* libjsinspector-tvOS.a */ = {\n+ isa = PBXReferenceProxy;\n+ fileType = archive.ar;\n+ path = \"libjsinspector-tvOS.a\";\n+ remoteRef = 7F3DD40220521A4B00A0D652 /* PBXContainerItemProxy */;\n+ sourceTree = BUILT_PRODUCTS_DIR;\n+ };\n+ 7F3DD40B20521A4C00A0D652 /* libRNExitApp.a */ = {\n+ isa = PBXReferenceProxy;\n+ fileType = archive.ar;\n+ path = libRNExitApp.a;\n+ remoteRef = 7F3DD40A20521A4C00A0D652 /* PBXContainerItemProxy */;\n+ sourceTree = BUILT_PRODUCTS_DIR;\n+ };\n7F407AEB1FF1D826006997C8 /* libfishhook.a */ = {\nisa = PBXReferenceProxy;\nfileType = archive.ar;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more-screen.react.js",
"new_path": "native/more/more-screen.react.js",
"diff": "@@ -21,7 +21,6 @@ import {\n} from 'react-native';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\n-import { SafeAreaView } from 'react-navigation';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport { registerFetchKey } from 'lib/reducers/loading-reducer';\n@@ -46,8 +45,6 @@ import { DeleteAccountRouteName } from './delete-account.react';\nimport { BuildInfoRouteName} from './build-info.react';\nimport { DevToolsRouteName} from './dev-tools.react';\n-const forceInset = { top: 'always', bottom: 'never' };\n-\ntype Props = {\nnavigation: NavigationScreenProp<*>,\n// Redux state\n@@ -78,7 +75,7 @@ class InnerMoreScreen extends React.PureComponent<Props> {\nresendVerificationEmail: PropTypes.func.isRequired,\n};\nstatic navigationOptions = {\n- header: null,\n+ headerTitle: \"More\",\n};\nrender() {\n@@ -125,7 +122,7 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n);\n}\nreturn (\n- <SafeAreaView forceInset={forceInset} style={styles.container}>\n+ <View style={styles.container}>\n<ScrollView contentContainerStyle={styles.scrollView}>\n<View style={styles.section}>\n<View style={styles.row}>\n@@ -205,7 +202,7 @@ class InnerMoreScreen extends React.PureComponent<Props> {\n</Button>\n</View>\n</ScrollView>\n- </SafeAreaView>\n+ </View>\n);\n}\n@@ -301,7 +298,7 @@ const styles = StyleSheet.create({\nflex: 1,\n},\nscrollView: {\n- paddingVertical: 16,\n+ paddingVertical: 24,\n},\nsection: {\nbackgroundColor: 'white',\n@@ -325,7 +322,7 @@ const styles = StyleSheet.create({\nborderBottomWidth: 1,\nborderColor: \"#CCCCCC\",\nmarginBottom: 24,\n- paddingVertical: 6,\n+ paddingVertical: 2,\n},\nrow: {\nflex: 1,\n@@ -405,7 +402,7 @@ const styles = StyleSheet.create({\nsubmenuButton: {\nflexDirection: 'row',\npaddingHorizontal: 24,\n- paddingVertical: 6,\n+ paddingVertical: 10,\n},\nsubmenuText: {\ncolor: 'black',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/more/more.react.js",
"new_path": "native/more/more.react.js",
"diff": "@@ -31,7 +31,6 @@ const More = StackNavigator(\n/>\n),\n}),\n- mode: \"modal\",\n},\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Some visual refinements on More tab |
129,187 | 12.03.2018 10:10:37 | 14,400 | 65db3dcdb788617f4efe096f7dd6e8517b9ea561 | Fix logic to visually combine messages on native | [
{
"change_type": "MODIFY",
"old_path": "native/selectors/chat-selectors.js",
"new_path": "native/selectors/chat-selectors.js",
"diff": "@@ -195,7 +195,7 @@ const baseMessageListData = (threadID: string) => createSelector(\nrobotext,\n});\n}\n- lastMessageInfo = messageInfo;\n+ lastMessageInfo = rawMessageInfo;\n}\nif (chatMessageItems.length > 0) {\nconst lastMessageItem = chatMessageItems[chatMessageItems.length - 1];\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix logic to visually combine messages on native |
129,187 | 18.03.2018 15:16:00 | 14,400 | c2d47dba7929db406a4d8ad642a3863d9586af47 | Uhh fully working Android splash screen? I think?
This took like five days. | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable-w481dp-xxhdpi/splash.xml",
"new_path": "native/android/app/src/main/res/drawable-w481dp-xxhdpi/splash.xml",
"diff": "android:gravity=\"fill\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable-w481dp-xxxhdpi/splash.xml",
"new_path": "native/android/app/src/main/res/drawable-w481dp-xxxhdpi/splash.xml",
"diff": "android:gravity=\"fill\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable-w801dp-xhdpi/splash.xml",
"new_path": "native/android/app/src/main/res/drawable-w801dp-xhdpi/splash.xml",
"diff": "android:gravity=\"fill\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable-w801dp/splash.xml",
"new_path": "native/android/app/src/main/res/drawable-w801dp/splash.xml",
"diff": "android:gravity=\"fill\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable-w961dp-hdpi/splash.xml",
"new_path": "native/android/app/src/main/res/drawable-w961dp-hdpi/splash.xml",
"diff": "android:gravity=\"fill\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/res/drawable/splash.xml",
"new_path": "native/android/app/src/main/res/drawable/splash.xml",
"diff": "android:gravity=\"center\"\n/>\n</item>\n- <item>\n- <bitmap\n- android:src=\"@drawable/header\"\n- android:width=\"177dp\"\n- android:height=\"62dp\"\n- android:gravity=\"center\"\n+ <item\n+ android:drawable=\"@drawable/splash_header\"\n/>\n- </item>\n</layer-list>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/drawable/splash_header.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<inset\n+ xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:insetBottom=\"56dp\"\n+ android:insetLeft=\"1dp\"\n+>\n+ <bitmap\n+ android:src=\"@drawable/header\"\n+ android:width=\"177dp\"\n+ android:height=\"62dp\"\n+ android:gravity=\"center\"\n+ />\n+</inset>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -157,7 +157,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\ncomponentDidMount() {\nif (Platform.OS === \"android\") {\n- setTimeout(SplashScreen.hide, 250);\n+ setTimeout(SplashScreen.hide, 350);\n} else {\nSplashScreen.hide();\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Uhh fully working Android splash screen? I think?
This took like five days. |
129,187 | 18.03.2018 19:21:17 | 14,400 | 56cd49968ffe71dc32303a3001f0b89baa946f4e | Fallback behavior on Android when we don't have a splash asset large enough | [
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/res/drawable-w481dp-xxhdpi/splash.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n-<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n- <item>\n- <bitmap\n- android:src=\"@drawable/splash_background\"\n- android:gravity=\"fill\"\n- />\n- </item>\n- <item\n- android:drawable=\"@drawable/splash_header\"\n- />\n-</layer-list>\n"
},
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/res/drawable-w481dp-xxxhdpi/splash.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n-<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n- <item>\n- <bitmap\n- android:src=\"@drawable/splash_background\"\n- android:gravity=\"fill\"\n- />\n- </item>\n- <item\n- android:drawable=\"@drawable/splash_header\"\n- />\n-</layer-list>\n"
},
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/res/drawable-w801dp-xhdpi/splash.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n-<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n- <item>\n- <bitmap\n- android:src=\"@drawable/splash_background\"\n- android:gravity=\"fill\"\n- />\n- </item>\n- <item\n- android:drawable=\"@drawable/splash_header\"\n- />\n-</layer-list>\n"
},
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/res/drawable-w801dp/splash.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n-<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n- <item>\n- <bitmap\n- android:src=\"@drawable/splash_background\"\n- android:gravity=\"fill\"\n- />\n- </item>\n- <item\n- android:drawable=\"@drawable/splash_header\"\n- />\n-</layer-list>\n"
},
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/res/drawable-w961dp-hdpi/splash.xml",
"new_path": null,
"diff": "-<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n-<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n- <item>\n- <bitmap\n- android:src=\"@drawable/splash_background\"\n- android:gravity=\"fill\"\n- />\n- </item>\n- <item\n- android:drawable=\"@drawable/splash_header\"\n- />\n-</layer-list>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/layout-w481dp-xxhdpi/launch_screen.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:orientation=\"vertical\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@color/primary_dark\"\n+ android:gravity=\"center\"\n+>\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"\n+ android:adjustViewBounds=\"true\"\n+ android:src=\"@drawable/splash_background\"\n+ />\n+ <ImageView\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_centerHorizontal=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:scaleType=\"center\"\n+ android:src=\"@drawable/splash_header\"\n+ />\n+</RelativeLayout>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/layout-w481dp-xxxhdpi/launch_screen.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:orientation=\"vertical\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@color/primary_dark\"\n+ android:gravity=\"center\"\n+>\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"\n+ android:adjustViewBounds=\"true\"\n+ android:src=\"@drawable/splash_background\"\n+ />\n+ <ImageView\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_centerHorizontal=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:scaleType=\"center\"\n+ android:src=\"@drawable/splash_header\"\n+ />\n+</RelativeLayout>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/layout-w801dp-xhdpi/launch_screen.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:orientation=\"vertical\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@color/primary_dark\"\n+ android:gravity=\"center\"\n+>\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"\n+ android:adjustViewBounds=\"true\"\n+ android:src=\"@drawable/splash_background\"\n+ />\n+ <ImageView\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_centerHorizontal=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:scaleType=\"center\"\n+ android:src=\"@drawable/splash_header\"\n+ />\n+</RelativeLayout>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/layout-w801dp/launch_screen.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:orientation=\"vertical\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@color/primary_dark\"\n+ android:gravity=\"center\"\n+>\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"\n+ android:adjustViewBounds=\"true\"\n+ android:src=\"@drawable/splash_background\"\n+ />\n+ <ImageView\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_centerHorizontal=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:scaleType=\"center\"\n+ android:src=\"@drawable/splash_header\"\n+ />\n+</RelativeLayout>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/layout-w961dp-hdpi/launch_screen.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n+<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ android:orientation=\"vertical\"\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:background=\"@color/primary_dark\"\n+ android:gravity=\"center\"\n+>\n+ <ImageView\n+ android:layout_width=\"match_parent\"\n+ android:layout_height=\"match_parent\"\n+ android:scaleType=\"centerCrop\"\n+ android:adjustViewBounds=\"true\"\n+ android:src=\"@drawable/splash_background\"\n+ />\n+ <ImageView\n+ android:layout_width=\"wrap_content\"\n+ android:layout_height=\"wrap_content\"\n+ android:layout_centerHorizontal=\"true\"\n+ android:layout_centerVertical=\"true\"\n+ android:scaleType=\"center\"\n+ android:src=\"@drawable/splash_header\"\n+ />\n+</RelativeLayout>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/values-w481dp-xxhdpi/styles.xml",
"diff": "+<resources>\n+ <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ </style>\n+ <style name=\"SplashTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ <item name=\"android:windowNoTitle\">true</item>\n+ <item name=\"android:windowDrawsSystemBarBackgrounds\">false</item>\n+ </style>\n+</resources>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/values-w481dp-xxxhdpi/styles.xml",
"diff": "+<resources>\n+ <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ </style>\n+ <style name=\"SplashTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ <item name=\"android:windowNoTitle\">true</item>\n+ <item name=\"android:windowDrawsSystemBarBackgrounds\">false</item>\n+ </style>\n+</resources>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/values-w801dp-xhdpi/styles.xml",
"diff": "+<resources>\n+ <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ </style>\n+ <style name=\"SplashTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ <item name=\"android:windowNoTitle\">true</item>\n+ <item name=\"android:windowDrawsSystemBarBackgrounds\">false</item>\n+ </style>\n+</resources>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/values-w801dp/styles.xml",
"diff": "+<resources>\n+ <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ </style>\n+ <style name=\"SplashTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ <item name=\"android:windowNoTitle\">true</item>\n+ <item name=\"android:windowDrawsSystemBarBackgrounds\">false</item>\n+ </style>\n+</resources>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/main/res/values-w961dp-hdpi/styles.xml",
"diff": "+<resources>\n+ <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ </style>\n+ <style name=\"SplashTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">\n+ <item name=\"android:windowNoTitle\">true</item>\n+ <item name=\"android:windowDrawsSystemBarBackgrounds\">false</item>\n+ </style>\n+</resources>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fallback behavior on Android when we don't have a splash asset large enough |
129,187 | 19.03.2018 11:00:58 | 14,400 | ae362e89ddbf30fb5e1aa7d77d054ce9ea1baaf6 | Some visual refinements for iOS splash and logged out screens | [
{
"change_type": "MODIFY",
"old_path": "native/account/forgot-password-panel.react.js",
"new_path": "native/account/forgot-password-panel.react.js",
"diff": "@@ -28,7 +28,7 @@ import {\nvalidEmailRegex,\n} from 'lib/shared/account-regexes';\n-import { TextInput } from './modal-components.react';\n+import { TextInput, usernamePlaceholder } from './modal-components.react';\nimport { PanelButton, Panel } from './panel-components.react';\ntype Props = {\n@@ -69,7 +69,7 @@ class ForgotPasswordPanel extends React.PureComponent<Props, State> {\nstyle={styles.input}\nvalue={this.state.usernameOrEmailInputText}\nonChangeText={this.onChangeUsernameOrEmailInputText}\n- placeholder=\"Username or email address\"\n+ placeholder={usernamePlaceholder}\nautoFocus={true}\nautoCorrect={false}\nautoCapitalize=\"none\"\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/log-in-panel.react.js",
"new_path": "native/account/log-in-panel.react.js",
"diff": "@@ -31,7 +31,7 @@ import {\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { currentCalendarQuery } from 'lib/selectors/nav-selectors';\n-import { TextInput } from './modal-components.react';\n+import { TextInput, usernamePlaceholder } from './modal-components.react';\nimport {\nPanelButton,\nPanelOnePasswordButton,\n@@ -114,7 +114,7 @@ class LogInPanel extends React.PureComponent<Props, State> {\nstyle={styles.input}\nvalue={this.state.usernameOrEmailInputText}\nonChangeText={this.onChangeUsernameOrEmailInputText}\n- placeholder=\"Username or email address\"\n+ placeholder={usernamePlaceholder}\nautoFocus={true}\nautoCorrect={false}\nautoCapitalize=\"none\"\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -49,7 +49,11 @@ import {\nappStartReduxLoggedInButInvalidCookie,\n} from 'lib/actions/user-actions';\n-import { windowHeight, contentVerticalOffset } from '../dimensions';\n+import {\n+ windowHeight,\n+ windowWidth,\n+ contentVerticalOffset,\n+} from '../dimensions';\nimport LogInPanelContainer from './log-in-panel-container.react';\nimport RegisterPanel from './register-panel.react';\nimport ConnectedStatusBar from '../connected-status-bar.react';\n@@ -326,9 +330,11 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n) {\nlet containerSize = Platform.OS === \"ios\" ? 62 : 59; // header height\nif (mode === \"log-in\") {\n- containerSize += 165;\n+ // We need to make space for the reset password button on smaller devices\n+ containerSize += windowHeight < 600 ? 195 : 165;\n} else if (mode === \"register\") {\n- containerSize += 246;\n+ // We need to make space for the password manager on smaller devices\n+ containerSize += windowHeight < 600 ? 261 : 246;\n} else {\n// This is arbitrary and artificial... actually centering just looks a bit\n// weird because the buttons are at the bottom. The reason it's different\n@@ -415,10 +421,12 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n// don't want to bother moving the panel between those events\nthis.keyboardHeight = event.endCoordinates.height;\n}\n- this.activeKeyboard = true;\nthis.animateToSecondMode(event.duration, event.endCoordinates.height);\n+ if (!this.activeKeyboard) {\nthis.opacityChangeQueued = false;\n}\n+ this.activeKeyboard = true;\n+ }\nanimateKeyboardDownOrBackToPrompt(inputDuration: ?number) {\nconst duration = inputDuration ? inputDuration : 250;\n@@ -706,7 +714,7 @@ const styles = StyleSheet.create({\n},\nbackButton: {\nposition: 'absolute',\n- left: 40,\n+ left: windowWidth < 360 ? 28 : 40,\ntop: 13,\n},\nbuttonContainer: {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/modal-components.react.js",
"new_path": "native/account/modal-components.react.js",
"diff": "@@ -9,6 +9,8 @@ import {\n} from 'react-native';\nimport invariant from 'invariant';\n+import { windowWidth } from '../dimensions';\n+\nclass TextInput extends React.PureComponent<*> {\ninnerTextInput: ?BaseTextInput;\n@@ -52,6 +54,11 @@ const styles = StyleSheet.create({\n},\n});\n+const usernamePlaceholder = windowWidth < 360\n+ ? \"Username or email\"\n+ : \"Username or email address\";\n+\nexport {\nTextInput,\n+ usernamePlaceholder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/panel-components.react.js",
"new_path": "native/account/panel-components.react.js",
"diff": "@@ -19,6 +19,7 @@ import PropTypes from 'prop-types';\nimport Button from '../components/button.react';\nimport OnePasswordButton from '../components/one-password-button.react';\n+import { windowHeight } from '../dimensions';\ntype ButtonProps = {\ntext: string,\n@@ -128,7 +129,7 @@ const styles = StyleSheet.create({\npaddingRight: 18,\nmarginLeft: 20,\nmarginRight: 20,\n- marginTop: 40,\n+ marginTop: windowHeight < 600 ? 15 : 40,\nborderRadius: 6,\nbackgroundColor: '#FFFFFFAA',\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground.png",
"new_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground.png and b/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png",
"new_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png and b/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@2x.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png",
"new_path": "native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png and b/native/ios/SquadCal/Images.xcassets/SplashBackground.imageset/SplashBackground@3x.png differ\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Some visual refinements for iOS splash and logged out screens |
129,187 | 19.03.2018 12:14:52 | 14,400 | 841037509d5daae60b805f8ce485a7c7611b1ff1 | Android notif icon | [
{
"change_type": "ADD",
"old_path": "native/android/app/src/main/res/drawable-hdpi/notif_icon.png",
"new_path": "native/android/app/src/main/res/drawable-hdpi/notif_icon.png",
"diff": "Binary files /dev/null and b/native/android/app/src/main/res/drawable-hdpi/notif_icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/android/app/src/main/res/drawable-xhdpi/notif_icon.png",
"new_path": "native/android/app/src/main/res/drawable-xhdpi/notif_icon.png",
"diff": "Binary files /dev/null and b/native/android/app/src/main/res/drawable-xhdpi/notif_icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/android/app/src/main/res/drawable-xxhdpi/notif_icon.png",
"new_path": "native/android/app/src/main/res/drawable-xxhdpi/notif_icon.png",
"diff": "Binary files /dev/null and b/native/android/app/src/main/res/drawable-xxhdpi/notif_icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/android/app/src/main/res/drawable-xxxhdpi/notif_icon.png",
"new_path": "native/android/app/src/main/res/drawable-xxxhdpi/notif_icon.png",
"diff": "Binary files /dev/null and b/native/android/app/src/main/res/drawable-xxxhdpi/notif_icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/android/app/src/main/res/drawable/notif_icon.png",
"new_path": "native/android/app/src/main/res/drawable/notif_icon.png",
"diff": "Binary files /dev/null and b/native/android/app/src/main/res/drawable/notif_icon.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -520,6 +520,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\npriority: \"high\",\nsound: \"default\",\nthreadID: notification.threadID,\n+ icon: \"notif_icon\",\n});\nthis.props.dispatchActionPayload(\nrecordAndroidNotificationActionType,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Android notif icon |
129,187 | 19.03.2018 15:22:51 | 14,400 | f48270c3c9836059b52105f62086ad7a959f840a | Avoiding asking for notif permissions twice on iOS | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -74,7 +74,10 @@ import {\nactiveThreadSelector,\ncreateIsForegroundSelector,\n} from './selectors/nav-selectors';\n-import { requestIOSPushPermissions } from './push/ios';\n+import {\n+ requestIOSPushPermissions,\n+ iosPushPermissionResponseReceived,\n+} from './push/ios';\nimport {\nrequestAndroidPushPermissions,\nrecordAndroidNotificationActionType,\n@@ -422,6 +425,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (deviceType !== \"android\" && deviceType !== \"ios\") {\nreturn;\n}\n+ if (deviceType === \"ios\") {\n+ iosPushPermissionResponseReceived();\n+ }\nthis.props.dispatchActionPromise(\nsetDeviceTokenActionTypes,\nthis.props.setDeviceToken(deviceToken, deviceType),\n@@ -432,14 +438,18 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (!this.props.appLoggedIn) {\nreturn;\n}\n- if (Platform.OS === \"ios\" && !__DEV__) {\n+ const deviceType = Platform.OS;\n+ if (deviceType === \"ios\") {\n+ iosPushPermissionResponseReceived();\n+ }\n+ if (deviceType === \"ios\" && !__DEV__) {\nAlert.alert(\n\"Need notif permissions\",\n\"SquadCal needs notification permissions to keep you in the loop! \" +\n\"Please enable in Settings App -> Notifications -> SquadCal.\",\n[ { text: 'OK' } ],\n);\n- } else if (Platform.OS === \"android\") {\n+ } else if (deviceType === \"android\") {\nAlert.alert(\n\"Unable to initialize notifs!\",\n\"Please check your network connection, make sure Google Play \" +\n"
},
{
"change_type": "MODIFY",
"old_path": "native/push/ios.js",
"new_path": "native/push/ios.js",
"diff": "@@ -19,15 +19,19 @@ async function requestIOSPushPermissions(missingDeviceToken: bool) {\n}\ncurrentlyActive = true;\nawait NotificationsIOS.requestPermissions();\n- currentlyActive = false;\n}\nNotificationsIOS.consumeBackgroundQueue();\n}\n+function iosPushPermissionResponseReceived() {\n+ currentlyActive = false;\n+}\n+\nfunction permissionMissing(permissions: PushPermissions) {\nreturn !permissions.alert || !permissions.badge || !permissions.sound;\n}\nexport {\nrequestIOSPushPermissions,\n+ iosPushPermissionResponseReceived,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Avoiding asking for notif permissions twice on iOS |
129,187 | 19.03.2018 20:07:25 | 14,400 | 2acab6ea4aef57dd0e6c14cfdfdb3089b9402a78 | Don't scrollToToday when calendar range shrinks if calendar tab is active | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -370,7 +370,9 @@ class InnerCalendar extends React.PureComponent<Props, State> {\n// If there are fewer items in our new data, which happens when the\n// current calendar query gets reset due to inactivity, let's reset the\n// scroll position to the center (today)\n+ if (!nextProps.tabActive) {\nsetTimeout(() => this.scrollToToday(), 50);\n+ }\nthis.firstScrollUpOnAndroidComplete = false;\n} else if (newStartDate < lastStartDate) {\nthis.updateScrollPositionAfterPrepend(lastLDWH, newLDWH);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't scrollToToday when calendar range shrinks if calendar tab is active |
129,187 | 19.03.2018 20:18:57 | 14,400 | 8d107af4cec143309b2722757888e7746ca7a954 | Customize appearance of tab bar on Android | [
{
"change_type": "MODIFY",
"old_path": "native/navigation-setup.js",
"new_path": "native/navigation-setup.js",
"diff": "@@ -28,7 +28,7 @@ import {\nimport invariant from 'invariant';\nimport _findIndex from 'lodash/fp/findIndex';\nimport _includes from 'lodash/fp/includes';\n-import { Alert, BackHandler } from 'react-native';\n+import { Alert, BackHandler, Platform } from 'react-native';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\n@@ -103,6 +103,19 @@ export type Action =\npayload: NotificationPressPayload,\n|} | AndroidNotificationActions;\n+let tabBarOptions;\n+if (Platform.OS === \"android\") {\n+ tabBarOptions = {\n+ style: {\n+ backgroundColor: '#445588',\n+ },\n+ indicatorStyle: {\n+ backgroundColor: '#AAFFCC',\n+ },\n+ };\n+} else {\n+ tabBarOptions = {};\n+}\nconst AppNavigator = TabNavigator(\n{\n[CalendarRouteName]: { screen: Calendar },\n@@ -112,6 +125,7 @@ const AppNavigator = TabNavigator(\n{\ninitialRouteName: CalendarRouteName,\nlazy: false,\n+ tabBarOptions,\n},\n);\ntype WrappedAppNavigatorProps = {|\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Customize appearance of tab bar on Android |
129,187 | 19.03.2018 22:44:13 | 14,400 | bcab1b6fc51f90215aca599dee4b098a21fe06c6 | Ignore Keyboard events while AppState isn't active
Had to fork `KeyboardAvoidingView` in order to do this, unfortunately. | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -62,6 +62,11 @@ import { pingNativeStartingPayload } from '../selectors/ping-selectors';\nimport { navigateToAppActionType } from '../navigation-setup';\nimport { splashBackgroundURI } from './background-info';\nimport { splashStyle } from '../splash';\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\nconst forceInset = { top: 'always', bottom: 'always' };\n@@ -184,24 +189,18 @@ class InnerLoggedOutModal extends React.PureComponent<Props, State> {\n}\nonForeground() {\n- this.keyboardShowListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n- this.keyboardShow,\n- );\n- this.keyboardHideListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n- this.keyboardHide,\n- );\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardShow);\n+ this.keyboardHideListener = addKeyboardDismissListener(this.keyboardHide);\nBackHandler.addEventListener('hardwareBackPress', this.hardwareBack);\n}\nonBackground() {\nif (this.keyboardShowListener) {\n- this.keyboardShowListener.remove();\n+ removeKeyboardListener(this.keyboardShowListener);\nthis.keyboardShowListener = null;\n}\nif (this.keyboardHideListener) {\n- this.keyboardHideListener.remove();\n+ removeKeyboardListener(this.keyboardHideListener);\nthis.keyboardHideListener = null;\n}\nBackHandler.removeEventListener('hardwareBackPress', this.hardwareBack);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/account/verification-modal.react.js",
"new_path": "native/account/verification-modal.react.js",
"diff": "@@ -52,6 +52,11 @@ import { createIsForegroundSelector } from '../selectors/nav-selectors';\nimport { navigateToAppActionType } from '../navigation-setup';\nimport { splashBackgroundURI } from './background-info';\nimport { splashStyle } from '../splash';\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\nconst forceInset = { top: 'always', bottom: 'always' };\n@@ -168,24 +173,18 @@ class InnerVerificationModal extends React.PureComponent<Props, State> {\n}\nonForeground() {\n- this.keyboardShowListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n- this.keyboardShow,\n- );\n- this.keyboardHideListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n- this.keyboardHide,\n- );\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardShow);\n+ this.keyboardHideListener = addKeyboardDismissListener(this.keyboardHide);\nBackHandler.addEventListener('hardwareBackPress', this.hardwareBack);\n}\nonBackground() {\nif (this.keyboardShowListener) {\n- this.keyboardShowListener.remove();\n+ removeKeyboardListener(this.keyboardShowListener);\nthis.keyboardShowListener = null;\n}\nif (this.keyboardHideListener) {\n- this.keyboardHideListener.remove();\n+ removeKeyboardListener(this.keyboardHideListener);\nthis.keyboardHideListener = null;\n}\nBackHandler.removeEventListener('hardwareBackPress', this.hardwareBack);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar-input-bar.react.js",
"new_path": "native/calendar/calendar-input-bar.react.js",
"diff": "// @flow\nimport React from 'react';\n-import { View, StyleSheet, Text, Keyboard, Platform } from 'react-native';\n+import { View, StyleSheet, Text } from 'react-native';\nimport Button from '../components/button.react';\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\ntype Props = {|\nonSave: () => void,\n@@ -20,23 +25,19 @@ class CalendarInputBar extends React.PureComponent<Props, State> {\nkeyboardDismissListener: ?Object;\ncomponentDidMount() {\n- this.keyboardShowListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n- this.keyboardShow,\n- );\n- this.keyboardDismissListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardShow);\n+ this.keyboardDismissListener = addKeyboardDismissListener(\nthis.keyboardDismiss,\n);\n}\ncomponentWillUnmount() {\nif (this.keyboardShowListener) {\n- this.keyboardShowListener.remove();\n+ removeKeyboardListener(this.keyboardShowListener);\nthis.keyboardShowListener = null;\n}\nif (this.keyboardDismissListener) {\n- this.keyboardDismissListener.remove();\n+ removeKeyboardListener(this.keyboardDismissListener);\nthis.keyboardDismissListener = null;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -25,7 +25,6 @@ import {\nActivityIndicator,\nKeyboard,\nLayoutAnimation,\n- KeyboardAvoidingView,\nTouchableWithoutFeedback,\n} from 'react-native';\nimport { SafeAreaView } from 'react-navigation';\n@@ -64,6 +63,12 @@ import SectionFooter from './section-footer.react';\nimport ThreadPicker from './thread-picker.react';\nimport CalendarInputBar from './calendar-input-bar.react';\nimport { iosKeyboardOffset } from '../dimensions';\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\n+import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nexport type EntryInfoWithHeight = EntryInfo & { textHeight: number };\ntype CalendarItemWithHeight =\n@@ -235,12 +240,8 @@ class InnerCalendar extends React.PureComponent<Props, State> {\ncomponentDidMount() {\nNativeAppState.addEventListener('change', this.handleAppStateChange);\nif (this.props.tabActive) {\n- this.keyboardShowListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n- this.keyboardShow,\n- );\n- this.keyboardDismissListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardShow);\n+ this.keyboardDismissListener = addKeyboardDismissListener(\nthis.keyboardDismiss,\n);\n}\n@@ -327,24 +328,20 @@ class InnerCalendar extends React.PureComponent<Props, State> {\ncomponentWillUpdate(nextProps: Props, nextState: State) {\nif (nextProps.tabActive && !this.props.tabActive) {\nif (!this.keyboardShowListener) {\n- this.keyboardShowListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n- this.keyboardShow,\n- );\n+ this.keyboardShowListener = addKeyboardShowListener(this.keyboardShow);\n}\nif (!this.keyboardDismissListener) {\n- this.keyboardDismissListener = Keyboard.addListener(\n- Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n+ this.keyboardDismissListener = addKeyboardDismissListener(\nthis.keyboardDismiss,\n);\n}\n} else if (!nextProps.tabActive && this.props.tabActive) {\nif (this.keyboardShowListener) {\n- this.keyboardShowListener.remove();\n+ removeKeyboardListener(this.keyboardShowListener);\nthis.keyboardShowListener = null;\n}\nif (this.keyboardDismissListener) {\n- this.keyboardDismissListener.remove();\n+ removeKeyboardListener(this.keyboardDismissListener);\nthis.keyboardDismissListener = null;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -13,7 +13,6 @@ import {\nFlatList,\nPlatform,\nTextInput,\n- KeyboardAvoidingView,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\n@@ -33,6 +32,7 @@ import ComposeThreadButton from './compose-thread-button.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport { ComposeThreadRouteName } from './compose-thread.react';\nimport { iosKeyboardOffset } from '../dimensions';\n+import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nconst floatingActions = [{\ntext: 'Compose',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -27,7 +27,6 @@ import {\nText,\nStyleSheet,\nAlert,\n- KeyboardAvoidingView,\nPlatform,\n} from 'react-native';\nimport invariant from 'invariant';\n@@ -68,6 +67,7 @@ import { MessageListRouteName } from './message-list.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport { iosKeyboardOffset } from '../dimensions';\nimport ThreadVisibility from '../components/thread-visibility.react';\n+import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\nconst tagInputProps = {\nplaceholder: \"username\",\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -24,7 +24,6 @@ import {\nView,\nStyleSheet,\nActivityIndicator,\n- KeyboardAvoidingView,\nPlatform,\nFlatList,\nDeviceInfo,\n@@ -59,6 +58,7 @@ import MessageListHeader from './message-list-header.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport ThreadSettingsButton from './thread-settings-button.react';\nimport { iosKeyboardOffset } from '../dimensions';\n+import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';\ntype NavProp = NavigationScreenProp<NavigationRoute>\n& { state: { params: { threadInfo: ThreadInfo } } };\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": "@@ -9,7 +9,6 @@ import {\nView,\nStyleSheet,\nPlatform,\n- KeyboardAvoidingView,\nText,\nInteractionManager,\n} from 'react-native';\n@@ -21,6 +20,8 @@ import { visibilityRules } from 'lib/types/thread-types';\nimport { iosKeyboardOffset } from '../../dimensions';\nimport Button from '../../components/button.react';\nimport { ComposeThreadRouteName } from '../compose-thread.react';\n+import KeyboardAvoidingView\n+ from '../../components/keyboard-avoiding-view.react';\ntype Props = {|\nthreadInfo: ThreadInfo,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/keyboard-avoiding-modal.react.js",
"new_path": "native/components/keyboard-avoiding-modal.react.js",
"diff": "@@ -5,16 +5,11 @@ import type {\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\nimport * as React from 'react';\n-import {\n- StyleSheet,\n- View,\n- Platform,\n- KeyboardAvoidingView,\n- ViewPropTypes,\n-} from 'react-native';\n+import { StyleSheet, View, Platform, ViewPropTypes } from 'react-native';\nimport PropTypes from 'prop-types';\nimport { iosKeyboardOffset } from '../dimensions';\n+import KeyboardAvoidingView from './keyboard-avoiding-view.react';\ntype Props = {|\nchildren?: React.Node,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/components/keyboard-avoiding-view.react.js",
"diff": "+// @flow\n+\n+import type {\n+ StyleObj,\n+} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\n+\n+import * as React from 'react';\n+import {\n+ Keyboard,\n+ LayoutAnimation,\n+ Platform,\n+ View,\n+ ViewPropTypes,\n+ AppState,\n+} from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+import {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+} from '../keyboard';\n+\n+type ViewLayout = {\n+ y: number,\n+ height: number,\n+};\n+type ViewLayoutEvent = { nativeEvent: { layout: ViewLayout } };\n+\n+type ScreenRect = {\n+ screenX: number,\n+ screenY: number,\n+ width: number,\n+ height: number,\n+};\n+type KeyboardChangeEvent = {\n+ startCoordinates?: ScreenRect,\n+ endCoordinates: ScreenRect,\n+ duration?: number,\n+ easing?: string,\n+};\n+type EmitterSubscription = {\n+ +remove: () => void,\n+};\n+\n+const viewRef = 'VIEW';\n+\n+type Props = {|\n+ behavior?: 'height' | 'position' | 'padding',\n+ children?: React.Node,\n+ contentContainerStyle?: StyleObj,\n+ style?: StyleObj,\n+ keyboardVerticalOffset: number,\n+|};\n+type State = {|\n+ bottom: number,\n+|};\n+class KeyboardAvoidingView extends React.PureComponent<Props, State> {\n+\n+ static propTypes = {\n+ behavior: PropTypes.oneOf(['height', 'position', 'padding']),\n+ children: PropTypes.node,\n+ contentContainerStyle: ViewPropTypes.style,\n+ style: ViewPropTypes.style,\n+ keyboardVerticalOffset: PropTypes.number.isRequired,\n+ };\n+ static defaultProps = {\n+ keyboardVerticalOffset: 0,\n+ };\n+ state = {\n+ bottom: 0,\n+ };\n+ subscriptions: EmitterSubscription[] = [];\n+ frame: ?ViewLayout = null;\n+ currentState = AppState.currentState;\n+\n+ _relativeKeyboardHeight(keyboardFrame: ScreenRect): number {\n+ const frame = this.frame;\n+ if (!frame || !keyboardFrame) {\n+ return 0;\n+ }\n+\n+ const keyboardY = keyboardFrame.screenY - this.props.keyboardVerticalOffset;\n+\n+ // Calculate the displacement needed for the view such that it\n+ // no longer overlaps with the keyboard\n+ return Math.max(frame.y + frame.height - keyboardY, 0);\n+ }\n+\n+ _onKeyboardChange = (event: ?KeyboardChangeEvent) => {\n+ if (this.currentState !== \"active\") {\n+ return;\n+ }\n+\n+ if (!event) {\n+ this.setState({bottom: 0});\n+ return;\n+ }\n+\n+ const { duration, easing, endCoordinates } = event;\n+ const height = this._relativeKeyboardHeight(endCoordinates);\n+\n+ if (this.state.bottom === height) {\n+ return;\n+ }\n+\n+ if (duration && easing) {\n+ LayoutAnimation.configureNext({\n+ duration: duration,\n+ update: {\n+ duration: duration,\n+ type: LayoutAnimation.Types[easing] || 'keyboard',\n+ },\n+ });\n+ }\n+ this.setState({ bottom: height });\n+ }\n+\n+ _onLayout = (event: ViewLayoutEvent) => {\n+ this.frame = event.nativeEvent.layout;\n+ }\n+\n+ _handleAppStateChange = (nextAppState: ?string) => {\n+ this.currentState = nextAppState;\n+ }\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+\n+ componentWillMount() {\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+ }\n+ AppState.addEventListener('change', this._handleAppStateChange);\n+ }\n+\n+ componentWillUnmount() {\n+ this.subscriptions.forEach((sub) => sub.remove());\n+ AppState.removeEventListener('change', this._handleAppStateChange);\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+ }\n+ return (\n+ <View\n+ ref={viewRef}\n+ style={[style, heightStyle]}\n+ onLayout={this._onLayout}\n+ {...props}\n+ >\n+ {children}\n+ </View>\n+ );\n+\n+ case 'position':\n+ const positionStyle = { bottom: this.state.bottom };\n+ const { contentContainerStyle } = this.props;\n+\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+\n+ case 'padding':\n+ const paddingStyle = { paddingBottom: this.state.bottom };\n+ return (\n+ <View\n+ ref={viewRef}\n+ style={[style, paddingStyle]}\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+}\n+\n+export default KeyboardAvoidingView;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/keyboard.js",
"new_path": "native/keyboard.js",
"diff": "// @flow\n+import { AppState, Keyboard, Platform } from 'react-native';\n+\nexport type KeyboardEvent = {\nduration: number,\nendCoordinates: {\n@@ -9,3 +11,59 @@ export type KeyboardEvent = {\nscreenY: number,\n},\n};\n+type KeyboardCallback = (event: KeyboardEvent) => void;\n+\n+let currentState = AppState.currentState;\n+function handleAppStateChange(nextAppState: ?string) {\n+ currentState = nextAppState;\n+}\n+\n+let listenersEnabled = 0;\n+let appStateListener = null;\n+function incrementAppStateListeners() {\n+ if (!listenersEnabled++) {\n+ currentState = AppState.currentState;\n+ appStateListener = AppState.addEventListener(\n+ 'change',\n+ handleAppStateChange,\n+ );\n+ }\n+}\n+function decrementAppStateListeners() {\n+ if (!--listenersEnabled && appStateListener) {\n+ AppState.removeEventListener('change', appStateListener);\n+ appStateListener = null;\n+ }\n+}\n+\n+function callCallbackIfAppActive(callback: KeyboardCallback): KeyboardCallback {\n+ return (event: KeyboardEvent) => {\n+ if (this.currentState === \"active\") {\n+ callback(event);\n+ }\n+ }\n+}\n+function addKeyboardShowListener(callback: KeyboardCallback) {\n+ incrementAppStateListeners();\n+ return Keyboard.addListener(\n+ Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\",\n+ callCallbackIfAppActive(callback),\n+ );\n+}\n+function addKeyboardDismissListener(callback: KeyboardCallback) {\n+ incrementAppStateListeners();\n+ return Keyboard.addListener(\n+ Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\",\n+ callCallbackIfAppActive(callback),\n+ );\n+}\n+function removeKeyboardListener(listener: { remove: () => void }) {\n+ decrementAppStateListeners();\n+ listener.remove();\n+}\n+\n+export {\n+ addKeyboardShowListener,\n+ addKeyboardDismissListener,\n+ removeKeyboardListener,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Ignore Keyboard events while AppState isn't active
Had to fork `KeyboardAvoidingView` in order to do this, unfortunately. |
129,187 | 20.03.2018 00:02:32 | 14,400 | 78c2602776002aa92ebb36ef89e995b949f365cc | Fix typo/bug in keyboard logic | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -249,6 +249,14 @@ class InnerCalendar extends React.PureComponent<Props, State> {\ncomponentWillUnmount() {\nNativeAppState.removeEventListener('change', this.handleAppStateChange);\n+ if (this.keyboardShowListener) {\n+ removeKeyboardListener(this.keyboardShowListener);\n+ this.keyboardShowListener = null;\n+ }\n+ if (this.keyboardDismissListener) {\n+ removeKeyboardListener(this.keyboardDismissListener);\n+ this.keyboardDismissListener = null;\n+ }\n}\nhandleAppStateChange = (nextAppState: ?string) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/keyboard.js",
"new_path": "native/keyboard.js",
"diff": "@@ -38,7 +38,7 @@ function decrementAppStateListeners() {\nfunction callCallbackIfAppActive(callback: KeyboardCallback): KeyboardCallback {\nreturn (event: KeyboardEvent) => {\n- if (this.currentState === \"active\") {\n+ if (currentState === \"active\") {\ncallback(event);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix typo/bug in keyboard logic |
129,187 | 20.03.2018 13:35:37 | 14,400 | 8f8b777c0161aeaedff04509c299551f2e0b3b7b | Changes to enable initial alpha release (woohoo!) | [
{
"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 1\n- versionName \"1.0\"\n+ versionCode 2\n+ versionName \"0.0.2\"\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": "-<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+<manifest\n+ xmlns:android=\"http://schemas.android.com/apk/res/android\"\n+ xmlns:tools=\"http://schemas.android.com/tools\"\npackage=\"org.squadcal\"\n- android:versionCode=\"1\"\n- android:versionName=\"1.0\">\n-\n+ android:versionCode=\"2\"\n+ android:versionName=\"0.0.2\"\n+>\n<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>\n<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n<uses-permission android:name=\"android.permission.VIBRATE\" />\n+ <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" tools:node=\"remove\" />\n<uses-sdk\nandroid:minSdkVersion=\"16\"\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/Contents.json",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/Contents.json",
"diff": "{\n\"images\" : [\n{\n- \"idiom\" : \"iphone\",\n\"size\" : \"20x20\",\n+ \"idiom\" : \"iphone\",\n+ \"filename\" : \"app-icon@40x40.png\",\n\"scale\" : \"2x\"\n},\n{\n- \"idiom\" : \"iphone\",\n\"size\" : \"20x20\",\n+ \"idiom\" : \"iphone\",\n+ \"filename\" : \"app-icon@60x60.png\",\n\"scale\" : \"3x\"\n},\n{\n{\n\"size\" : \"40x40\",\n\"idiom\" : \"iphone\",\n- \"filename\" : \"app-icon@120x120.png\",\n+ \"filename\" : \"app-icon@120x120-1.png\",\n\"scale\" : \"3x\"\n},\n{\n\"scale\" : \"3x\"\n},\n{\n- \"idiom\" : \"ios-marketing\",\n\"size\" : \"1024x1024\",\n+ \"idiom\" : \"ios-marketing\",\n+ \"filename\" : \"app-icon-iTunesArtwork.png\",\n\"scale\" : \"1x\"\n}\n],\n"
},
{
"change_type": "ADD",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon-iTunesArtwork.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon-iTunesArtwork.png",
"diff": "Binary files /dev/null and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon-iTunesArtwork.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120-1.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120-1.png",
"diff": "Binary files /dev/null and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120-1.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120.png and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@120x120.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@180x180.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@180x180.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@180x180.png and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@180x180.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@40x40.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@40x40.png",
"diff": "Binary files /dev/null and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@40x40.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@58x58.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@58x58.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@58x58.png and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@58x58.png differ\n"
},
{
"change_type": "ADD",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@60x60.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@60x60.png",
"diff": "Binary files /dev/null and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@60x60.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@80x80.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@80x80.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@80x80.png and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@80x80.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@87x87.png",
"new_path": "native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@87x87.png",
"diff": "Binary files a/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@87x87.png and b/native/ios/SquadCal/Images.xcassets/AppIcon.appiconset/app-icon@87x87.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n- <key>UIStatusBarStyle</key>\n- <string>UIStatusBarStyleLightContent</string>\n<key>CFBundleDevelopmentRegion</key>\n<string>en</string>\n<key>CFBundleDisplayName</key>\n<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0</string>\n+ <string>0.0.1</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>1</string>\n+ <string>0</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n<array>\n<string>armv7</string>\n</array>\n+ <key>UIStatusBarStyle</key>\n+ <string>UIStatusBarStyleLightContent</string>\n<key>UISupportedInterfaceOrientations</key>\n<array>\n<string>UIInterfaceOrientationPortrait</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Changes to enable initial alpha release (woohoo!) |
129,187 | 20.03.2018 16:06:58 | 14,400 | 1076f5a27fed6ca31d26b8eeaf06248df153249a | Adding prod sha256_cert_fingerprints to assetlinks.json for Android App Links | [
{
"change_type": "MODIFY",
"old_path": "server/.well-known/assetlinks.json",
"new_path": "server/.well-known/assetlinks.json",
"diff": "\"namespace\": \"android_app\",\n\"package_name\": \"org.squadcal\",\n\"sha256_cert_fingerprints\": [\n- \"A8:81:32:91:5C:9A:D9:9E:14:68:1B:10:EA:5D:4E:D0:62:D0:BF:13:15:77:AA:BF:1D:C9:E6:67:ED:AD:E7:6F\"\n+ \"A8:81:32:91:5C:9A:D9:9E:14:68:1B:10:EA:5D:4E:D0:62:D0:BF:13:15:77:AA:BF:1D:C9:E6:67:ED:AD:E7:6F\",\n+ \"78:8A:30:DF:7E:1F:AB:0E:F6:2B:69:8B:98:21:00:FE:97:E7:EB:34:AD:21:45:50:7D:A1:EE:CF:74:C8:FD:0D\"\n]\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Adding prod sha256_cert_fingerprints to assetlinks.json for Android App Links |
129,187 | 20.03.2018 17:09:04 | 14,400 | b21e796bc3c8f62b6695c6a4a3afe708617e7ac9 | Use lighter link color in chat messages with a dark background | [
{
"change_type": "MODIFY",
"old_path": "native/chat/text-message.react.js",
"new_path": "native/chat/text-message.react.js",
"diff": "@@ -80,10 +80,11 @@ class TextMessage extends React.PureComponent<Props> {\nlet containerStyle = null,\nmessageStyle = {},\ntextStyle = {};\n+ let darkColor = false;\nif (isViewer) {\ncontainerStyle = { alignSelf: 'flex-end' };\nmessageStyle.backgroundColor = `#${this.props.threadInfo.color}`;\n- const darkColor = colorIsDark(this.props.threadInfo.color);\n+ darkColor = colorIsDark(this.props.threadInfo.color);\ntextStyle.color = darkColor ? 'white' : 'black';\n} else {\ncontainerStyle = { alignSelf: 'flex-start' };\n@@ -119,9 +120,10 @@ class TextMessage extends React.PureComponent<Props> {\n);\nconst text = this.props.item.messageInfo.text;\n+ const linkStyle = darkColor ? styles.lightLinkText : styles.darkLinkText;\nconst content = (\n<View style={[styles.message, messageStyle]}>\n- <Hyperlink linkDefault={true} linkStyle={styles.linkText}>\n+ <Hyperlink linkDefault={true} linkStyle={linkStyle}>\n<Text\nonPress={this.onPress}\nonLongPress={this.onPress}\n@@ -200,10 +202,14 @@ const styles = StyleSheet.create({\npaddingVertical: 4,\nheight: 25,\n},\n- linkText: {\n+ darkLinkText: {\ncolor: \"#036AFF\",\ntextDecorationLine: \"underline\",\n},\n+ lightLinkText: {\n+ color: \"#129AFF\",\n+ textDecorationLine: \"underline\",\n+ },\npopoverLabelStyle: {\ntextAlign: 'center',\ncolor: '#444',\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use lighter link color in chat messages with a dark background |
129,187 | 20.03.2018 18:56:24 | 14,400 | fa403469f897d60428cd88ee30f442573fc6a8d8 | Add icons (favicon etc.) to website | [
{
"change_type": "ADD",
"old_path": "server/icons/android-chrome-192x192.png",
"new_path": "server/icons/android-chrome-192x192.png",
"diff": "Binary files /dev/null and b/server/icons/android-chrome-192x192.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/android-chrome-512x512.png",
"new_path": "server/icons/android-chrome-512x512.png",
"diff": "Binary files /dev/null and b/server/icons/android-chrome-512x512.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/apple-touch-icon.png",
"new_path": "server/icons/apple-touch-icon.png",
"diff": "Binary files /dev/null and b/server/icons/apple-touch-icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/icons/browserconfig.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+<browserconfig>\n+ <msapplication>\n+ <tile>\n+ <square150x150logo src=\"/mstile-150x150.png\"/>\n+ <TileColor>#b91d47</TileColor>\n+ </tile>\n+ </msapplication>\n+</browserconfig>\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/favicon-16x16.png",
"new_path": "server/icons/favicon-16x16.png",
"diff": "Binary files /dev/null and b/server/icons/favicon-16x16.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/favicon-32x32.png",
"new_path": "server/icons/favicon-32x32.png",
"diff": "Binary files /dev/null and b/server/icons/favicon-32x32.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/favicon.ico",
"new_path": "server/icons/favicon.ico",
"diff": "Binary files /dev/null and b/server/icons/favicon.ico differ\n"
},
{
"change_type": "ADD",
"old_path": "server/icons/mstile-150x150.png",
"new_path": "server/icons/mstile-150x150.png",
"diff": "Binary files /dev/null and b/server/icons/mstile-150x150.png differ\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/icons/safari-pinned-tab.svg",
"diff": "+<?xml version=\"1.0\" standalone=\"no\"?>\n+<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\"\n+ \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n+<svg version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\"\n+ width=\"1200.000000pt\" height=\"1200.000000pt\" viewBox=\"0 0 1200.000000 1200.000000\"\n+ preserveAspectRatio=\"xMidYMid meet\">\n+<metadata>\n+Created by potrace 1.11, written by Peter Selinger 2001-2013\n+</metadata>\n+<g transform=\"translate(0.000000,1200.000000) scale(0.100000,-0.100000)\"\n+fill=\"#000000\" stroke=\"none\">\n+<path d=\"M2000 11400 l0 -600 -367 -1 c-203 0 -388 -2 -413 -4 -66 -5 -143\n+-15 -160 -20 -8 -2 -28 -6 -43 -9 -87 -15 -259 -77 -357 -130 -355 -189 -583\n+-496 -648 -871 -9 -54 -9 -8666 0 -8731 41 -283 218 -567 471 -755 81 -60 230\n+-149 251 -149 7 0 16 -4 21 -9 23 -21 173 -67 355 -108 19 -4 2204 -8 4855\n+-10 4898 -2 4904 -2 5012 31 10 3 31 7 47 10 101 18 324 117 441 197 282 192\n+457 454 520 779 12 65 14 651 12 4415 l-2 4340 -27 92 c-15 50 -39 120 -53\n+155 -27 67 -103 201 -117 206 -4 2 -8 8 -8 14 0 23 -128 161 -220 239 -150\n+126 -407 252 -575 282 -191 35 -194 35 -622 36 l-373 1 0 600 0 600 -664 0\n+c-522 0 -665 -3 -668 -12 -2 -7 -3 -277 -3 -600 l1 -588 -2666 0 -2666 0 0\n+598 0 597 -667 3 -667 2 0 -600z m8666 -6897 l-1 -3298 -4666 -3 -4665 -2 0\n+3300 0 3300 4666 0 4666 0 0 -3297z\"/>\n+<path d=\"M3585 6979 c-334 -74 -579 -373 -580 -709 0 -143 9 -196 54 -308 89\n+-224 324 -413 560 -450 50 -8 208 -8 256 0 198 34 359 135 482 302 98 133 145\n+288 139 456 -5 134 -20 198 -72 305 -100 207 -289 355 -528 412 -58 14 -235 9\n+-311 -8z\"/>\n+<path d=\"M8169 6996 c-2 -2 -24 -6 -49 -9 -161 -20 -339 -128 -458 -276 -43\n+-53 -104 -157 -107 -181 0 -3 -3 -9 -7 -15 -3 -5 -14 -41 -24 -80 -25 -94 -24\n+-284 0 -375 84 -311 356 -534 678 -556 336 -23 646 183 756 502 30 87 33 106\n+37 225 7 220 -70 407 -233 564 -82 80 -212 152 -327 181 -16 4 -37 9 -45 11\n+-23 6 -216 14 -221 9z\"/>\n+<path d=\"M7539 3723 c-64 -82 -202 -222 -289 -294 -253 -211 -605 -363 -935\n+-404 -27 -4 -61 -9 -75 -11 -62 -13 -451 -11 -560 2 -287 35 -544 121 -750\n+253 -159 102 -337 270 -453 426 -33 44 -62 80 -66 80 -6 0 -162 -104 -401\n+-268 -69 -47 -189 -129 -268 -183 -79 -54 -145 -101 -147 -105 -8 -12 145\n+-212 250 -327 267 -293 570 -511 920 -661 88 -38 283 -107 325 -116 8 -2 44\n+-11 80 -20 65 -17 83 -21 130 -30 14 -2 50 -9 80 -15 175 -34 318 -45 580 -45\n+191 0 327 7 424 20 383 52 687 143 981 293 39 19 84 42 100 50 50 25 306 196\n+371 248 172 138 376 343 489 488 17 22 41 52 54 69 20 24 22 31 10 37 -8 5\n+-186 137 -395 294 -210 157 -386 286 -392 286 -6 0 -34 -30 -63 -67z\"/>\n+</g>\n+</svg>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/icons/site.webmanifest",
"diff": "+{\n+ \"name\": \"SquadCal\",\n+ \"short_name\": \"SquadCal\",\n+ \"icons\": [\n+ {\n+ \"src\": \"/android-chrome-192x192.png\",\n+ \"sizes\": \"192x192\",\n+ \"type\": \"image/png\"\n+ },\n+ {\n+ \"src\": \"/android-chrome-512x512.png\",\n+ \"sizes\": \"512x512\",\n+ \"type\": \"image/png\"\n+ }\n+ ],\n+ \"theme_color\": \"#b91d47\",\n+ \"background_color\": \"#b91d47\",\n+ \"display\": \"standalone\"\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -170,6 +170,29 @@ async function websiteResponder(viewer: Viewer, url: string): Promise<string> {\n<base href=\"${basePath}\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${fontsURL}\" />\n${cssInclude}\n+ <link\n+ rel=\"apple-touch-icon\"\n+ sizes=\"180x180\"\n+ href=\"apple-touch-icon.png\"\n+ />\n+ <link\n+ rel=\"icon\"\n+ type=\"image/png\"\n+ sizes=\"32x32\"\n+ href=\"favicon-32x32.png\"\n+ />\n+ <link\n+ rel=\"icon\"\n+ type=\"image/png\"\n+ sizes=\"16x16\"\n+ href=\"favicon-16x16.png\"\n+ />\n+ <link rel=\"manifest\" href=\"site.webmanifest\" />\n+ <link rel=\"mask-icon\" href=\"safari-pinned-tab.svg\" color=\"#b91d47\" />\n+ <meta name=\"apple-mobile-web-app-title\" content=\"SquadCal\" />\n+ <meta name=\"application-name\" content=\"SquadCal\" />\n+ <meta name=\"msapplication-TileColor\" content=\"#b91d47\" />\n+ <meta name=\"theme-color\" content=\"#b91d47\" />\n<script>\nvar preloadedState = ${stringifiedState};\nvar baseURL = \"${baseURL}\";\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -76,6 +76,7 @@ router.use(\n),\n);\nrouter.use('/compiled', express.static('compiled'));\n+router.use('/', express.static('icons'));\nconst jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'update_activity': updateActivityResponder,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add icons (favicon etc.) to website |
129,187 | 20.03.2018 19:14:19 | 14,400 | 239979c43b1c0ca76d66aaf33493fedc635d2dd9 | Add white background for favicon | [
{
"change_type": "MODIFY",
"old_path": "server/icons/android-chrome-192x192.png",
"new_path": "server/icons/android-chrome-192x192.png",
"diff": "Binary files a/server/icons/android-chrome-192x192.png and b/server/icons/android-chrome-192x192.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/android-chrome-512x512.png",
"new_path": "server/icons/android-chrome-512x512.png",
"diff": "Binary files a/server/icons/android-chrome-512x512.png and b/server/icons/android-chrome-512x512.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/apple-touch-icon.png",
"new_path": "server/icons/apple-touch-icon.png",
"diff": "Binary files a/server/icons/apple-touch-icon.png and b/server/icons/apple-touch-icon.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/favicon-16x16.png",
"new_path": "server/icons/favicon-16x16.png",
"diff": "Binary files a/server/icons/favicon-16x16.png and b/server/icons/favicon-16x16.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/favicon-32x32.png",
"new_path": "server/icons/favicon-32x32.png",
"diff": "Binary files a/server/icons/favicon-32x32.png and b/server/icons/favicon-32x32.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/favicon.ico",
"new_path": "server/icons/favicon.ico",
"diff": "Binary files a/server/icons/favicon.ico and b/server/icons/favicon.ico differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/icons/mstile-150x150.png",
"new_path": "server/icons/mstile-150x150.png",
"diff": "Binary files a/server/icons/mstile-150x150.png and b/server/icons/mstile-150x150.png differ\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add white background for favicon |
129,187 | 21.03.2018 12:22:37 | 14,400 | 3212a6bbd56e18de6eaf279c8ae4e404e3a4ba6a | Add padding to lines between member and child thread rows in chat settings on native | [
{
"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": "@@ -52,11 +52,7 @@ class ThreadSettingsChildThread extends React.PureComponent<Props> {\nconst styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n- flexDirection: 'row',\n- paddingLeft: 12,\n- paddingRight: 16,\n- borderTopWidth: 1,\n- borderColor: \"#CCCCCC\",\n+ paddingHorizontal: 12,\nbackgroundColor: \"white\",\n},\nbutton: {\n@@ -64,8 +60,10 @@ const styles = StyleSheet.create({\nflexDirection: 'row',\npaddingVertical: 8,\npaddingLeft: 12,\n- paddingRight: 6,\n+ paddingRight: 10,\nalignItems: 'center',\n+ borderTopWidth: 1,\n+ borderColor: \"#CCCCCC\",\n},\nleftSide: {\nflex: 1,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-list-action.react.js",
"new_path": "native/chat/settings/thread-settings-list-action.react.js",
"diff": "@@ -40,6 +40,7 @@ type SeeMoreProps = {|\nfunction ThreadSettingsSeeMore(props: SeeMoreProps) {\nreturn (\n<View style={styles.seeMoreRow}>\n+ <View style={styles.seeMoreContents}>\n<ThreadSettingsListAction\nonPress={props.onPress}\ntext=\"See more...\"\n@@ -49,6 +50,7 @@ function ThreadSettingsSeeMore(props: SeeMoreProps) {\niconStyle={styles.seeMoreIcon}\n/>\n</View>\n+ </View>\n);\n}\n@@ -110,11 +112,13 @@ const styles = StyleSheet.create({\nlineHeight: 20,\n},\nseeMoreRow: {\n+ paddingHorizontal: 12,\n+ backgroundColor: \"white\",\n+ },\n+ seeMoreContents: {\nborderTopWidth: 1,\nborderColor: \"#CCCCCC\",\n- paddingHorizontal: 12,\npaddingTop: 2,\n- backgroundColor: \"white\",\n},\nseeMoreIcon: {\nposition: 'absolute',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-member.react.js",
"new_path": "native/chat/settings/thread-settings-member.react.js",
"diff": "@@ -195,12 +195,14 @@ class ThreadSettingsMember extends React.PureComponent<Props, State> {\nreturn (\n<View style={styles.container}>\n+ <View style={styles.innerContainer}>\n<View style={styles.row}>\n{userInfo}\n{editButton}\n</View>\n{roleInfo}\n</View>\n+ </View>\n);\n}\n@@ -284,11 +286,15 @@ class ThreadSettingsMember extends React.PureComponent<Props, State> {\nconst styles = StyleSheet.create({\ncontainer: {\nflex: 1,\n- paddingHorizontal: 24,\n- paddingVertical: 8,\n+ paddingHorizontal: 12,\n+ backgroundColor: \"white\",\n+ },\n+ innerContainer: {\n+ flex: 1,\n+ paddingHorizontal: 12,\nborderTopWidth: 1,\nborderColor: \"#CCCCCC\",\n- backgroundColor: \"white\",\n+ paddingVertical: 8,\n},\nrow: {\nflex: 1,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add padding to lines between member and child thread rows in chat settings on native |
129,187 | 21.03.2018 13:26:45 | 14,400 | 610418947e48619e4719dd5f80336bb360efa588 | Add delete thread button on native and rework chat settings style a bit | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-category.react.js",
"new_path": "native/chat/settings/thread-settings-category.react.js",
"diff": "@@ -43,7 +43,6 @@ function ThreadSettingsCategoryFooter(props: FooterProps) {\n} else if (props.type === \"outline\") {\n} else if (props.type === \"unpadded\") {\ncontentStyle = styles.fullFooter;\n- paddingStyle = styles.unpaddedFooterPadding;\n} else {\ninvariant(false, \"invalid ThreadSettingsCategory type\");\n}\n@@ -85,10 +84,6 @@ const styles = StyleSheet.create({\nbackgroundColor: \"white\",\nheight: 6,\n},\n- unpaddedFooterPadding: {\n- backgroundColor: \"white\",\n- height: 4,\n- },\n});\nexport {\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": "// @flow\n-import type { ThreadInfo } from 'lib/types/thread-types';\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\nimport type { NavigationParams } from 'react-navigation';\nimport React from 'react';\n-import { Text, StyleSheet, View } from 'react-native';\n+import { Text, StyleSheet, View, Platform } from 'react-native';\n+import PropTypes from 'prop-types';\nimport { MessageListRouteName } from '../message-list.react';\nimport Button from '../../components/button.react';\n@@ -17,13 +18,21 @@ type Props = {|\nrouteName: string,\nparams?: NavigationParams,\n) => bool,\n+ lastListItem: bool,\n|};\nclass ThreadSettingsChildThread extends React.PureComponent<Props> {\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ navigate: PropTypes.func.isRequired,\n+ lastListItem: PropTypes.bool.isRequired,\n+ };\n+\nrender() {\n+ const lastButtonStyle = this.props.lastListItem ? styles.lastButton : null;\nreturn (\n<View style={styles.container}>\n- <Button onPress={this.onPress} style={styles.button}>\n+ <Button onPress={this.onPress} style={[styles.button, lastButtonStyle]}>\n<View style={styles.leftSide}>\n<ColorSplotch color={this.props.threadInfo.color} />\n<Text style={styles.text} numberOfLines={1}>\n@@ -75,6 +84,10 @@ const styles = StyleSheet.create({\ncolor: \"#036AFF\",\npaddingLeft: 8,\n},\n+ lastButton: {\n+ paddingTop: 8,\n+ paddingBottom: Platform.OS === \"ios\" ? 12 : 10,\n+ },\n});\nexport default ThreadSettingsChildThread;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/chat/settings/thread-settings-delete-thread.react.js",
"diff": "+// @flow\n+\n+import {\n+ type ThreadInfo,\n+ threadInfoPropType,\n+} from 'lib/types/thread-types';\n+\n+import React from 'react';\n+import { Text, StyleSheet, View, Platform } from 'react-native';\n+import PropTypes from 'prop-types';\n+\n+import Button from '../../components/button.react';\n+\n+type Props = {|\n+ threadInfo: ThreadInfo,\n+ canLeaveThread: bool,\n+|};\n+class ThreadSettingsDeleteThread extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ threadInfo: threadInfoPropType.isRequired,\n+ canLeaveThread: PropTypes.bool.isRequired,\n+ };\n+\n+ render() {\n+ const borderStyle = this.props.canLeaveThread ? styles.border : null;\n+ return (\n+ <View style={styles.container}>\n+ <Button\n+ onPress={this.onPress}\n+ style={[styles.button, borderStyle]}\n+ iosFormat=\"highlight\"\n+ iosHighlightUnderlayColor=\"#EEEEEEDD\"\n+ >\n+ <Text style={styles.text}>Delete thread...</Text>\n+ </Button>\n+ </View>\n+ );\n+ }\n+\n+ onPress = () => {\n+ }\n+\n+}\n+\n+const styles = StyleSheet.create({\n+ container: {\n+ backgroundColor: \"white\",\n+ paddingHorizontal: 12,\n+ },\n+ button: {\n+ flexDirection: 'row',\n+ paddingHorizontal: 12,\n+ paddingTop: 10,\n+ paddingBottom: Platform.OS === \"ios\" ? 14 : 12,\n+ },\n+ text: {\n+ fontSize: 16,\n+ color: \"#AA0000\",\n+ flex: 1,\n+ },\n+ border: {\n+ borderTopWidth: 1,\n+ borderColor: \"#CCCCCC\",\n+ },\n+});\n+\n+export default ThreadSettingsDeleteThread;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-leave-thread.react.js",
"new_path": "native/chat/settings/thread-settings-leave-thread.react.js",
"diff": "@@ -17,6 +17,7 @@ import {\nAlert,\nActivityIndicator,\nView,\n+ Platform,\n} from 'react-native';\nimport PropTypes from 'prop-types';\n@@ -32,6 +33,7 @@ import Button from '../../components/button.react';\ntype Props = {|\nthreadInfo: ThreadInfo,\n+ canDeleteThread: bool,\n// Redux state\nloadingStatus: LoadingStatus,\notherUsersButNoOtherAdmins: bool,\n@@ -44,6 +46,7 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\n+ canDeleteThread: PropTypes.bool.isRequired,\nloadingStatus: loadingStatusPropType.isRequired,\notherUsersButNoOtherAdmins: PropTypes.bool.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -54,11 +57,14 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nconst loadingIndicator = this.props.loadingStatus === \"loading\"\n? <ActivityIndicator size=\"small\" />\n: null;\n+ const lastButtonStyle = this.props.canDeleteThread\n+ ? null\n+ : styles.lastButton;\nreturn (\n<View style={styles.container}>\n<Button\nonPress={this.onPress}\n- style={styles.button}\n+ style={[styles.button, lastButtonStyle]}\niosFormat=\"highlight\"\niosHighlightUnderlayColor=\"#EEEEEEDD\"\n>\n@@ -108,17 +114,18 @@ class ThreadSettingsLeaveThread extends React.PureComponent<Props> {\nconst styles = StyleSheet.create({\ncontainer: {\n- marginVertical: 16,\n- borderTopWidth: 1,\n- borderBottomWidth: 1,\n- borderColor: \"#CCCCCC\",\nbackgroundColor: \"white\",\n+ paddingHorizontal: 12,\n},\nbutton: {\nflexDirection: 'row',\n- paddingHorizontal: 24,\n+ paddingHorizontal: 12,\npaddingVertical: 10,\n},\n+ lastButton: {\n+ paddingTop: 10,\n+ paddingBottom: Platform.OS === \"ios\" ? 14 : 12,\n+ },\ntext: {\nfontSize: 16,\ncolor: \"#AA0000\",\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-list-action.react.js",
"new_path": "native/chat/settings/thread-settings-list-action.react.js",
"diff": "@@ -5,7 +5,7 @@ import type {\n} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';\nimport React from 'react';\n-import { View, Text, StyleSheet } from 'react-native';\n+import { View, Text, StyleSheet, Platform } from 'react-native';\nimport Icon from 'react-native-vector-icons/Ionicons';\nimport Button from '../../components/button.react';\n@@ -17,10 +17,11 @@ type ListActionProps = {|\niconColor: string,\niconSize: number,\niconStyle?: StyleObj,\n+ buttonStyle?: StyleObj,\n|};\nfunction ThreadSettingsListAction(props: ListActionProps) {\nreturn (\n- <Button onPress={props.onPress}>\n+ <Button onPress={props.onPress} style={props.buttonStyle}>\n<View style={styles.container}>\n<Text style={styles.text}>{props.text}</Text>\n<Icon\n@@ -48,6 +49,7 @@ function ThreadSettingsSeeMore(props: SeeMoreProps) {\niconColor=\"#036AFF\"\niconSize={36}\niconStyle={styles.seeMoreIcon}\n+ buttonStyle={styles.seeMoreButton}\n/>\n</View>\n</View>\n@@ -66,6 +68,7 @@ function ThreadSettingsAddMember(props: AddMemberProps) {\niconName=\"md-add\"\niconColor=\"#009900\"\niconSize={20}\n+ buttonStyle={styles.addMemberButton}\n/>\n</View>\n);\n@@ -74,25 +77,21 @@ function ThreadSettingsAddMember(props: AddMemberProps) {\ntype AddChildThreadProps = {|\nonPress: () => void,\n|};\n-class ThreadSettingsAddChildThread\n- extends React.PureComponent<AddChildThreadProps> {\n-\n- render() {\n+function ThreadSettingsAddChildThread(props: AddChildThreadProps) {\nreturn (\n<View style={styles.addItemRow}>\n<ThreadSettingsListAction\n- onPress={this.props.onPress}\n+ onPress={props.onPress}\ntext=\"Add child thread\"\niconName=\"md-add\"\niconColor=\"#009900\"\niconSize={20}\n+ buttonStyle={styles.addChildThreadButton}\n/>\n</View>\n);\n}\n-}\n-\nconst styles = StyleSheet.create({\ncontainer: {\n@@ -118,18 +117,26 @@ const styles = StyleSheet.create({\nseeMoreContents: {\nborderTopWidth: 1,\nborderColor: \"#CCCCCC\",\n- paddingTop: 2,\n},\nseeMoreIcon: {\nposition: 'absolute',\nright: 10,\n- top: 15,\n+ top: Platform.OS === \"android\" ? 17 : 15,\n},\naddItemRow: {\npaddingHorizontal: 12,\n- paddingTop: 4,\nbackgroundColor: \"white\",\n},\n+ addMemberButton: {\n+ paddingTop: Platform.OS === \"ios\" ? 4 : 1,\n+ },\n+ addChildThreadButton: {\n+ paddingTop: Platform.OS === \"ios\" ? 4 : 1,\n+ },\n+ seeMoreButton: {\n+ paddingTop: Platform.OS === \"ios\" ? 2 : 0,\n+ paddingBottom: Platform.OS === \"ios\" ? 4 : 2,\n+ },\n});\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-member.react.js",
"new_path": "native/chat/settings/thread-settings-member.react.js",
"diff": "@@ -46,6 +46,7 @@ type Props = {|\nmemberInfo: RelativeMemberInfo,\nthreadInfo: ThreadInfo,\ncanEdit: bool,\n+ lastListItem: bool,\n// Redux state\nremoveUserLoadingStatus: LoadingStatus,\nchangeRoleLoadingStatus: LoadingStatus,\n@@ -71,6 +72,7 @@ class ThreadSettingsMember extends React.PureComponent<Props, State> {\nmemberInfo: relativeMemberInfoPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\ncanEdit: PropTypes.bool.isRequired,\n+ lastListItem: PropTypes.bool.isRequired,\nremoveUserLoadingStatus: loadingStatusPropType.isRequired,\nchangeRoleLoadingStatus: loadingStatusPropType.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n@@ -193,9 +195,12 @@ class ThreadSettingsMember extends React.PureComponent<Props, State> {\n}\n}\n+ const lastInnerContainer = this.props.lastListItem\n+ ? styles.lastInnerContainer\n+ : null;\nreturn (\n<View style={styles.container}>\n- <View style={styles.innerContainer}>\n+ <View style={[styles.innerContainer, lastInnerContainer]}>\n<View style={styles.row}>\n{userInfo}\n{editButton}\n@@ -326,6 +331,10 @@ const styles = StyleSheet.create({\ncolor: \"#888888\",\npaddingTop: 4,\n},\n+ lastInnerContainer: {\n+ paddingTop: 8,\n+ paddingBottom: Platform.OS === \"ios\" ? 12 : 10,\n+ },\n});\nconst icon = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings.react.js",
"new_path": "native/chat/settings/thread-settings.react.js",
"diff": "@@ -60,6 +60,7 @@ import ThreadSettingsParent from './thread-settings-parent.react';\nimport ThreadSettingsVisibility from './thread-settings-visibility.react';\nimport ThreadSettingsPushNotifs from './thread-settings-push-notifs.react';\nimport ThreadSettingsLeaveThread from './thread-settings-leave-thread.react';\n+import ThreadSettingsDeleteThread from './thread-settings-delete-thread.react';\nconst itemPageLength = 5;\n@@ -127,6 +128,7 @@ type ChatSettingsItem =\nkey: string,\nthreadInfo: ThreadInfo,\nnavigate: (routeName: string, params?: NavigationParams) => bool,\n+ lastListItem: bool,\n|}\n| {|\nitemType: \"addChildThread\",\n@@ -138,6 +140,7 @@ type ChatSettingsItem =\nmemberInfo: RelativeMemberInfo,\nthreadInfo: ThreadInfo,\ncanEdit: bool,\n+ lastListItem: bool,\n|}\n| {|\nitemType: \"addMember\",\n@@ -146,6 +149,13 @@ type ChatSettingsItem =\n| {|\nitemType: \"leaveThread\",\nkey: string,\n+ canDeleteThread: bool,\n+ threadInfo: ThreadInfo,\n+ |}\n+ | {|\n+ itemType: \"deleteThread\",\n+ key: string,\n+ canLeaveThread: bool,\nthreadInfo: ThreadInfo,\n|};\n@@ -372,7 +382,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\ncategoryType: \"full\",\n});\n- let childThreads = null;\n+ let childThreadItems = null;\nif (this.props.childThreadInfos) {\nlet childThreadInfos;\nlet seeMoreChildThreads = null;\n@@ -387,14 +397,18 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n} else {\nchildThreadInfos = this.props.childThreadInfos;\n}\n- childThreads = childThreadInfos.map(childThreadInfo => ({\n+ const childThreads = childThreadInfos.map(childThreadInfo => ({\nitemType: \"childThread\",\nkey: `childThread${childThreadInfo.id}`,\nthreadInfo: childThreadInfo,\nnavigate: this.props.navigation.navigate,\n+ lastListItem: false,\n}));\nif (seeMoreChildThreads) {\n- childThreads.push(seeMoreChildThreads);\n+ childThreadItems = [ ...childThreads, seeMoreChildThreads ];\n+ } else {\n+ childThreads[childThreads.length - 1].lastListItem = true;\n+ childThreadItems = childThreads;\n}\n}\n@@ -410,7 +424,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n};\n}\n- if (addChildThread || childThreads) {\n+ if (addChildThread || childThreadItems) {\nlistData.push({\nitemType: \"header\",\nkey: \"childThreadHeader\",\n@@ -421,10 +435,10 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nif (addChildThread) {\nlistData.push(addChildThread);\n}\n- if (childThreads) {\n- listData = [...listData, ...childThreads];\n+ if (childThreadItems) {\n+ listData = [...listData, ...childThreadItems];\n}\n- if (addChildThread || childThreads) {\n+ if (addChildThread || childThreadItems) {\nlistData.push({\nitemType: \"footer\",\nkey: \"childThreadFooter\",\n@@ -451,9 +465,14 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nmemberInfo,\nthreadInfo,\ncanEdit: canStartEditing,\n+ lastListItem: false,\n}));\n+ let memberItems;\nif (seeMoreMembers) {\n- members.push(seeMoreMembers);\n+ memberItems = [ ...members, seeMoreMembers ];\n+ } else {\n+ members[members.length - 1].lastListItem = true;\n+ memberItems = members;\n}\nlet addMembers = null;\n@@ -468,7 +487,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n};\n}\n- if (addMembers || members) {\n+ if (addMembers || memberItems) {\nlistData.push({\nitemType: \"header\",\nkey: \"memberHeader\",\n@@ -479,10 +498,10 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nif (addMembers) {\nlistData.push(addMembers);\n}\n- if (members) {\n- listData = [...listData, ...members];\n+ if (memberItems) {\n+ listData = [...listData, ...memberItems];\n}\n- if (addMembers || members) {\n+ if (addMembers || memberItems) {\nlistData.push({\nitemType: \"footer\",\nkey: \"memberFooter\",\n@@ -490,13 +509,42 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n});\n}\n- if (viewerIsMember(threadInfo)) {\n+ const canLeaveThread = viewerIsMember(threadInfo);\n+ const canDeleteThread = threadHasPermission(\n+ threadInfo,\n+ threadPermissions.DELETE_THREAD,\n+ );\n+ if (canLeaveThread || canDeleteThread) {\n+ listData.push({\n+ itemType: \"header\",\n+ key: \"actionsHeader\",\n+ title: \"Actions\",\n+ categoryType: \"unpadded\",\n+ });\n+ }\n+ if (canLeaveThread) {\nlistData.push({\nitemType: \"leaveThread\",\nkey: \"leaveThread\",\n+ canDeleteThread: !!canDeleteThread,\n+ threadInfo,\n+ });\n+ }\n+ if (canDeleteThread) {\n+ listData.push({\n+ itemType: \"deleteThread\",\n+ key: \"deleteThread\",\n+ canLeaveThread: !!canLeaveThread,\nthreadInfo,\n});\n}\n+ if (canLeaveThread || canDeleteThread) {\n+ listData.push({\n+ itemType: \"footer\",\n+ key: \"actionsFooter\",\n+ categoryType: \"unpadded\",\n+ });\n+ }\nreturn (\n<View>\n@@ -592,6 +640,7 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\n<ThreadSettingsChildThread\nthreadInfo={item.threadInfo}\nnavigate={item.navigate}\n+ lastListItem={item.lastListItem}\n/>\n);\n} else if (item.itemType === \"addChildThread\") {\n@@ -604,12 +653,25 @@ class InnerThreadSettings extends React.PureComponent<Props, State> {\nmemberInfo={item.memberInfo}\nthreadInfo={item.threadInfo}\ncanEdit={item.canEdit}\n+ lastListItem={item.lastListItem}\n/>\n);\n} else if (item.itemType === \"addMember\") {\nreturn <ThreadSettingsAddMember onPress={this.onPressAddMember} />;\n} else if (item.itemType === \"leaveThread\") {\n- return <ThreadSettingsLeaveThread threadInfo={item.threadInfo} />;\n+ return (\n+ <ThreadSettingsLeaveThread\n+ threadInfo={item.threadInfo}\n+ canDeleteThread={item.canDeleteThread}\n+ />\n+ );\n+ } else if (item.itemType === \"deleteThread\") {\n+ return (\n+ <ThreadSettingsDeleteThread\n+ threadInfo={item.threadInfo}\n+ canLeaveThread={item.canLeaveThread}\n+ />\n+ );\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add delete thread button on native and rework chat settings style a bit |
129,187 | 22.03.2018 11:02:03 | 14,400 | 53b12c204b0035cc907b8a33cc1ae039663dbc01 | Get rid of "closing" activity update
All it does is set `last_ping` to 0 for the cookie, which prevents us from tracking the actual `last_ping` effectively | [
{
"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- | {| closing: true |};\n+ | {| focus: false, threadID: string, latestMessage: ?string |};\nexport type UpdateActivityRequest = {|\nupdates: $ReadOnlyArray<ActivityUpdate>,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -615,20 +615,14 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\nclosingApp() {\n- if (!this.props.appLoggedIn) {\n+ if (!this.props.appLoggedIn || !this.props.activeThread) {\nreturn;\n}\n- const updates = [];\n- updates.push({\n- closing: true,\n- });\n- if (this.props.activeThread) {\n- updates.push({\n+ const updates = [{\nfocus: false,\nthreadID: this.props.activeThread,\nlatestMessage: this.props.activeThreadLatestMessage,\n- });\n- }\n+ }];\nthis.props.dispatchActionPromise(\nupdateActivityActionTypes,\nthis.props.updateActivity(updates),\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/activity-responders.js",
"new_path": "server/src/responders/activity-responders.js",
"diff": "@@ -22,9 +22,6 @@ 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": "@@ -29,30 +29,19 @@ async function activityUpdater(\nconst unverifiedThreadIDs = new Set();\nconst focusUpdatesByThreadID = new Map();\n- let closing = false;\nfor (let activityUpdate of request.updates) {\n- if (activityUpdate.closing) {\n- closing = true;\n- continue;\n- }\nconst threadID = activityUpdate.threadID;\nunverifiedThreadIDs.add(threadID);\nfocusUpdatesByThreadID.set(threadID, activityUpdate);\n}\n- const dbPromises = [];\n- dbPromises.push(dbQuery(SQL`\n+ const deleteQuery = SQL`\nDELETE FROM focused\nWHERE user = ${localViewer.userID} AND cookie = ${localViewer.cookieID}\n- `));\n- if (closing) {\n- dbPromises.push(dbQuery(SQL`\n- UPDATE cookies SET last_ping = 0 WHERE id = ${localViewer.cookieID}\n- `));\n- }\n+ `;\nconst [ verifiedThreadIDs ] = await Promise.all([\nverifyThreadIDs([...unverifiedThreadIDs]),\n- Promise.all(dbPromises),\n+ dbQuery(deleteQuery),\n]);\nconst focusedThreadIDs = [];\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Get rid of "closing" activity update
All it does is set `last_ping` to 0 for the cookie, which prevents us from tracking the actual `last_ping` effectively |
129,187 | 22.03.2018 18:35:55 | 14,400 | 4dbc429e6ccae707904ccb110d1749bafd8f78ce | Improve handling of notifications
1. Immediately dispatch a ping when we know we'll be displaying a notification to the user.
2. Don't crash if a thread isn't available when a notification is clicked; just wait until it is available to respond to the user action. | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -157,6 +157,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nandroidNotifListener: ?Object = null;\nandroidRefreshTokenListener: ?Object = null;\ninitialAndroidNotifHandled = false;\n+ openThreadOnceReceived: Set<string> = new Set();\ncomponentDidMount() {\nif (Platform.OS === \"android\") {\n@@ -336,6 +337,18 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\n}\n+ pingNow() {\n+ if (this.activePingSubscription) {\n+ // If the ping callback is active now, this restarts it so it runs\n+ // immediately\n+ clearInterval(this.activePingSubscription);\n+ this.activePingSubscription = setInterval(this.ping, pingFrequency);\n+ } else {\n+ // Otherwise, we just do a one-off ping\n+ this.ping();\n+ }\n+ }\n+\ncomponentWillReceiveProps(nextProps: Props) {\nconst justLoggedIn = nextProps.appLoggedIn && !this.props.appLoggedIn;\nif (\n@@ -359,6 +372,14 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nif (nextProps.unreadCount !== this.props.unreadCount) {\nAppWithNavigationState.updateBadgeCount(nextProps.unreadCount);\n}\n+ for (let threadID of this.openThreadOnceReceived) {\n+ const rawThreadInfo = nextProps.rawThreadInfos[threadID];\n+ if (rawThreadInfo) {\n+ this.navigateToThread(rawThreadInfo, false);\n+ this.openThreadOnceReceived.clear();\n+ break;\n+ }\n+ }\n}\nasync ensurePushNotifsEnabled() {\n@@ -459,16 +480,25 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\n}\n- onPressNotificationForThread(threadID: string, clearChatRoutes: bool) {\n+ navigateToThread(rawThreadInfo: RawThreadInfo, clearChatRoutes: bool) {\nthis.props.dispatchActionPayload(\nnotificationPressActionType,\n{\n- rawThreadInfo: this.props.rawThreadInfos[threadID],\n+ rawThreadInfo,\nclearChatRoutes,\n},\n);\n}\n+ onPressNotificationForThread(threadID: string, clearChatRoutes: bool) {\n+ const rawThreadInfo = this.props.rawThreadInfos[threadID];\n+ if (rawThreadInfo) {\n+ this.navigateToThread(rawThreadInfo, clearChatRoutes);\n+ } else {\n+ this.openThreadOnceReceived.add(threadID);\n+ }\n+ }\n+\niosForegroundNotificationReceived = (notification) => {\nif (\nnotification.getData() &&\n@@ -484,6 +514,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nnotification.finish(NotificationsIOS.FetchResult.NoData);\nreturn;\n}\n+ this.pingNow();\ninvariant(this.inAppNotification, \"should be set\");\nthis.inAppNotification.show({\nmessage: notification.getMessage(),\n@@ -499,6 +530,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nnotification.finish(NotificationsIOS.FetchResult.NoData);\nreturn;\n}\n+ this.pingNow();\nthis.onPressNotificationForThread(threadID, true),\nnotification.finish(NotificationsIOS.FetchResult.NewData);\n}\n@@ -518,12 +550,14 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nconsole.log(\"Notification with missing threadID received!\");\nreturn;\n}\n+ this.pingNow();\ninvariant(this.inAppNotification, \"should be set\");\nthis.inAppNotification.show({\nmessage: notification.notifBody,\nonPress: () => this.onPressNotificationForThread(threadID, false),\n});\n} else if (notification.notifBody) {\n+ this.pingNow();\nFCM.presentLocalNotification({\nid: notification.notifID,\nbody: notification.notifBody,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Improve handling of notifications
1. Immediately dispatch a ping when we know we'll be displaying a notification to the user.
2. Don't crash if a thread isn't available when a notification is clicked; just wait until it is available to respond to the user action. |
129,187 | 22.03.2018 21:56:03 | 14,400 | 7ecbca02d3bf2b0360fce31aee602f7f63f3af4f | Add a clear button for the search bar on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -13,6 +13,7 @@ import {\nFlatList,\nPlatform,\nTextInput,\n+ TouchableOpacity,\n} from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\n@@ -122,6 +123,21 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\n}\nrenderSearchBar = () => {\n+ let clearSearchInputIcon = null;\n+ if (this.state.searchText) {\n+ clearSearchInputIcon = (\n+ <TouchableOpacity\n+ onPress={this.onPressClearSearch}\n+ activeOpacity={0.5}\n+ >\n+ <Icon\n+ name=\"times-circle\"\n+ size={18}\n+ color=\"#AAAAAA\"\n+ />\n+ </TouchableOpacity>\n+ );\n+ }\nreturn (\n<View style={styles.searchContainer}>\n<View style={styles.search}>\n@@ -140,6 +156,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nplaceholderTextColor=\"#AAAAAA\"\nreturnKeyType=\"go\"\n/>\n+ {clearSearchInputIcon}\n</View>\n</View>\n);\n@@ -218,6 +235,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\ngetItemLayout={InnerChatThreadList.getItemLayout}\nextraData={this.props.viewerID}\ninitialNumToRender={11}\n+ keyboardShouldPersistTaps=\"handled\"\nstyle={styles.flatList}\n/>\n{floatingAction}\n@@ -241,6 +259,10 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nthis.setState({ searchText, searchResults: new Set(results) });\n}\n+ onPressClearSearch = () => {\n+ this.onChangeSearchText(\"\");\n+ }\n+\nonPressItem = (threadInfo: ThreadInfo) => {\nthis.props.navigation.navigate(\nMessageListRouteName,\n@@ -277,7 +299,8 @@ const styles = StyleSheet.create({\nmarginHorizontal: 12,\nmarginBottom: 8,\nmarginTop: Platform.OS === \"android\" ? 10 : 8,\n- paddingHorizontal: 14,\n+ paddingLeft: 14,\n+ paddingRight: 12,\npaddingTop: Platform.OS === \"android\" ? 1 : 6,\npaddingBottom: Platform.OS === \"android\" ? 2 : 6,\nborderRadius: 6,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add a clear button for the search bar on native |
129,187 | 22.03.2018 22:34:31 | 14,400 | 7d6879b9a23a5261755592b0c81be8fa27fdb079 | Add separate style for weekends on mobile
(But it doesn't do anything yet because I couldn't figure out a good way for it to look) | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/calendar.react.js",
"new_path": "native/calendar/calendar.react.js",
"diff": "@@ -575,9 +575,13 @@ class InnerCalendar extends React.PureComponent<Props, State> {\nif (dateString(new Date()) === row.item.dateString) {\ndate += \" (today)\";\n}\n+ const dateObj = dateFromString(row.item.dateString).getDay();\n+ const weekendStyle = dateObj === 0 || dateObj === 6\n+ ? styles.weekendSectionHeader\n+ : null;\nreturn (\n<TouchableWithoutFeedback onPress={this.makeAllEntriesInactive}>\n- <View style={styles.sectionHeader}>\n+ <View style={[styles.sectionHeader, weekendStyle]}>\n<Text style={styles.sectionHeaderText}>\n{date}\n</Text>\n@@ -1028,6 +1032,9 @@ const styles = StyleSheet.create({\nborderBottomWidth: 2,\nborderColor: '#FFFFFF',\n},\n+ weekendSectionHeader: {\n+ backgroundColor: '#EEEEEE',\n+ },\nsectionHeaderText: {\npadding: 5,\nfontWeight: 'bold',\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add separate style for weekends on mobile
(But it doesn't do anything yet because I couldn't figure out a good way for it to look) |
129,187 | 22.03.2018 22:53:32 | 14,400 | 2ae105054d4f420e9b458345ae52b17e5714c084 | Update to code version.... 3 | [
{
"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 2\n- versionName \"0.0.2\"\n+ versionCode 3\n+ versionName \"0.0.3\"\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=\"2\"\n- android:versionName=\"0.0.2\"\n+ android:versionCode=\"3\"\n+ android:versionName=\"0.0.3\"\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.1</string>\n+ <string>0.0.3</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>0</string>\n+ <string>3</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": "@@ -34,7 +34,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 0;\n+const codeVersion = 3;\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 | Update to code version.... 3 |
129,187 | 23.03.2018 14:26:19 | 14,400 | 7e260581ddc22e10bf87fa2ee6ef6ed89fac21cf | Don't create multiple threads when people click the create button multiple times on mobile | [
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-thread.react.js",
"new_path": "native/chat/compose-thread.react.js",
"diff": "@@ -80,6 +80,7 @@ type NavProp =\n& { state: { params: {\nparentThreadID?: string,\nvisibilityRules?: VisibilityRules,\n+ createButtonDisabled?: bool,\n} } };\ntype Props = {\n@@ -132,6 +133,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n<LinkButton\ntext=\"Create\"\nonPress={() => navigation.state.params.onPressCreateThread()}\n+ disabled={!!navigation.state.params.createButtonDisabled}\n/>\n),\nheaderBackTitle: \"Back\",\n@@ -178,6 +180,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\nthis.searchUsers(\"\");\nthis.props.navigation.setParams({\nonPressCreateThread: this.onPressCreateThread,\n+ createButtonDisabled: false,\n});\n}\n@@ -420,6 +423,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n}\nasync newChatThreadAction() {\n+ this.props.navigation.setParams({ createButtonDisabled: true });\ntry {\nconst visRules = this.props.navigation.state.params.visibilityRules\n? this.props.navigation.state.params.visibilityRules\n@@ -438,6 +442,7 @@ class InnerComposeThread extends React.PureComponent<Props, State> {\n: null,\n});\n} catch (e) {\n+ this.props.navigation.setParams({ createButtonDisabled: false });\nAlert.alert(\n\"Unknown error\",\n\"Uhh... try again?\",\n"
},
{
"change_type": "MODIFY",
"old_path": "native/components/link-button.react.js",
"new_path": "native/components/link-button.react.js",
"diff": "@@ -13,6 +13,7 @@ import Button from './button.react';\ntype Props = {\ntext: string,\nonPress: () => void,\n+ disabled?: bool,\nstyle?: StyleObj,\n};\nclass LinkButton extends React.PureComponent<Props> {\n@@ -20,18 +21,21 @@ class LinkButton extends React.PureComponent<Props> {\nstatic propTypes = {\ntext: PropTypes.string.isRequired,\nonPress: PropTypes.func.isRequired,\n+ disabled: PropTypes.bool,\nstyle: ViewPropTypes.style,\n};\nrender() {\n+ const disabledStyle = this.props.disabled ? styles.disabled : null;\nreturn (\n<Button\nonPress={this.props.onPress}\nandroidBorderlessRipple={true}\niosActiveOpacity={0.85}\n+ disabled={!!this.props.disabled}\nstyle={this.props.style}\n>\n- <Text style={styles.text}>{this.props.text}</Text>\n+ <Text style={[styles.text, disabledStyle]}>{this.props.text}</Text>\n</Button>\n);\n}\n@@ -48,6 +52,9 @@ const styles = StyleSheet.create({\n}),\nfontWeight: Platform.select({ android: 'bold' }),\n},\n+ disabled: {\n+ color: \"#AAAAAA\",\n+ },\n});\nexport default LinkButton;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Don't create multiple threads when people click the create button multiple times on mobile |
129,187 | 23.03.2018 15:45:24 | 14,400 | 2a07663b2342f39086a75af2bee8b70434f059f4 | Always use "Back" as headerBackTitle in Chat screens on native
This lets us get rid of the hacky `MessageListHeader`, which I suspect was causing some problems. | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -74,6 +74,7 @@ class InnerChatThreadList extends React.PureComponent<Props, State> {\nheaderRight: Platform.OS === \"ios\"\n? (<ComposeThreadButton navigate={navigation.navigate} />)\n: null,\n+ headerBackTitle: \"Back\",\n});\nconstructor(props: Props) {\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": "@@ -19,16 +19,12 @@ type Props = {\nrouteName: string,\nparams?: NavigationParams,\n) => bool,\n- sceneKey: string,\n- onWidthChange: (key: string, width: number) => void,\n};\nclass MessageListHeaderTitle extends React.PureComponent<Props> {\nstatic propTypes = {\nthreadInfo: threadInfoPropType.isRequired,\nnavigate: PropTypes.func.isRequired,\n- sceneKey: PropTypes.string.isRequired,\n- onWidthChange: PropTypes.func.isRequired,\n};\nrender() {\n@@ -59,7 +55,7 @@ class MessageListHeaderTitle extends React.PureComponent<Props> {\n>\n<View style={styles.container}>\n{fakeIcon}\n- <HeaderTitle onLayout={this.onLayout}>\n+ <HeaderTitle>\n{this.props.threadInfo.uiName}\n</HeaderTitle>\n{icon}\n@@ -68,13 +64,6 @@ class MessageListHeaderTitle extends React.PureComponent<Props> {\n);\n}\n- onLayout = (event: { nativeEvent: { layout: { width: number } } }) => {\n- this.props.onWidthChange(\n- this.props.sceneKey,\n- event.nativeEvent.layout.width,\n- );\n- }\n-\nonPress = () => {\nthis.props.navigate(\nThreadSettingsRouteName,\n"
},
{
"change_type": "DELETE",
"old_path": "native/chat/message-list-header.react.js",
"new_path": null,
"diff": "-// @flow\n-\n-import type { HeaderProps, NavigationScene } from 'react-navigation';\n-\n-import React from 'react';\n-import { Header } from 'react-navigation';\n-\n-// The whole reason for overriding header is because when we override\n-// headerTitle, we end up having to implement headerTruncatedBackTitle ourselves\n-type Props = HeaderProps & { routeKey: string };\n-type State = { titleWidths: {[key: string]: number} };\n-class MessageListHeader extends React.PureComponent<Props, State> {\n-\n- state = {\n- titleWidths: {},\n- };\n-\n- setTitleWidth(routeKey: string, width: number) {\n- this.setState({\n- titleWidths: {...this.state.titleWidths, [routeKey]: width },\n- });\n- }\n-\n- getScreenDetails = (scene: NavigationScene) => {\n- const actualResponse = this.props.getScreenDetails(scene);\n- const width = this.state.titleWidths[this.props.routeKey];\n- if (\n- scene.key === this.props.scene.key ||\n- width === undefined || width === null\n- ) {\n- return actualResponse;\n- }\n- const spaceLeft = (this.props.layout.initWidth - width) / 2;\n- if (spaceLeft > 100) {\n- return actualResponse;\n- }\n- return {\n- ...actualResponse,\n- options: {\n- ...actualResponse.options,\n- headerBackTitle: \"Back\",\n- },\n- };\n- }\n-\n- render() {\n- const { getScreenDetails, ...passProps } = this.props;\n- return (\n- <Header\n- getScreenDetails={this.getScreenDetails}\n- {...passProps}\n- />\n- );\n- }\n-\n-}\n-\n-export default MessageListHeader;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list.react.js",
"new_path": "native/chat/message-list.react.js",
"diff": "@@ -54,7 +54,6 @@ import TextHeightMeasurer from '../text-height-measurer.react';\nimport ChatInputBar from './chat-input-bar.react';\nimport ListLoadingIndicator from '../list-loading-indicator.react';\nimport MessageListHeaderTitle from './message-list-header-title.react';\n-import MessageListHeader from './message-list-header.react';\nimport { registerChatScreen } from './chat-screen-registry';\nimport ThreadSettingsButton from './thread-settings-button.react';\nimport { iosKeyboardOffset } from '../dimensions';\n@@ -88,16 +87,6 @@ type ChatMessageItemWithHeight =\n{| itemType: \"loader\" |} |\nChatMessageInfoItemWithHeight;\n-let messageListHeader = null;\n-function messageListHeaderRef(header: ?MessageListHeader) {\n- messageListHeader = header;\n-};\n-function onTitleWidthChange(key: string, width: number) {\n- if (messageListHeader) {\n- messageListHeader.setTitleWidth(key, width);\n- }\n-}\n-\ntype Props = {\nnavigation: NavProp,\n// Redux state\n@@ -147,8 +136,6 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n<MessageListHeaderTitle\nthreadInfo={navigation.state.params.threadInfo}\nnavigate={navigation.navigate}\n- sceneKey={navigation.state.key}\n- onWidthChange={onTitleWidthChange}\n/>\n),\nheaderRight:\n@@ -160,13 +147,6 @@ class InnerMessageList extends React.PureComponent<Props, State> {\n/>\n)\n: null,\n- header: (props: *) => (\n- <MessageListHeader\n- {...props}\n- routeKey={navigation.state.key}\n- ref={messageListHeaderRef}\n- />\n- ),\nheaderBackTitle: \"Back\",\n});\ntextHeights: ?Map<string, number> = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/delete-thread.react.js",
"new_path": "native/chat/settings/delete-thread.react.js",
"diff": "@@ -77,6 +77,7 @@ class InnerDeleteThread extends React.PureComponent<Props, State> {\n};\nstatic navigationOptions = {\nheaderTitle: \"Delete thread\",\n+ headerBackTitle: \"Back\",\n};\nmounted = false;\npasswordInput: ?TextInput;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Always use "Back" as headerBackTitle in Chat screens on native
This lets us get rid of the hacky `MessageListHeader`, which I suspect was causing some problems. |
129,187 | 23.03.2018 16:47:42 | 14,400 | dbc561c03f10a7276fa8bee1f29f1411fdeebcef | Trim message text on native | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -242,6 +242,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\n}\nonSend = () => {\n+ const text = this.state.text.trim();\nthis.updateText(\"\");\nconst localID = `local${getNewLocalID()}`;\nconst creatorID = this.props.viewerID;\n@@ -250,7 +251,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\ntype: messageType.TEXT,\nlocalID,\nthreadID: this.props.threadInfo.id,\n- text: this.state.text,\n+ text,\ncreatorID,\ntime: Date.now(),\n}: RawTextMessageInfo);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Trim message text on native |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.