small fix
This commit is contained in:
parent
69e04a4c26
commit
77d7f51f30
|
@ -18,6 +18,7 @@ import {
|
|||
} from '../actions/messages';
|
||||
import { showToast } from '../utils/info';
|
||||
|
||||
const returnAnArray = obj => obj || [];
|
||||
@connect(
|
||||
state => ({
|
||||
showActions: state.messages.showActions,
|
||||
|
@ -171,11 +172,11 @@ export default class MessageActions extends React.Component {
|
|||
}
|
||||
|
||||
setPermissions(permissions) {
|
||||
this.hasEditPermission = permissions['edit-message']
|
||||
this.hasEditPermission = returnAnArray(permissions['edit-message'])
|
||||
.some(item => this.mergedRoles.indexOf(item) !== -1);
|
||||
this.hasDeletePermission = permissions['delete-message']
|
||||
this.hasDeletePermission = returnAnArray(permissions['delete-message'])
|
||||
.some(item => this.mergedRoles.indexOf(item) !== -1);
|
||||
this.hasForceDeletePermission = permissions['force-delete-message']
|
||||
this.hasForceDeletePermission = returnAnArray(permissions['force-delete-message'])
|
||||
.some(item => this.mergedRoles.indexOf(item) !== -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ export default class Status extends React.Component {
|
|||
|
||||
get status() {
|
||||
const userId = this.props.id;
|
||||
return this.props.activeUsers && this.props.activeUsers[userId] || 'offline';
|
||||
return (this.props.activeUsers && this.props.activeUsers[userId]) || 'offline';
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -160,7 +160,8 @@ export default class RoomItem extends React.PureComponent {
|
|||
userMentions: PropTypes.number,
|
||||
id: PropTypes.string,
|
||||
onPress: PropTypes.func,
|
||||
customEmojis: PropTypes.object
|
||||
customEmojis: PropTypes.object,
|
||||
user: PropTypes.object
|
||||
}
|
||||
|
||||
get icon() {
|
||||
|
@ -193,10 +194,13 @@ export default class RoomItem extends React.PureComponent {
|
|||
|
||||
const msg = `${ prefix }${ lastMessage.msg.replace(/[\n\t\r]/igm, '') }`;
|
||||
|
||||
const maxChars = 35;
|
||||
|
||||
|
||||
if (alert) {
|
||||
return `**${ msg.slice(0, 30) }${ msg.replace(/:[a-z0-9]+:/gi, ':::').length > 30 ? '...' : '' }**`;
|
||||
return `**${ msg.slice(0, maxChars) }${ msg.replace(/:[a-z0-9]+:/gi, ':::').length > maxChars ? '...' : '' }**`;
|
||||
}
|
||||
return msg;
|
||||
return `${ msg.slice(0, maxChars) }${ msg.replace(/:[a-z0-9]+:/gi, ':::').length > maxChars ? '...' : '' }`;
|
||||
}
|
||||
|
||||
formatDate = date => moment(date).calendar(null, {
|
||||
|
|
Loading…
Reference in New Issue