Remove dependency of RocketChat namespace and custom-sounds (#13136)

* Move rocketchat settings to specific package

* WIP: Move models from rocketchat-lib to a specific package (server)

* Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models

* Move client models from rocketchat:lib to rocketchat:models

* Fix lint

* Move rocketchat.info from lib to utils

* Remove directly dependency between lib and migrations

* Move statistics Model to rocketchat:models

* Create rocketchat:metrics to be able to depacking rocketchat callbacks

* Move  callbacks to specific package

* Remove unused dependency

* Move rocketchat-notifications to a specific package

* Move rocketchat-promises to a specific package

* remove directly dependency from metrics and models

* Move CachedCollection from lib to models

* Move ui models/collections from ui to models

* Move authorization client/ui models to rocketchat:models to be able to remove lib dependency

* Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz

* Move some common functions to rocketchat:utils

* Change imports to dynamic imports to avoid directly dependency between some packages

* Move authz models to rocketchat:models

* Remove directly dependency between rocketchat:authz and rocketchat:lib

* Move some functions from rocketchat:lib to rocketchat:utils

* Add functions to settings package

* Convert rocketchat:file-upload to main module structure

* Import FileUpload where it is being used

* Remove FileUpload and fileUploadHandler from globals eslintrc

* Move some  functions to rocketchat:ui-utils

* Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils

* Remove dependency between lazy-load and lib

* Change imports of renderMessageBody from ui-message to ui-utils

* Add import of main ready from ui-utils

* Convert rocketchat-ui-sidenav to main module structure

* Add imports of toolbarSearch from ui-sidenav

* Remove toolbarSearch from eslintrc globals

* Move CachedCollection to a specific package

* Change imports of CachedCollection to new package

* Move some functions to rocketchat:ui-utils

* Remove directly dependency between tooltip and lib

*  Remove directly dependency between settings and metrics

* Move some settings client function from lib to settings

* Convert rocketchat-ui-master to main module structure

* Remove directly dependency between rocketchat:e2e and rocketchat:lib

* Fix wrong import and lint

* Convert rocketchat-webrtc to main module structure

* Fix missing export

* Remove directly dependency between rocketchat:emoji and lib

* Add emoji dependencies inside RocketChat namespace

* Merge branch 'develop' into globals/move-rocketchat-callbacks

* Move some functions to utils

* Fix lint

* Move some ui functions to ui-utils

* Fix import missed objects inside RocketChat namespace

* Fix lint

* Remove rocketchat:ui package dependency of RocketChat namespace

* Remove lib dependency in rocketchat:ui-sidenav

* Remove dependency between lib and ui-vrecord

* Add logger dependency in file-upload

* Convert rocketchat:ui to main module structure

* import variables that was broken due to conversion of rocketchat:ui

* Remove globals variables from eslintrc and add some to the eslintrc of livechat app

* Remove dependency between RocketChat namespace and migrations

* Revert commented test file

* Remove dependency of RocketChat namespace and logger

* Move CustomSounds Model to rocketchat:models

* Remove dependency of RocketChat namespace and custom-sounds
pull/13137/head^2
Marcos Spessatto Defendi 6 years ago committed by Rodrigo Nascimento
parent 7ceb0a9940
commit c3c2f5a324
  1. 13
      packages/rocketchat-custom-sounds/client/admin/adminSounds.js
  2. 3
      packages/rocketchat-custom-sounds/client/admin/soundEdit.js
  3. 3
      packages/rocketchat-custom-sounds/client/admin/soundInfo.js
  4. 7
      packages/rocketchat-custom-sounds/client/admin/startup.js
  5. 3
      packages/rocketchat-custom-sounds/client/index.js
  6. 11
      packages/rocketchat-custom-sounds/client/lib/CustomSounds.js
  7. 10
      packages/rocketchat-custom-sounds/client/models/CustomSounds.js
  8. 8
      packages/rocketchat-custom-sounds/client/notifications/deleteCustomSound.js
  9. 8
      packages/rocketchat-custom-sounds/client/notifications/updateCustomSound.js
  10. 6
      packages/rocketchat-custom-sounds/package.js
  11. 1
      packages/rocketchat-custom-sounds/server/index.js
  12. 12
      packages/rocketchat-custom-sounds/server/methods/deleteCustomSound.js
  13. 16
      packages/rocketchat-custom-sounds/server/methods/insertOrUpdateSound.js
  14. 4
      packages/rocketchat-custom-sounds/server/methods/listCustomSounds.js
  15. 7
      packages/rocketchat-custom-sounds/server/methods/uploadCustomSound.js
  16. 6
      packages/rocketchat-custom-sounds/server/publications/customSounds.js
  17. 12
      packages/rocketchat-custom-sounds/server/startup/custom-sounds.js
  18. 6
      packages/rocketchat-custom-sounds/server/startup/permissions.js
  19. 4
      packages/rocketchat-custom-sounds/server/startup/settings.js
  20. 3
      packages/rocketchat-lib/client/lib/CustomSounds.js
  21. 6
      packages/rocketchat-lib/client/models/index.js
  22. 24
      packages/rocketchat-lib/server/models/index.js
  23. 2
      packages/rocketchat-models/client/index.js
  24. 10
      packages/rocketchat-models/client/models/CustomSounds.js
  25. 2
      packages/rocketchat-models/server/index.js
  26. 6
      packages/rocketchat-models/server/models/CustomSounds.js

@ -1,10 +1,9 @@
import { ReactiveVar } from 'meteor/reactive-var'; import { ReactiveVar } from 'meteor/reactive-var';
import { RocketChatTabBar } from 'meteor/rocketchat:lib'; import { RocketChatTabBar, SideNav, TabBar } from 'meteor/rocketchat:ui-utils';
import { Tracker } from 'meteor/tracker'; import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router'; import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating'; import { Template } from 'meteor/templating';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CustomSounds } from 'meteor/rocketchat:models';
import { SideNav } from 'meteor/rocketchat:ui';
import s from 'underscore.string'; import s from 'underscore.string';
Template.adminSounds.helpers({ Template.adminSounds.helpers({
@ -50,7 +49,7 @@ Template.adminSounds.onCreated(function() {
this.tabBar.showGroup(FlowRouter.current().route.name); this.tabBar.showGroup(FlowRouter.current().route.name);
this.tabBarData = new ReactiveVar(); this.tabBarData = new ReactiveVar();
RocketChat.TabBar.addButton({ TabBar.addButton({
groups: ['custom-sounds', 'custom-sounds-selected'], groups: ['custom-sounds', 'custom-sounds-selected'],
id: 'add-sound', id: 'add-sound',
i18nTitle: 'Custom_Sound_Add', i18nTitle: 'Custom_Sound_Add',
@ -63,7 +62,7 @@ Template.adminSounds.onCreated(function() {
order: 1, order: 1,
}); });
RocketChat.TabBar.addButton({ TabBar.addButton({
groups: ['custom-sounds-selected'], groups: ['custom-sounds-selected'],
id: 'admin-sound-info', id: 'admin-sound-info',
i18nTitle: 'Custom_Sound_Info', i18nTitle: 'Custom_Sound_Info',
@ -90,7 +89,7 @@ Template.adminSounds.onCreated(function() {
const limit = (instance.limit != null) ? instance.limit.get() : 0; const limit = (instance.limit != null) ? instance.limit.get() : 0;
return RocketChat.models.CustomSounds.find(query, { limit, sort: { name: 1 } }).fetch(); return CustomSounds.find(query, { limit, sort: { name: 1 } }).fetch();
}; };
}); });
@ -118,7 +117,7 @@ Template.adminSounds.events({
'click .sound-info'(e, instance) { 'click .sound-info'(e, instance) {
e.preventDefault(); e.preventDefault();
instance.tabBarData.set(RocketChat.models.CustomSounds.findOne({ _id: this._id })); instance.tabBarData.set(CustomSounds.findOne({ _id: this._id }));
instance.tabBar.showGroup('custom-sounds-selected'); instance.tabBar.showGroup('custom-sounds-selected');
instance.tabBar.open('admin-sound-info'); instance.tabBar.open('admin-sound-info');
}, },

@ -1,8 +1,7 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating'; import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n'; import { TAPi18n } from 'meteor/tap:i18n';
import { t } from 'meteor/rocketchat:utils'; import { t, handleError } from 'meteor/rocketchat:utils';
import { handleError } from 'meteor/rocketchat:lib';
import toastr from 'toastr'; import toastr from 'toastr';
import s from 'underscore.string'; import s from 'underscore.string';

@ -2,8 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var'; import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating'; import { Template } from 'meteor/templating';
import { modal } from 'meteor/rocketchat:ui'; import { modal } from 'meteor/rocketchat:ui';
import { t } from 'meteor/rocketchat:utils'; import { t, handleError } from 'meteor/rocketchat:utils';
import { handleError } from 'meteor/rocketchat:lib';
Template.soundInfo.helpers({ Template.soundInfo.helpers({
name() { name() {

@ -1,10 +1,11 @@
import { RocketChat } from 'meteor/rocketchat:lib'; import { AdminBox } from 'meteor/rocketchat:ui-utils';
import { hasAtLeastOnePermission } from 'meteor/rocketchat:authorization';
RocketChat.AdminBox.addOption({ AdminBox.addOption({
href: 'custom-sounds', href: 'custom-sounds',
i18nLabel: 'Custom_Sounds', i18nLabel: 'Custom_Sounds',
icon: 'volume', icon: 'volume',
permissionGranted() { permissionGranted() {
return RocketChat.authz.hasAtLeastOnePermission(['manage-sounds']); return hasAtLeastOnePermission(['manage-sounds']);
}, },
}); });

@ -1,5 +1,4 @@
import './lib/CustomSounds'; export { CustomSounds } from './lib/CustomSounds';
import './models/CustomSounds';
import './notifications/deleteCustomSound'; import './notifications/deleteCustomSound';
import './notifications/updateCustomSound'; import './notifications/updateCustomSound';
import './admin/adminSoundEdit.html'; import './admin/adminSoundEdit.html';

@ -1,9 +1,9 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var'; import { ReactiveVar } from 'meteor/reactive-var';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CachedCollectionManager } from 'meteor/rocketchat:ui-cached-collection';
import _ from 'underscore'; import _ from 'underscore';
class CustomSounds { class CustomSoundsClass {
constructor() { constructor() {
this.list = new ReactiveVar({}); this.list = new ReactiveVar({});
this.add({ _id: 'beep', name: 'Beep', extension: 'mp3', src: 'sounds/beep.mp3' }); this.add({ _id: 'beep', name: 'Beep', extension: 'mp3', src: 'sounds/beep.mp3' });
@ -61,14 +61,13 @@ class CustomSounds {
return _.sortBy(list, 'name'); return _.sortBy(list, 'name');
} }
} }
export const CustomSounds = new CustomSoundsClass();
RocketChat.CustomSounds = new CustomSounds;
Meteor.startup(() => Meteor.startup(() =>
RocketChat.CachedCollectionManager.onLogin(() => { CachedCollectionManager.onLogin(() => {
Meteor.call('listCustomSounds', (error, result) => { Meteor.call('listCustomSounds', (error, result) => {
for (const sound of result) { for (const sound of result) {
RocketChat.CustomSounds.add(sound); CustomSounds.add(sound);
} }
}); });
}) })

@ -1,10 +0,0 @@
import { RocketChat } from 'meteor/rocketchat:lib';
class CustomSounds extends RocketChat.models._Base {
constructor() {
super();
this._initModel('custom_sounds');
}
}
RocketChat.models.CustomSounds = new CustomSounds();

@ -1,8 +1,10 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CachedCollectionManager } from 'meteor/rocketchat:ui-cached-collection';
import { Notifications } from 'meteor/rocketchat:notifications';
import { CustomSounds } from '../lib/CustomSounds';
Meteor.startup(() => Meteor.startup(() =>
RocketChat.CachedCollectionManager.onLogin(() => CachedCollectionManager.onLogin(() =>
RocketChat.Notifications.onAll('deleteCustomSound', (data) => RocketChat.CustomSounds.remove(data.soundData)) Notifications.onAll('deleteCustomSound', (data) => CustomSounds.remove(data.soundData))
) )
); );

@ -1,8 +1,10 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CachedCollectionManager } from 'meteor/rocketchat:ui-cached-collection';
import { Notifications } from 'meteor/rocketchat:notifications';
import { CustomSounds } from '../lib/CustomSounds';
Meteor.startup(() => Meteor.startup(() =>
RocketChat.CachedCollectionManager.onLogin(() => CachedCollectionManager.onLogin(() =>
RocketChat.Notifications.onAll('updateCustomSound', (data) => RocketChat.CustomSounds.update(data.soundData)) Notifications.onAll('updateCustomSound', (data) => CustomSounds.update(data.soundData))
) )
); );

@ -9,8 +9,12 @@ Package.onUse(function(api) {
api.use([ api.use([
'ecmascript', 'ecmascript',
'rocketchat:file', 'rocketchat:file',
'rocketchat:lib',
'rocketchat:utils', 'rocketchat:utils',
'rocketchat:settings',
'rocketchat:authorization',
'rocketchat:notifications',
'rocketchat:ui-cached-collection',
'rocketchat:ui-utils',
'templating', 'templating',
'reactive-var', 'reactive-var',
'webapp', 'webapp',

@ -1,7 +1,6 @@
import './startup/custom-sounds'; import './startup/custom-sounds';
import './startup/permissions'; import './startup/permissions';
import './startup/settings'; import './startup/settings';
import './models/CustomSounds';
import './methods/deleteCustomSound'; import './methods/deleteCustomSound';
import './methods/insertOrUpdateSound'; import './methods/insertOrUpdateSound';
import './methods/listCustomSounds'; import './methods/listCustomSounds';

@ -1,13 +1,15 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CustomSounds } from 'meteor/rocketchat:models';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { Notifications } from 'meteor/rocketchat:notifications';
import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds'; import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds';
Meteor.methods({ Meteor.methods({
deleteCustomSound(_id) { deleteCustomSound(_id) {
let sound = null; let sound = null;
if (RocketChat.authz.hasPermission(this.userId, 'manage-sounds')) { if (hasPermission(this.userId, 'manage-sounds')) {
sound = RocketChat.models.CustomSounds.findOneByID(_id); sound = CustomSounds.findOneByID(_id);
} else { } else {
throw new Meteor.Error('not_authorized'); throw new Meteor.Error('not_authorized');
} }
@ -17,8 +19,8 @@ Meteor.methods({
} }
RocketChatFileCustomSoundsInstance.deleteFile(`${ sound._id }.${ sound.extension }`); RocketChatFileCustomSoundsInstance.deleteFile(`${ sound._id }.${ sound.extension }`);
RocketChat.models.CustomSounds.removeByID(_id); CustomSounds.removeByID(_id);
RocketChat.Notifications.notifyAll('deleteCustomSound', { soundData: sound }); Notifications.notifyAll('deleteCustomSound', { soundData: sound });
return true; return true;
}, },

@ -1,11 +1,13 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { hasPermission } from 'meteor/rocketchat:authorization';
import { CustomSounds } from 'meteor/rocketchat:models';
import { Notifications } from 'meteor/rocketchat:notifications';
import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds'; import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds';
import s from 'underscore.string'; import s from 'underscore.string';
Meteor.methods({ Meteor.methods({
insertOrUpdateSound(soundData) { insertOrUpdateSound(soundData) {
if (!RocketChat.authz.hasPermission(this.userId, 'manage-sounds')) { if (!hasPermission(this.userId, 'manage-sounds')) {
throw new Meteor.Error('not_authorized'); throw new Meteor.Error('not_authorized');
} }
@ -29,9 +31,9 @@ Meteor.methods({
let matchingResults = []; let matchingResults = [];
if (soundData._id) { if (soundData._id) {
matchingResults = RocketChat.models.CustomSounds.findByNameExceptID(soundData.name, soundData._id).fetch(); matchingResults = CustomSounds.findByNameExceptID(soundData.name, soundData._id).fetch();
} else { } else {
matchingResults = RocketChat.models.CustomSounds.findByName(soundData.name).fetch(); matchingResults = CustomSounds.findByName(soundData.name).fetch();
} }
if (matchingResults.length > 0) { if (matchingResults.length > 0) {
@ -45,7 +47,7 @@ Meteor.methods({
extension: soundData.extension, extension: soundData.extension,
}; };
const _id = RocketChat.models.CustomSounds.create(createSound); const _id = CustomSounds.create(createSound);
createSound._id = _id; createSound._id = _id;
return _id; return _id;
@ -56,8 +58,8 @@ Meteor.methods({
} }
if (soundData.name !== soundData.previousName) { if (soundData.name !== soundData.previousName) {
RocketChat.models.CustomSounds.setName(soundData._id, soundData.name); CustomSounds.setName(soundData._id, soundData.name);
RocketChat.Notifications.notifyAll('updateCustomSound', { soundData }); Notifications.notifyAll('updateCustomSound', { soundData });
} }
return soundData._id; return soundData._id;

@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CustomSounds } from 'meteor/rocketchat:models';
Meteor.methods({ Meteor.methods({
listCustomSounds() { listCustomSounds() {
return RocketChat.models.CustomSounds.find({}).fetch(); return CustomSounds.find({}).fetch();
}, },
}); });

@ -1,11 +1,12 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { hasPermission } from 'meteor/rocketchat:authorization';
import { Notifications } from 'meteor/rocketchat:notifications';
import { RocketChatFile } from 'meteor/rocketchat:file'; import { RocketChatFile } from 'meteor/rocketchat:file';
import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds'; import { RocketChatFileCustomSoundsInstance } from '../startup/custom-sounds';
Meteor.methods({ Meteor.methods({
uploadCustomSound(binaryContent, contentType, soundData) { uploadCustomSound(binaryContent, contentType, soundData) {
if (!RocketChat.authz.hasPermission(this.userId, 'manage-sounds')) { if (!hasPermission(this.userId, 'manage-sounds')) {
throw new Meteor.Error('not_authorized'); throw new Meteor.Error('not_authorized');
} }
@ -15,7 +16,7 @@ Meteor.methods({
RocketChatFileCustomSoundsInstance.deleteFile(`${ soundData._id }.${ soundData.extension }`); RocketChatFileCustomSoundsInstance.deleteFile(`${ soundData._id }.${ soundData.extension }`);
const ws = RocketChatFileCustomSoundsInstance.createWriteStream(`${ soundData._id }.${ soundData.extension }`, contentType); const ws = RocketChatFileCustomSoundsInstance.createWriteStream(`${ soundData._id }.${ soundData.extension }`, contentType);
ws.on('end', Meteor.bindEnvironment(() => ws.on('end', Meteor.bindEnvironment(() =>
Meteor.setTimeout(() => RocketChat.Notifications.notifyAll('updateCustomSound', { soundData }), 500) Meteor.setTimeout(() => Notifications.notifyAll('updateCustomSound', { soundData }), 500)
)); ));
rs.pipe(ws); rs.pipe(ws);

@ -1,5 +1,5 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { CustomSounds } from 'meteor/rocketchat:models';
import s from 'underscore.string'; import s from 'underscore.string';
Meteor.publish('customSounds', function(filter, limit) { Meteor.publish('customSounds', function(filter, limit) {
@ -22,8 +22,8 @@ Meteor.publish('customSounds', function(filter, limit) {
if (filter) { if (filter) {
const filterReg = new RegExp(s.escapeRegExp(filter), 'i'); const filterReg = new RegExp(s.escapeRegExp(filter), 'i');
return RocketChat.models.CustomSounds.findByName(filterReg, options); return CustomSounds.findByName(filterReg, options);
} }
return RocketChat.models.CustomSounds.find({}, options); return CustomSounds.find({}, options);
}); });

@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { WebApp } from 'meteor/webapp'; import { WebApp } from 'meteor/webapp';
import { RocketChatFile } from 'meteor/rocketchat:file'; import { RocketChatFile } from 'meteor/rocketchat:file';
import { RocketChat } from 'meteor/rocketchat:lib'; import { settings } from 'meteor/rocketchat:settings';
import _ from 'underscore'; import _ from 'underscore';
export let RocketChatFileCustomSoundsInstance; export let RocketChatFileCustomSoundsInstance;
@ -9,8 +9,8 @@ export let RocketChatFileCustomSoundsInstance;
Meteor.startup(function() { Meteor.startup(function() {
let storeType = 'GridFS'; let storeType = 'GridFS';
if (RocketChat.settings.get('CustomSounds_Storage_Type')) { if (settings.get('CustomSounds_Storage_Type')) {
storeType = RocketChat.settings.get('CustomSounds_Storage_Type'); storeType = settings.get('CustomSounds_Storage_Type');
} }
const RocketChatStore = RocketChatFile[storeType]; const RocketChatStore = RocketChatFile[storeType];
@ -22,9 +22,9 @@ Meteor.startup(function() {
console.log(`Using ${ storeType } for custom sounds storage`.green); console.log(`Using ${ storeType } for custom sounds storage`.green);
let path = '~/uploads'; let path = '~/uploads';
if (RocketChat.settings.get('CustomSounds_FileSystemPath') != null) { if (settings.get('CustomSounds_FileSystemPath') != null) {
if (RocketChat.settings.get('CustomSounds_FileSystemPath').trim() !== '') { if (settings.get('CustomSounds_FileSystemPath').trim() !== '') {
path = RocketChat.settings.get('CustomSounds_FileSystemPath'); path = settings.get('CustomSounds_FileSystemPath');
} }
} }

@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib'; import { Permissions } from 'meteor/rocketchat:models';
Meteor.startup(() => { Meteor.startup(() => {
if (RocketChat.models && RocketChat.models.Permissions) { if (Permissions) {
RocketChat.models.Permissions.createOrUpdate('manage-sounds', ['admin']); Permissions.createOrUpdate('manage-sounds', ['admin']);
} }
}); });

@ -1,6 +1,6 @@
import { RocketChat } from 'meteor/rocketchat:lib'; import { settings } from 'meteor/rocketchat:settings';
RocketChat.settings.addGroup('CustomSoundsFilesystem', function() { settings.addGroup('CustomSoundsFilesystem', function() {
this.add('CustomSounds_Storage_Type', 'GridFS', { this.add('CustomSounds_Storage_Type', 'GridFS', {
type: 'select', type: 'select',
values: [{ values: [{

@ -0,0 +1,3 @@
import { CustomSounds } from 'meteor/rocketchat:custom-sounds';
RocketChat.CustomSounds = CustomSounds;

@ -1,11 +1,9 @@
import { Avatars } from 'meteor/rocketchat:models'; import { Base as _Base, Avatars, Uploads, UserDataFiles, CustomSounds } from 'meteor/rocketchat:models';
import { Base as _Base } from 'meteor/rocketchat:models';
import { Uploads } from 'meteor/rocketchat:models';
import { UserDataFiles } from 'meteor/rocketchat:models';
Object.assign(RocketChat.models, { Object.assign(RocketChat.models, {
_Base, _Base,
Avatars, Avatars,
Uploads, Uploads,
UserDataFiles, UserDataFiles,
CustomSounds,
}); });

@ -1,14 +1,17 @@
import { Avatars } from 'meteor/rocketchat:models'; import {
Avatars,
ExportOperations,
Messages,
Reports,
Rooms,
Settings,
Subscriptions,
Uploads,
UserDataFiles,
Users,
CustomSounds,
} from 'meteor/rocketchat:models';
import { Base as _Base } from 'meteor/rocketchat:models'; import { Base as _Base } from 'meteor/rocketchat:models';
import { ExportOperations } from 'meteor/rocketchat:models';
import { Messages } from 'meteor/rocketchat:models';
import { Reports } from 'meteor/rocketchat:models';
import { Rooms } from 'meteor/rocketchat:models';
import { Settings } from 'meteor/rocketchat:models';
import { Subscriptions } from 'meteor/rocketchat:models';
import { Uploads } from 'meteor/rocketchat:models';
import { UserDataFiles } from 'meteor/rocketchat:models';
import { Users } from 'meteor/rocketchat:models';
Object.assign(RocketChat.models, { Object.assign(RocketChat.models, {
_Base, _Base,
@ -22,4 +25,5 @@ Object.assign(RocketChat.models, {
Uploads, Uploads,
UserDataFiles, UserDataFiles,
Users, Users,
CustomSounds,
}); });

@ -17,6 +17,7 @@ import { RoomRoles } from './models/RoomRoles';
import { UserAndRoom } from './models/UserAndRoom'; import { UserAndRoom } from './models/UserAndRoom';
import { UserRoles } from './models/UserRoles'; import { UserRoles } from './models/UserRoles';
import { AuthzCachedCollection, ChatPermissions } from './models/ChatPermissions'; import { AuthzCachedCollection, ChatPermissions } from './models/ChatPermissions';
import CustomSounds from './models/CustomSounds';
import _ from 'underscore'; import _ from 'underscore';
const Users = _.extend({}, users, Meteor.users); const Users = _.extend({}, users, Meteor.users);
@ -47,4 +48,5 @@ export {
ChatMessage, ChatMessage,
ChatSubscription, ChatSubscription,
Rooms, Rooms,
CustomSounds,
}; };

@ -0,0 +1,10 @@
import { Base } from './_Base';
export class CustomSounds extends Base {
constructor() {
super();
this._initModel('custom_sounds');
}
}
export default new CustomSounds();

@ -13,6 +13,7 @@ import Users from './models/Users';
import Statistics from './models/Statistics'; import Statistics from './models/Statistics';
import Permissions from './models/Permissions'; import Permissions from './models/Permissions';
import Roles from './models/Roles'; import Roles from './models/Roles';
import CustomSounds from './models/CustomSounds';
export { export {
Base, Base,
@ -30,4 +31,5 @@ export {
Statistics, Statistics,
Permissions, Permissions,
Roles, Roles,
CustomSounds,
}; };

@ -1,6 +1,6 @@
import { RocketChat } from 'meteor/rocketchat:lib'; import { Base } from './_Base';
class CustomSounds extends RocketChat.models._Base { class CustomSounds extends Base {
constructor() { constructor() {
super('custom_sounds'); super('custom_sounds');
@ -53,4 +53,4 @@ class CustomSounds extends RocketChat.models._Base {
} }
} }
RocketChat.models.CustomSounds = new CustomSounds(); export default new CustomSounds();
Loading…
Cancel
Save