Do not allow attachments if there are link previews
This commit is contained in:
@@ -405,7 +405,7 @@ export const CompositionArea = ({
|
|||||||
/>
|
/>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
const attButton = (
|
const attButton = linkPreviewResult ? undefined : (
|
||||||
<div className="CompositionArea__button-cell">
|
<div className="CompositionArea__button-cell">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@@ -3895,6 +3895,18 @@ export class ConversationModel extends window.Backbone
|
|||||||
[window.ConversationController.getOurConversationIdOrThrow()]
|
[window.ConversationController.getOurConversationIdOrThrow()]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// If there are link previews present in the message we shouldn't include
|
||||||
|
// any attachments as well.
|
||||||
|
const attachmentsToSend = preview && preview.length ? [] : attachments;
|
||||||
|
|
||||||
|
if (preview && preview.length) {
|
||||||
|
attachments.forEach(attachment => {
|
||||||
|
if (attachment.path) {
|
||||||
|
deleteAttachmentData(attachment.path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Here we move attachments to disk
|
// Here we move attachments to disk
|
||||||
const messageWithSchema = await upgradeMessageSchema({
|
const messageWithSchema = await upgradeMessageSchema({
|
||||||
timestamp: now,
|
timestamp: now,
|
||||||
@@ -3903,7 +3915,7 @@ export class ConversationModel extends window.Backbone
|
|||||||
conversationId: this.id,
|
conversationId: this.id,
|
||||||
quote,
|
quote,
|
||||||
preview,
|
preview,
|
||||||
attachments,
|
attachments: attachmentsToSend,
|
||||||
sent_at: now,
|
sent_at: now,
|
||||||
received_at: window.Signal.Util.incrementMessageCounter(),
|
received_at: window.Signal.Util.incrementMessageCounter(),
|
||||||
received_at_ms: now,
|
received_at_ms: now,
|
||||||
|
Reference in New Issue
Block a user