After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748703 - Private chats throw errors
Private chats throw errors
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-30 12:46 UTC by Florian Müllner
Modified: 2015-06-02 13:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
chatView: setNickStatus only for group chats (1.74 KB, patch)
2015-04-30 17:44 UTC, Bastian Ilsø
none Details | Review
chatView: setNickStatus only for group chats (2.08 KB, patch)
2015-05-02 19:09 UTC, Bastian Ilsø
none Details | Review
chatView: setNickStatus only for group chats (1.99 KB, patch)
2015-05-02 19:12 UTC, Bastian Ilsø
none Details | Review
chatView.js: color contact availability in PM rooms (2.69 KB, patch)
2015-05-28 14:58 UTC, Bastian Ilsø
none Details | Review
chatView.js: color contact availability in PM rooms (2.57 KB, patch)
2015-06-01 22:11 UTC, Bastian Ilsø
none Details | Review
chatView: Color contact availability in PM rooms (2.64 KB, patch)
2015-06-02 12:12 UTC, Bastian Ilsø
accepted-commit_now Details | Review

Description Florian Müllner 2015-04-30 12:46:25 UTC
This is fallout from bug 710792 - the patches there assume that all channels have group functionality, which is not the case for private conversations:


(org.gnome.Polari:31787): Gjs-WARNING **: JS ERROR: TypeError: members is null
ChatView<._onChannelChanged@resource:///org/gnome/Polari/js/chatView.js:607
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
_ChatroomManager<._ensureRoomForChannel@resource:///org/gnome/Polari/js/chatroomManager.js:198
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
_ChatroomManager<.handleChannels/<@resource:///org/gnome/Polari/js/chatroomManager.js:249
_ChatroomManager<._processRequest@resource:///org/gnome/Polari/js/chatroomManager.js:213
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
_ChatroomManager<.handleChannels@resource:///org/gnome/Polari/js/chatroomManager.js:245
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
Client<.vfunc_handle_channels@resource:///org/gnome/Polari/js/chatroomManager.js:38
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
main@resource:///org/gnome/Polari/js/main.js:17
run@resource:///org/gnome/gjs/modules/package.js:192
start@resource:///org/gnome/gjs/modules/package.js:176
@/home/fmuellner/opt/gnome/bin/polari:5


(org.gnome.Polari:31787): Gjs-WARNING **: JS ERROR: TypeError: null has no properties
ChatView<._insertPendingLogs@resource:///org/gnome/Polari/js/chatView.js:323
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
ChatView<._onLogEventsReady@resource:///org/gnome/Polari/js/chatView.js:280
wrapper@resource:///org/gnome/gjs/modules/lang.js:169
main@resource:///org/gnome/Polari/js/main.js:17
run@resource:///org/gnome/gjs/modules/package.js:192
start@resource:///org/gnome/gjs/modules/package.js:176
@/home/fmuellner/opt/gnome/bin/polari:5
Comment 1 Bastian Ilsø 2015-04-30 17:44:57 UTC
Created attachment 302685 [details] [review]
chatView: setNickStatus only for group chats

just testing the waters. is this pretty?
Comment 2 Florian Müllner 2015-04-30 20:17:19 UTC
(In reply to Bastian from comment #1)
> just testing the waters. is this pretty?

No. Either check whether the channel has the group interface, or look at the room type.

(Also eventually we need to do better than simply ignoring private conversations, see bug 712635)
Comment 3 Bastian Ilsø 2015-05-02 19:09:05 UTC
Created attachment 302765 [details] [review]
chatView: setNickStatus only for group chats

I am checking the HandleType of the channel now.
Comment 4 Bastian Ilsø 2015-05-02 19:12:14 UTC
Created attachment 302766 [details] [review]
chatView: setNickStatus only for group chats

woops, looks like i rushed that previous one a bit.
Comment 5 Florian Müllner 2015-05-06 18:17:21 UTC
Review of attachment 302766 [details] [review]:

Apart from the style nits outlined below, maybe we should try to do a bit better than outright ignoring private conversations - it shouldn't be too hard actually, considering that we *know* the list of members in that case: there are exactly two users in the "room", this._channel.connection.self_contact and this._channel.target_contact ...
If we then fix bug 712635 to detect when the target contact disconnects, everything should work as expected.

::: src/chatView.js
@@ +323,3 @@
+
+        let channelHandle = this._channel.get_handle();
+        if (channelHandle[1] == Tp.HandleType.ROOM) {

PolariRoom duplicates the type property (because we need to differentiate between ROOM and CONTACT even when unconnected, i.e. without a channel), so this can just be
if (this._room.type == Tp.HandleType.ROOM)

@@ +326,2 @@
             let members = this._channel.group_dup_members_contacts();
+            for (let j = 0; j < members.length; j++) {

Unrelated change
Comment 6 Bastian Ilsø 2015-05-28 14:58:04 UTC
Created attachment 304183 [details] [review]
chatView.js: color contact availability in PM rooms

The patch now handles the private messaging room case as well. However, Bug 712635 still remains to be solved before coloring would be of any help in there.
Comment 7 Florian Müllner 2015-06-01 17:02:43 UTC
Review of attachment 304183 [details] [review]:

::: src/chatView.js
@@ +323,3 @@
+
+        let channelHandle = this._channel.get_handle();
+        if (channelHandle[1] == Tp.HandleType.ROOM) {

I don't like that stylistically - the meaning of "channelHandle[1]" is totally obscure here. There are two better (IMHO) options:
 (1) Use:
     let [handle, type] = this._channel.get_handle();
     if (type == ...)

 (2) Use:
     if (this._room.type == ...)

@@ +614,3 @@
 
+        let channelHandle = this._channel.get_handle();
+        if (channelHandle[1] == Tp.HandleType.ROOM) {

Dto.
Comment 8 Bastian Ilsø 2015-06-01 22:11:15 UTC
Created attachment 304388 [details] [review]
chatView.js: color contact availability in PM rooms
Comment 9 Florian Müllner 2015-06-02 10:27:50 UTC
Review of attachment 304388 [details] [review]:

Code looks good to me now, thanks.

A couple of nicks on the commit message:
Prefix without extension please, i.e. "chatView" rather than "chatView.js"; the following subject line should use sentence capitalization. Regarding the body, it's a bit on the vague side as-is - I'd mention that the original commit used API that is only available on MUCs unconditionally, resulting in errors in PM rooms. I'd either leave the last sentence out, or replace it with something like: "We currently don't have a way to check the actual online status of a PM message, so always mark it as available."
Comment 10 Bastian Ilsø 2015-06-02 12:12:14 UTC
Created attachment 304426 [details] [review]
chatView: Color contact availability in PM rooms

Now reads: 

"Commit c96929c uses an API which is only available in group
chat rooms, resulting in errors in private message rooms.
We currently don't have a way to check the actual online
status of a PM message, so always mark it as available."
Comment 11 Florian Müllner 2015-06-02 13:18:19 UTC
Review of attachment 304426 [details] [review]:

(In reply to Bastian from comment #10)
> Now reads: 
> 
> [...]

Fine with me, thanks!