Adding browser functions in utilis and calling them in settings_sidebar
Этот коммит содержится в:
@@ -1,11 +1,12 @@
|
|||||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
var utils = require('../utils/utils.jsx');
|
||||||
|
|
||||||
export default class SettingsSidebar extends React.Component {
|
export default class SettingsSidebar extends React.Component {
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
$('.settings-modal').find('.modal-body').scrollTop(0);
|
$('.settings-modal').find('.modal-body').scrollTop(0);
|
||||||
$('.settings-modal').find('.modal-body').perfectScrollbar('update');
|
$('.settings-modal').find('.modal-body').perfectScrollbar('update');
|
||||||
if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
|
if (utils.isSafari()) {
|
||||||
$('.settings-modal .settings-links .nav').addClass('absolute');
|
$('.settings-modal .settings-links .nav').addClass('absolute');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,20 @@ export function isTestDomain() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isChrome() {
|
||||||
|
if (navigator.userAgent.indexOf('Chrome') > -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isSafari() {
|
||||||
|
if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
export function isInRole(roles, inRole) {
|
export function isInRole(roles, inRole) {
|
||||||
var parts = roles.split(' ');
|
var parts = roles.split(' ');
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user