[polari] chatView: Remove pending marks on channel changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Remove pending marks on channel changes
- Date: Mon, 1 Aug 2016 20:30:46 +0000 (UTC)
commit da46950ed2e244376b28dfb56a486c9c4a672a4c
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 10 22:42:00 2016 +0200
chatView: Remove pending marks on channel changes
For highlighted messages, we defer acknowledging the message
until it has been read and pause autoscrolling in the meantime.
However as pending messages are tied to their channel, they won't
ever get acknowledged after a channel change (for instance on
disconnect). As a result, autoscrolling gets stuck until another
highlighted message happens to have the same ID (which may never
happen). Fix this by clearing out all pending marks on channel
changes.
https://bugzilla.gnome.org/show_bug.cgi?id=769355
src/chatView.js | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 4ebb439..ad59b33 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -715,12 +715,16 @@ const ChatView = new Lang.Class({
let [id, valid] = message.get_pending_message_id();
if (!valid || !this._pending.has(id))
return;
+ this._removePendingMark(id);
+ this._app.withdraw_notification(this._getNotificationID(id));
+ },
+
+ _removePendingMark: function(id) {
let mark = this._pending.get(id);
// Re-enable auto-scrolling if this is the most recent message
if (this._view.buffer.get_iter_at_mark(mark).is_end())
this._autoscroll = true;
this._view.buffer.delete_mark(mark);
- this._app.withdraw_notification(this._getNotificationID(id));
this._pending.delete(id);
},
@@ -897,6 +901,11 @@ const ChatView = new Lang.Class({
if (this._channel == this._room.channel)
return;
+ // Pending IDs are invalidated by channel changes, so
+ // remove marks to not get stuck on highlighted messages
+ for (let id of this._pending.keys())
+ this._removePendingMark(id);
+
if (this._channel) {
for (let i = 0; i < this._channelSignals.length; i++)
this._channel.disconnect(this._channelSignals[i]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]