Skip to content

Commit

Permalink
Merge pull request #36312 from Tony-MK/fix/35578
Browse files Browse the repository at this point in the history
fix/35578 | Action menu for MP4 files has "Copy to clipboard" and "Edit comment" functions
  • Loading branch information
srikarparsi authored Feb 26, 2024
2 parents dbcdbce + 4acae04 commit 56c0218
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ function getAllReportActions(reportID: string): ReportActions {
function isReportActionAttachment(reportAction: OnyxEntry<ReportAction>): boolean {
const message = reportAction?.message?.[0];

if (reportAction && 'isAttachment' in reportAction) {
return reportAction.isAttachment ?? false;
if (reportAction && ('isAttachment' in reportAction || 'attachmentInfo' in reportAction)) {
return reportAction?.isAttachment ?? !!reportAction?.attachmentInfo ?? false;
}

if (message) {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ function canEditReportAction(reportAction: OnyxEntry<ReportAction>): boolean {
reportAction?.actorAccountID === currentUserAccountID &&
isCommentOrIOU &&
canEditMoneyRequest(reportAction) && // Returns true for non-IOU actions
!isReportMessageAttachment(reportAction?.message?.[0] ?? {type: '', text: ''}) &&
!ReportActionsUtils.isReportActionAttachment(reportAction) &&
!ReportActionsUtils.isDeletedAction(reportAction) &&
!ReportActionsUtils.isCreatedTaskReportAction(reportAction) &&
reportAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
Expand Down
3 changes: 2 additions & 1 deletion src/libs/isReportMessageAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Str from 'expensify-common/lib/str';
import CONST from '@src/CONST';
import type {Message} from '@src/types/onyx/ReportAction';

Expand All @@ -17,5 +18,5 @@ export default function isReportMessageAttachment({text, html, translationKey}:
}

const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i');
return text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML);
return (text === CONST.ATTACHMENT_MESSAGE_TEXT || !!Str.isVideo(text)) && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML);
}

0 comments on commit 56c0218

Please sign in to comment.