diff --git a/__tests__/__snapshots__/RoomItem.js.snap b/__tests__/__snapshots__/RoomItem.js.snap index 049fbc30..1ce3b141 100644 --- a/__tests__/__snapshots__/RoomItem.js.snap +++ b/__tests__/__snapshots__/RoomItem.js.snap @@ -2,1346 +2,37 @@ exports[`render channel 1`] = ` - - - - - G - - - - - - - general - - - Nov 10 - - - - - - - - - - - - - + View `; exports[`render no icon 1`] = ` - - - - - N - - - - - - - name - - - Nov 10 - - - - - - - - - - - - - + View `; exports[`render private group 1`] = ` - - - - - P - - - - - - - private-group - - - Nov 10 - - - - - - - - - - - - - + View `; exports[`render unread +999 1`] = ` - - - - - N - - - - - - - - - - name - - - Nov 10 - - - - - - - - - 999+ - - - - - - - - - + View `; exports[`render unread 1`] = ` - - - - - N - - - - - - - - - - name - - - Nov 10 - - - - - - - - - 1 - - - - - - - - - + View `; exports[`renders correctly 1`] = ` - - - - - N - - - - - - - - - - name - - - Nov 10 - - - - - - - - - - - - - + View `; diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index 2b24c6a5..a2aff47d 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -298,2711 +298,17 @@ exports[`Storyshots Avatar avatar 1`] = ` exports[`Storyshots Channel Cell Direct Messages 1`] = ` - - - - - R - - - - - - - - - - rocket.cat - - - Nov 10 - - - - - - - - - - - - - - - - - - R - - - - - - - - - - rocket.cat - - - Nov 10 - - - - - - - - - - - - - - - - - - R - - - - - - - - - - rocket.cat - - - Nov 10 - - - - - - - - - 1 - - - - - - - - - - - - - - L - - - - - - - - - - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries - - - Nov 10 - - - - - - - - - 9 - - - - - - - - - - - - - - L - - - - - - - - - - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries - - - Nov 10 - - - - - - - - - 99 - - - - - - - - - - - - - - L - - - - - - - - - - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries - - - Nov 10 - - - - - - - - - 100 - - - - - - - - - - - - - - L - - - - - - - - - - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries - - - Nov 10 - - - - - - - - - 999+ - - - - - - - - - - - - - - L - - - - - - - - - - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries - - - Nov 10 - - - - - - - - - @ 999+ - - - - - - - - - - - - - - W - - - - - - - - - - W - - - Nov 10 - - - - - - - - - - - - - - - - - - W - - - - - - - - - - WW - - - Nov 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Nov 10 - - - - - - - - - - - - - + View + View + View + View + View + View + View + View + View + View + View `; diff --git a/app/containers/message/Message.js b/app/containers/message/Message.js index c911e07f..e83f92ac 100644 --- a/app/containers/message/Message.js +++ b/app/containers/message/Message.js @@ -41,9 +41,9 @@ const SYSTEM_MESSAGES = [ ]; const getInfoMessage = ({ - type, role, msg, user + type, role, msg, author }) => { - const { username } = user; + const { username } = author; if (type === 'rm') { return I18n.t('Message_removed'); } else if (type === 'uj') { diff --git a/app/containers/message/index.js b/app/containers/message/index.js index dd9df8e2..1fc6ffa4 100644 --- a/app/containers/message/index.js +++ b/app/containers/message/index.js @@ -14,10 +14,9 @@ import { @connect(state => ({ baseUrl: state.settings.Site_Url || state.server ? state.server.server : '', customEmojis: state.customEmojis, - editing: state.messages.editing, Message_GroupingPeriod: state.settings.Message_GroupingPeriod, Message_TimeFormat: state.settings.Message_TimeFormat, - message: state.messages.message, + editingMessage: state.messages.message, useRealName: state.settings.UI_Use_Real_Name }), dispatch => ({ errorActionsShow: actionMessage => dispatch(errorActionsShowAction(actionMessage)), @@ -43,10 +42,9 @@ export default class MessageContainer extends React.Component { // redux baseUrl: PropTypes.string, customEmojis: PropTypes.object, - editing: PropTypes.bool, Message_GroupingPeriod: PropTypes.number, Message_TimeFormat: PropTypes.string, - message: PropTypes.object, + editingMessage: PropTypes.object, useRealName: PropTypes.bool, // methods - props onLongPress: PropTypes.func, @@ -73,7 +71,7 @@ export default class MessageContainer extends React.Component { shouldComponentUpdate(nextProps, nextState) { const { reactionsModal } = this.state; const { - status, reactions, broadcast, editing, _updatedAt + status, reactions, broadcast, _updatedAt, editingMessage, item } = this.props; if (reactionsModal !== nextState.reactionsModal) { @@ -92,8 +90,12 @@ export default class MessageContainer extends React.Component { if (broadcast !== nextProps.broadcast) { return true; } - if (editing !== nextProps.editing) { - return true; + if (!equal(editingMessage, nextProps.editingMessage)) { + if (nextProps.editingMessage && nextProps.editingMessage._id === item._id) { + return true; + } else if (!nextProps.editingMessage._id !== item._id && editingMessage._id === item._id) { + return true; + } } return _updatedAt.toGMTString() !== nextProps._updatedAt.toGMTString(); } @@ -163,12 +165,12 @@ export default class MessageContainer extends React.Component { render() { const { reactionsModal } = this.state; const { - item, message, editing, user, style, archived, baseUrl, customEmojis, useRealName, broadcast + item, editingMessage, user, style, archived, baseUrl, customEmojis, useRealName, broadcast } = this.props; const { msg, ts, attachments, urls, reactions, t, status, avatar, u, alias, editedBy, role } = item; - const isEditing = message._id === item._id && editing; + const isEditing = editingMessage._id === item._id; return ( { function sendMessageByRest(message) { const { token, id } = this.ddp._login; - const server = this.ddp.url.replace('ws', 'http'); + const server = this.ddp.url.replace(/^ws/, 'http'); const { _id, rid, msg } = message; return post({ token, id, server }, 'chat.sendMessage', { message: { _id, rid, msg } }); } diff --git a/app/presentation/RoomItem.js b/app/presentation/RoomItem.js index 69715cc6..b525adb3 100644 --- a/app/presentation/RoomItem.js +++ b/app/presentation/RoomItem.js @@ -6,6 +6,7 @@ import { } from 'react-native'; import { connect } from 'react-redux'; import { emojify } from 'react-emojione'; +import { RectButton } from 'react-native-gesture-handler'; import Avatar from '../containers/Avatar'; import Status from '../containers/status'; @@ -142,7 +143,6 @@ export default class RoomItem extends React.Component { userMentions: PropTypes.number, id: PropTypes.string, onPress: PropTypes.func, - onLongPress: PropTypes.func, username: PropTypes.string, avatarSize: PropTypes.number, testID: PropTypes.string, @@ -229,7 +229,7 @@ export default class RoomItem extends React.Component { render() { const { - favorite, unread, userMentions, name, _updatedAt, alert, testID, height, onPress, onLongPress + favorite, unread, userMentions, name, _updatedAt, alert, testID, height, onPress } = this.props; const date = this.formatDate(_updatedAt); @@ -250,16 +250,16 @@ export default class RoomItem extends React.Component { } return ( - - + {this.avatar} @@ -276,7 +276,7 @@ export default class RoomItem extends React.Component { {this.renderDisclosureIndicator()} - + ); } } diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index b8ba9bd1..e7febc59 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -7,6 +7,7 @@ import Icon from 'react-native-vector-icons/Ionicons'; import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; import { connect, Provider } from 'react-redux'; import { Navigation } from 'react-native-navigation'; +import { gestureHandlerRootHOC } from 'react-native-gesture-handler'; import { leaveRoom as leaveRoomAction } from '../../actions/room'; import LoggedView from '../View'; @@ -74,7 +75,7 @@ export default class RoomActionsView extends LoggedView { if (item.route) { if (modules[item.route] == null) { modules[item.route] = item.require(); - Navigation.registerComponent(item.route, () => modules[item.route], store, Provider); + Navigation.registerComponent(item.route, () => gestureHandlerRootHOC(modules[item.route]), store, Provider); } navigator.push({ screen: item.route,