mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-15 07:28:59 +00:00
Restrict message attachments shown in gallery & lightbox
This commit is contained in:
@@ -3498,12 +3498,12 @@ function getAdjacentMessagesByConversation(
|
||||
}
|
||||
${
|
||||
requireVisualMediaAttachments
|
||||
? sqlFragment`hasVisualMediaAttachments IS 1 AND`
|
||||
? sqlFragment`hasVisualMediaAttachments IS 1 AND isViewOnce IS 0 AND`
|
||||
: sqlFragment``
|
||||
}
|
||||
${
|
||||
requireFileAttachments
|
||||
? sqlFragment`hasFileAttachments IS 1 AND`
|
||||
? sqlFragment`hasFileAttachments IS 1 AND isViewOnce IS 0 AND`
|
||||
: sqlFragment``
|
||||
}
|
||||
isStory IS 0 AND
|
||||
|
||||
@@ -34,6 +34,7 @@ import type { MediaItemType } from '../../types/MediaItem';
|
||||
import type { StateType as RootStateType } from '../reducer';
|
||||
import type { MessageAttributesType } from '../../model-types';
|
||||
import { MessageModel } from '../../models/messages';
|
||||
import { isTapToView } from '../selectors/message';
|
||||
|
||||
const log = createLogger('mediaGallery');
|
||||
|
||||
@@ -150,6 +151,11 @@ function _cleanVisualAttachments(
|
||||
.flatMap(message => {
|
||||
let index = 0;
|
||||
|
||||
// Also checked via the DB query
|
||||
if (isTapToView(message.attributes)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return (message.get('attachments') || []).map(
|
||||
(attachment: AttachmentType): MediaType | undefined => {
|
||||
if (
|
||||
@@ -188,6 +194,9 @@ function _cleanFileAttachments(
|
||||
): ReadonlyArray<MediaItemType> {
|
||||
return rawDocuments
|
||||
.map(message => {
|
||||
if (isTapToView(message.attributes)) {
|
||||
return;
|
||||
}
|
||||
const attachments = message.get('attachments') || [];
|
||||
const attachment = attachments[0];
|
||||
if (!attachment) {
|
||||
|
||||
Reference in New Issue
Block a user