Remove directly dependency between lib and e2e (#13115)
* 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 * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lintpull/13117/head^2
parent
deae2a43dc
commit
e8f05c2702
@ -1,15 +0,0 @@ |
||||
import { RocketChat } from 'meteor/rocketchat:lib'; |
||||
|
||||
RocketChat.models.Rooms.setE2eKeyId = function(_id, e2eKeyId, options) { |
||||
const query = { |
||||
_id, |
||||
}; |
||||
|
||||
const update = { |
||||
$set: { |
||||
e2eKeyId, |
||||
}, |
||||
}; |
||||
|
||||
return this.update(query, update, options); |
||||
}; |
@ -1,40 +0,0 @@ |
||||
import { RocketChat } from 'meteor/rocketchat:lib'; |
||||
|
||||
RocketChat.models.Subscriptions.updateGroupE2EKey = function(_id, key) { |
||||
const query = { _id }; |
||||
const update = { $set: { E2EKey: key } }; |
||||
this.update(query, update); |
||||
return this.findOne({ _id }); |
||||
}; |
||||
|
||||
RocketChat.models.Subscriptions.findByRidWithoutE2EKey = function(rid, options) { |
||||
const query = { |
||||
rid, |
||||
E2EKey: { |
||||
$exists: false, |
||||
}, |
||||
}; |
||||
|
||||
return this.find(query, options); |
||||
}; |
||||
|
||||
RocketChat.models.Subscriptions.resetUserE2EKey = function(userId) { |
||||
this.update({ 'u._id': userId }, { |
||||
$unset: { |
||||
E2EKey: '', |
||||
}, |
||||
}, { |
||||
multi: true, |
||||
}); |
||||
}; |
||||
|
||||
RocketChat.models.Subscriptions.findByUserIdWithoutE2E = function(userId, options) { |
||||
const query = { |
||||
'u._id': userId, |
||||
E2EKey: { |
||||
$exists: false, |
||||
}, |
||||
}; |
||||
|
||||
return this.find(query, options); |
||||
}; |
@ -1,44 +0,0 @@ |
||||
import { RocketChat } from 'meteor/rocketchat:lib'; |
||||
|
||||
RocketChat.models.Users.setE2EPublicAndPivateKeysByUserId = function(userId, { public_key, private_key }) { |
||||
this.update({ _id: userId }, { |
||||
$set: { |
||||
'e2e.public_key': public_key, |
||||
'e2e.private_key': private_key, |
||||
}, |
||||
}); |
||||
}; |
||||
|
||||
RocketChat.models.Users.fetchKeysByUserId = function(userId) { |
||||
const user = this.findOne({ _id: userId }, { fields: { e2e: 1 } }); |
||||
|
||||
if (!user || !user.e2e || !user.e2e.public_key) { |
||||
return {}; |
||||
} |
||||
|
||||
return { |
||||
public_key: user.e2e.public_key, |
||||
private_key: user.e2e.private_key, |
||||
}; |
||||
}; |
||||
|
||||
RocketChat.models.Users.findByIdsWithPublicE2EKey = function(ids, options) { |
||||
const query = { |
||||
_id: { |
||||
$in: ids, |
||||
}, |
||||
'e2e.public_key': { |
||||
$exists: 1, |
||||
}, |
||||
}; |
||||
|
||||
return this.find(query, options); |
||||
}; |
||||
|
||||
RocketChat.models.Users.resetE2EKey = function(userId) { |
||||
this.update({ _id: userId }, { |
||||
$unset: { |
||||
e2e: '', |
||||
}, |
||||
}); |
||||
}; |
Loading…
Reference in new issue