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-soundspull/13137/head^2
parent
7ceb0a9940
commit
c3c2f5a324
@ -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', |
||||
i18nLabel: 'Custom_Sounds', |
||||
icon: 'volume', |
||||
permissionGranted() { |
||||
return RocketChat.authz.hasAtLeastOnePermission(['manage-sounds']); |
||||
return hasAtLeastOnePermission(['manage-sounds']); |
||||
}, |
||||
}); |
||||
|
@ -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 { 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(() => |
||||
RocketChat.CachedCollectionManager.onLogin(() => |
||||
RocketChat.Notifications.onAll('deleteCustomSound', (data) => RocketChat.CustomSounds.remove(data.soundData)) |
||||
CachedCollectionManager.onLogin(() => |
||||
Notifications.onAll('deleteCustomSound', (data) => CustomSounds.remove(data.soundData)) |
||||
) |
||||
); |
||||
|
@ -1,8 +1,10 @@ |
||||
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(() => |
||||
RocketChat.CachedCollectionManager.onLogin(() => |
||||
RocketChat.Notifications.onAll('updateCustomSound', (data) => RocketChat.CustomSounds.update(data.soundData)) |
||||
CachedCollectionManager.onLogin(() => |
||||
Notifications.onAll('updateCustomSound', (data) => CustomSounds.update(data.soundData)) |
||||
) |
||||
); |
||||
|
@ -1,8 +1,8 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { RocketChat } from 'meteor/rocketchat:lib'; |
||||
import { CustomSounds } from 'meteor/rocketchat:models'; |
||||
|
||||
Meteor.methods({ |
||||
listCustomSounds() { |
||||
return RocketChat.models.CustomSounds.find({}).fetch(); |
||||
return CustomSounds.find({}).fetch(); |
||||
}, |
||||
}); |
||||
|
@ -1,8 +1,8 @@ |
||||
import { Meteor } from 'meteor/meteor'; |
||||
import { RocketChat } from 'meteor/rocketchat:lib'; |
||||
import { Permissions } from 'meteor/rocketchat:models'; |
||||
|
||||
Meteor.startup(() => { |
||||
if (RocketChat.models && RocketChat.models.Permissions) { |
||||
RocketChat.models.Permissions.createOrUpdate('manage-sounds', ['admin']); |
||||
if (Permissions) { |
||||
Permissions.createOrUpdate('manage-sounds', ['admin']); |
||||
} |
||||
}); |
||||
|
@ -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 } from 'meteor/rocketchat:models'; |
||||
import { Uploads } from 'meteor/rocketchat:models'; |
||||
import { UserDataFiles } from 'meteor/rocketchat:models'; |
||||
import { Base as _Base, Avatars, Uploads, UserDataFiles, CustomSounds } from 'meteor/rocketchat:models'; |
||||
|
||||
Object.assign(RocketChat.models, { |
||||
_Base, |
||||
Avatars, |
||||
Uploads, |
||||
UserDataFiles, |
||||
CustomSounds, |
||||
}); |
||||
|
@ -0,0 +1,10 @@ |
||||
import { Base } from './_Base'; |
||||
|
||||
export class CustomSounds extends Base { |
||||
constructor() { |
||||
super(); |
||||
this._initModel('custom_sounds'); |
||||
} |
||||
} |
||||
|
||||
export default new CustomSounds(); |
Loading…
Reference in new issue