kopia lustrzana https://github.com/ryukoposting/Signal-Android
Do not show stories for inactive groups.
rodzic
88a8430c31
commit
54251a27a8
|
@ -162,8 +162,8 @@ public final class PushGroupSendJob extends PushSendJob {
|
|||
{
|
||||
SignalLocalMetrics.GroupMessageSend.onJobStarted(messageId);
|
||||
|
||||
MessageTable database = SignalDatabase.mms();
|
||||
OutgoingMediaMessage message = database.getOutgoingMessage(messageId);
|
||||
MessageTable database = SignalDatabase.mms();
|
||||
OutgoingMediaMessage message = database.getOutgoingMessage(messageId);
|
||||
long threadId = database.getMessageRecord(messageId).getThreadId();
|
||||
Set<NetworkFailure> existingNetworkFailures = message.getNetworkFailures();
|
||||
Set<IdentityKeyMismatch> existingIdentityMismatches = message.getIdentityKeyMismatches();
|
||||
|
@ -185,6 +185,10 @@ public final class PushGroupSendJob extends PushSendJob {
|
|||
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 {
|
||||
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 {
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -877,6 +877,10 @@ public class Recipient {
|
|||
return Stream.of(getParticipantIds()).anyMatch(p -> p.equals(selfId));
|
||||
}
|
||||
|
||||
public boolean isInactiveGroup() {
|
||||
return isGroup() && !isActiveGroup();
|
||||
}
|
||||
|
||||
public @NonNull List<RecipientId> getParticipantIds() {
|
||||
return new ArrayList<>(participantIds);
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ class StoriesLandingRepository(context: Context) {
|
|||
|
||||
stories.forEach {
|
||||
val recipient = Recipient.resolved(it.recipientId)
|
||||
if (recipient.isDistributionList || it.isOutgoing) {
|
||||
if (recipient.isDistributionList || (it.isOutgoing && !recipient.isInactiveGroup())) {
|
||||
val list = mapping[myStories] ?: emptyList()
|
||||
mapping[myStories] = list + it
|
||||
}
|
||||
|
||||
if (!recipient.isDistributionList && !recipient.isBlocked) {
|
||||
if (!recipient.isDistributionList && !recipient.isBlocked && !recipient.isInactiveGroup()) {
|
||||
val list = mapping[recipient] ?: emptyList()
|
||||
mapping[recipient] = list + it
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue