mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Check if there is an attachment available before trying to send it to a story.
This commit is contained in:
committed by
Greyson Parrelli
parent
f6f4e6fde7
commit
a7a4972013
@@ -177,8 +177,10 @@ public final class PushDistributionListSendJob extends PushSendJob {
|
||||
final SignalServiceStoryMessage storyMessage;
|
||||
if (message.getStoryType().isTextStory()) {
|
||||
storyMessage = SignalServiceStoryMessage.forTextAttachment(Recipient.self().getProfileKey(), null, StorySendUtil.deserializeBodyToStoryTextAttachment(message, this::getPreviewsFor), message.getStoryType().isStoryWithReplies());
|
||||
} else {
|
||||
} else if (!attachmentPointers.isEmpty()) {
|
||||
storyMessage = SignalServiceStoryMessage.forFileAttachment(Recipient.self().getProfileKey(), null, attachmentPointers.get(0), message.getStoryType().isStoryWithReplies());
|
||||
} else {
|
||||
throw new UndeliverableMessageException("No attachment on non-text story.");
|
||||
}
|
||||
return GroupSendUtil.sendStoryMessage(context, message.getRecipient().requireDistributionListId(), destinations, isRecipientUpdate, new MessageId(messageId, true), message.getSentTimeMillis(), storyMessage);
|
||||
} catch (ServerRejectedException e) {
|
||||
|
||||
@@ -253,8 +253,10 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||
final SignalServiceStoryMessage storyMessage;
|
||||
if (message.getStoryType().isTextStory()) {
|
||||
storyMessage = SignalServiceStoryMessage.forTextAttachment(Recipient.self().getProfileKey(), groupContext, StorySendUtil.deserializeBodyToStoryTextAttachment(message, this::getPreviewsFor), message.getStoryType().isStoryWithReplies());
|
||||
} else {
|
||||
} else if (!attachmentPointers.isEmpty()) {
|
||||
storyMessage = SignalServiceStoryMessage.forFileAttachment(Recipient.self().getProfileKey(), groupContext, attachmentPointers.get(0), message.getStoryType().isStoryWithReplies());
|
||||
} else {
|
||||
throw new UndeliverableMessageException("No attachment on non-text story.");
|
||||
}
|
||||
|
||||
return GroupSendUtil.sendGroupStoryMessage(context, groupId.requireV2(), destinations, isRecipientUpdate, new MessageId(messageId, true), message.getSentTimeMillis(), storyMessage);
|
||||
|
||||
Reference in New Issue
Block a user