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