Check stories capability when sending replies

This commit is contained in:
Fedor Indutny 2022-10-25 17:03:51 -07:00 committed by GitHub
parent 3beccbfd31
commit d6afae64d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -3661,13 +3661,16 @@ export class ConversationModel extends window.Backbone
getRecipients({ getRecipients({
includePendingMembers, includePendingMembers,
extraConversationsForSend, extraConversationsForSend,
isStoryReply = false,
}: { }: {
includePendingMembers?: boolean; includePendingMembers?: boolean;
extraConversationsForSend?: Array<string>; extraConversationsForSend?: Array<string>;
isStoryReply?: boolean;
} = {}): Array<string> { } = {}): Array<string> {
return getRecipients(this.attributes, { return getRecipients(this.attributes, {
includePendingMembers, includePendingMembers,
extraConversationsForSend, extraConversationsForSend,
isStoryReply,
}); });
} }
@ -3939,8 +3942,11 @@ export class ConversationModel extends window.Backbone
const expireTimer = this.get('expireTimer'); const expireTimer = this.get('expireTimer');
const recipientMaybeConversations = map(this.getRecipients(), identifier => const recipientMaybeConversations = map(
window.ConversationController.get(identifier) this.getRecipients({
isStoryReply: storyId !== undefined,
}),
identifier => window.ConversationController.get(identifier)
); );
const recipientConversations = filter( const recipientConversations = filter(
recipientMaybeConversations, recipientMaybeConversations,

View file

@ -15,9 +15,11 @@ export function getRecipients(
{ {
includePendingMembers, includePendingMembers,
extraConversationsForSend, extraConversationsForSend,
isStoryReply = false,
}: { }: {
includePendingMembers?: boolean; includePendingMembers?: boolean;
extraConversationsForSend?: Array<string>; extraConversationsForSend?: Array<string>;
isStoryReply?: boolean;
} = {} } = {}
): Array<string> { ): Array<string> {
if (isDirectConversation(conversationAttributes)) { if (isDirectConversation(conversationAttributes)) {
@ -25,10 +27,14 @@ export function getRecipients(
return [getSendTarget(conversationAttributes)!]; return [getSendTarget(conversationAttributes)!];
} }
const members = getConversationMembers(conversationAttributes, { let members = getConversationMembers(conversationAttributes, {
includePendingMembers, includePendingMembers,
}); });
if (isStoryReply) {
members = members.filter(({ capabilities }) => capabilities?.stories);
}
// There are cases where we need to send to someone we just removed from the group, to // There are cases where we need to send to someone we just removed from the group, to
// let them know that we removed them. In that case, we need to send to more than // let them know that we removed them. In that case, we need to send to more than
// are currently in the group. // are currently in the group.