[polari] telepathyClient: Fix identifying to NickServ
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] telepathyClient: Fix identifying to NickServ
- Date: Thu, 24 Jun 2021 17:15:51 +0000 (UTC)
commit 2294d808c0b0723162a76e21578afd965ee82e8b
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jun 24 18:38:23 2021 +0200
telepathyClient: Fix identifying to NickServ
Commit 042d62b66e introduced an ordering issue in _requestChannel():
When identifying to a bot, the room is only created when observing
the new channel, so looking up the room *before* the request will fail,
even when the request then succeeds. Resetting the channel_error on
the undefined room variable will then throw an exception, which we
silently ignore.
Fix this by moving the channelError handling (including room lookup)
after the channel request completes.
https://gitlab.gnome.org/GNOME/polari/-/merge_requests/195
src/telepathyClient.js | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index d3529b58..c8992c6a 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -349,21 +349,20 @@ class TelepathyClient extends Tp.BaseClient {
req.set_target_id(targetType, targetId);
req.set_delegate_to_preferred_handler(true);
- const room = this._roomManager.lookupRoom(roomId);
const preferredHandler = `${Tp.CLIENT_BUS_NAME_BASE}Polari`;
let channel = null;
+ let channelError = '';
try {
channel = await req.ensure_and_observe_channel_async(
preferredHandler, cancellable);
- room.channel_error = '';
} catch (e) {
debug(`Failed to ensure channel: ${e.message}`);
-
- if (room)
- room.channel_error = Tp.error_get_dbus_name(e.code);
-
+ channelError = Tp.error_get_dbus_name(e.code);
throw e;
} finally {
+ const room = this._roomManager.lookupRoom(roomId);
+ if (room)
+ room.set({ channelError });
this._pendingRequests.delete(roomId);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]