Skip to content

Commit

Permalink
Fixed an issue with channel name not being updated in chats list duri…
Browse files Browse the repository at this point in the history
…ng creation of the channel #beagleim-271
  • Loading branch information
hantu85 committed Aug 18, 2020
1 parent 50e8988 commit 268878a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion BeagleIM/channel/CreateChannelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ class CreateChannelView: NSView, OpenChannelViewControllerTabView, NSTextFieldDe
self?.delegate?.operationFinished();
}
})
mixModule.publishInfo(for: channelJid, info: ChannelInfo(name: channelName, description: channelDescription, contact: []), completionHandler: nil);
let info = ChannelInfo(name: channelName, description: channelDescription, contact: []);
mixModule.publishInfo(for: channelJid, info: info, completionHandler: { result in
switch result {
case .success(_):
mixModule.channelManager.update(channel: channelJid, info: info);
default:
break;
}
});
if let avatarData = avatar?.scaled(maxWidthOrHeight: 512.0, format: .jpeg, properties: [.compressionFactor: 0.8]) {
avatarModule.publishAvatar(at: channelJid, data: avatarData, mimeType: "image/jpeg", completionHandler: { result in
print("avatar publication result:", result);
Expand Down
9 changes: 9 additions & 0 deletions BeagleIM/chatslist/ChatsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ class UnifiedChatItem: AbstractChatItem {

let isInRoster: Bool;

override var name: String {
get {
return (self.chat as? DBChatStore.DBChannel)?.name ?? super.name;
}
set {
super.name = newValue;
}
}

init(chat: DBChatProtocol) {
var name = chat.jid.stringValue;
switch chat {
Expand Down

0 comments on commit 268878a

Please sign in to comment.