Skip to content

Commit 9c04dd8

Browse files
committed
Harmonize behavior of live chats and requests with respect to actions handling
Fixes #44 Do not open Assistify-tab if running in the mobile app (fixes #41). However, a browser opening the mobile view is likely to open the panel on opening the room still.
1 parent 9cb699a commit 9c04dd8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/assistify-help-request/client/hooks/openAiTab.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
* (a request, an expertise or a livechat)
44
*/
55
RocketChat.callbacks.add('enter-room', function(subscription) {
6-
const roomOpened = RocketChat.models.Rooms.findOne({_id: subscription.rid});
7-
if (roomOpened.t === 'r' || roomOpened.t === 'e' || roomOpened.t === 'l') {
8-
$('.flex-tab-container:not(.opened) .flex-tab-bar :not(.hidden) .icon-lightbulb').click(); //there is no ID of the tabbar's Button which we could use so far
6+
if (Meteor.isCordova) {
7+
return; //looks awkward on mobile if panel is opened by default
8+
}
9+
10+
if (subscription) { //no subscription: if a user joins a room without being subscribed to it, e. g. in live chat
11+
const roomOpened = RocketChat.models.Rooms.findOne({_id: subscription.rid});
12+
if (roomOpened.t === 'r' || roomOpened.t === 'e' || roomOpened.t === 'l') {
13+
$('.flex-tab-container:not(.opened) .flex-tab-bar :not(.hidden) .icon-lightbulb').click(); //there is no ID of the tabbar's Button which we could use so far
14+
}
915
}
1016
});

0 commit comments

Comments
 (0)