[NEW] Report message (#818)
This commit is contained in:
parent
28628b4dba
commit
d969b04d3a
|
@ -16,6 +16,7 @@ import {
|
||||||
import { vibrate } from '../utils/vibration';
|
import { vibrate } from '../utils/vibration';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
|
import log from '../utils/log';
|
||||||
|
|
||||||
@connect(
|
@connect(
|
||||||
state => ({
|
state => ({
|
||||||
|
@ -117,6 +118,10 @@ export default class MessageActions extends React.Component {
|
||||||
this.REACTION_INDEX = this.options.length - 1;
|
this.REACTION_INDEX = this.options.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report
|
||||||
|
this.options.push(I18n.t('Report'));
|
||||||
|
this.REPORT_INDEX = this.options.length - 1;
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if (this.allowDelete(props)) {
|
if (this.allowDelete(props)) {
|
||||||
this.options.push(I18n.t('Delete'));
|
this.options.push(I18n.t('Delete'));
|
||||||
|
@ -297,6 +302,16 @@ export default class MessageActions extends React.Component {
|
||||||
toggleReactionPicker(actionMessage);
|
toggleReactionPicker(actionMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleReport = async() => {
|
||||||
|
const { actionMessage } = this.props;
|
||||||
|
try {
|
||||||
|
await RocketChat.reportMessage(actionMessage._id);
|
||||||
|
Alert.alert(I18n.t('Message_Reported'));
|
||||||
|
} catch (err) {
|
||||||
|
log('report message', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleActionPress = (actionIndex) => {
|
handleActionPress = (actionIndex) => {
|
||||||
if (actionIndex) {
|
if (actionIndex) {
|
||||||
switch (actionIndex) {
|
switch (actionIndex) {
|
||||||
|
@ -327,6 +342,9 @@ export default class MessageActions extends React.Component {
|
||||||
case this.REACTION_INDEX:
|
case this.REACTION_INDEX:
|
||||||
this.handleReaction();
|
this.handleReaction();
|
||||||
break;
|
break;
|
||||||
|
case this.REPORT_INDEX:
|
||||||
|
this.handleReport();
|
||||||
|
break;
|
||||||
case this.DELETE_INDEX:
|
case this.DELETE_INDEX:
|
||||||
this.handleDelete();
|
this.handleDelete();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -203,6 +203,7 @@ export default {
|
||||||
message: 'message',
|
message: 'message',
|
||||||
messages: 'messages',
|
messages: 'messages',
|
||||||
Messages: 'Messages',
|
Messages: 'Messages',
|
||||||
|
Message_Reported: 'Message reported',
|
||||||
Microphone_Permission_Message: 'Rocket Chat needs access to your microphone so you can send audio message.',
|
Microphone_Permission_Message: 'Rocket Chat needs access to your microphone so you can send audio message.',
|
||||||
Microphone_Permission: 'Microphone Permission',
|
Microphone_Permission: 'Microphone Permission',
|
||||||
Mute: 'Mute',
|
Mute: 'Mute',
|
||||||
|
@ -266,6 +267,7 @@ export default {
|
||||||
replies: 'replies',
|
replies: 'replies',
|
||||||
reply: 'reply',
|
reply: 'reply',
|
||||||
Reply: 'Reply',
|
Reply: 'Reply',
|
||||||
|
Report: 'Report',
|
||||||
Resend: 'Resend',
|
Resend: 'Resend',
|
||||||
Reset_password: 'Reset password',
|
Reset_password: 'Reset password',
|
||||||
resetting_password: 'resetting password',
|
resetting_password: 'resetting password',
|
||||||
|
|
|
@ -511,6 +511,9 @@ const RocketChat = {
|
||||||
// RC 0.59.0
|
// RC 0.59.0
|
||||||
return this.sdk.post('chat.pinMessage', { messageId: message._id });
|
return this.sdk.post('chat.pinMessage', { messageId: message._id });
|
||||||
},
|
},
|
||||||
|
reportMessage(messageId) {
|
||||||
|
return this.sdk.post('chat.reportMessage', { messageId, description: 'Message reported by user' });
|
||||||
|
},
|
||||||
getRoom(rid) {
|
getRoom(rid) {
|
||||||
const [result] = database.objects('subscriptions').filtered('rid = $0', rid);
|
const [result] = database.objects('subscriptions').filtered('rid = $0', rid);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|
Loading…
Reference in New Issue