File tree Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,8 @@ + (ThreadDynamicInteractions *)ensureDynamicInteractionsForThread:(TSThread *)th
340340 shouldHaveAddToContactsOffer = NO ;
341341 // Only create block offers for users which are not already blocked.
342342 shouldHaveBlockOffer = NO ;
343+ // Don't create profile whitelist offers for users which are not already blocked.
344+ shouldHaveAddToProfileWhitelistOffer = NO ;
343345 }
344346
345347 SignalAccount *signalAccount = contactsManager.signalAccountMap [recipientId];
@@ -374,6 +376,19 @@ + (ThreadDynamicInteractions *)ensureDynamicInteractionsForThread:(TSThread *)th
374376 // Don't show offer if thread is local user hasn't configured their profile.
375377 // Don't show offer if thread is already in profile whitelist.
376378 shouldHaveAddToProfileWhitelistOffer = NO ;
379+ } else if (thread.isGroupThread ) {
380+ BOOL hasUnwhitelistedMember = NO ;
381+ for (NSString *recipientId in thread.recipientIdentifiers ) {
382+ if (![OWSProfileManager.sharedManager isUserInProfileWhitelist: recipientId]) {
383+ hasUnwhitelistedMember = YES ;
384+ break ;
385+ }
386+ }
387+ if (!hasUnwhitelistedMember) {
388+ // Don't show offer in group thread if all members are already individually
389+ // whitelisted.
390+ hasUnwhitelistedMember = YES ;
391+ }
377392 }
378393
379394 // We use these offset to control the ordering of the offers and indicators.
Original file line number Diff line number Diff line change @@ -702,6 +702,9 @@ - (void)handleIncomingEnvelope:(OWSSignalServiceProtosEnvelope *)messageEnvelope
702702 // user, we can infer that that user belongs in our profile whitelist.
703703 id <ProfileManagerProtocol> profileManager = [TextSecureKitEnv sharedEnv ].profileManager ;
704704 [profileManager addUserToProfileWhitelist: destination];
705+
706+ // TODO: Can we also infer when groups are added to the whitelist
707+ // from sent messages to groups?
705708 }
706709
707710 if ([self isDataMessageGroupAvatarUpdate: syncMessage.sent.message]) {
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
3+ //
4+
5+ #import " TSRequest.h"
6+
7+ NS_ASSUME_NONNULL_BEGIN
8+
9+ @interface TSProfileAvatarUploadFormRequest : TSRequest
10+
11+ - (nullable instancetype )init ;
12+
13+ - (instancetype )init NS_UNAVAILABLE;
14+
15+ @end
16+
17+ NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change 1+ //
2+ // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
3+ //
4+
5+ #import " TSProfileAvatarUploadFormRequest.h"
6+ #import " TSConstants.h"
7+
8+ NS_ASSUME_NONNULL_BEGIN
9+
10+ @implementation TSProfileAvatarUploadFormRequest
11+
12+ - (nullable instancetype )init
13+ {
14+ self = [super initWithURL: [NSURL URLWithString: textSecureProfileAvatarFormAPI]];
15+
16+ self.HTTPMethod = @" GET" ;
17+
18+ return self;
19+ }
20+
21+ @end
22+
23+ NS_ASSUME_NONNULL_END
You can’t perform that action at this time.
0 commit comments