Skip to content

Commit

Permalink
Harmonize behavior of live chats and requests with respect to actions…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
mrsimpson committed Jul 21, 2017
1 parent 9cb699a commit 9c04dd8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/assistify-help-request/client/hooks/openAiTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
* (a request, an expertise or a livechat)
*/
RocketChat.callbacks.add('enter-room', function(subscription) {
const roomOpened = RocketChat.models.Rooms.findOne({_id: subscription.rid});
if (roomOpened.t === 'r' || roomOpened.t === 'e' || roomOpened.t === 'l') {
$('.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
if (Meteor.isCordova) {
return; //looks awkward on mobile if panel is opened by default
}

if (subscription) { //no subscription: if a user joins a room without being subscribed to it, e. g. in live chat
const roomOpened = RocketChat.models.Rooms.findOne({_id: subscription.rid});
if (roomOpened.t === 'r' || roomOpened.t === 'e' || roomOpened.t === 'l') {
$('.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
}
}
});

0 comments on commit 9c04dd8

Please sign in to comment.