Skip to content

Commit

Permalink
fix reportMessage emtfunction and moderation bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnouv committed Mar 24, 2023
1 parent 826fce1 commit a4dd2c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions apps/meteor/app/apps/server/bridges/moderation.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Meteor } from 'meteor/meteor';
import { ModerationBridge } from '@rocket.chat/apps-engine/server/bridges/ModerationBridge';
import type { IMessage } from '@rocket.chat/core-typings';

import type { AppServerOrchestrator } from '../orchestrator';
import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { reportMessage } from '../../../../server/lib/moderation/reportMessage';

export class AppModerationBridge extends ModerationBridge {
constructor(private readonly orch: AppServerOrchestrator) {
super();
}

protected async report(messageId: IMessage['_id'], description: string, appId: string): Promise<void> {
protected async report(messageId: IMessage['_id'], description: string, userId: string, appId: string): Promise<void> {
this.orch.debugLog(`The App ${appId} is creating a new report.`);

if (!messageId) {
Expand All @@ -20,6 +20,8 @@ export class AppModerationBridge extends ModerationBridge {
throw new Error('Invalid description');
}

Meteor.call('reportMessage', { messageId, description });
await reportMessage(messageId, description, userId || 'rocket.cat');

// Meteor.call('reportMessage', { messageId, description });
}
}
2 changes: 1 addition & 1 deletion apps/meteor/server/lib/moderation/reportMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { IMessage, IUser } from '@rocket.chat/core-typings';

import { Messages } from '../../../app/models/server';
import { canAccessRoomAsync } from '../../../app/authorization/server/functions/canAccessRoom';
import { AppEvents, Apps } from '../../../app/apps/server';
import { AppEvents, Apps } from '../../../ee/server/apps';

export const reportMessage = async (messageId: IMessage['_id'], description: string, uid: IUser['_id']) => {
if (!uid) {
Expand Down

0 comments on commit a4dd2c3

Please sign in to comment.