kopia lustrzana https://github.com/ryukoposting/Signal-Android
Do not show stories for inactive groups.
rodzic
88a8430c31
commit
54251a27a8
|
@ -185,6 +185,10 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||||
throw new MmsException("No GV1 messages can be sent anymore!");
|
throw new MmsException("No GV1 messages can be sent anymore!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((message.getStoryType().isStory() || message.getParentStoryId() != null) && !groupRecipient.isActiveGroup()) {
|
||||||
|
throw new MmsException("Not a member of the group!");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments()));
|
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments()));
|
||||||
|
|
||||||
|
|
|
@ -1462,7 +1462,17 @@ public final class MessageContentProcessor {
|
||||||
private void handleStoryMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceStoryMessage message, @NonNull Recipient senderRecipient, @NonNull Recipient threadRecipient) throws StorageFailedException {
|
private void handleStoryMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceStoryMessage message, @NonNull Recipient senderRecipient, @NonNull Recipient threadRecipient) throws StorageFailedException {
|
||||||
log(content.getTimestamp(), "Story message.");
|
log(content.getTimestamp(), "Story message.");
|
||||||
|
|
||||||
if (!threadRecipient.isActiveGroup() && !(senderRecipient.isProfileSharing() || senderRecipient.isSystemContact())) {
|
if (threadRecipient.isInactiveGroup()) {
|
||||||
|
warn(content.getTimestamp(), "Dropping a group story from a group we're no longer in.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (threadRecipient.isGroup() && !SignalDatabase.groups().isCurrentMember(threadRecipient.requireGroupId().requirePush(), senderRecipient.getId())) {
|
||||||
|
warn(content.getTimestamp(), "Dropping a group story from a user who's no longer a member.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!threadRecipient.isGroup() && !(senderRecipient.isProfileSharing() || senderRecipient.isSystemContact())) {
|
||||||
warn(content.getTimestamp(), "Dropping story from an untrusted source.");
|
warn(content.getTimestamp(), "Dropping story from an untrusted source.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -877,6 +877,10 @@ public class Recipient {
|
||||||
return Stream.of(getParticipantIds()).anyMatch(p -> p.equals(selfId));
|
return Stream.of(getParticipantIds()).anyMatch(p -> p.equals(selfId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInactiveGroup() {
|
||||||
|
return isGroup() && !isActiveGroup();
|
||||||
|
}
|
||||||
|
|
||||||
public @NonNull List<RecipientId> getParticipantIds() {
|
public @NonNull List<RecipientId> getParticipantIds() {
|
||||||
return new ArrayList<>(participantIds);
|
return new ArrayList<>(participantIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,12 @@ class StoriesLandingRepository(context: Context) {
|
||||||
|
|
||||||
stories.forEach {
|
stories.forEach {
|
||||||
val recipient = Recipient.resolved(it.recipientId)
|
val recipient = Recipient.resolved(it.recipientId)
|
||||||
if (recipient.isDistributionList || it.isOutgoing) {
|
if (recipient.isDistributionList || (it.isOutgoing && !recipient.isInactiveGroup())) {
|
||||||
val list = mapping[myStories] ?: emptyList()
|
val list = mapping[myStories] ?: emptyList()
|
||||||
mapping[myStories] = list + it
|
mapping[myStories] = list + it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipient.isDistributionList && !recipient.isBlocked) {
|
if (!recipient.isDistributionList && !recipient.isBlocked && !recipient.isInactiveGroup()) {
|
||||||
val list = mapping[recipient] ?: emptyList()
|
val list = mapping[recipient] ?: emptyList()
|
||||||
mapping[recipient] = list + it
|
mapping[recipient] = list + it
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue