Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency of RC namespace in rc-ui-master, ui-message- user-data-download and version-check #13365

Merged
merged 144 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
171754e
Remove some dependencies inside rocketchat-lib/client (#13210)
MarcosSpessatto Jan 21, 2019
f536345
Remove some dependencies inside rocketchat-lib/lib (#13212)
MarcosSpessatto Jan 21, 2019
118634c
Remove some dependencies inside rocketchat-lib/server/functions (#13214)
MarcosSpessatto Jan 22, 2019
2bf63fb
Remove some dependencies inside rocketchat-lib/server/lib (#13217)
MarcosSpessatto Jan 22, 2019
3f1451f
Remove some dependencies inside rocketchat-lib/server/methods (#13218)
MarcosSpessatto Jan 22, 2019
23388c4
Remove some dependencies inside rocketchat-lib/server/startup, public…
MarcosSpessatto Jan 22, 2019
23547e9
Remove duplicated server settings (#13223)
MarcosSpessatto Jan 22, 2019
45b5dd0
Export functions and lib function of rc-lib but keep it inside RC na…
MarcosSpessatto Jan 23, 2019
a233ad7
Import variables from functions and lib to remove RC namespace depen…
MarcosSpessatto Jan 23, 2019
96f6fa1
Remove dependency of RC namespace in rc-sandstorm (#13227)
MarcosSpessatto Jan 23, 2019
4a3c69a
Remove dependency of RC namespace in chatpal-search (#13231)
MarcosSpessatto Jan 23, 2019
54b152f
Remove dependency of RC namespace in meteor saml (#13233)
MarcosSpessatto Jan 23, 2019
b3906fa
Remove dependency of RC namespace in rc-theme (#13234)
MarcosSpessatto Jan 23, 2019
9bd766a
Remove dependency of RC namespace in rc-2fa (#13235)
MarcosSpessatto Jan 23, 2019
86ae7c8
Remove dependency of RC namespace in rc-action-links (#13236)
MarcosSpessatto Jan 23, 2019
ed81de8
Remove dependency of RC namespace in rc-analytics and rc-assets (#13…
MarcosSpessatto Jan 24, 2019
a5e4f43
Remove dependency of RC namespace in rc-markdown, rc-autolinker and …
MarcosSpessatto Jan 24, 2019
258d258
Remove dependency of RC namespace in rc-blockstack, bot-helpers and …
MarcosSpessatto Jan 24, 2019
b9e1538
Remove dependency of RC namespace in rc-channel-settings (#13251)
MarcosSpessatto Jan 24, 2019
aff4cfe
Remove dependency of RC namespace in rc-channel-mail-messages and cl…
MarcosSpessatto Jan 24, 2019
02436be
Remove dependency of RC namespace in rc-colors, cors, crowd and dolp…
MarcosSpessatto Jan 24, 2019
5528c0f
Remove dependency of RC namespace in rc-emoji-custom and drupal (#13…
MarcosSpessatto Jan 25, 2019
c70a809
Remove dependency of RC namespace in rc-emojione, error-handler, gh-e…
MarcosSpessatto Jan 25, 2019
ffa0945
Remove dependency of RC namespace in rc-google-natural-language, gran…
MarcosSpessatto Jan 25, 2019
9ea6306
Remove dependency of RC namespace in rc-iframe-login and all imports…
MarcosSpessatto Jan 25, 2019
801ed01
Move RestAPI client to rc-api package
MarcosSpessatto Jan 28, 2019
1238c2c
Remove dependency of RC namespace in rc-api/helpers and api.js
MarcosSpessatto Jan 28, 2019
dc8f615
Remove dependency of RC namespace on half of api files
MarcosSpessatto Jan 28, 2019
c6db2d5
Partial Remove dependency of RC namespace in rc-api
MarcosSpessatto Jan 28, 2019
06f62e6
import API where it was being used by the RC namespace
MarcosSpessatto Jan 28, 2019
cd1930c
Move processWebhookMessage function to rc-lib package
MarcosSpessatto Jan 28, 2019
d7eab39
Remove API from RC namespace and import missing function that was bei…
MarcosSpessatto Jan 28, 2019
59bbccc
Remove dependency of RC namespace in rc-graphql
MarcosSpessatto Jan 28, 2019
e90ab24
Fix import from wrong package
MarcosSpessatto Jan 28, 2019
fd4f74c
Remove dependency of RC namespace in rc-importer
MarcosSpessatto Jan 28, 2019
58ad493
Remove dependency of RC namespace in rc-issue-links
MarcosSpessatto Jan 28, 2019
5783786
Remove dependency of RC namespace in rc-katex
MarcosSpessatto Jan 28, 2019
e9be3a4
Move templateVarHandler fn to rc-utils
MarcosSpessatto Jan 28, 2019
406e037
Remove dependency of RC namespace in rc-ldap
MarcosSpessatto Jan 28, 2019
0206d28
Remove dependency of RC namespace in rc-livestream
MarcosSpessatto Feb 1, 2019
b6b980b
Remove dependency of RC namespace in rc-mail-messages
MarcosSpessatto Feb 1, 2019
7c7b063
Remove dependency of RC namespace in rc-mapview
MarcosSpessatto Feb 1, 2019
e08ad7e
Remove dependency of RC namespace in rc-mentions
MarcosSpessatto Feb 1, 2019
8bb2a96
Remove dependency of RC namespace in rc-mentions-flextab
MarcosSpessatto Feb 1, 2019
ea2b699
Remove depedency of RC namespace in rc-message-attachements
MarcosSpessatto Feb 1, 2019
4da85d9
Remove dependdency of RC namespace in rc-message-mark-as-unread
MarcosSpessatto Feb 1, 2019
1717135
Remove dependency of RC namespace in rc-message-pin
MarcosSpessatto Feb 1, 2019
6733112
Fix templateVarHandler that was in wrong folder
MarcosSpessatto Feb 1, 2019
bff0955
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 4, 2019
b42676d
Merge branch 'depackaging' into globals/api-wave-1
MarcosSpessatto Feb 4, 2019
9db42c7
Merge branch 'globals/api-wave-1' into globals/api-wave-2
MarcosSpessatto Feb 4, 2019
d9635ae
Merge branch 'globals/api-wave-2' into globals/api-wave-3
MarcosSpessatto Feb 4, 2019
5560fb1
Merge branch 'globals/api-wave-3' into globals/api-wave-4
MarcosSpessatto Feb 4, 2019
765a43a
Merge branch 'globals/api-wave-4' into globals/graphql
MarcosSpessatto Feb 4, 2019
b567143
Merge branch 'globals/graphql' into globals/importer
MarcosSpessatto Feb 4, 2019
9fdf8a1
Merge branch 'globals/importer' into globals/issue-katex-ldap
MarcosSpessatto Feb 4, 2019
e9d857d
Merge branch 'globals/issue-katex-ldap' into globals/livestream-mail-…
MarcosSpessatto Feb 4, 2019
edf0e3d
Merge branch 'globals/livestream-mail-messages' into globals/mapview-…
MarcosSpessatto Feb 4, 2019
d39b6cd
Remove namespace in the new livechat endpoint
MarcosSpessatto Feb 4, 2019
e08efcd
Merge branch 'globals/api-wave-4' into globals/graphql
MarcosSpessatto Feb 4, 2019
20a71ff
Merge branch 'globals/graphql' into globals/importer
MarcosSpessatto Feb 4, 2019
77d0e2e
Merge branch 'globals/importer' into globals/issue-katex-ldap
MarcosSpessatto Feb 4, 2019
b588332
Merge branch 'globals/issue-katex-ldap' into globals/livestream-mail-…
MarcosSpessatto Feb 4, 2019
e9a51ab
Merge branch 'globals/livestream-mail-messages' into globals/mapview-…
MarcosSpessatto Feb 4, 2019
0d397c8
Merge branch 'globals/mapview-mentions' into globals/message
MarcosSpessatto Feb 4, 2019
1ae8bfd
Remove dependency of RC namespace in rc-message-snippet
MarcosSpessatto Feb 4, 2019
3bd702f
Remove dependency of RC namespace in rc-message-star
MarcosSpessatto Feb 4, 2019
0dbc8ed
Remove dependency of RC namespace in rc-oauth2
MarcosSpessatto Feb 4, 2019
584d087
Remove dependency of RC namespace in rc-oembed
MarcosSpessatto Feb 4, 2019
c06f9e1
Remove dependency of RC namespace in rc-otr
MarcosSpessatto Feb 4, 2019
b807e99
Remove dependency of RC namespace in rc-reactions
MarcosSpessatto Feb 4, 2019
87a39cf
Remove dependency of RC namespace in rc-retention-policy
MarcosSpessatto Feb 4, 2019
923b584
Remove dependency of RC namespace in rc-earch
MarcosSpessatto Feb 4, 2019
b2db169
Remove dependency of RC namespace in rc-setup-wizard
MarcosSpessatto Feb 4, 2019
b7174f8
Remove dependency of RC namespace in rc-slackbridge
MarcosSpessatto Feb 4, 2019
9cbf738
Remove dependency of Rc namespace in slashcommands-asciiarts
MarcosSpessatto Feb 4, 2019
3dd76ba
Remove depedency of RC namespace in rc-slash-archiveroom
MarcosSpessatto Feb 4, 2019
ca9c074
Remove dependency of RC namespace in rc-slash-create
MarcosSpessatto Feb 4, 2019
c4354d0
Remove dependency of RC namespace in rc-slash-help
MarcosSpessatto Feb 4, 2019
c0ede55
Remove dependency of RC namespace in rc-slash-hide
MarcosSpessatto Feb 4, 2019
b6fd2d5
Remove dependency of RC namespace in rc-slash-invite
MarcosSpessatto Feb 4, 2019
c532fad
Remove dependency of RC namespace in rc-slash-inviteall
MarcosSpessatto Feb 4, 2019
40fb545
Remove dependency of RC namespace in rc-slash-join
MarcosSpessatto Feb 5, 2019
e24096b
Remove dependency of RC namespace in rc-slash-kick
MarcosSpessatto Feb 5, 2019
1aa0f73
Remove dependency of RC namespace in rc-slash-leave
MarcosSpessatto Feb 5, 2019
74fc80c
Remove dependency of RC namespace in rc-slash-me
MarcosSpessatto Feb 5, 2019
5180629
Remove dependency of RC namespace in rc-slash-msg
MarcosSpessatto Feb 5, 2019
b3c4be2
Remove dependency of RC namespace in rc-slash-mute
MarcosSpessatto Feb 5, 2019
baa9aec
Remove dependency of RC namespace in rc-slash-open
MarcosSpessatto Feb 5, 2019
d75940e
Remove dependency of RC namespace in rc-slash-topic
MarcosSpessatto Feb 5, 2019
8687f9e
Remove dependency of RC namespace in rc-slash-unarchiveroom
MarcosSpessatto Feb 5, 2019
90adc29
Remove dependency of RC namespace in rc-smarsh-connector
MarcosSpessatto Feb 5, 2019
76a7209
Remove dependency of RC namespace in rc-sms
MarcosSpessatto Feb 5, 2019
73c2704
Remove dependency of RC namespace in rc-spotify
MarcosSpessatto Feb 5, 2019
56d9d99
Remove dependency of RC namespace in rc-statistics
MarcosSpessatto Feb 5, 2019
ad49a78
Move tokenpass models methods to rc-models
MarcosSpessatto Feb 5, 2019
8169e2c
Remove dependency of RC namespace in rc-tokenpass
MarcosSpessatto Feb 5, 2019
dfeab9f
import tokenpass inside rc-lib
MarcosSpessatto Feb 5, 2019
7e7752c
Remove dependency of RC namespace in rc-ui
MarcosSpessatto Feb 5, 2019
c9e2c01
Move webdavAccounts models to rc-model
MarcosSpessatto Feb 5, 2019
62e6542
Remove dependency of RC namespace in rc-ui-account
MarcosSpessatto Feb 5, 2019
2432e9a
Remove dependency of RC namespace in rc-ui-admin
MarcosSpessatto Feb 5, 2019
3c063a5
Remove dependency of RC namespace in rc-ui-clean-history
MarcosSpessatto Feb 5, 2019
18724d6
Remove dependency of RC namespace in rc-ui-flextab
MarcosSpessatto Feb 5, 2019
e877444
Remove dependency of RC namespace in rc-ui-login
MarcosSpessatto Feb 5, 2019
995f51a
Remove dependency of RC namespace in rc-ui-master
MarcosSpessatto Feb 5, 2019
060d85a
Remove dependency of RC namespace in rc-ui-message
MarcosSpessatto Feb 5, 2019
00b33ca
REmove dependency of RC namespace in rc-user-data-download
MarcosSpessatto Feb 5, 2019
ba43cc0
Remove dependency of RC namespace in rc-version-check
MarcosSpessatto Feb 5, 2019
767f35d
Remove dependency of RC namespace in rc-api/helpers and api.js (#13273)
MarcosSpessatto Feb 6, 2019
5228d2f
Remove dependency of RC namespace on half of api files (#13275)
MarcosSpessatto Feb 6, 2019
db160bf
Partial Remove dependency of RC namespace in rc-api (#13277)
MarcosSpessatto Feb 6, 2019
c977598
Remove dependency of RC namespace in rc-api (#13278)
MarcosSpessatto Feb 6, 2019
599f6f3
Remove dependency of RC namespace in rc-graphql (#13279)
MarcosSpessatto Feb 6, 2019
05bb4a6
Remove dependency of RC namespace in rc-importer (#13280)
MarcosSpessatto Feb 6, 2019
dc75e7d
Remove dependency of RC namespace in rc-ldap, katex and issue-links …
MarcosSpessatto Feb 6, 2019
412eb06
Remove dependency of RC namespace in rc-livestream and rc-mail-messa…
MarcosSpessatto Feb 6, 2019
3613dc5
Merge remote-tracking branch 'origin/depackaging' into globals/messag…
rodrigok Feb 13, 2019
da35a0b
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 14, 2019
fbf2883
Merge remote-tracking branch 'origin/depackaging' into globals/messag…
rodrigok Feb 14, 2019
427692c
Merge remote-tracking branch 'origin/develop' into globals/message-pi…
rodrigok Feb 14, 2019
6150fd4
Merge remote-tracking branch 'origin/globals/message-pin-snippet' int…
rodrigok Feb 14, 2019
2ae5c47
Merge remote-tracking branch 'origin/develop' into globals/message-pi…
rodrigok Feb 14, 2019
32d2e62
Merge branch 'globals/message-pin-snippet' into globals/message-star-…
rodrigok Feb 14, 2019
61a7534
Merge branch 'globals/message-star-oauth2-server' into globals/oembed…
rodrigok Feb 14, 2019
4211b8e
Merge branch 'develop' into globals/message-star-oauth2-server
rodrigok Feb 14, 2019
ec940cb
Merge branch 'globals/message-star-oauth2-server' into globals/oembed…
rodrigok Feb 14, 2019
45f6a1e
Merge branch 'globals/oembed-otr' into globals/reactions-rp-search
rodrigok Feb 14, 2019
0495b53
Merge branch 'globals/reactions-rp-search' into globals/setup-slackbr…
rodrigok Feb 14, 2019
b5278f7
Merge branch 'globals/setup-slackbridge-asciiarts' into globals/slash
rodrigok Feb 14, 2019
fc6bcf8
Merge branch 'globals/slash' into globals/slash-wave-2
rodrigok Feb 14, 2019
2bd8afd
Merge remote-tracking branch 'origin/develop' into globals/reactions-…
rodrigok Feb 14, 2019
47a145d
Merge branch 'globals/reactions-rp-search' into globals/setup-slackbr…
rodrigok Feb 14, 2019
9f29f12
Merge branch 'globals/setup-slackbridge-asciiarts' into globals/slash
rodrigok Feb 14, 2019
4a23834
Merge branch 'globals/slash' into globals/slash-wave-2
rodrigok Feb 14, 2019
03e17cb
Merge branch 'develop' into globals/slash
rodrigok Feb 14, 2019
07b435b
Merge remote-tracking branch 'origin/globals/slash' into globals/slas…
rodrigok Feb 14, 2019
9f3d69c
Merge remote-tracking branch 'origin/develop' into globals/slash-wave-2
rodrigok Feb 14, 2019
867f05a
Merge branch 'globals/slash-wave-2' into globals/smarsh-sms-spotify
rodrigok Feb 14, 2019
2cea2ef
Merge branch 'globals/smarsh-sms-spotify' into globals/statistics-tok…
rodrigok Feb 14, 2019
4fe5462
Merge branch 'globals/statistics-tokenpass' into globals/ui-account-a…
rodrigok Feb 14, 2019
a348050
Merge branch 'develop' into globals/ui-account-admin
rodrigok Feb 14, 2019
7005d3c
Merge branch 'globals/ui-account-admin' into globals/ui-clean-history…
rodrigok Feb 14, 2019
dd9939b
Merge branch 'globals/ui-clean-history-flextab-login' into globals/ui…
rodrigok Feb 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/rocketchat-models/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { RoomRoles } from './models/RoomRoles';
import { UserAndRoom } from './models/UserAndRoom';
import { UserRoles } from './models/UserRoles';
import { AuthzCachedCollection, ChatPermissions } from './models/ChatPermissions';
import { WebdavAccounts } from './models/WebdavAccounts';
import CustomSounds from './models/CustomSounds';
import EmojiCustom from './models/EmojiCustom';
import _ from 'underscore';
Expand Down Expand Up @@ -51,4 +52,5 @@ export {
Rooms,
CustomSounds,
EmojiCustom,
WebdavAccounts,
};
3 changes: 3 additions & 0 deletions packages/rocketchat-models/client/models/WebdavAccounts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Mongo } from 'meteor/mongo';

export const WebdavAccounts = new Mongo.Collection('rocketchat_webdav_accounts');
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-account/client/account.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tracker } from 'meteor/tracker';
import { Template } from 'meteor/templating';
import { SideNav } from 'meteor/rocketchat:ui';
import { SideNav } from 'meteor/rocketchat:ui-utils';

Template.account.onRendered(function() {
Tracker.afterFlush(function() {
Expand Down
15 changes: 8 additions & 7 deletions packages/rocketchat-ui-account/client/accountFlex.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import { SideNav } from 'meteor/rocketchat:ui';
import { settings } from 'meteor/rocketchat:settings';
import { hasAllPermission } from 'meteor/rocketchat:authorization';
import { SideNav, Layout } from 'meteor/rocketchat:ui-utils';
import { t } from 'meteor/rocketchat:utils';

Template.accountFlex.events({
Expand All @@ -15,16 +16,16 @@ Template.accountFlex.events({

Template.accountFlex.helpers({
allowUserProfileChange() {
return RocketChat.settings.get('Accounts_AllowUserProfileChange');
return settings.get('Accounts_AllowUserProfileChange');
},
accessTokensEnabled() {
return RocketChat.authz.hasAllPermission(['create-personal-access-tokens']);
return hasAllPermission(['create-personal-access-tokens']);
},
encryptionEnabled() {
return RocketChat.settings.get('E2E_Enable');
return settings.get('E2E_Enable');
},
webdavIntegrationEnabled() {
return RocketChat.settings.get('Webdav_Integration_Enabled');
return settings.get('Webdav_Integration_Enabled');
},
menuItem(name, icon, section, group) {
return {
Expand All @@ -36,6 +37,6 @@ Template.accountFlex.helpers({
};
},
embeddedVersion() {
return RocketChat.Layout.isEmbedded();
return Layout.isEmbedded();
},
});
6 changes: 3 additions & 3 deletions packages/rocketchat-ui-account/client/accountIntegrations.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib';
import { modal } from 'meteor/rocketchat:ui';
import { WebdavAccounts } from 'meteor/rocketchat:models';
import { modal } from 'meteor/rocketchat:ui-utils';
import { t } from 'meteor/rocketchat:utils';
import toastr from 'toastr';

Template.accountIntegrations.helpers({
webdavAccounts() {
return RocketChat.models.WebdavAccounts.find().fetch();
return WebdavAccounts.find().fetch();
},
getOptionValue(account) {
return account.name || `${ account.username }@${ account.server_url.replace(/^https?\:\/\//i, '') }`;
Expand Down
52 changes: 27 additions & 25 deletions packages/rocketchat-ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { Tracker } from 'meteor/tracker';
import { Reload } from 'meteor/reload';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { modal, SideNav, KonchatNotification } from 'meteor/rocketchat:ui';
import { t } from 'meteor/rocketchat:utils';
import { t, handleError, getUserPreference } from 'meteor/rocketchat:utils';
import { modal, SideNav } from 'meteor/rocketchat:ui-utils';
import { KonchatNotification } from 'meteor/rocketchat:ui';
import { settings } from 'meteor/rocketchat:settings';
import { CustomSounds } from 'meteor/rocketchat:custom-sounds';
import _ from 'underscore';
import s from 'underscore.string';
import toastr from 'toastr';
Expand All @@ -26,21 +28,21 @@ function checkedSelected(property, value, defaultValue = undefined) {
if (defaultValue && defaultValue.hash) {
defaultValue = undefined;
}
return RocketChat.getUserPreference(Meteor.userId(), property, defaultValue) === value;
return getUserPreference(Meteor.userId(), property, defaultValue) === value;
}

Template.accountPreferences.helpers({
audioAssets() {
return (RocketChat.CustomSounds && RocketChat.CustomSounds.getList && RocketChat.CustomSounds.getList()) || [];
return (CustomSounds && CustomSounds.getList && CustomSounds.getList()) || [];
},
newMessageNotification() {
return RocketChat.getUserPreference(Meteor.userId(), 'newMessageNotification');
return getUserPreference(Meteor.userId(), 'newMessageNotification');
},
newRoomNotification() {
return RocketChat.getUserPreference(Meteor.userId(), 'newRoomNotification');
return getUserPreference(Meteor.userId(), 'newRoomNotification');
},
muteFocusedConversations() {
return RocketChat.getUserPreference(Meteor.userId(), 'muteFocusedConversations');
return getUserPreference(Meteor.userId(), 'muteFocusedConversations');
},
languages() {
const languages = TAPi18n.getLanguages();
Expand Down Expand Up @@ -68,7 +70,7 @@ Template.accountPreferences.helpers({
return checkedSelected(property, value, defaultValue);
},
highlights() {
const userHighlights = RocketChat.getUserPreference(Meteor.userId(), 'highlights');
const userHighlights = getUserPreference(Meteor.userId(), 'highlights');
return userHighlights ? userHighlights.join(',\n') : undefined;
},
desktopNotificationEnabled() {
Expand All @@ -78,38 +80,38 @@ Template.accountPreferences.helpers({
return KonchatNotification.notificationStatus.get() === 'denied' || (window.Notification && Notification.permission === 'denied');
},
desktopNotificationDuration() {
const userPref = RocketChat.getUserPreference(Meteor.userId(), 'desktopNotificationDuration', 'undefined');
const userPref = getUserPreference(Meteor.userId(), 'desktopNotificationDuration', 'undefined');
return userPref !== 'undefined' ? userPref : undefined;
},
defaultDesktopNotificationDuration() {
return RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration');
return settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration');
},
idleTimeLimit() {
return RocketChat.getUserPreference(Meteor.userId(), 'idleTimeLimit');
return getUserPreference(Meteor.userId(), 'idleTimeLimit');
},
defaultIdleTimeLimit() {
return RocketChat.settings.get('Accounts_Default_User_Preferences_idleTimeLimit');
return settings.get('Accounts_Default_User_Preferences_idleTimeLimit');
},
defaultDesktopNotification() {
return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotifications')];
return notificationLabels[settings.get('Accounts_Default_User_Preferences_desktopNotifications')];
},
defaultMobileNotification() {
return notificationLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_mobileNotifications')];
return notificationLabels[settings.get('Accounts_Default_User_Preferences_mobileNotifications')];
},
defaultEmailNotification() {
return emailLabels[RocketChat.settings.get('Accounts_Default_User_Preferences_emailNotificationMode')];
return emailLabels[settings.get('Accounts_Default_User_Preferences_emailNotificationMode')];
},
showRoles() {
return RocketChat.settings.get('UI_DisplayRoles');
return settings.get('UI_DisplayRoles');
},
userDataDownloadEnabled() {
return RocketChat.settings.get('UserData_EnableDownload') !== false;
return settings.get('UserData_EnableDownload') !== false;
},
notificationsSoundVolume() {
return RocketChat.getUserPreference(Meteor.userId(), 'notificationsSoundVolume');
return getUserPreference(Meteor.userId(), 'notificationsSoundVolume');
},
dontAskAgainList() {
return RocketChat.getUserPreference(Meteor.userId(), 'dontAskAgainList');
return getUserPreference(Meteor.userId(), 'dontAskAgainList');
},
});

Expand All @@ -122,7 +124,7 @@ Template.accountPreferences.onCreated(function() {

settingsTemplate.child.push(this);

this.useEmojis = new ReactiveVar(RocketChat.getUserPreference(Meteor.userId(), 'useEmojis'));
this.useEmojis = new ReactiveVar(getUserPreference(Meteor.userId(), 'useEmojis'));

let instance = this;

Expand Down Expand Up @@ -161,7 +163,7 @@ Template.accountPreferences.onCreated(function() {
data.sendOnEnter = $('#sendOnEnter').find('select').val();
data.autoImageLoad = JSON.parse($('input[name=autoImageLoad]:checked').val());
data.emailNotificationMode = $('select[name=emailNotificationMode]').val();
data.desktopNotificationDuration = $('input[name=desktopNotificationDuration]').val() === '' ? RocketChat.settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration') : parseInt($('input[name=desktopNotificationDuration]').val());
data.desktopNotificationDuration = $('input[name=desktopNotificationDuration]').val() === '' ? settings.get('Accounts_Default_User_Preferences_desktopNotificationDuration') : parseInt($('input[name=desktopNotificationDuration]').val());
data.desktopNotifications = $('#desktopNotifications').find('select').val();
data.mobileNotifications = $('#mobileNotifications').find('select').val();
data.unreadAlert = JSON.parse($('#unreadAlert').find('input:checked').val());
Expand All @@ -174,12 +176,12 @@ Template.accountPreferences.onCreated(function() {

let reload = false;

if (RocketChat.settings.get('UI_DisplayRoles')) {
if (settings.get('UI_DisplayRoles')) {
data.hideRoles = JSON.parse($('#hideRoles').find('input:checked').val());
}

// if highlights changed we need page reload
const highlights = RocketChat.getUserPreference(Meteor.userId(), 'highlights');
const highlights = getUserPreference(Meteor.userId(), 'highlights');
if (highlights && highlights.join('\n') !== data.highlights.join('\n')) {
reload = true;
}
Expand All @@ -198,7 +200,7 @@ Template.accountPreferences.onCreated(function() {
reload = true;
}

const idleTimeLimit = $('input[name=idleTimeLimit]').val() === '' ? RocketChat.settings.get('Accounts_Default_User_Preferences_idleTimeLimit') : parseInt($('input[name=idleTimeLimit]').val());
const idleTimeLimit = $('input[name=idleTimeLimit]').val() === '' ? settings.get('Accounts_Default_User_Preferences_idleTimeLimit') : parseInt($('input[name=idleTimeLimit]').val());
data.idleTimeLimit = idleTimeLimit;
if (this.shouldUpdateLocalStorageSetting('idleTimeLimit', idleTimeLimit)) {
localStorage.setItem('idleTimeLimit', idleTimeLimit);
Expand Down
48 changes: 25 additions & 23 deletions packages/rocketchat-ui-account/client/accountProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { modal, SideNav } from 'meteor/rocketchat:ui';
import { t } from 'meteor/rocketchat:utils';
import { modal, SideNav } from 'meteor/rocketchat:ui-utils';
import { t, handleError } from 'meteor/rocketchat:utils';
import { settings } from 'meteor/rocketchat:settings';
import { Notifications } from 'meteor/rocketchat:notifications';
import { callbacks } from 'meteor/rocketchat:callbacks';
import _ from 'underscore';
import s from 'underscore.string';
import toastr from 'toastr';

const validateEmail = (email) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email);
const validateUsername = (username) => {
const reg = new RegExp(`^${ RocketChat.settings.get('UTF8_Names_Validation') }$`);
const reg = new RegExp(`^${ settings.get('UTF8_Names_Validation') }$`);
return reg.test(username);
};
const validateName = (name) => name && name.length;
Expand All @@ -26,7 +28,7 @@ const validatePassword = (password, confirmationPassword) => {
};

const filterNames = (old) => {
const reg = new RegExp(`^${ RocketChat.settings.get('UTF8_Names_Validation') }$`);
const reg = new RegExp(`^${ settings.get('UTF8_Names_Validation') }$`);
return [...old.replace(' ', '')].filter((f) => reg.test(f)).join('');
};
const filterEmail = (old) => old.replace(' ', '');
Expand Down Expand Up @@ -83,7 +85,7 @@ Template.accountProfile.helpers({
return Object.keys(suggestions.avatars).map((service) => ({
name: service,
// TODO: improve this fix
service: !suggestions.avatars[service.toLowerCase()] ? RocketChat.settings.get(`Accounts_OAuth_${ s.capitalize(service.toLowerCase()) }`) : false,
service: !suggestions.avatars[service.toLowerCase()] ? settings.get(`Accounts_OAuth_${ s.capitalize(service.toLowerCase()) }`) : false,
suggestion: suggestions.avatars[service.toLowerCase()],
}))
.filter(({ service, suggestion }) => service || suggestion);
Expand Down Expand Up @@ -133,7 +135,7 @@ Template.accountProfile.helpers({
return;
},
allowDeleteOwnAccount() {
return RocketChat.settings.get('Accounts_AllowDeleteOwnAccount');
return settings.get('Accounts_AllowDeleteOwnAccount');
},
realname() {
return Meteor.user().name;
Expand All @@ -150,23 +152,23 @@ Template.accountProfile.helpers({
return isUserEmailVerified(user);
},
allowRealNameChange() {
return RocketChat.settings.get('Accounts_AllowRealNameChange');
return settings.get('Accounts_AllowRealNameChange');
},
allowUsernameChange() {
return RocketChat.settings.get('Accounts_AllowUsernameChange') && RocketChat.settings.get('LDAP_Enable') !== true;
return settings.get('Accounts_AllowUsernameChange') && settings.get('LDAP_Enable') !== true;
},
allowEmailChange() {
return RocketChat.settings.get('Accounts_AllowEmailChange');
return settings.get('Accounts_AllowEmailChange');
},
allowPasswordChange() {
return RocketChat.settings.get('Accounts_AllowPasswordChange');
return settings.get('Accounts_AllowPasswordChange');
},
canConfirmNewPassword() {
const password = Template.instance().password.get();
return RocketChat.settings.get('Accounts_AllowPasswordChange') && password && password !== '';
return settings.get('Accounts_AllowPasswordChange') && password && password !== '';
},
allowAvatarChange() {
return RocketChat.settings.get('Accounts_AllowUserAvatarChange');
return settings.get('Accounts_AllowUserAvatarChange');
},
customFields() {
return Meteor.user().customFields;
Expand All @@ -187,7 +189,7 @@ Template.accountProfile.onCreated(function() {
self.url = new ReactiveVar('');
self.usernameAvaliable = new ReactiveVar(true);

RocketChat.Notifications.onLogged('updateAvatar', () => self.avatar.set());
Notifications.onLogged('updateAvatar', () => self.avatar.set());
self.getSuggestions = function() {
self.suggestions.set(undefined);
Meteor.call('getAvatarSuggestion', function(error, avatars) {
Expand All @@ -207,7 +209,7 @@ Template.accountProfile.onCreated(function() {
const instance = this;
if (!newPassword) {
return callback();
} else if (!RocketChat.settings.get('Accounts_AllowPasswordChange')) {
} else if (!settings.get('Accounts_AllowPasswordChange')) {
toastr.remove();
toastr.error(t('Password_Change_Disabled'));
instance.clearForm();
Expand All @@ -229,7 +231,7 @@ Template.accountProfile.onCreated(function() {
}));
} else {
toastr.success(t('Avatar_changed_successfully'));
RocketChat.callbacks.run('userAvatarSet', avatar.service);
callbacks.run('userAvatarSet', avatar.service);
}
});
}
Expand All @@ -239,11 +241,11 @@ Template.accountProfile.onCreated(function() {
if (typedPassword) {
data.typedPassword = typedPassword;
}
if (s.trim(self.password.get()) && RocketChat.settings.get('Accounts_AllowPasswordChange')) {
if (s.trim(self.password.get()) && settings.get('Accounts_AllowPasswordChange')) {
data.newPassword = self.password.get();
}
if (s.trim(self.realname.get()) !== user.name) {
if (!RocketChat.settings.get('Accounts_AllowRealNameChange')) {
if (!settings.get('Accounts_AllowRealNameChange')) {
toastr.remove();
toastr.error(t('RealName_Change_Disabled'));
instance.clearForm();
Expand All @@ -253,7 +255,7 @@ Template.accountProfile.onCreated(function() {
}
}
if (s.trim(self.username.get()) !== user.username) {
if (!RocketChat.settings.get('Accounts_AllowUsernameChange')) {
if (!settings.get('Accounts_AllowUsernameChange')) {
toastr.remove();
toastr.error(t('Username_Change_Disabled'));
instance.clearForm();
Expand All @@ -263,7 +265,7 @@ Template.accountProfile.onCreated(function() {
}
}
if (s.trim(self.email.get()) !== getUserEmailAddress(user)) {
if (!RocketChat.settings.get('Accounts_AllowEmailChange')) {
if (!settings.get('Accounts_AllowEmailChange')) {
toastr.remove();
toastr.error(t('Email_Change_Disabled'));
instance.clearForm();
Expand Down Expand Up @@ -299,7 +301,7 @@ Template.accountProfile.onCreated(function() {

Template.accountProfile.onRendered(function() {
Tracker.afterFlush(() => {
if (!RocketChat.settings.get('Accounts_AllowUserProfileChange')) {
if (!settings.get('Accounts_AllowUserProfileChange')) {
FlowRouter.go('home');
}
this.clearForm();
Expand All @@ -326,7 +328,7 @@ Template.accountProfile.events({
}));
} else {
toastr.success(t('Avatar_changed_successfully'));
RocketChat.callbacks.run('userAvatarSet', 'initials');
callbacks.run('userAvatarSet', 'initials');
}
});
},
Expand Down Expand Up @@ -527,7 +529,7 @@ Template.accountProfile.events({
contentType: blob.type,
blob: reader.result,
});
RocketChat.callbacks.run('userAvatarSet', 'upload');
callbacks.run('userAvatarSet', 'upload');
};
});
},
Expand Down
Loading