Check for "Former one2one" room type in some other room related functions.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2023-02-06 16:24:55 +01:00
Родитель efb3f5d470
Коммит 6fefd71c8d
4 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -206,12 +206,13 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
- (BOOL)isNameEditable
{
return [self canModerate] && self.type != kNCRoomTypeOneToOne;
return [self canModerate] && self.type != kNCRoomTypeOneToOne && self.type != kNCRoomTypeFormerOneToOne;
}
- (BOOL)isLockedOneToOne
{
return self.type == kNCRoomTypeOneToOne && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityLockedOneToOneRooms];
return (self.type == kNCRoomTypeOneToOne && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityLockedOneToOneRooms])
|| self.type == kNCRoomTypeFormerOneToOne;
}
- (BOOL)userCanStartCall
@ -224,7 +225,8 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
- (BOOL)hasUnreadMention
{
return self.unreadMention || self.unreadMentionDirect || (self.type == kNCRoomTypeOneToOne && self.unreadMessages > 0);
return self.unreadMention || self.unreadMentionDirect || (self.type == kNCRoomTypeOneToOne && self.unreadMessages > 0)
|| (self.type == kNCRoomTypeFormerOneToOne && self.unreadMessages > 0);
}
- (BOOL)isLeavable
@ -233,13 +235,14 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
// (No need to check room type because in one2one rooms users will always be moderators)
// or when in a group call and there are other participants.
// We can also check "canLeaveConversation" since v2
return self.canLeaveConversation || ![self canModerate] || (self.type != kNCRoomTypeOneToOne && [self.participants count] > 1);
return self.canLeaveConversation || ![self canModerate] || (self.type != kNCRoomTypeOneToOne && [self.participants count] > 1)
|| (self.type != kNCRoomTypeFormerOneToOne && [self.participants count] > 1);
}
- (NSString *)deletionMessage
{
NSString *message = NSLocalizedString(@"Do you really want to delete this conversation?", nil);
if (self.type == kNCRoomTypeOneToOne) {
if (self.type == kNCRoomTypeOneToOne || self.type == kNCRoomTypeFormerOneToOne) {
message = [NSString stringWithFormat:NSLocalizedString(@"If you delete the conversation, it will also be deleted for %@", nil), self.displayName];
} else if ([self.participants count] > 1) {
message = NSLocalizedString(@"If you delete the conversation, it will also be deleted for all other participants.", nil);

Просмотреть файл

@ -325,7 +325,7 @@ typedef enum FileAction {
// Guests section
[sections addObject:[NSNumber numberWithInt:kRoomInfoSectionGuests]];
// Webinar section
if (_room.type != kNCRoomTypeOneToOne && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityWebinaryLobby]) {
if (_room.type != kNCRoomTypeOneToOne && _room.type != kNCRoomTypeFormerOneToOne && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityWebinaryLobby]) {
[sections addObject:[NSNumber numberWithInt:kRoomInfoSectionWebinar]];
}
}

Просмотреть файл

@ -298,11 +298,11 @@ typedef enum RoomSearchSection {
// Set unread messages
if ([[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityDirectMentionFlag]) {
BOOL mentioned = room.unreadMentionDirect || room.type == kNCRoomTypeOneToOne;
BOOL mentioned = room.unreadMentionDirect || room.type == kNCRoomTypeOneToOne || room.type == kNCRoomTypeFormerOneToOne;
BOOL groupMentioned = room.unreadMention && !room.unreadMentionDirect;
[cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:groupMentioned];
} else {
BOOL mentioned = room.unreadMention || room.type == kNCRoomTypeOneToOne;
BOOL mentioned = room.unreadMention || room.type == kNCRoomTypeOneToOne || room.type == kNCRoomTypeFormerOneToOne;
[cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO];
}

Просмотреть файл

@ -1180,11 +1180,11 @@ typedef void (^FetchRoomsCompletionBlock)(BOOL success);
// Set unread messages
if ([[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityDirectMentionFlag]) {
BOOL mentioned = room.unreadMentionDirect || room.type == kNCRoomTypeOneToOne;
BOOL mentioned = room.unreadMentionDirect || room.type == kNCRoomTypeOneToOne || room.type == kNCRoomTypeFormerOneToOne;
BOOL groupMentioned = room.unreadMention && !room.unreadMentionDirect;
[cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:groupMentioned];
} else {
BOOL mentioned = room.unreadMention || room.type == kNCRoomTypeOneToOne;
BOOL mentioned = room.unreadMention || room.type == kNCRoomTypeOneToOne || room.type == kNCRoomTypeFormerOneToOne;
[cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO];
}