mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Prevent editing or forwarding polls
This commit is contained in:
@@ -76,3 +76,9 @@ export const shouldTryToCopyFromQuotedMessage = ({
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export function isPoll(
|
||||
message: Pick<ReadonlyMessageAttributesType, 'poll'>
|
||||
): boolean {
|
||||
return Boolean(message.poll);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,12 @@ import { getConversationColorAttributes } from '../../util/getConversationColorA
|
||||
import { DAY, DurationInSeconds } from '../../util/durations/index.std.js';
|
||||
import { getStoryReplyText } from '../../util/getStoryReplyText.std.js';
|
||||
import type { MessageAttributesWithPaymentEvent } from '../../messages/payments.std.js';
|
||||
import { isIncoming, isOutgoing, isStory } from '../../messages/helpers.std.js';
|
||||
import {
|
||||
isIncoming,
|
||||
isOutgoing,
|
||||
isPoll,
|
||||
isStory,
|
||||
} from '../../messages/helpers.std.js';
|
||||
import { messageHasPaymentEvent } from '../../messages/payments.std.js';
|
||||
|
||||
import { calculateExpirationTimestamp } from '../../util/expirationTimer.std.js';
|
||||
@@ -2245,7 +2250,8 @@ export function canForward(message: ReadonlyMessageAttributesType): boolean {
|
||||
!isTapToView(message) &&
|
||||
!message.deletedForEveryone &&
|
||||
!message.giftBadge &&
|
||||
!getPayment(message)
|
||||
!getPayment(message) &&
|
||||
!isPoll(message)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { ReadonlyMessageAttributesType } from '../model-types.d.ts';
|
||||
import { DAY } from './durations/index.std.js';
|
||||
import { isMoreRecentThan } from './timestamp.std.js';
|
||||
import { isOutgoing } from '../messages/helpers.std.js';
|
||||
import { isOutgoing, isPoll } from '../messages/helpers.std.js';
|
||||
import { isMessageNoteToSelf } from './isMessageNoteToSelf.dom.js';
|
||||
|
||||
export const MESSAGE_MAX_EDIT_COUNT = 10;
|
||||
@@ -16,6 +16,7 @@ export function canEditMessage(
|
||||
!message.sms &&
|
||||
!message.deletedForEveryone &&
|
||||
isOutgoing(message) &&
|
||||
!isPoll(message) &&
|
||||
(isMoreRecentThan(message.sent_at, DAY) || isMessageNoteToSelf(message)) &&
|
||||
Boolean(message.body)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user