Merge commit '778c940cb772c61fb2c97e3448ed4a3da57060e6'

This commit is contained in:
Ali 2022-10-12 18:18:02 +04:00
commit 03a5fa6e47
2 changed files with 14 additions and 2 deletions

View File

@ -91,13 +91,13 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
return TelegramMediaAction(action: .topicCreated(title: title, iconColor: iconColor, iconFileId: iconEmojiId))
case let .messageActionTopicEdit(flags, title, iconEmojiId, closed):
var componenents: [TelegramMediaActionType.ForumTopicEditComponent] = []
if let title {
if let title = title {
componenents.append(.title(title))
}
if (flags & (1 << 1)) != 0 {
componenents.append(.iconFileId(iconEmojiId == 0 ? nil : iconEmojiId))
}
if let closed {
if let closed = closed {
componenents.append(.isClosed(closed == .boolTrue))
}
return TelegramMediaAction(action: .topicEdited(components: componenents))

View File

@ -54,6 +54,18 @@ public extension Peer {
return nil
}
}
var usernames: [TelegramPeerUsername] {
switch self {
case let user as TelegramUser:
return user.usernames
case _ as TelegramGroup:
return []
case let channel as TelegramChannel:
return channel.usernames
default:
return []
}
}
var displayLetters: [String] {
switch self {