Skip to content

Commit eb2ae3e

Browse files
Allow users to send messages to contacts marked as pending approval
1 parent 8734189 commit eb2ae3e

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

ChatSecure/Classes/Model/Yap Storage/OTRXMPPBuddy.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "OTRXMPPBuddy.h"
1010
#import "OTRBuddyCache.h"
1111
@import XMPPFramework;
12+
@import OTRAssets;
1213

1314
@implementation OTRXMPPBuddy
1415
@synthesize vCardTemp = _vCardTemp;
@@ -59,6 +60,15 @@ - (BOOL) waitingForvCardTempFetch {
5960
return [[OTRBuddyCache sharedInstance] waitingForvCardTempFetchForBuddy:self];
6061
}
6162

63+
- (NSString *)threadName
64+
{
65+
NSString *threadName = [super threadName];
66+
if (self.pendingApproval) {
67+
threadName = [NSString stringWithFormat:@"%@ - %@", threadName, PENDING_APPROVAL_STRING()];
68+
}
69+
return threadName;
70+
}
71+
6272
#pragma - mark Class Methods
6373

6474
+ (NSString *)collection

ChatSecure/Classes/View Controllers/OTRConversationViewController.m

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
343343
}];
344344
cell = approvalCell;
345345
cell.selectionStyle = UITableViewCellSelectionStyleNone;
346-
347-
} else if ([thread isKindOfClass:[OTRXMPPBuddy class]] &&
348-
((OTRXMPPBuddy*)thread).pendingApproval) {
349-
cell = [tableView dequeueReusableCellWithIdentifier:[OTRBuddyInfoCell reuseIdentifier] forIndexPath:indexPath];
350-
cell.selectionStyle = UITableViewCellSelectionStyleNone;
351346
} else {
352347
cell = [tableView dequeueReusableCellWithIdentifier:[OTRConversationCell reuseIdentifier] forIndexPath:indexPath];
353348
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
@@ -380,10 +375,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
380375
{
381376
id <OTRThreadOwner> thread = [self threadForIndexPath:indexPath];
382377

383-
// Bail out if it's a subscription request or pending approval
378+
// Bail out if it's a subscription request
384379
if ([thread isKindOfClass:[OTRXMPPBuddy class]] &&
385-
(((OTRXMPPBuddy*)thread).hasIncomingSubscriptionRequest ||
386-
((OTRXMPPBuddy*)thread).pendingApproval)) {
380+
((OTRXMPPBuddy*)thread).hasIncomingSubscriptionRequest) {
387381
return;
388382
}
389383

ChatSecure/Classes/Views/Cells/OTRBuddyInfoCell.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ - (void)setThread:(id<OTRThreadOwner>)thread
7373

7474
self.nameLabel.text = name;
7575
self.identifierLabel.text = nil;
76-
77-
if ([thread isKindOfClass:[OTRXMPPBuddy class]]) {
78-
if(((OTRXMPPBuddy *)thread).pendingApproval) {
79-
NSString *pendingString = [NSString stringWithFormat:@" - %@",PENDING_APPROVAL_STRING()];
80-
self.nameLabel.text = [self.nameLabel.text stringByAppendingString:pendingString];
81-
}
82-
}
8376
}
8477

8578
- (void)updateConstraints

ChatSecure/Classes/Views/Cells/UserInfoProfileCell.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ public class UserInfoProfileCell: XLFormBaseCell {
1616
@IBOutlet weak var displayNameLabel: UILabel!
1717
@IBOutlet weak var avatarImageView: UIImageView!
1818

19-
public override func awakeFromNib() {
20-
super.awakeFromNib()
21-
22-
23-
24-
}
25-
2619
public override func update() {
2720
super.update()
2821
guard let userInfo = rowDescriptor.value as? OTRUserInfoProfile else {
2922
return
3023
}
24+
var displayName = userInfo.displayName
25+
if let userInfo = userInfo as? OTRThreadOwner {
26+
displayName = userInfo.threadName()
27+
}
3128
usernameLabel.text = userInfo.username
32-
displayNameLabel.text = userInfo.displayName
29+
displayNameLabel.text = displayName
3330
avatarImageView.image = userInfo.avatarImage
3431
avatarImageView.layer.cornerRadius = CGRectGetHeight(self.avatarImageView.frame)/2
3532
avatarImageView.layer.masksToBounds = true

0 commit comments

Comments
 (0)