Skip to content

Commit

Permalink
Merge pull request RocketChat#229 from Shailesh351/sb_vm_mobile
Browse files Browse the repository at this point in the history
Set ViewMode to Extended for Mobile
  • Loading branch information
ear-dev authored Apr 14, 2020
2 parents 994d838 + 6eec0f4 commit aed6b8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 4 additions & 1 deletion app/ui-sidenav/client/sideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Tracker } from 'meteor/tracker';

import { SideNav, menu } from '../../ui-utils';
import { settings } from '../../settings';
import { roomTypes, getUserPreference } from '../../utils';
import { roomTypes, getUserPreference, isMobile } from '../../utils';
import { Users } from '../../models';

Template.sideNav.helpers({
Expand Down Expand Up @@ -39,6 +39,9 @@ Template.sideNav.helpers({
},

sidebarViewMode() {
if (isMobile()) {
return 'extended';
}
const viewMode = getUserPreference(Meteor.userId(), 'sidebarViewMode');
return viewMode || 'extended';
},
Expand Down
8 changes: 1 addition & 7 deletions app/ui-sidenav/client/sidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,6 @@ const toolbarButtons = (user) => [{
type: 'sort-action',
};

const viewModeOption = {
name: t('View_mode'),
icon: () => viewModeIcon[getUserPreference(user, 'sidebarViewMode') || 'extended'],
type: 'view-mode-action',
};

const shareOption = {
name: t('Share'),
icon: 'share',
Expand Down Expand Up @@ -330,7 +324,7 @@ const toolbarButtons = (user) => [{
offsetVertical: e.currentTarget.clientHeight + 10,
};
if (isMobile()) {
config.columns[0].groups[0].items = config.columns[0].groups[0].items.concat([viewModeOption, sortOption]);
config.columns[0].groups[0].items = config.columns[0].groups[0].items.concat([sortOption]);
}
config.columns[0].groups[0].items = config.columns[0].groups[0].items.concat([shareOption]);

Expand Down
9 changes: 7 additions & 2 deletions app/ui-sidenav/client/sidebarItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';

import { t, getUserPreference, roomTypes } from '../../utils';
import { t, getUserPreference, roomTypes, isMobile } from '../../utils';
import { popover, renderMessageBody, menu } from '../../ui-utils';
import { Users, ChatSubscription } from '../../models';
import { settings } from '../../settings';
Expand All @@ -18,6 +18,9 @@ Template.sidebarItem.helpers({
return this.rid || this._id;
},
isExtendedViewMode() {
if (isMobile()) {
return 'extended';
}
return getUserPreference(Meteor.userId(), 'sidebarViewMode') === 'extended';
},
lastMessage() {
Expand Down Expand Up @@ -169,7 +172,9 @@ Template.sidebarItem.onCreated(function() {
const currentData = Template.currentData();

if (!currentData.lastMessage || getUserPreference(Meteor.userId(), 'sidebarViewMode') !== 'extended') {
return clearInterval(this.timeAgoInterval);
if (!isMobile()) {
return clearInterval(this.timeAgoInterval);
}
}

if (currentData.lastMessage && !currentData.lastMessage._id) {
Expand Down

0 comments on commit aed6b8d

Please sign in to comment.