Fix unread bubbles having wrong color on startup

This commit is contained in:
fiaxh 2020-07-07 17:47:14 +02:00
parent 932140cdd4
commit 8e3462b1b7
2 changed files with 4 additions and 4 deletions

View file

@ -89,7 +89,6 @@ public class Register : StreamInteractionModule, Object{
}); });
stream.get_module(Tls.Module.IDENTITY).invalid_certificate.connect((peer_cert, errors) => { stream.get_module(Tls.Module.IDENTITY).invalid_certificate.connect((peer_cert, errors) => {
if (callback != null) { if (callback != null) {
ret.error_flags = errors; ret.error_flags = errors;
Idle.add((owned)callback); Idle.add((owned)callback);
} }

View file

@ -54,6 +54,7 @@ public class ConversationSelectorRow : ListBoxRow {
stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => { stream_interactor.get_module(MucManager.IDENTITY).room_info_updated.connect((account, jid) => {
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) { if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
update_name_label(); update_name_label();
update_read(true); // bubble color might have changed
} }
}); });
stream_interactor.get_module(MucManager.IDENTITY).private_room_occupant_updated.connect((account, room, occupant) => { stream_interactor.get_module(MucManager.IDENTITY).private_room_occupant_updated.connect((account, room, occupant) => {
@ -100,7 +101,7 @@ public class ConversationSelectorRow : ListBoxRow {
stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation); stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
}); });
image.set_conversation(stream_interactor, conversation); image.set_conversation(stream_interactor, conversation);
conversation.notify["read-up-to-item"].connect(update_read); conversation.notify["read-up-to-item"].connect(() => update_read());
update_name_label(); update_name_label();
content_item_received(); content_item_received();
@ -203,9 +204,9 @@ public class ConversationSelectorRow : ListBoxRow {
} }
} }
protected void update_read() { protected void update_read(bool force_update = false) {
int current_num_unread = stream_interactor.get_module(ChatInteraction.IDENTITY).get_num_unread(conversation); int current_num_unread = stream_interactor.get_module(ChatInteraction.IDENTITY).get_num_unread(conversation);
if (num_unread == current_num_unread) return; if (num_unread == current_num_unread && !force_update) return;
num_unread = current_num_unread; num_unread = current_num_unread;
if (num_unread == 0) { if (num_unread == 0) {