Skip to content

Commit

Permalink
refactor!: removed reportMessage method
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Kumar <[email protected]>
  • Loading branch information
abhinavkrin committed Jun 19, 2024
1 parent bc4fad7 commit df2e554
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IMessage } from '@rocket.chat/core-typings';
import { css } from '@rocket.chat/css-in-js';
import { TextAreaInput, FieldGroup, Field, FieldRow, FieldError, Box } from '@rocket.chat/fuselage';
import { useToastMessageDispatch, useTranslation, useMethod } from '@rocket.chat/ui-contexts';
import { useToastMessageDispatch, useTranslation, useEndpoint } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React from 'react';
import { useForm } from 'react-hook-form';
Expand Down Expand Up @@ -31,13 +31,13 @@ const ReportMessageModal = ({ message, onClose }: ReportMessageModalProps): Reac
handleSubmit,
} = useForm<ReportMessageModalsFields>();
const dispatchToastMessage = useToastMessageDispatch();
const reportMessage = useMethod('reportMessage');
const reportMessage = useEndpoint('POST', '/v1/chat.reportMessage');

const { _id } = message;

const handleReportMessage = async ({ description }: ReportMessageModalsFields): Promise<void> => {
try {
await reportMessage(_id, description);
await reportMessage({ messageId: _id, description });
dispatchToastMessage({ type: 'success', message: t('Report_has_been_sent') });
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/server/methods/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import './removeRoomLeader';
import './removeRoomModerator';
import './removeRoomOwner';
import './removeUserFromRoom';
import './reportMessage';
import './requestDataDownload';
import './resetAvatar';
import './roomNameExists';
Expand Down
84 changes: 0 additions & 84 deletions apps/meteor/server/methods/reportMessage.ts

This file was deleted.

0 comments on commit df2e554

Please sign in to comment.