mirror of
https://github.com/YunoHost-Apps/rocketchat_ynh.git
synced 2024-09-03 20:16:25 +02:00
Updates to rocket.chat 0.57.2
Adds minor improvements Updates to rocket.chat 0.57.2 Adds ci routine
This commit is contained in:
parent
0f6decb84c
commit
cdb11b1723
15010 changed files with 46 additions and 1859897 deletions
15
.travis.yml
Normal file
15
.travis.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
dist: trusty
|
||||
sudo: required
|
||||
|
||||
language: node_js
|
||||
|
||||
before_install:
|
||||
- sudo apt-get install git dialog
|
||||
- git clone https://github.com/YunoHost/install_script /tmp/install_script
|
||||
- echo "yunohost_${TRAVIS_BUILD_ID}" | passwd --stdin root
|
||||
- cd /tmp/install_script && sudo ./install_yunohost
|
||||
- git clone https://github.com/YunoHost/package_linter /tmp/packge_linter
|
||||
|
||||
script:
|
||||
- /tmp/package_linter.py ./
|
||||
- yunohost app install ./
|
|
@ -1,18 +1,22 @@
|
|||
{
|
||||
"package_format": 1,
|
||||
"name": "Rocketchat",
|
||||
"name": "RocketChat",
|
||||
"id": "rocketchat",
|
||||
"description": {
|
||||
"en": "online editor providing collaborative editing in really real-time"
|
||||
"en": "the ultimate chat platform"
|
||||
},
|
||||
"developer": {
|
||||
"name": "realitygaps",
|
||||
"email": "realitygaps@yahoo.com",
|
||||
"url": "http://rocket.chat"
|
||||
"maintainer": {
|
||||
"name": "selamanse",
|
||||
"email": "selamanse@scheinfrei.info",
|
||||
"url": "https://github.com/selamanse"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"multi_instance": "false",
|
||||
"services": [
|
||||
"nginx",
|
||||
"mongodb"
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.4.0"
|
||||
"yunohost": ">> 2.5.6"
|
||||
},
|
||||
"arguments": {
|
||||
"install" : [
|
||||
|
@ -31,10 +35,6 @@
|
|||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#Retrieve arguments
|
||||
domain=$1
|
||||
is_public=$2
|
||||
ROCKETCHAT_VERSION=0.57.2
|
||||
NODE_VERSION=4.7.1
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain -a rocketchat
|
||||
|
@ -13,23 +15,18 @@ fi
|
|||
# Save specific settings
|
||||
sudo yunohost app setting rocketchat is_public -v $is_public
|
||||
|
||||
|
||||
#Install dependencies
|
||||
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
|
||||
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org curl graphicsmagick
|
||||
sudo apt-get install -y npm
|
||||
sudo npm install -g n
|
||||
sudo apt-get install -y mongodb-org gunzip curl graphicsmagick npm n
|
||||
|
||||
# Meteor needs at least this version of node to work.
|
||||
sudo n 0.10.40
|
||||
sudo n $NODE_VERSION
|
||||
|
||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||
sed -i "s@CHANGEMETOROOTURL@$domain/@g" ../conf/Rocketchat.service
|
||||
|
||||
|
||||
sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/rocketchat.conf
|
||||
|
||||
pkgdir=$(pwd)
|
||||
|
@ -37,7 +34,11 @@ pkgdir=$(pwd)
|
|||
# Copy files to the right place
|
||||
final_path=/var/www/rocketchat
|
||||
sudo mkdir -p $final_path
|
||||
sudo cp -a ../sources/* $final_path
|
||||
|
||||
# download and extract rocketchat
|
||||
cd /tmp && curl -sO https://rocket.chat/releases/$ROCKETCHAT_VERSION/download
|
||||
cd $final_path && gunzip -c /tmp/rocket.chat-$ROCKETCHAT_VERSION.gtar | tar xvf -
|
||||
cd $final_path && rm -r PaxHeader && mv bundle/** .
|
||||
|
||||
sudo cp ../conf/Rocketchat.service /etc/systemd/system/
|
||||
|
||||
|
@ -49,8 +50,6 @@ cd $final_path/
|
|||
|
||||
sudo chown -R www-data: $final_path
|
||||
|
||||
|
||||
|
||||
sudo service nginx reload
|
||||
if [ "$is_public" = "Yes" ];
|
||||
then
|
||||
|
@ -66,6 +65,3 @@ cd $pkgdir
|
|||
sudo mongo < ../conf/rocketchat_ldap.js
|
||||
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#!/bin/bash
|
||||
ROCKETCHAT_VERSION=0.57.2
|
||||
NODE_VERSION=4.7.1
|
||||
|
||||
sudo systemctl stop Rocketchat.service
|
||||
|
||||
sudo m -rf /var/www/rocketchat/*
|
||||
sudo cp -r ../sources/* /var/www/rocketchat/*
|
||||
|
||||
sudo n $NODE_VERSION
|
||||
|
||||
# download and extract rocketchat
|
||||
cd /tmp && curl -sO https://rocket.chat/releases/$ROCKETCHAT_VERSION/download
|
||||
cd $final_path && gunzip -c /tmp/rocket.chat-$ROCKETCHAT_VERSION.gtar | tar xvf -
|
||||
cd $final_path && rm -r PaxHeader && mv bundle/** .
|
||||
|
||||
sudo systemctl start Rocketchat.service
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
This is a Meteor application bundle. It has only one external dependency:
|
||||
Node.js 0.10.40 or newer. To run the application:
|
||||
|
||||
$ (cd programs/server && npm install)
|
||||
$ export MONGO_URL='mongodb://user:password@host:port/databasename'
|
||||
$ export ROOT_URL='http://example.com'
|
||||
$ export MAIL_URL='smtp://user:password@mailhost:port/'
|
||||
$ node main.js
|
||||
|
||||
Use the PORT environment variable to set the port where the
|
||||
application will listen. The default is 80, but that will require
|
||||
root on most systems.
|
||||
|
||||
Find out more about Meteor at meteor.com.
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
// The debugger pauses here when you run `meteor debug`, because this is
|
||||
// the very first code to be executed by the server process. If you have
|
||||
// not already added any `debugger` statements to your code, feel free to
|
||||
// do so now, wait for the server to restart, then reload this page and
|
||||
// click the |▶ button to continue.
|
||||
process.argv.splice(2, 0, 'program.json');
|
||||
process.chdir(require('path').join(__dirname, 'programs', 'server'));
|
||||
require('./programs/server/boot.js');
|
|
@ -1,18 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// lib/RegExp.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
RegExp.escape = function(s) { // 1
|
||||
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); // 2
|
||||
}; // 1
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=RegExp.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/lib/RegExp.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,MAAP,GAAgB,SAAC,CAAD;AACf,SAAO,CAAC,CAAC,OAAF,CAAU,wBAAV,EAAoC,MAApC,CAAP,CADe;AAAA,CAAhB","file":"/lib/RegExp.coffee.js","sourcesContent":["RegExp.escape = (s) ->\n\treturn s.replace /[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'"]}
|
|
@ -1,106 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// lib/fileUpload.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var initFileStore; // 1
|
||||
//
|
||||
if (typeof UploadFS !== "undefined" && UploadFS !== null) { // 1
|
||||
RocketChat.models.Uploads.model.allow({ // 2
|
||||
insert: function(userId, doc) { // 3
|
||||
return userId; // 4
|
||||
}, //
|
||||
update: function(userId, doc) { // 3
|
||||
return userId === doc.userId; // 7
|
||||
}, //
|
||||
remove: function(userId, doc) { // 3
|
||||
return userId === doc.userId; // 10
|
||||
} //
|
||||
}); //
|
||||
initFileStore = function() { // 2
|
||||
var cookie; // 13
|
||||
cookie = new Cookies(); // 13
|
||||
if (Meteor.isClient) { // 14
|
||||
cookie.set('rc_uid', Meteor.userId()); // 15
|
||||
cookie.set('rc_token', Meteor._localStorage.getItem('Meteor.loginToken'));
|
||||
cookie.send(); // 15
|
||||
} //
|
||||
return Meteor.fileStore = new UploadFS.store.GridFS({ //
|
||||
collection: RocketChat.models.Uploads.model, // 20
|
||||
name: 'rocketchat_uploads', // 20
|
||||
collectionName: 'rocketchat_uploads', // 20
|
||||
filter: new UploadFS.Filter({ // 20
|
||||
onCheck: FileUpload.validateFileUpload // 24
|
||||
}), //
|
||||
transformWrite: function(readStream, writeStream, fileId, file) {
|
||||
var identify, stream; // 26
|
||||
if (RocketChatFile.enabled === false || !/^image\/.+/.test(file.type)) {
|
||||
return readStream.pipe(writeStream); // 27
|
||||
} //
|
||||
stream = void 0; // 26
|
||||
identify = function(err, data) { // 26
|
||||
var ref; // 32
|
||||
if (err != null) { // 32
|
||||
return stream.pipe(writeStream); // 33
|
||||
} //
|
||||
file.identify = { // 32
|
||||
format: data.format, // 36
|
||||
size: data.size // 36
|
||||
}; //
|
||||
if ((data.Orientation != null) && ((ref = data.Orientation) !== '' && ref !== 'Unknown' && ref !== 'Undefined')) {
|
||||
return RocketChatFile.gm(stream).autoOrient().stream().pipe(writeStream);
|
||||
} else { //
|
||||
return stream.pipe(writeStream); //
|
||||
} //
|
||||
}; //
|
||||
return stream = RocketChatFile.gm(readStream).identify(identify).stream();
|
||||
}, //
|
||||
onRead: function(fileId, file, req, res) { // 20
|
||||
var rawCookies, ref, token, uid; // 47
|
||||
if (RocketChat.settings.get('FileUpload_ProtectFiles')) { // 47
|
||||
if ((req != null ? (ref = req.headers) != null ? ref.cookie : void 0 : void 0) != null) {
|
||||
rawCookies = req.headers.cookie; // 48
|
||||
} //
|
||||
if (rawCookies != null) { // 49
|
||||
uid = cookie.get('rc_uid', rawCookies); // 49
|
||||
} //
|
||||
if (rawCookies != null) { // 50
|
||||
token = cookie.get('rc_token', rawCookies); // 50
|
||||
} //
|
||||
if (uid == null) { // 52
|
||||
uid = req.query.rc_uid; // 53
|
||||
token = req.query.rc_token; // 53
|
||||
} //
|
||||
if (!(uid && token && RocketChat.models.Users.findOneByIdAndLoginToken(uid, token))) {
|
||||
res.writeHead(403); // 57
|
||||
return false; // 58
|
||||
} //
|
||||
} //
|
||||
res.setHeader('content-disposition', "attachment; filename=\"" + (encodeURIComponent(file.name)) + "\"");
|
||||
return true; // 61
|
||||
} //
|
||||
}); //
|
||||
}; //
|
||||
Meteor.startup(function() { // 2
|
||||
if (Meteor.isServer) { // 64
|
||||
return initFileStore(); //
|
||||
} else { //
|
||||
return Tracker.autorun(function(c) { //
|
||||
if (Meteor.userId() && RocketChat.settings.subscription.ready()) {
|
||||
initFileStore(); // 69
|
||||
return c.stop(); //
|
||||
} //
|
||||
}); //
|
||||
} //
|
||||
}); //
|
||||
} //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=fileUpload.coffee.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,18 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// lib/francocatena_fix.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
this.i18n_status_func = function(key, options) { // 1
|
||||
return TAPi18n.__(key, options); // 2
|
||||
}; // 1
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=francocatena_fix.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/lib/francocatena_fix.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,IAAC,iBAAD,GAAoB,SAAC,GAAD,EAAK,OAAL;AACnB,SAAO,OAAO,CAAC,EAAR,CAAW,GAAX,EAAe,OAAf,CAAP,CADmB;AAAA,CAApB","file":"/lib/francocatena_fix.coffee.js","sourcesContent":["@i18n_status_func = (key,options) ->\n\treturn TAPi18n.__(key,options)\n"]}
|
12
sources/programs/server/app/lib/ua-parser.min.js
vendored
12
sources/programs/server/app/lib/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,33 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// lib/underscore.string.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var mixin; // 6
|
||||
//
|
||||
mixin = function(obj) { // 6
|
||||
return _.each(_.functions(obj), function(name) { //
|
||||
var func; // 8
|
||||
if (!_[name] && (_.prototype[name] == null)) { // 8
|
||||
func = _[name] = obj[name]; // 9
|
||||
return _.prototype[name] = function() { //
|
||||
var args; // 11
|
||||
args = [this._wrapped]; // 11
|
||||
push.apply(args, arguments); // 11
|
||||
return result.call(this, func.apply(_, args)); // 13
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
}; // 6
|
||||
//
|
||||
mixin(s.exports()); // 6
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=underscore.string.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/lib/underscore.string.coffee"],"names":[],"mappings":";;;;;;;;;AAKA;;AAAA,QAAQ,SAAC,GAAD;SACP,CAAC,CAAC,IAAF,CAAO,CAAC,CAAC,SAAF,CAAY,GAAZ,CAAP,EAAyB,SAAC,IAAD;AACxB;AAAA,QAAG,EAAM,MAAN,IAAoB,2BAAvB;AACC,aAAO,CAAE,MAAF,GAAU,GAAI,MAArB;aACA,CAAC,CAAC,SAAU,MAAZ,GAAoB;AACnB;AAAA,eAAO,CAAC,IAAI,CAAC,QAAN,CAAP;AAAA,QACA,IAAI,CAAC,KAAL,CAAW,IAAX,EAAiB,SAAjB,CADA;AAEA,eAAO,MAAM,CAAC,IAAP,CAAY,IAAZ,EAAkB,IAAI,CAAC,KAAL,CAAW,CAAX,EAAc,IAAd,CAAlB,CAAP,CAHmB;MAAA,EAFrB;KADwB;EAAA,CAAzB,EADO;AAAA,CAAR;;AAAA,KASA,CAAM,CAAC,CAAC,OAAF,EAAN,CATA","file":"/lib/underscore.string.coffee.js","sourcesContent":["# This will add underscore.string methods to Underscore.js\n# except for include, contains, reverse and join that are \n# dropped because they collide with the functions already \n# defined by Underscore.js.\n\nmixin = (obj) ->\n\t_.each _.functions(obj), (name) ->\n\t\tif not _[name] and not _.prototype[name]?\n\t\t\tfunc = _[name] = obj[name]\n\t\t\t_.prototype[name] = ->\n\t\t\t\targs = [this._wrapped]\n\t\t\t\tpush.apply(args, arguments)\n\t\t\t\treturn result.call(this, func.apply(_, args))\n\nmixin(s.exports())"]}
|
|
@ -1,57 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/configuration/accounts_meld.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var orig_updateOrCreateUserFromExternalService; // 1
|
||||
//
|
||||
orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService;
|
||||
//
|
||||
Accounts.updateOrCreateUserFromExternalService = function(serviceName, serviceData, options) {
|
||||
var email, i, len, ref, user; // 4
|
||||
if ((serviceName !== 'facebook' && serviceName !== 'github' && serviceName !== 'gitlab' && serviceName !== 'google' && serviceName !== 'meteor-developer' && serviceName !== 'linkedin' && serviceName !== 'twitter' && serviceName !== 'sandstorm') && serviceData._OAuthCustom !== true) {
|
||||
return; // 5
|
||||
} //
|
||||
if (serviceName === 'meteor-developer') { // 7
|
||||
if (_.isArray(serviceData != null ? serviceData.emails : void 0)) {
|
||||
serviceData.emails.sort(function(a, b) { // 9
|
||||
return a.primary !== true; // 10
|
||||
}); //
|
||||
ref = serviceData.emails; // 12
|
||||
for (i = 0, len = ref.length; i < len; i++) { // 12
|
||||
email = ref[i]; //
|
||||
if (email.verified === true) { // 13
|
||||
serviceData.email = email.address; // 14
|
||||
break; // 15
|
||||
} //
|
||||
} // 12
|
||||
} //
|
||||
} //
|
||||
if (serviceName === 'linkedin') { // 17
|
||||
serviceData.email = serviceData.emailAddress; // 18
|
||||
} //
|
||||
if (serviceData.email) { // 20
|
||||
user = RocketChat.models.Users.findOneByEmailAddress(serviceData.email);
|
||||
if (user != null) { // 24
|
||||
if (!_.findWhere(user.emails, { // 26
|
||||
address: serviceData.email, // 26
|
||||
verified: true // 26
|
||||
})) { //
|
||||
RocketChat.models.Users.resetPasswordAndSetRequirePasswordChange(user._id, true, 'This_email_has_already_been_used_and_has_not_been_verified__Please_change_your_password');
|
||||
} //
|
||||
RocketChat.models.Users.setServiceId(user._id, serviceName, serviceData.id);
|
||||
RocketChat.models.Users.setEmailVerified(user._id, serviceData.email);
|
||||
} //
|
||||
} //
|
||||
return orig_updateOrCreateUserFromExternalService.apply(this, arguments);
|
||||
}; // 2
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=accounts_meld.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources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A,MAIA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,YAAxB,CAAqC,IAAI,CAAC,GAA1C,EAA+C,WAA/C,EAA4D,WAAW,CAAC,EAAxE,CAJA;AAAA,MAOA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAxB,CAAyC,IAAI,CAAC,GAA9C,EAAmD,WAAW,CAAC,KAA/D,CAPA,CAFD;KAJD;GAhBA;AA+BA,SAAO,0CAA0C,CAAC,KAA3C,CAAiD,IAAjD,EAAuD,SAAvD,CAAP,CAjCgD;AAAA,CADjD","file":"/server/configuration/accounts_meld.coffee.js","sourcesContent":["orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService\nAccounts.updateOrCreateUserFromExternalService = (serviceName, serviceData, options) ->\n\n\tif serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._OAuthCustom isnt true\n\t\treturn\n\n\tif serviceName is 'meteor-developer'\n\t\tif _.isArray serviceData?.emails\n\t\t\tserviceData.emails.sort (a, b) ->\n\t\t\t\treturn a.primary isnt true\n\n\t\t\tfor email in serviceData.emails\n\t\t\t\tif email.verified is true\n\t\t\t\t\tserviceData.email = email.address\n\t\t\t\t\tbreak\n\n\tif serviceName is 'linkedin'\n\t\tserviceData.email = serviceData.emailAddress\n\n\tif serviceData.email\n\n\t\t# Find user with given email\n\t\tuser = RocketChat.models.Users.findOneByEmailAddress serviceData.email\n\t\tif user?\n\t\t\t# If e-mail is not verified, reset password and require password change\n\t\t\tif not _.findWhere user.emails, { address: serviceData.email, verified: true }\n\t\t\t\tRocketChat.models.Users.resetPasswordAndSetRequirePasswordChange(user._id, true, 'This_email_has_already_been_used_and_has_not_been_verified__Please_change_your_password')\n\n\t\t\t# Merge accounts\n\t\t\tRocketChat.models.Users.setServiceId user._id, serviceName, serviceData.id\n\n\t\t\t# Validate e-mail\n\t\t\tRocketChat.models.Users.setEmailVerified user._id, serviceData.email\n\n\treturn orig_updateOrCreateUserFromExternalService.apply(this, arguments)\n"]}
|
|
@ -1,177 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/lib/accounts.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var accountsConfig, resetPasswordText, verifyEmailText, // 2
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
//
|
||||
accountsConfig = { // 2
|
||||
forbidClientAccountCreation: true, // 2
|
||||
loginExpirationInDays: RocketChat.settings.get('Accounts_LoginExpiration')
|
||||
}; //
|
||||
//
|
||||
Accounts.config(accountsConfig); // 2
|
||||
//
|
||||
RocketChat.settings.get('Accounts_AllowedDomainsList', function(_id, value) {
|
||||
var domainWhiteList, restrictCreationByEmailDomain; // 6
|
||||
domainWhiteList = _.map(value.split(','), function(domain) { // 6
|
||||
return domain.trim(); //
|
||||
}); //
|
||||
restrictCreationByEmailDomain = domainWhiteList.length === 1 ? domainWhiteList[0] : function(email) {
|
||||
var domain, i, len, ret; // 8
|
||||
ret = false; // 8
|
||||
for (i = 0, len = domainWhiteList.length; i < len; i++) { // 9
|
||||
domain = domainWhiteList[i]; //
|
||||
if (email.match('@' + RegExp.escape(domain) + '$')) { // 10
|
||||
ret = true; // 11
|
||||
break; // 12
|
||||
} //
|
||||
} // 9
|
||||
return ret; // 14
|
||||
}; //
|
||||
delete Accounts._options['restrictCreationByEmailDomain']; // 6
|
||||
if (!_.isEmpty(value)) { // 17
|
||||
return Accounts.config({ //
|
||||
restrictCreationByEmailDomain: restrictCreationByEmailDomain // 18
|
||||
}); //
|
||||
} //
|
||||
}); // 5
|
||||
//
|
||||
Accounts.emailTemplates.siteName = RocketChat.settings.get('Site_Name');
|
||||
//
|
||||
Accounts.emailTemplates.from = (RocketChat.settings.get('Site_Name')) + " <" + (RocketChat.settings.get('From_Email')) + ">";
|
||||
//
|
||||
verifyEmailText = Accounts.emailTemplates.verifyEmail.text; // 2
|
||||
//
|
||||
Accounts.emailTemplates.verifyEmail.text = function(user, url) { // 2
|
||||
url = url.replace(Meteor.absoluteUrl(), Meteor.absoluteUrl() + 'login/');
|
||||
return verifyEmailText(user, url); //
|
||||
}; // 24
|
||||
//
|
||||
resetPasswordText = Accounts.emailTemplates.resetPassword.text; // 2
|
||||
//
|
||||
Accounts.emailTemplates.resetPassword.text = function(user, url) { // 2
|
||||
url = url.replace(/\/#\//, '/'); // 30
|
||||
return resetPasswordText(user, url); //
|
||||
}; // 29
|
||||
//
|
||||
if (RocketChat.settings.get('Accounts_Enrollment_Email')) { // 33
|
||||
Accounts.emailTemplates.enrollAccount.text = function(user, url) { // 34
|
||||
var ref, ref1, text; // 35
|
||||
text = RocketChat.settings.get('Accounts_Enrollment_Email'); // 35
|
||||
text = text.replace(/\[name\]/g, user.name || ''); // 35
|
||||
text = text.replace(/\[fname\]/g, _.strLeft(user.name, ' ') || '');
|
||||
text = text.replace(/\[lname\]/g, _.strRightBack(user.name, ' ') || '');
|
||||
text = text.replace(/\[email\]/g, ((ref = user.emails) != null ? (ref1 = ref[0]) != null ? ref1.address : void 0 : void 0) || '');
|
||||
return text; // 42
|
||||
}; //
|
||||
} //
|
||||
//
|
||||
Accounts.onCreateUser(function(options, user) { // 2
|
||||
var ref, ref1, ref2, service, serviceName; // 49
|
||||
RocketChat.callbacks.run('beforeCreateUser', options, user); // 49
|
||||
user.status = 'offline'; // 49
|
||||
user.active = !RocketChat.settings.get('Accounts_ManuallyApproveNewUsers');
|
||||
if (((user != null ? user.name : void 0) == null) || user.name === '') {
|
||||
if (((ref = options.profile) != null ? ref.name : void 0) != null) {
|
||||
user.name = (ref1 = options.profile) != null ? ref1.name : void 0;
|
||||
} //
|
||||
} //
|
||||
if (user.services != null) { // 58
|
||||
ref2 = user.services; // 59
|
||||
for (serviceName in ref2) { // 59
|
||||
service = ref2[serviceName]; //
|
||||
if (((user != null ? user.name : void 0) == null) || user.name === '') {
|
||||
if (service.name != null) { // 61
|
||||
user.name = service.name; // 62
|
||||
} else if (service.username != null) { //
|
||||
user.name = service.username; // 64
|
||||
} //
|
||||
} //
|
||||
if ((user.emails == null) && (service.email != null)) { // 66
|
||||
user.emails = [ // 67
|
||||
{ //
|
||||
address: service.email, // 68
|
||||
verified: true // 68
|
||||
} //
|
||||
]; //
|
||||
} //
|
||||
} // 59
|
||||
} //
|
||||
return user; // 72
|
||||
}); // 44
|
||||
//
|
||||
Accounts.insertUserDoc = _.wrap(Accounts.insertUserDoc, function(insertUserDoc, options, user) {
|
||||
var _id, hasAdmin, roles; // 76
|
||||
roles = []; // 76
|
||||
if (Match.test(user.globalRoles, [String]) && user.globalRoles.length > 0) {
|
||||
roles = roles.concat(user.globalRoles); // 78
|
||||
} //
|
||||
delete user.globalRoles; // 76
|
||||
if (user.type == null) { //
|
||||
user.type = 'user'; //
|
||||
} //
|
||||
_id = insertUserDoc.call(Accounts, options, user); // 76
|
||||
if (roles.length === 0) { // 86
|
||||
hasAdmin = RocketChat.models.Users.findOne({ // 88
|
||||
roles: 'admin' // 88
|
||||
}, { //
|
||||
fields: { // 88
|
||||
_id: 1 // 88
|
||||
} //
|
||||
}); //
|
||||
if (hasAdmin != null) { // 89
|
||||
roles.push('user'); // 90
|
||||
} else { //
|
||||
roles.push('admin'); // 92
|
||||
} //
|
||||
} //
|
||||
RocketChat.authz.addUserRoles(_id, roles); // 76
|
||||
RocketChat.callbacks.run('afterCreateUser', options, user); // 76
|
||||
return _id; // 97
|
||||
}); // 75
|
||||
//
|
||||
Accounts.validateLoginAttempt(function(login) { // 2
|
||||
var ref, ref1, validEmail; // 100
|
||||
login = RocketChat.callbacks.run('beforeValidateLogin', login); // 100
|
||||
if (login.allowed !== true) { // 102
|
||||
return login.allowed; // 103
|
||||
} //
|
||||
if (!!((ref = login.user) != null ? ref.active : void 0) !== true) {
|
||||
throw new Meteor.Error('inactive-user', TAPi18n.__('User_is_not_activated'));
|
||||
return false; // 107
|
||||
} //
|
||||
if (indexOf.call((ref1 = login.user) != null ? ref1.roles : void 0, 'admin') < 0 && login.type === 'password' && RocketChat.settings.get('Accounts_EmailVerification') === true) {
|
||||
validEmail = login.user.emails.filter(function(email) { // 111
|
||||
return email.verified === true; // 112
|
||||
}); //
|
||||
if (validEmail.length === 0) { // 114
|
||||
throw new Meteor.Error('no-valid-email'); // 115
|
||||
return false; // 116
|
||||
} //
|
||||
} //
|
||||
RocketChat.models.Users.updateLastLoginById(login.user._id); // 100
|
||||
Meteor.defer(function() { // 100
|
||||
return RocketChat.callbacks.run('afterValidateLogin', login); //
|
||||
}); //
|
||||
return true; // 123
|
||||
}); // 99
|
||||
//
|
||||
Accounts.validateNewUser(function(user) { // 2
|
||||
var ref; // 126
|
||||
if (RocketChat.settings.get('Accounts_Registration_AuthenticationServices_Enabled') === false && RocketChat.settings.get('LDAP_Enable') === false && (((ref = user.services) != null ? ref.password : void 0) == null)) {
|
||||
throw new Meteor.Error('registration-disabled-authentication-services', 'User registration is disabled for authentication services');
|
||||
} //
|
||||
return true; // 128
|
||||
}); // 125
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=accounts.coffee.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,204 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/lib/cordova.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var configurePush, sendPush; // 1
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
log: function() { // 2
|
||||
return console.log.apply(console, arguments); //
|
||||
}, //
|
||||
push_test: function() { // 2
|
||||
var query, tokens, user; // 6
|
||||
user = Meteor.user(); // 6
|
||||
if (user == null) { // 7
|
||||
throw new Meteor.Error('unauthorized', '[methods] push_test -> Unauthorized');
|
||||
} //
|
||||
if (!RocketChat.authz.hasRole(user._id, 'admin')) { // 10
|
||||
throw new Meteor.Error('unauthorized', '[methods] push_test -> Unauthorized');
|
||||
} //
|
||||
if (Push.enabled !== true) { // 13
|
||||
throw new Meteor.Error('push_disabled'); // 14
|
||||
} //
|
||||
query = { // 6
|
||||
$and: [ // 17
|
||||
{ //
|
||||
userId: user._id // 18
|
||||
}, { //
|
||||
$or: [ // 19
|
||||
{ //
|
||||
'token.apn': { // 21
|
||||
$exists: true // 21
|
||||
} //
|
||||
}, { //
|
||||
'token.gcm': { // 22
|
||||
$exists: true // 22
|
||||
} //
|
||||
} //
|
||||
] //
|
||||
} //
|
||||
] //
|
||||
}; //
|
||||
tokens = Push.appCollection.find(query).count(); // 6
|
||||
if (tokens === 0) { // 29
|
||||
throw new Meteor.Error('no_tokens_for_this_user'); // 30
|
||||
} //
|
||||
Push.send({ // 6
|
||||
from: 'push', // 33
|
||||
title: "@" + user.username, // 33
|
||||
text: TAPi18n.__("This_is_a_push_test_messsage"), // 33
|
||||
apn: { // 33
|
||||
text: ("@" + user.username + ":\n") + TAPi18n.__("This_is_a_push_test_messsage")
|
||||
}, //
|
||||
sound: 'chime', // 33
|
||||
query: { // 33
|
||||
userId: user._id // 40
|
||||
} //
|
||||
}); //
|
||||
return { // 42
|
||||
message: "Your_push_was_sent_to_s_devices", // 43
|
||||
params: [tokens] // 43
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
configurePush = function() { // 1
|
||||
var apn, gcm; // 48
|
||||
if (RocketChat.settings.get('Push_debug')) { // 48
|
||||
console.log('Push: configuring...'); // 49
|
||||
} //
|
||||
if (RocketChat.settings.get('Push_enable') === true) { // 51
|
||||
Push.allow({ // 52
|
||||
send: function(userId, notification) { // 53
|
||||
return RocketChat.authz.hasRole(userId, 'admin'); // 54
|
||||
} //
|
||||
}); //
|
||||
apn = void 0; // 52
|
||||
gcm = void 0; // 52
|
||||
if (RocketChat.settings.get('Push_enable_gateway') === false) { // 59
|
||||
gcm = { // 60
|
||||
apiKey: RocketChat.settings.get('Push_gcm_api_key'), // 61
|
||||
projectNumber: RocketChat.settings.get('Push_gcm_project_number')
|
||||
}; //
|
||||
apn = { // 60
|
||||
passphrase: RocketChat.settings.get('Push_apn_passphrase'), // 65
|
||||
keyData: RocketChat.settings.get('Push_apn_key'), // 65
|
||||
certData: RocketChat.settings.get('Push_apn_cert') // 65
|
||||
}; //
|
||||
if (RocketChat.settings.get('Push_production') !== true) { // 69
|
||||
apn = { // 70
|
||||
passphrase: RocketChat.settings.get('Push_apn_dev_passphrase'),
|
||||
keyData: RocketChat.settings.get('Push_apn_dev_key'), // 71
|
||||
certData: RocketChat.settings.get('Push_apn_dev_cert'), // 71
|
||||
gateway: 'gateway.sandbox.push.apple.com' // 71
|
||||
}; //
|
||||
} //
|
||||
if ((apn.keyData == null) || apn.keyData.trim() === '' || (apn.keyData == null) || apn.keyData.trim() === '') {
|
||||
apn = void 0; // 77
|
||||
} //
|
||||
if ((gcm.apiKey == null) || gcm.apiKey.trim() === '' || (gcm.projectNumber == null) || gcm.projectNumber.trim() === '') {
|
||||
gcm = void 0; // 80
|
||||
} //
|
||||
} //
|
||||
Push.Configure({ // 52
|
||||
apn: apn, // 83
|
||||
gcm: gcm, // 83
|
||||
production: RocketChat.settings.get('Push_production'), // 83
|
||||
sendInterval: 1000, // 83
|
||||
sendBatchSize: 10 // 83
|
||||
}); //
|
||||
if (RocketChat.settings.get('Push_enable_gateway') === true) { // 89
|
||||
Push.serverSend = function(options) { // 90
|
||||
var query; // 91
|
||||
options = options || { // 91
|
||||
badge: 0 // 91
|
||||
}; //
|
||||
query = void 0; // 91
|
||||
if (options.from !== '' + options.from) { // 94
|
||||
throw new Error('Push.send: option "from" not a string'); // 95
|
||||
} //
|
||||
if (options.title !== '' + options.title) { // 97
|
||||
throw new Error('Push.send: option "title" not a string'); // 98
|
||||
} //
|
||||
if (options.text !== '' + options.text) { // 100
|
||||
throw new Error('Push.send: option "text" not a string'); // 101
|
||||
} //
|
||||
if (RocketChat.settings.get('Push_debug')) { // 103
|
||||
console.log('Push: send message "' + options.title + '" via query', options.query);
|
||||
} //
|
||||
query = { // 91
|
||||
$and: [ // 107
|
||||
options.query, { //
|
||||
$or: [ // 109
|
||||
{ //
|
||||
'token.apn': { // 111
|
||||
$exists: true // 111
|
||||
} //
|
||||
}, { //
|
||||
'token.gcm': { // 112
|
||||
$exists: true // 112
|
||||
} //
|
||||
} //
|
||||
] //
|
||||
} //
|
||||
] //
|
||||
}; //
|
||||
return Push.appCollection.find(query).forEach(function(app) { //
|
||||
var service, token; // 118
|
||||
if (RocketChat.settings.get('Push_debug')) { // 118
|
||||
console.log('Push: send to token', app.token); // 119
|
||||
} //
|
||||
if (app.token.apn != null) { // 121
|
||||
service = 'apn'; // 122
|
||||
token = app.token.apn; // 122
|
||||
} else if (app.token.gcm != null) { //
|
||||
service = 'gcm'; // 125
|
||||
token = app.token.gcm; // 125
|
||||
} //
|
||||
return sendPush(service, token, options); //
|
||||
}); //
|
||||
}; //
|
||||
} //
|
||||
return Push.enabled = true; //
|
||||
} //
|
||||
}; // 47
|
||||
//
|
||||
sendPush = function(service, token, options, tries) { // 1
|
||||
var e, milli; // 133
|
||||
if (tries == null) { //
|
||||
tries = 0; //
|
||||
} //
|
||||
try { // 133
|
||||
return HTTP.post(RocketChat.settings.get('Push_gateway') + ("/push/" + service + "/send"), {
|
||||
data: { // 135
|
||||
token: token, // 136
|
||||
options: options // 136
|
||||
} //
|
||||
}); //
|
||||
} catch (_error) { //
|
||||
e = _error; // 139
|
||||
SystemLogger.error('Error sending push to gateway (' + tries + ' try) ->', e);
|
||||
if (tries <= 6) { // 140
|
||||
milli = Math.pow(10, tries + 2); // 141
|
||||
SystemLogger.log('Trying sending push to gateway again in', milli, 'milliseconds');
|
||||
return Meteor.setTimeout(function() { //
|
||||
return sendPush(service, token, options, tries + 1); //
|
||||
}, milli); //
|
||||
} //
|
||||
} //
|
||||
}; // 132
|
||||
//
|
||||
Meteor.startup(function() { // 1
|
||||
return configurePush(); //
|
||||
}); // 150
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=cordova.coffee.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,54 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/lib/cordova/facebook-login.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var getIdentity; // 1
|
||||
//
|
||||
Accounts.registerLoginHandler(function(loginRequest) { // 1
|
||||
var fields, identity, options, profileFields, serviceData, whitelisted;
|
||||
if (!loginRequest.cordova) { // 2
|
||||
return void 0; // 3
|
||||
} //
|
||||
loginRequest = loginRequest.authResponse; // 2
|
||||
identity = getIdentity(loginRequest.accessToken); // 2
|
||||
serviceData = { // 2
|
||||
accessToken: loginRequest.accessToken, // 9
|
||||
expiresAt: (+(new Date)) + (1000 * loginRequest.expiresIn) // 9
|
||||
}; //
|
||||
whitelisted = ['id', 'email', 'name', 'first_name', 'last_name', 'link', 'username', 'gender', 'locale', 'age_range'];
|
||||
fields = _.pick(identity, whitelisted); // 2
|
||||
_.extend(serviceData, fields); // 2
|
||||
options = { // 2
|
||||
profile: {} // 17
|
||||
}; //
|
||||
profileFields = _.pick(identity, whitelisted); // 2
|
||||
_.extend(options.profile, profileFields); // 2
|
||||
return Accounts.updateOrCreateUserFromExternalService("facebook", serviceData, options);
|
||||
}); // 1
|
||||
//
|
||||
getIdentity = function(accessToken) { // 1
|
||||
var err; // 25
|
||||
try { // 25
|
||||
return HTTP.get("https://graph.facebook.com/me", { // 26
|
||||
params: { // 26
|
||||
access_token: accessToken // 26
|
||||
} //
|
||||
}).data; //
|
||||
} catch (_error) { //
|
||||
err = _error; // 29
|
||||
throw _.extend(new Error("Failed to fetch identity from Facebook. " + err.message), {
|
||||
response: err.response // 29
|
||||
}); //
|
||||
} //
|
||||
}; // 24
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=facebook-login.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/lib/cordova/facebook-login.coffee"],"names":[],"mappings":";;;;;;;;;AAAA;;AAAA,QAAQ,CAAC,oBAAT,CAA8B,SAAC,YAAD;AAC7B;AAAA,MAAG,aAAgB,CAAC,OAApB;AACC,WAAO,MAAP,CADD;GAAA;AAAA,EAGA,eAAe,YAAY,CAAC,YAH5B;AAAA,EAIA,WAAW,YAAY,YAAY,CAAC,WAAzB,CAJX;AAAA,EAMA,cACC;AAAA,iBAAa,YAAY,CAAC,WAA1B;AAAA,IACA,WAAW,CAAC,EAAC,SAAF,IAAc,CAAC,OAAO,YAAY,CAAC,SAArB,CADzB;GAPD;AAAA,EAUA,cAAc,CAAC,IAAD,EAAO,OAAP,EAAgB,MAAhB,EAAwB,YAAxB,EAAsC,WAAtC,EAAmD,MAAnD,EAA2D,UAA3D,EAAuE,QAAvE,EAAiF,QAAjF,EAA2F,WAA3F,CAVd;AAAA,EAYA,SAAS,CAAC,CAAC,IAAF,CAAO,QAAP,EAAiB,WAAjB,CAZT;AAAA,EAaA,CAAC,CAAC,MAAF,CAAS,WAAT,EAAsB,MAAtB,CAbA;AAAA,EAeA,UAAU;AAAA,IAAC,SAAS,EAAV;GAfV;AAAA,EAgBA,gBAAgB,CAAC,CAAC,IAAF,CAAO,QAAP,EAAiB,WAAjB,CAhBhB;AAAA,EAiBA,CAAC,CAAC,MAAF,CAAS,OAAO,CAAC,OAAjB,EAA0B,aAA1B,CAjBA;AAmBA,SAAO,QAAQ,CAAC,qCAAT,CAA+C,UAA/C,EAA2D,WAA3D,EAAwE,OAAxE,CAAP,CApB6B;AAAA,CAA9B;;AAAA,WAuBA,GAAc,SAAC,WAAD;AACb;AAAA;AACC,WAAO,IAAI,CAAC,GAAL,CAAS,+BAAT,EAA0C;AAAA,MAAC,QAAQ;AAAA,QAAC,cAAc,WAAf;OAAT;KAA1C,CAAgF,CAAC,IAAxF,CADD;GAAA;AAIC,IADK,YACL;AAAA,UAAM,CAAC,CAAC,MAAF,CAAa,UAAM,6CAA6C,GAAG,CAAC,OAAvD,CAAb,EAA8E;AAAA,MAAC,UAAU,GAAG,CAAC,QAAf;KAA9E,CAAN,CAJD;GADa;AAAA,CAvBd","file":"/server/lib/cordova/facebook-login.coffee.js","sourcesContent":["Accounts.registerLoginHandler (loginRequest) ->\n\tif not loginRequest.cordova\n\t\treturn undefined\n\n\tloginRequest = loginRequest.authResponse\n\tidentity = getIdentity(loginRequest.accessToken)\n\n\tserviceData =\n\t\taccessToken: loginRequest.accessToken\n\t\texpiresAt: (+new Date) + (1000 * loginRequest.expiresIn)\n\n\twhitelisted = ['id', 'email', 'name', 'first_name', 'last_name', 'link', 'username', 'gender', 'locale', 'age_range']\n\n\tfields = _.pick(identity, whitelisted)\n\t_.extend(serviceData, fields)\n\n\toptions = {profile: {}}\n\tprofileFields = _.pick(identity, whitelisted)\n\t_.extend(options.profile, profileFields)\n\n\treturn Accounts.updateOrCreateUserFromExternalService(\"facebook\", serviceData, options)\n\n\ngetIdentity = (accessToken) ->\n\ttry\n\t\treturn HTTP.get(\"https://graph.facebook.com/me\", {params: {access_token: accessToken}}).data\n\n\tcatch err\n\t\tthrow _.extend new Error(\"Failed to fetch identity from Facebook. \" + err.message), {response: err.response}"]}
|
|
@ -1,58 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/addRoomModerator.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
addRoomModerator: function(rid, userId) { // 2
|
||||
var fromUser, subscription, user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { // 4
|
||||
method: 'addRoomModerator' // 4
|
||||
}); //
|
||||
} //
|
||||
check(rid, String); // 3
|
||||
check(userId, String); // 3
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'set-moderator', rid)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 10
|
||||
method: 'addRoomModerator' // 10
|
||||
}); //
|
||||
} //
|
||||
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, userId);
|
||||
if (subscription == null) { // 13
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 14
|
||||
method: 'addRoomModerator' // 14
|
||||
}); //
|
||||
} //
|
||||
RocketChat.models.Subscriptions.addRoleById(subscription._id, 'moderator');
|
||||
user = RocketChat.models.Users.findOneById(userId); // 3
|
||||
fromUser = RocketChat.models.Users.findOneById(Meteor.userId()); // 3
|
||||
RocketChat.models.Messages.createSubscriptionRoleAddedWithRoomIdAndUser(rid, user, {
|
||||
u: { // 21
|
||||
_id: fromUser._id, // 22
|
||||
username: fromUser.username // 22
|
||||
}, //
|
||||
role: 'moderator' // 21
|
||||
}); //
|
||||
RocketChat.Notifications.notifyAll('roles-change', { // 3
|
||||
type: 'added', // 26
|
||||
_id: 'moderator', // 26
|
||||
u: { // 26
|
||||
_id: user._id, // 26
|
||||
username: user.username // 26
|
||||
}, //
|
||||
scope: rid // 26
|
||||
}); //
|
||||
return true; // 28
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||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AxE,EAA6E,IAA7E,EACC;AAAA,SACC;AAAA,aAAK,QAAQ,CAAC,GAAd;AAAA,QACA,UAAU,QAAQ,CAAC,QADnB;OADD;AAAA,MAGA,MAAM,WAHN;KADD,CAjBA;AAAA,IAuBA,UAAU,CAAC,aAAa,CAAC,SAAzB,CAAmC,cAAnC,EAAmD;AAAA,MAAE,MAAM,OAAR;AAAA,MAAiB,KAAK,WAAtB;AAAA,MAAmC,GAAG;AAAA,QAAE,KAAK,IAAI,CAAC,GAAZ;AAAA,QAAiB,UAAU,IAAI,CAAC,QAAhC;OAAtC;AAAA,MAAkF,OAAO,GAAzF;KAAnD,CAvBA;AAyBA,WAAO,IAAP,CA1BiB;EAAA,CAAlB;CADD","file":"/server/methods/addRoomModerator.coffee.js","sourcesContent":["Meteor.methods\n\taddRoomModerator: (rid, userId) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'addRoomModerator' }\n\n\t\tcheck rid, String\n\t\tcheck userId, String\n\n\t\tunless RocketChat.authz.hasPermission Meteor.userId(), 'set-moderator', rid\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'addRoomModerator' }\n\n\t\tsubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId rid, userId\n\t\tunless subscription?\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: 'addRoomModerator' }\n\n\t\tRocketChat.models.Subscriptions.addRoleById(subscription._id, 'moderator')\n\n\t\tuser = RocketChat.models.Users.findOneById userId\n\t\tfromUser = RocketChat.models.Users.findOneById Meteor.userId()\n\t\tRocketChat.models.Messages.createSubscriptionRoleAddedWithRoomIdAndUser rid, user,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\t\t\trole: 'moderator'\n\n\t\tRocketChat.Notifications.notifyAll('roles-change', { type: 'added', _id: 'moderator', u: { _id: user._id, username: user.username }, scope: rid });\n\n\t\treturn true\n"]}
|
|
@ -1,58 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/addRoomOwner.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
addRoomOwner: function(rid, userId) { // 2
|
||||
var fromUser, subscription, user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { // 4
|
||||
method: 'addRoomOwner' // 4
|
||||
}); //
|
||||
} //
|
||||
check(rid, String); // 3
|
||||
check(userId, String); // 3
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'set-owner', rid)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 10
|
||||
method: 'addRoomOwner' // 10
|
||||
}); //
|
||||
} //
|
||||
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, userId);
|
||||
if (subscription == null) { // 13
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 14
|
||||
method: 'addRoomOwner' // 14
|
||||
}); //
|
||||
} //
|
||||
RocketChat.models.Subscriptions.addRoleById(subscription._id, 'owner');
|
||||
user = RocketChat.models.Users.findOneById(userId); // 3
|
||||
fromUser = RocketChat.models.Users.findOneById(Meteor.userId()); // 3
|
||||
RocketChat.models.Messages.createSubscriptionRoleAddedWithRoomIdAndUser(rid, user, {
|
||||
u: { // 21
|
||||
_id: fromUser._id, // 22
|
||||
username: fromUser.username // 22
|
||||
}, //
|
||||
role: 'owner' // 21
|
||||
}); //
|
||||
RocketChat.Notifications.notifyAll('roles-change', { // 3
|
||||
type: 'added', // 26
|
||||
_id: 'owner', // 26
|
||||
u: { // 26
|
||||
_id: user._id, // 26
|
||||
username: user.username // 26
|
||||
}, //
|
||||
scope: rid // 26
|
||||
}); //
|
||||
return true; // 28
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=addRoomOwner.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/addRoomOwner.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,gBAAc,SAAC,GAAD,EAAM,MAAN;AACb;AAAA,eAAa,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,cAAV;OAAnD,CAAV,CADD;KAAA;AAAA,IAGA,MAAM,GAAN,EAAW,MAAX,CAHA;AAAA,IAIA,MAAM,MAAN,EAAc,MAAd,CAJA;AAMA,mBAAiB,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,WAAhD,EAA6D,GAA7D,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,mBAAb,EAAkC,aAAlC,EAAiD;AAAA,QAAE,QAAQ,cAAV;OAAjD,CAAV,CADD;KANA;AAAA,IASA,eAAe,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,wBAAhC,CAAyD,GAAzD,EAA8D,MAA9D,CATf;AAUA,QAAO,oBAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,cAAV;OAAnD,CAAV,CADD;KAVA;AAAA,IAaA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,WAAhC,CAA4C,YAAY,CAAC,GAAzD,EAA8D,OAA9D,CAbA;AAAA,IAeA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAApC,CAfP;AAAA,IAgBA,WAAW,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAAM,CAAC,MAAP,EAApC,CAhBX;AAAA,IAiBA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,4CAA3B,CAAwE,GAAxE,EAA6E,IAA7E,EACC;AAAA,SACC;AAAA,aAAK,QAAQ,CAAC,GAAd;AAAA,QACA,UAAU,QAAQ,CAAC,QADnB;OADD;AAAA,MAGA,MAAM,OAHN;KADD,CAjBA;AAAA,IAuBA,UAAU,CAAC,aAAa,CAAC,SAAzB,CAAmC,cAAnC,EAAmD;AAAA,MAAE,MAAM,OAAR;AAAA,MAAiB,KAAK,OAAtB;AAAA,MAA+B,GAAG;AAAA,QAAE,KAAK,IAAI,CAAC,GAAZ;AAAA,QAAiB,UAAU,IAAI,CAAC,QAAhC;OAAlC;AAAA,MAA8E,OAAO,GAArF;KAAnD,CAvBA;AAyBA,WAAO,IAAP,CA1Ba;EAAA,CAAd;CADD","file":"/server/methods/addRoomOwner.coffee.js","sourcesContent":["Meteor.methods\n\taddRoomOwner: (rid, userId) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'addRoomOwner' }\n\n\t\tcheck rid, String\n\t\tcheck userId, String\n\n\t\tunless RocketChat.authz.hasPermission Meteor.userId(), 'set-owner', rid\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'addRoomOwner' }\n\n\t\tsubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId rid, userId\n\t\tunless subscription?\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: 'addRoomOwner' }\n\n\t\tRocketChat.models.Subscriptions.addRoleById(subscription._id, 'owner')\n\n\t\tuser = RocketChat.models.Users.findOneById userId\n\t\tfromUser = RocketChat.models.Users.findOneById Meteor.userId()\n\t\tRocketChat.models.Messages.createSubscriptionRoleAddedWithRoomIdAndUser rid, user,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\t\t\trole: 'owner'\n\n\t\tRocketChat.Notifications.notifyAll('roles-change', { type: 'added', _id: 'owner', u: { _id: user._id, username: user.username }, scope: rid });\n\n\t\treturn true\n"]}
|
|
@ -1,63 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/addUserToRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
addUserToRoom: function(data) { // 2
|
||||
var fromId, fromUser, newUser, now, room; // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
if (!Match.test(data != null ? data.rid : void 0, String)) { // 4
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 5
|
||||
method: addUserToRoom // 5
|
||||
}); //
|
||||
} //
|
||||
if (!Match.test(data != null ? data.username : void 0, String)) { // 7
|
||||
throw new Meteor.Error('error-invalid-username', 'Invalid username', {
|
||||
method: addUserToRoom // 8
|
||||
}); //
|
||||
} //
|
||||
room = RocketChat.models.Rooms.findOneById(data.rid); // 3
|
||||
if (room.t === 'c' && !RocketChat.authz.hasPermission(fromId, 'add-user-to-room', room._id)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 14
|
||||
method: addUserToRoom // 14
|
||||
}); //
|
||||
} //
|
||||
if (room.t === 'd') { // 16
|
||||
throw new Meteor.Error('error-cant-invite-for-direct-room', 'Can\'t invite user to direct rooms', {
|
||||
method: addUserToRoom // 17
|
||||
}); //
|
||||
} //
|
||||
if (room.usernames.indexOf(data.username) !== -1) { // 20
|
||||
return; // 21
|
||||
} //
|
||||
newUser = RocketChat.models.Users.findOneByUsername(data.username);
|
||||
RocketChat.models.Rooms.addUsernameById(data.rid, data.username); // 3
|
||||
now = new Date(); // 3
|
||||
RocketChat.models.Subscriptions.createWithRoomAndUser(room, newUser, {
|
||||
ts: now, // 30
|
||||
open: true, // 30
|
||||
alert: true, // 30
|
||||
unread: 1 // 30
|
||||
}); //
|
||||
fromUser = RocketChat.models.Users.findOneById(fromId); // 3
|
||||
RocketChat.models.Messages.createUserAddedWithRoomIdAndUser(data.rid, newUser, {
|
||||
ts: now, // 37
|
||||
u: { // 37
|
||||
_id: fromUser._id, // 39
|
||||
username: fromUser.username // 39
|
||||
} //
|
||||
}); //
|
||||
return true; // 42
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=addUserToRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/addUserToRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,IAAD;AACd;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AACA,cAAY,CAAC,IAAN,gBAAW,IAAI,CAAE,YAAjB,EAAsB,MAAtB,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,aAAV;OAAnD,CAAV,CADD;KADA;AAIA,cAAY,CAAC,IAAN,gBAAW,IAAI,CAAE,iBAAjB,EAA2B,MAA3B,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,wBAAb,EAAuC,kBAAvC,EAA2D;AAAA,QAAE,QAAQ,aAAV;OAA3D,CAAV,CADD;KAJA;AAAA,IAOA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,IAAI,CAAC,GAAzC,CAPP;AAUA,QAAG,IAAI,CAAC,CAAL,KAAU,GAAV,IAAkB,WAAc,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAA/B,EAAuC,kBAAvC,EAA2D,IAAI,CAAC,GAAhE,CAAzB;AACC,YAAU,UAAM,CAAC,KAAP,CA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, String\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: addUserToRoom }\n\n\t\tunless Match.test data?.username, String\n\t\t\tthrow new Meteor.Error 'error-invalid-username', 'Invalid username', { method: addUserToRoom }\n\n\t\troom = RocketChat.models.Rooms.findOneById data.rid\n\n\t\t# if room.username isnt Meteor.user().username and room.t is 'c'\n\t\tif room.t is 'c' and not RocketChat.authz.hasPermission(fromId, 'add-user-to-room', room._id)\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: addUserToRoom }\n\n\t\tif room.t is 'd'\n\t\t\tthrow new Meteor.Error 'error-cant-invite-for-direct-room', 'Can\\'t invite user to direct rooms', { method: addUserToRoom }\n\n\t\t# verify if user is already in room\n\t\tif room.usernames.indexOf(data.username) isnt -1\n\t\t\treturn\n\n\t\tnewUser = RocketChat.models.Users.findOneByUsername data.username\n\n\t\tRocketChat.models.Rooms.addUsernameById data.rid, data.username\n\n\t\tnow = new Date()\n\n\t\tRocketChat.models.Subscriptions.createWithRoomAndUser room, newUser,\n\t\t\tts: now\n\t\t\topen: true\n\t\t\talert: true\n\t\t\tunread: 1\n\n\t\tfromUser = RocketChat.models.Users.findOneById fromId\n\t\tRocketChat.models.Messages.createUserAddedWithRoomIdAndUser data.rid, newUser,\n\t\t\tts: now\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\n\t\treturn true\n"]}
|
|
@ -1,52 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/archiveRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
archiveRoom: function(rid) { // 2
|
||||
var i, len, member, ref, results, room, username; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { // 4
|
||||
method: 'archiveRoom' // 4
|
||||
}); //
|
||||
} //
|
||||
room = RocketChat.models.Rooms.findOneById(rid); // 3
|
||||
if (!room) { // 8
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 9
|
||||
method: 'archiveRoom' // 9
|
||||
}); //
|
||||
} //
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'archive-room', room._id)) {
|
||||
throw new Meteor.Error('error-not-authorized', 'Not authorized', {
|
||||
method: 'archiveRoom' // 12
|
||||
}); //
|
||||
} //
|
||||
RocketChat.models.Rooms.archiveById(rid); // 3
|
||||
ref = room.usernames; // 16
|
||||
results = []; // 16
|
||||
for (i = 0, len = ref.length; i < len; i++) { //
|
||||
username = ref[i]; //
|
||||
member = RocketChat.models.Users.findOneByUsername(username, { // 17
|
||||
fields: { // 17
|
||||
username: 1 // 17
|
||||
} //
|
||||
}); //
|
||||
if (member == null) { // 18
|
||||
continue; // 19
|
||||
} //
|
||||
results.push(RocketChat.models.Subscriptions.archiveByRoomIdAndUserId(rid, member._id));
|
||||
} // 16
|
||||
return results; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=archiveRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/archiveRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,eAAa,SAAC,GAAD;AACZ;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,aAAV;OAAnD,CAAV,CADD;KAAA;AAAA,IAGA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,GAApC,CAHP;AAKA;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,aAAV;OAAnD,CAAV,CADD;KALA;AAQA,mBAAiB,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,cAAhD,EAAgE,IAAI,CAAC,GAArE,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,sBAAb,EAAqC,gBAArC,EAAuD;AAAA,QAAE,QAAQ,aAAV;OAAvD,CAAV,CADD;KARA;AAAA,IAWA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,GAApC,CAXA;AAaA;AAAA;SAAA;wBAAA;AACC,eAAS,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAxB,CAA0C,QAA1C,EAAoD;AAAA,QAAE,QAAQ;AAAA,UAAE,UAAU,CAAZ;SAAV;OAApD,CAAT;AACA,UAAO,cAAP;AACC,iBADD;OADA;AAAA,mBAIA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,wBAAhC,CAAyD,GAAzD,EAA8D,MAAM,CAAC,GAArE,EAJA,CADD;AAAA;mBAdY;EAAA,CAAb;CADD","file":"/server/methods/archiveRoom.coffee.js","sourcesContent":["Meteor.methods\n\tarchiveRoom: (rid) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'archiveRoom' }\n\n\t\troom = RocketChat.models.Rooms.findOneById rid\n\n\t\tunless room\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: 'archiveRoom' }\n\n\t\tunless RocketChat.authz.hasPermission(Meteor.userId(), 'archive-room', room._id)\n\t\t\tthrow new Meteor.Error 'error-not-authorized', 'Not authorized', { method: 'archiveRoom' }\n\n\t\tRocketChat.models.Rooms.archiveById rid\n\n\t\tfor username in room.usernames\n\t\t\tmember = RocketChat.models.Users.findOneByUsername(username, { fields: { username: 1 }})\n\t\t\tif not member?\n\t\t\t\tcontinue\n\n\t\t\tRocketChat.models.Subscriptions.archiveByRoomIdAndUserId rid, member._id\n"]}
|
|
@ -1,53 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/canAccessRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
canAccessRoom: function(rid, userId) { // 2
|
||||
var canAccess, room, user; // 3
|
||||
user = RocketChat.models.Users.findOneById(userId, { // 3
|
||||
fields: { // 3
|
||||
username: 1 // 3
|
||||
} //
|
||||
}); //
|
||||
if (!(user != null ? user.username : void 0)) { // 5
|
||||
throw new Meteor.Error('not-logged-user', "[methods] canAccessRoom -> User doesn't have enough permissions");
|
||||
} //
|
||||
if (!rid) { // 8
|
||||
throw new Meteor.Error('invalid-room', '[methods] canAccessRoom -> Cannot access empty room');
|
||||
} //
|
||||
room = RocketChat.models.Rooms.findOneById(rid, { // 3
|
||||
fields: { // 11
|
||||
usernames: 1, // 11
|
||||
t: 1, // 11
|
||||
name: 1, // 11
|
||||
muted: 1 // 11
|
||||
} //
|
||||
}); //
|
||||
if (room) { // 13
|
||||
if (room.usernames.indexOf(user.username) !== -1) { // 14
|
||||
canAccess = true; // 15
|
||||
} else if (room.t === 'c') { //
|
||||
canAccess = RocketChat.authz.hasPermission(userId, 'view-c-room');
|
||||
} //
|
||||
if (canAccess !== true) { // 19
|
||||
return false; // 20
|
||||
} else { //
|
||||
return _.pick(room, ['_id', 't', 'name', 'usernames', 'muted']);
|
||||
} //
|
||||
} else { //
|
||||
throw new Meteor.Error('invalid-room', '[methods] canAccessRoom -> Room ID is invalid');
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||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Ab,EAA6B,+CAA7B,CAAV,CAXD;KAXc;EAAA,CAAf;CADD","file":"/server/methods/canAccessRoom.coffee.js","sourcesContent":["Meteor.methods\n\tcanAccessRoom: (rid, userId) ->\n\t\tuser = RocketChat.models.Users.findOneById userId, fields: username: 1\n\n\t\tunless user?.username\n\t\t\tthrow new Meteor.Error 'not-logged-user', \"[methods] canAccessRoom -> User doesn't have enough permissions\"\n\n\t\tunless rid\n\t\t\tthrow new Meteor.Error 'invalid-room', '[methods] canAccessRoom -> Cannot access empty room'\n\n\t\troom = RocketChat.models.Rooms.findOneById rid, { fields: { usernames: 1, t: 1, name: 1, muted: 1 } }\n\n\t\tif room\n\t\t\tif room.usernames.indexOf(user.username) isnt -1\n\t\t\t\tcanAccess = true\n\t\t\telse if room.t is 'c'\n\t\t\t\tcanAccess = RocketChat.authz.hasPermission(userId, 'view-c-room')\n\n\t\t\tif canAccess isnt true\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\treturn _.pick room, ['_id', 't', 'name', 'usernames', 'muted']\n\t\telse\n\t\t\tthrow new Meteor.Error 'invalid-room', '[methods] canAccessRoom -> Room ID is invalid'\n"]}
|
|
@ -1,53 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/channelsList.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
channelsList: function(filter, limit, sort) { // 2
|
||||
var options; // 3
|
||||
options = { // 3
|
||||
fields: { // 3
|
||||
name: 1 // 3
|
||||
}, //
|
||||
sort: { // 3
|
||||
msgs: -1 // 3
|
||||
} //
|
||||
}; //
|
||||
if (_.isNumber(limit)) { // 4
|
||||
options.limit = limit; // 5
|
||||
} //
|
||||
if (_.trim(sort)) { // 6
|
||||
switch (sort) { // 7
|
||||
case 'name': // 7
|
||||
options.sort = { // 9
|
||||
name: 1 // 9
|
||||
}; //
|
||||
break; // 8
|
||||
case 'msgs': // 7
|
||||
options.sort = { // 11
|
||||
msgs: -1 // 11
|
||||
}; //
|
||||
} // 7
|
||||
} //
|
||||
if (filter) { // 13
|
||||
return { // 14
|
||||
channels: RocketChat.models.Rooms.findByNameContainingAndTypes(filter, ['c'], options).fetch()
|
||||
}; //
|
||||
} else { //
|
||||
return { // 16
|
||||
channels: RocketChat.models.Rooms.findByTypeAndArchivationState('c', false, options).fetch()
|
||||
}; //
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=channelsList.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/channelsList.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,gBAAc,SAAC,MAAD,EAAS,KAAT,EAAgB,IAAhB;AACb;AAAA,cAAW;AAAA,MAAE,QAAQ;AAAA,QAAE,MAAM,CAAR;OAAV;AAAA,MAAuB,MAAM;AAAA,QAAE,MAAK,EAAP;OAA7B;KAAX;AACA,QAAG,CAAC,CAAC,QAAF,CAAW,KAAX,CAAH;AACC,aAAO,CAAC,KAAR,GAAgB,KAAhB,CADD;KADA;AAGA,QAAG,CAAC,CAAC,IAAF,CAAO,IAAP,CAAH;AACC,cAAO,IAAP;AAAA,aACM,MADN;AAEE,iBAAO,CAAC,IAAR,GAAe;AAAA,YAAE,MAAM,CAAR;WAAf,CAFF;AACM;AADN,aAGM,MAHN;AAIE,iBAAO,CAAC,IAAR,GAAe;AAAA,YAAE,MAAM,EAAR;WAAf,CAJF;AAAA,OADD;KAHA;AAUA,QAAG,MAAH;AACC,aAAO;AAAA,QAAE,UAAU,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,4BAAxB,CAAqD,MAArD,EAA6D,CAAC,GAAD,CAA7D,EAAoE,OAApE,CAA4E,CAAC,KAA7E,EAAZ;OAAP,CADD;KAAA;AAGC,aAAO;AAAA,QAAE,UAAU,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,6BAAxB,CAAsD,GAAtD,EAA2D,KAA3D,EAAkE,OAAlE,CAA0E,CAAC,KAA3E,EAAZ;OAAP,CAHD;KAXa;EAAA,CAAd;CADD","file":"/server/methods/channelsList.coffee.js","sourcesContent":["Meteor.methods\n\tchannelsList: (filter, limit, sort) ->\n\t\toptions = { fields: { name: 1 }, sort: { msgs:-1 } }\n\t\tif _.isNumber limit\n\t\t\toptions.limit = limit\n\t\tif _.trim(sort)\n\t\t\tswitch sort\n\t\t\t\twhen 'name'\n\t\t\t\t\toptions.sort = { name: 1 }\n\t\t\t\twhen 'msgs'\n\t\t\t\t\toptions.sort = { msgs: -1 }\n\n\t\tif filter\n\t\t\treturn { channels: RocketChat.models.Rooms.findByNameContainingAndTypes(filter, ['c'], options).fetch() }\n\t\telse\n\t\t\treturn { channels: RocketChat.models.Rooms.findByTypeAndArchivationState('c', false, options).fetch() }\n"]}
|
|
@ -1,81 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/createChannel.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
createChannel: function(name, members) { // 2
|
||||
var extra, i, len, member, nameValidation, now, ref, room, user, username;
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] createChannel -> Invalid user");
|
||||
} //
|
||||
try { // 6
|
||||
nameValidation = new RegExp('^' + RocketChat.settings.get('UTF8_Names_Validation') + '$');
|
||||
} catch (_error) { //
|
||||
nameValidation = new RegExp('^[0-9a-zA-Z-_.]+$'); // 9
|
||||
} //
|
||||
if (!nameValidation.test(name)) { // 11
|
||||
throw new Meteor.Error('name-invalid'); // 12
|
||||
} //
|
||||
if (RocketChat.authz.hasPermission(Meteor.userId(), 'create-c') !== true) {
|
||||
throw new Meteor.Error('not-authorized', '[methods] createChannel -> Not authorized');
|
||||
} //
|
||||
now = new Date(); // 3
|
||||
user = Meteor.user(); // 3
|
||||
if (ref = user.username, indexOf.call(members, ref) < 0) { // 20
|
||||
members.push(user.username); // 20
|
||||
} //
|
||||
if (RocketChat.models.Rooms.findOneByName(name)) { // 23
|
||||
if (RocketChat.models.Rooms.findOneByName(name).archived) { // 24
|
||||
throw new Meteor.Error('archived-duplicate-name'); // 25
|
||||
} else { //
|
||||
throw new Meteor.Error('duplicate-name'); // 27
|
||||
} //
|
||||
} //
|
||||
RocketChat.callbacks.run('beforeCreateChannel', user, { // 3
|
||||
t: 'c', // 32
|
||||
name: name, // 32
|
||||
ts: now, // 32
|
||||
usernames: members, // 32
|
||||
u: { // 32
|
||||
_id: user._id, // 37
|
||||
username: user.username // 37
|
||||
} //
|
||||
}); //
|
||||
room = RocketChat.models.Rooms.createWithTypeNameUserAndUsernames('c', name, user, members, {
|
||||
ts: now // 42
|
||||
}); //
|
||||
for (i = 0, len = members.length; i < len; i++) { // 44
|
||||
username = members[i]; //
|
||||
member = RocketChat.models.Users.findOneByUsername(username); // 45
|
||||
if (member == null) { // 46
|
||||
continue; // 47
|
||||
} //
|
||||
extra = {}; // 45
|
||||
if (username === user.username) { // 51
|
||||
extra.ls = now; // 52
|
||||
extra.open = true; // 52
|
||||
} //
|
||||
RocketChat.models.Subscriptions.createWithRoomAndUser(room, member, extra);
|
||||
} // 44
|
||||
RocketChat.authz.addUserRoles(Meteor.userId(), ['owner'], room._id);
|
||||
Meteor.defer(function() { // 3
|
||||
return RocketChat.callbacks.run('afterCreateChannel', user, room);
|
||||
}); //
|
||||
return { // 63
|
||||
rid: room._id // 63
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=createChannel.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/createChannel.coffee"],"names":[],"mappings":";;;;;;;;;AAAA;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,IAAD,EAAO,OAAP;AACd;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,yCAA7B,CAAV,CADD;KAAA;AAGA;AACC,uBAAqB,WAAO,MAAM,UAAU,CAAC,QAAQ,CAAC,GAApB,CAAwB,uBAAxB,CAAN,GAAyD,GAAhE,CAArB,CADD;KAAA;AAGC,uBAAqB,WAAO,mBAAP,CAArB,CAHD;KAHA;AAQA,QAAG,eAAkB,CAAC,IAAf,CAAoB,IAApB,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,CAAV,CADD;KARA;AAWA,QAAG,UAAU,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,UAAhD,MAAiE,IAApE;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,gBAAb,EAA+B,2CAA/B,CAAV,CADD;KAXA;AAAA,IAcA,MAAU,UAdV;AAAA,IAeA,OAAO,MAAM,CAAC,IAAP,EAfP;AAiBA,cAA8B,IAAI,CAAC,QAAL,eAAqB,OAArB,UAA9B;AAAA,aAAO,CAAC,IAAR,CAAa,IAAI,CAAC,QAAlB;KAjBA;AAoBA,QAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,aAAxB,CAAsC,IAAtC,CAAH;AACC,UAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,aAAxB,CAAsC,IAAtC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AzDA;AA4DA,WAAO;AAAA,MACN,KAAK,IAAI,CAAC,GADJ;KAAP,CA7Dc;EAAA,CAAf;CADD","file":"/server/methods/createChannel.coffee.js","sourcesContent":["Meteor.methods\n\tcreateChannel: (name, members) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', \"[methods] createChannel -> Invalid user\"\n\n\t\ttry\n\t\t\tnameValidation = new RegExp '^' + RocketChat.settings.get('UTF8_Names_Validation') + '$'\n\t\tcatch\n\t\t\tnameValidation = new RegExp '^[0-9a-zA-Z-_.]+$'\n\n\t\tif not nameValidation.test name\n\t\t\tthrow new Meteor.Error 'name-invalid'\n\n\t\tif RocketChat.authz.hasPermission(Meteor.userId(), 'create-c') isnt true\n\t\t\tthrow new Meteor.Error 'not-authorized', '[methods] createChannel -> Not authorized'\n\n\t\tnow = new Date()\n\t\tuser = Meteor.user()\n\n\t\tmembers.push user.username if user.username not in members\n\n\t\t# avoid duplicate names\n\t\tif RocketChat.models.Rooms.findOneByName name\n\t\t\tif RocketChat.models.Rooms.findOneByName(name).archived\n\t\t\t\tthrow new Meteor.Error 'archived-duplicate-name'\n\t\t\telse\n\t\t\t\tthrow new Meteor.Error 'duplicate-name'\n\n\t\t# name = s.slugify name\n\n\t\tRocketChat.callbacks.run 'beforeCreateChannel', user,\n\t\t\tt: 'c'\n\t\t\tname: name\n\t\t\tts: now\n\t\t\tusernames: members\n\t\t\tu:\n\t\t\t\t_id: user._id\n\t\t\t\tusername: user.username\n\n\t\t# create new room\n\t\troom = RocketChat.models.Rooms.createWithTypeNameUserAndUsernames 'c', name, user, members,\n\t\t\tts: now\n\n\t\tfor username in members\n\t\t\tmember = RocketChat.models.Users.findOneByUsername username\n\t\t\tif not member?\n\t\t\t\tcontinue\n\n\t\t\textra = {}\n\n\t\t\tif username is user.username\n\t\t\t\textra.ls = now\n\t\t\t\textra.open = true\n\n\t\t\tRocketChat.models.Subscriptions.createWithRoomAndUser room, member, extra\n\n\t\t# set creator as channel moderator. permission limited to channel by scoping to rid\n\t\tRocketChat.authz.addUserRoles(Meteor.userId(), ['owner'], room._id)\n\n\t\tMeteor.defer ->\n\t\t\tRocketChat.callbacks.run 'afterCreateChannel', user, room\n\n\t\treturn {\n\t\t\trid: room._id\n\t\t}\n"]}
|
|
@ -1,95 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/createDirectMessage.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
createDirectMessage: function(username) { // 2
|
||||
var me, now, rid, to; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] createDirectMessage -> Invalid user");
|
||||
} //
|
||||
me = Meteor.user(); // 3
|
||||
if (!me.username) { // 8
|
||||
throw new Meteor.Error('invalid-user', '[methods] createDirectMessage -> Invalid user');
|
||||
} //
|
||||
if (me.username === username) { // 11
|
||||
throw new Meteor.Error('invalid-user', "[methods] createDirectMessage -> Invalid target user");
|
||||
} //
|
||||
to = RocketChat.models.Users.findOneByUsername(username); // 3
|
||||
if (!to) { // 16
|
||||
throw new Meteor.Error('invalid-user', "[methods] createDirectMessage -> Invalid target user");
|
||||
} //
|
||||
rid = [me._id, to._id].sort().join(''); // 3
|
||||
now = new Date(); // 3
|
||||
RocketChat.models.Rooms.upsert({ // 3
|
||||
_id: rid // 25
|
||||
}, { //
|
||||
$set: { // 27
|
||||
usernames: [me.username, to.username] // 28
|
||||
}, //
|
||||
$setOnInsert: { // 27
|
||||
t: 'd', // 30
|
||||
msgs: 0, // 30
|
||||
ts: now // 30
|
||||
} //
|
||||
}); //
|
||||
RocketChat.models.Subscriptions.upsert({ // 3
|
||||
rid: rid, // 36
|
||||
$and: [ // 36
|
||||
{ //
|
||||
'u._id': me._id // 37
|
||||
} //
|
||||
] //
|
||||
}, { //
|
||||
$set: { // 39
|
||||
ts: now, // 40
|
||||
ls: now, // 40
|
||||
open: true // 40
|
||||
}, //
|
||||
$setOnInsert: { // 39
|
||||
name: to.username, // 44
|
||||
t: 'd', // 44
|
||||
alert: false, // 44
|
||||
unread: 0, // 44
|
||||
u: { // 44
|
||||
_id: me._id, // 49
|
||||
username: me.username // 49
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
RocketChat.models.Subscriptions.upsert({ // 3
|
||||
rid: rid, // 54
|
||||
$and: [ // 54
|
||||
{ //
|
||||
'u._id': to._id // 55
|
||||
} //
|
||||
] //
|
||||
}, { //
|
||||
$setOnInsert: { // 57
|
||||
name: me.username, // 58
|
||||
t: 'd', // 58
|
||||
open: false, // 58
|
||||
alert: false, // 58
|
||||
unread: 0, // 58
|
||||
u: { // 58
|
||||
_id: to._id, // 64
|
||||
username: to.username // 64
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
return { // 67
|
||||
rid: rid // 67
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=createDirectMessage.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/createDirectMessage.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,uBAAqB,SAAC,QAAD;AACpB;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,+CAA7B,CAAV,CADD;KAAA;AAAA,IAGA,KAAK,MAAM,CAAC,IAAP,EAHL;AAKA,WAAS,CAAC,QAAV;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,+CAA7B,CAAV,CADD;KALA;AAQA,QAAG,EAAE,CAAC,QAAH,KAAe,QAAlB;AACC,YAAU,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AC;AAAA,UAAC,SAAS,EAAE,CAAC,GAAb;SAAD;OADN;KADD,EAIC;AAAA,oBACC;AAAA,cAAM,EAAE,CAAC,QAAT;AAAA,QACA,GAAG,GADH;AAAA,QAEA,MAAM,KAFN;AAAA,QAGA,OAAO,KAHP;AAAA,QAIA,QAAQ,CAJR;AAAA,QAKA,GACC;AAAA,eAAK,EAAE,CAAC,GAAR;AAAA,UACA,UAAU,EAAE,CAAC,QADb;SAND;OADD;KAJD,CAlDA;AAgEA,WAAO;AAAA,MACN,KAAK,GADC;KAAP,CAjEoB;EAAA,CAArB;CADD","file":"/server/methods/createDirectMessage.coffee.js","sourcesContent":["Meteor.methods\n\tcreateDirectMessage: (username) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', \"[methods] createDirectMessage -> Invalid user\"\n\n\t\tme = Meteor.user()\n\n\t\tunless me.username\n\t\t\tthrow new Meteor.Error('invalid-user', '[methods] createDirectMessage -> Invalid user')\n\n\t\tif me.username is username\n\t\t\tthrow new Meteor.Error('invalid-user', \"[methods] createDirectMessage -> Invalid target user\")\n\n\t\tto = RocketChat.models.Users.findOneByUsername username\n\n\t\tif not to\n\t\t\tthrow new Meteor.Error('invalid-user', \"[methods] createDirectMessage -> Invalid target user\")\n\n\t\trid = [me._id, to._id].sort().join('')\n\n\t\tnow = new Date()\n\n\t\t# Make sure we have a room\n\t\tRocketChat.models.Rooms.upsert\n\t\t\t_id: rid\n\t\t,\n\t\t\t$set:\n\t\t\t\tusernames: [me.username, to.username]\n\t\t\t$setOnInsert:\n\t\t\t\tt: 'd'\n\t\t\t\tmsgs: 0\n\t\t\t\tts: now\n\n\t\t# Make user I have a subcription to this room\n\t\tRocketChat.models.Subscriptions.upsert\n\t\t\trid: rid\n\t\t\t$and: [{'u._id': me._id}] # work around to solve problems with upsert and dot\n\t\t,\n\t\t\t$set:\n\t\t\t\tts: now\n\t\t\t\tls: now\n\t\t\t\topen: true\n\t\t\t$setOnInsert:\n\t\t\t\tname: to.username\n\t\t\t\tt: 'd'\n\t\t\t\talert: false\n\t\t\t\tunread: 0\n\t\t\t\tu:\n\t\t\t\t\t_id: me._id\n\t\t\t\t\tusername: me.username\n\n\t\t# Make user the target user has a subcription to this room\n\t\tRocketChat.models.Subscriptions.upsert\n\t\t\trid: rid\n\t\t\t$and: [{'u._id': to._id}] # work around to solve problems with upsert and dot\n\t\t,\n\t\t\t$setOnInsert:\n\t\t\t\tname: me.username\n\t\t\t\tt: 'd'\n\t\t\t\topen: false\n\t\t\t\talert: false\n\t\t\t\tunread: 0\n\t\t\t\tu:\n\t\t\t\t\t_id: to._id\n\t\t\t\t\tusername: to.username\n\n\t\treturn {\n\t\t\trid: rid\n\t\t}\n"]}
|
|
@ -1,69 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/createPrivateGroup.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
createPrivateGroup: function(name, members) { // 2
|
||||
var extra, i, len, me, member, nameValidation, now, room, username;
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] createPrivateGroup -> Invalid user");
|
||||
} //
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'create-p')) {
|
||||
throw new Meteor.Error('not-authorized', '[methods] createPrivateGroup -> Not authorized');
|
||||
} //
|
||||
try { // 9
|
||||
nameValidation = new RegExp('^' + RocketChat.settings.get('UTF8_Names_Validation') + '$');
|
||||
} catch (_error) { //
|
||||
nameValidation = new RegExp('^[0-9a-zA-Z-_.]+$'); // 12
|
||||
} //
|
||||
if (!nameValidation.test(name)) { // 14
|
||||
throw new Meteor.Error('name-invalid'); // 15
|
||||
} //
|
||||
now = new Date(); // 3
|
||||
me = Meteor.user(); // 3
|
||||
members.push(me.username); // 3
|
||||
if (RocketChat.models.Rooms.findOneByName(name)) { // 26
|
||||
if (RocketChat.models.Rooms.findOneByName(name).archived) { // 27
|
||||
throw new Meteor.Error('archived-duplicate-name'); // 28
|
||||
} else { //
|
||||
throw new Meteor.Error('duplicate-name'); // 30
|
||||
} //
|
||||
} //
|
||||
room = RocketChat.models.Rooms.createWithTypeNameUserAndUsernames('p', name, me, members, {
|
||||
ts: now // 34
|
||||
}); //
|
||||
for (i = 0, len = members.length; i < len; i++) { // 36
|
||||
username = members[i]; //
|
||||
member = RocketChat.models.Users.findOneByUsername(username, { // 37
|
||||
fields: { // 37
|
||||
username: 1 // 37
|
||||
} //
|
||||
}); //
|
||||
if (member == null) { // 38
|
||||
continue; // 39
|
||||
} //
|
||||
extra = {}; // 37
|
||||
if (username === me.username) { // 43
|
||||
extra.ls = now; // 44
|
||||
} else { //
|
||||
extra.alert = true; // 46
|
||||
} //
|
||||
RocketChat.models.Subscriptions.createWithRoomAndUser(room, member, extra);
|
||||
} // 36
|
||||
RocketChat.authz.addUserRoles(Meteor.userId(), ['owner'], room._id);
|
||||
return { // 53
|
||||
rid: room._id // 53
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=createPrivateGroup.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/createPrivateGroup.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,sBAAoB,SAAC,IAAD,EAAO,OAAP;AACnB;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,8CAA7B,CAAV,CADD;KAAA;AAGA,mBAAiB,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,UAAhD,CAA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K,CAAC,KAAN,GAAc,IAAd,CAHD;OANA;AAAA,MAWA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,qBAAhC,CAAsD,IAAtD,EAA4D,MAA5D,EAAoE,KAApE,CAXA,CADD;AAAA,KAjCA;AAAA,IAgDA,UAAU,CAAC,KAAK,CAAC,YAAjB,CAA8B,MAAM,CAAC,MAAP,EAA9B,EAA+C,CAAC,OAAD,CAA/C,EAA0D,IAAI,CAAC,GAA/D,CAhDA;AAkDA,WAAO;AAAA,MACN,KAAK,IAAI,CAAC,GADJ;KAAP,CAnDmB;EAAA,CAApB;CADD","file":"/server/methods/createPrivateGroup.coffee.js","sourcesContent":["Meteor.methods\n\tcreatePrivateGroup: (name, members) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', \"[methods] createPrivateGroup -> Invalid user\"\n\n\t\tunless RocketChat.authz.hasPermission(Meteor.userId(), 'create-p')\n\t\t\tthrow new Meteor.Error 'not-authorized', '[methods] createPrivateGroup -> Not authorized'\n\n\t\ttry\n\t\t\tnameValidation = new RegExp '^' + RocketChat.settings.get('UTF8_Names_Validation') + '$'\n\t\tcatch\n\t\t\tnameValidation = new RegExp '^[0-9a-zA-Z-_.]+$'\n\n\t\tif not nameValidation.test name\n\t\t\tthrow new Meteor.Error 'name-invalid'\n\n\t\tnow = new Date()\n\n\t\tme = Meteor.user()\n\n\t\tmembers.push me.username\n\n\t\t# name = s.slugify name\n\n\t\t# avoid duplicate names\n\t\tif RocketChat.models.Rooms.findOneByName name\n\t\t\tif RocketChat.models.Rooms.findOneByName(name).archived\n\t\t\t\tthrow new Meteor.Error 'archived-duplicate-name'\n\t\t\telse\n\t\t\t\tthrow new Meteor.Error 'duplicate-name'\n\n\t\t# create new room\n\t\troom = RocketChat.models.Rooms.createWithTypeNameUserAndUsernames 'p', name, me, members,\n\t\t\tts: now\n\n\t\tfor username in members\n\t\t\tmember = RocketChat.models.Users.findOneByUsername(username, { fields: { username: 1 }})\n\t\t\tif not member?\n\t\t\t\tcontinue\n\n\t\t\textra = {}\n\n\t\t\tif username is me.username\n\t\t\t\textra.ls = now\n\t\t\telse\n\t\t\t\textra.alert = true\n\n\t\t\tRocketChat.models.Subscriptions.createWithRoomAndUser room, member, extra\n\n\t\t# set creator as group moderator. permission limited to group by scoping to rid\n\t\tRocketChat.authz.addUserRoles(Meteor.userId(), ['owner'], room._id)\n\n\t\treturn {\n\t\t\trid: room._id\n\t\t}\n"]}
|
|
@ -1,9 +0,0 @@
|
|||
(function(){Meteor.methods({
|
||||
deleteFileMessage: function(fileID) {
|
||||
return Meteor.call('deleteMessage', RocketChat.models.Messages.getMessageByFileId(fileID));
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=deleteFileMessage.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/deleteFileMessage.js"],"names":[],"mappings":"yBAAA;AACA;AACA;AACA;AACA","file":"/server/methods/deleteFileMessage.js","sourcesContent":["Meteor.methods({\n\tdeleteFileMessage: function(fileID) {\n\t\treturn Meteor.call('deleteMessage', RocketChat.models.Messages.getMessageByFileId(fileID));\n\t}\n});\n"]}
|
|
@ -1,82 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/deleteMessage.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
deleteMessage: function(message) { // 2
|
||||
var blockDeleteInMinutes, currentTsDiff, deleteAllowed, deleteOwn, hasPermission, keepHistory, msgTs, originalMessage, ref, ref1, ref2, showDeletedStatus;
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] deleteMessage -> Invalid user");
|
||||
} //
|
||||
originalMessage = RocketChat.models.Messages.findOneById(message._id, {
|
||||
fields: { // 6
|
||||
u: 1, // 6
|
||||
rid: 1, // 6
|
||||
file: 1 // 6
|
||||
} //
|
||||
}); //
|
||||
if (originalMessage == null) { // 7
|
||||
throw new Meteor.Error('message-deleting-not-allowed', "[methods] deleteMessage -> Message with id [" + message._id + " dos not exists]");
|
||||
} //
|
||||
hasPermission = RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', originalMessage.rid);
|
||||
deleteAllowed = RocketChat.settings.get('Message_AllowDeleting'); // 3
|
||||
deleteOwn = (originalMessage != null ? (ref = originalMessage.u) != null ? ref._id : void 0 : void 0) === Meteor.userId();
|
||||
if (!(hasPermission || (deleteAllowed && deleteOwn))) { // 15
|
||||
throw new Meteor.Error('message-deleting-not-allowed', "[methods] deleteMessage -> Message deleting not allowed");
|
||||
} //
|
||||
blockDeleteInMinutes = RocketChat.settings.get('Message_AllowDeleting_BlockDeleteInMinutes');
|
||||
if ((blockDeleteInMinutes != null) && blockDeleteInMinutes !== 0) {
|
||||
if (originalMessage.ts != null) { // 20
|
||||
msgTs = moment(originalMessage.ts); // 20
|
||||
} //
|
||||
if (msgTs != null) { // 21
|
||||
currentTsDiff = moment().diff(msgTs, 'minutes'); // 21
|
||||
} //
|
||||
if (currentTsDiff > blockDeleteInMinutes) { // 22
|
||||
toastr.error(t('Message_deleting_blocked')); // 23
|
||||
throw new Meteor.Error('message-deleting-blocked'); // 24
|
||||
} //
|
||||
} //
|
||||
keepHistory = RocketChat.settings.get('Message_KeepHistory'); // 3
|
||||
showDeletedStatus = RocketChat.settings.get('Message_ShowDeletedStatus');
|
||||
if (keepHistory) { // 30
|
||||
if (showDeletedStatus) { // 31
|
||||
RocketChat.models.Messages.cloneAndSaveAsHistoryById(originalMessage._id);
|
||||
} else { //
|
||||
RocketChat.models.Messages.setHiddenById(originalMessage._id, true);
|
||||
} //
|
||||
if (((ref1 = originalMessage.file) != null ? ref1._id : void 0) != null) {
|
||||
RocketChat.models.Uploads.update(originalMessage.file._id, { // 37
|
||||
$set: { // 37
|
||||
_hidden: true // 37
|
||||
} //
|
||||
}); //
|
||||
} //
|
||||
} else { //
|
||||
if (!showDeletedStatus) { // 40
|
||||
RocketChat.models.Messages.removeById(originalMessage._id); // 41
|
||||
} //
|
||||
if (((ref2 = originalMessage.file) != null ? ref2._id : void 0) != null) {
|
||||
FileUpload["delete"](originalMessage.file._id); // 44
|
||||
} //
|
||||
} //
|
||||
if (showDeletedStatus) { // 46
|
||||
return RocketChat.models.Messages.setAsDeletedById(originalMessage._id);
|
||||
} else { //
|
||||
return RocketChat.Notifications.notifyRoom(originalMessage.rid, 'deleteMessage', {
|
||||
_id: originalMessage._id // 49
|
||||
}); //
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=deleteMessage.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/deleteMessage.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,OAAD;AACd;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,yCAA7B,CAAV,CADD;KAAA;AAAA,IAGA,kBAAkB,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,WAA3B,CAAuC,OAAO,CAAC,GAA/C,EAAoD;AAAA,MAAC,QAAQ;AAAA,QAAC,GAAG,CAAJ;AAAA,QAAO,KAAK,CAAZ;AAAA,QAAe,MAAM,CAArB;OAAT;KAApD,CAHlB;AAIA,QAAO,uBAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,8BAAb,EAA6C,iDAA+C,OAAO,CAAC,GAAvD,GAA2D,kBAAxG,CAAV,CADD;KAJA;AAAA,IAOA,gBAAgB,UAAU,CAAC,KAAK,CAAC,aAAjB,CAA+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,CAAC,GAAtD,EAA2D;AAAA,UAAC,MAAM;AAAA,YAAC,SAAS,IAAV;WAAP;SAA3D,EADD;OAND;KAAA;AAUC,UAAG,kBAAH;AACC,kBAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,UAA3B,CAAsC,eAAe,CAAC,GAAtD,EADD;OAAA;AAGA,UAAG,mEAAH;AACC,kBAAU,CAAC,QAAD,CAAV,CAAkB,eAAe,CAAC,IAAI,CAAC,GAAvC,EADD;OAbD;KA3BA;AA2CA,QAAG,iBAAH;aACC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAA3B,CAA4C,eAAe,CAAC,GAA5D,EADD;KAAA;aAGC,UAAU,CAAC,aAAa,CAAC,UAAzB,CAAoC,eAAe,CAAC,GAApD,EAAyD,eAAzD,EAA0E;AAAA,QAAC,KAAK,eAAe,CAAC,GAAtB;OAA1E,EAHD;KA5Cc;EAAA,CAAf;CADD","file":"/server/methods/deleteMessage.coffee.js","sourcesContent":["Meteor.methods\n\tdeleteMessage: (message) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error('invalid-user', \"[methods] deleteMessage -> Invalid user\")\n\n\t\toriginalMessage = RocketChat.models.Messages.findOneById message._id, {fields: {u: 1, rid: 1, file: 1}}\n\t\tif not originalMessage?\n\t\t\tthrow new Meteor.Error 'message-deleting-not-allowed', \"[methods] deleteMessage -> Message with id [#{message._id} dos not exists]\"\n\n\t\thasPermission = RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', originalMessage.rid)\n\t\tdeleteAllowed = RocketChat.settings.get 'Message_AllowDeleting'\n\n\t\tdeleteOwn = originalMessage?.u?._id is Meteor.userId()\n\n\t\tunless hasPermission or (deleteAllowed and deleteOwn)\n\t\t\tthrow new Meteor.Error 'message-deleting-not-allowed', \"[methods] deleteMessage -> Message deleting not allowed\"\n\n\t\tblockDeleteInMinutes = RocketChat.settings.get 'Message_AllowDeleting_BlockDeleteInMinutes'\n\t\tif blockDeleteInMinutes? and blockDeleteInMinutes isnt 0\n\t\t\tmsgTs = moment(originalMessage.ts) if originalMessage.ts?\n\t\t\tcurrentTsDiff = moment().diff(msgTs, 'minutes') if msgTs?\n\t\t\tif currentTsDiff > blockDeleteInMinutes\n\t\t\t\ttoastr.error t('Message_deleting_blocked')\n\t\t\t\tthrow new Meteor.Error 'message-deleting-blocked'\n\n\n\t\tkeepHistory = RocketChat.settings.get 'Message_KeepHistory'\n\t\tshowDeletedStatus = RocketChat.settings.get 'Message_ShowDeletedStatus'\n\n\t\tif keepHistory\n\t\t\tif showDeletedStatus\n\t\t\t\tRocketChat.models.Messages.cloneAndSaveAsHistoryById originalMessage._id\n\t\t\telse\n\t\t\t\tRocketChat.models.Messages.setHiddenById originalMessage._id, true\n\n\t\t\tif originalMessage.file?._id?\n\t\t\t\tRocketChat.models.Uploads.update originalMessage.file._id, {$set: {_hidden: true}}\n\n\t\telse\n\t\t\tif not showDeletedStatus\n\t\t\t\tRocketChat.models.Messages.removeById originalMessage._id\n\n\t\t\tif originalMessage.file?._id?\n\t\t\t\tFileUpload.delete(originalMessage.file._id)\n\n\t\tif showDeletedStatus\n\t\t\tRocketChat.models.Messages.setAsDeletedById originalMessage._id\n\t\telse\n\t\t\tRocketChat.Notifications.notifyRoom originalMessage.rid, 'deleteMessage', {_id: originalMessage._id}\n"]}
|
|
@ -1,33 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/deleteUser.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
deleteUser: function(userId) { // 2
|
||||
var user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] deleteUser -> Invalid user");
|
||||
} //
|
||||
user = RocketChat.models.Users.findOneById(Meteor.userId()); // 3
|
||||
if (RocketChat.authz.hasPermission(Meteor.userId(), 'delete-user') !== true) {
|
||||
throw new Meteor.Error('not-authorized', '[methods] deleteUser -> Not authorized');
|
||||
} //
|
||||
user = RocketChat.models.Users.findOneById(userId); // 3
|
||||
if (user == null) { // 12
|
||||
throw new Meteor.Error('not-found', '[methods] deleteUser -> User not found');
|
||||
} //
|
||||
RocketChat.deleteUser(userId); // 3
|
||||
return true; // 17
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=deleteUser.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/deleteUser.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,cAAY,SAAC,MAAD;AACX;AAAA,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,sCAA7B,CAAV,CADD;KAAA;AAAA,IAGA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAAM,CAAC,MAAP,EAApC,CAHP;AAKA,QAAO,UAAU,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,aAAhD,MAAkE,IAAzE;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,gBAAb,EAA+B,wCAA/B,CAAV,CADD;KALA;AAAA,IAQA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAApC,CARP;AASA,QAAO,YAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,WAAb,EAA0B,wCAA1B,CAAV,CADD;KATA;AAAA,IAYA,UAAU,CAAC,UAAX,CAAsB,MAAtB,CAZA;AAcA,WAAO,IAAP,CAfW;EAAA,CAAZ;CADD","file":"/server/methods/deleteUser.coffee.js","sourcesContent":["Meteor.methods\n\tdeleteUser: (userId) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error('invalid-user', \"[methods] deleteUser -> Invalid user\")\n\n\t\tuser = RocketChat.models.Users.findOneById Meteor.userId()\n\n\t\tunless RocketChat.authz.hasPermission(Meteor.userId(), 'delete-user') is true\n\t\t\tthrow new Meteor.Error 'not-authorized', '[methods] deleteUser -> Not authorized'\n\n\t\tuser = RocketChat.models.Users.findOneById userId\n\t\tunless user?\n\t\t\tthrow new Meteor.Error 'not-found', '[methods] deleteUser -> User not found'\n\n\t\tRocketChat.deleteUser(userId)\n\n\t\treturn true\n"]}
|
|
@ -1,29 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/eraseRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
eraseRoom: function(rid) { // 2
|
||||
var fromId, ref, roomType; // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
roomType = (ref = RocketChat.models.Rooms.findOneById(rid)) != null ? ref.t : void 0;
|
||||
if (RocketChat.authz.hasPermission(fromId, "delete-" + roomType, rid)) {
|
||||
RocketChat.models.Messages.removeByRoomId(rid); // 10
|
||||
RocketChat.models.Subscriptions.removeByRoomId(rid); // 10
|
||||
return RocketChat.models.Rooms.removeById(rid); //
|
||||
} else { //
|
||||
throw new Meteor.Error('unauthorized'); // 15
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=eraseRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/eraseRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,aAAW,SAAC,GAAD;AACV;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AAAA,IAEA,yEAAmD,CAAE,UAFrD;AAIA,QAAG,UAAU,CAAC,KAAK,CAAC,aAAjB,CAAgC,MAAhC,EAAwC,YAAU,QAAlD,EAA8D,GAA9D,CAAH;AAGC,gBAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,cAA3B,CAA0C,GAA1C;AAAA,MACA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,cAAhC,CAA+C,GAA/C,CADA;aAEA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,UAAxB,CAAmC,GAAnC,EALD;KAAA;AAQC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,CAAV,CARD;KALU;EAAA,CAAX;CADD","file":"/server/methods/eraseRoom.coffee.js","sourcesContent":["Meteor.methods\n\teraseRoom: (rid) ->\n\t\tfromId = Meteor.userId()\n\n\t\troomType = RocketChat.models.Rooms.findOneById(rid)?.t\n\n\t\tif RocketChat.authz.hasPermission( fromId, \"delete-#{roomType}\", rid )\n\t\t\t# ChatRoom.update({ _id: rid}, {'$pull': { userWatching: Meteor.userId(), userIn: Meteor.userId() }})\n\n\t\t\tRocketChat.models.Messages.removeByRoomId rid\n\t\t\tRocketChat.models.Subscriptions.removeByRoomId rid\n\t\t\tRocketChat.models.Rooms.removeById rid\n\t\t\t# @TODO remove das mensagens lidas do usuário\n\t\telse\n\t\t\tthrow new Meteor.Error 'unauthorized'\n"]}
|
|
@ -1,124 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/getAvatarSuggestion.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
this.getAvatarSuggestionForUser = function(user) { // 1
|
||||
var avatar, avatars, blob, e, email, i, j, k, len, len1, len2, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, result, validAvatars;
|
||||
avatars = []; // 2
|
||||
if ((((ref = user.services.facebook) != null ? ref.id : void 0) != null) && RocketChat.settings.get('Accounts_OAuth_Facebook')) {
|
||||
avatars.push({ // 5
|
||||
service: 'facebook', // 6
|
||||
url: "https://graph.facebook.com/" + user.services.facebook.id + "/picture?type=large"
|
||||
}); //
|
||||
} //
|
||||
if ((((ref1 = user.services.google) != null ? ref1.picture : void 0) != null) && user.services.google.picture !== "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg" && RocketChat.settings.get('Accounts_OAuth_Google')) {
|
||||
avatars.push({ // 10
|
||||
service: 'google', // 11
|
||||
url: user.services.google.picture // 11
|
||||
}); //
|
||||
} //
|
||||
if ((((ref2 = user.services.github) != null ? ref2.username : void 0) != null) && RocketChat.settings.get('Accounts_OAuth_Github')) {
|
||||
avatars.push({ // 15
|
||||
service: 'github', // 16
|
||||
url: "https://avatars.githubusercontent.com/" + user.services.github.username + "?s=200"
|
||||
}); //
|
||||
} //
|
||||
if ((((ref3 = user.services.linkedin) != null ? ref3.pictureUrl : void 0) != null) && RocketChat.settings.get('Accounts_OAuth_Linkedin')) {
|
||||
avatars.push({ // 20
|
||||
service: 'linkedin', // 21
|
||||
url: user.services.linkedin.pictureUrl // 21
|
||||
}); //
|
||||
} //
|
||||
if ((((ref4 = user.services.twitter) != null ? ref4.profile_image_url_https : void 0) != null) && RocketChat.settings.get('Accounts_OAuth_Twitter')) {
|
||||
avatars.push({ // 25
|
||||
service: 'twitter', // 26
|
||||
url: user.services.twitter.profile_image_url_https // 26
|
||||
}); //
|
||||
} //
|
||||
if ((((ref5 = user.services.gitlab) != null ? ref5.avatar_url : void 0) != null) && RocketChat.settings.get('Accounts_OAuth_Gitlab')) {
|
||||
avatars.push({ // 30
|
||||
service: 'gitlab', // 31
|
||||
url: user.services.gitlab.avatar_url // 31
|
||||
}); //
|
||||
} //
|
||||
if ((((ref6 = user.services.sandstorm) != null ? ref6.picture : void 0) != null) && Meteor.settings["public"].sandstorm) {
|
||||
avatars.push({ // 35
|
||||
service: 'sandstorm', // 36
|
||||
url: user.services.sandstorm.picture // 36
|
||||
}); //
|
||||
} //
|
||||
if (((ref7 = user.emails) != null ? ref7.length : void 0) > 0) { // 39
|
||||
ref8 = user.emails; // 40
|
||||
for (i = 0, len = ref8.length; i < len; i++) { // 40
|
||||
email = ref8[i]; //
|
||||
if (email.verified === true) { //
|
||||
avatars.push({ // 41
|
||||
service: 'gravatar', // 42
|
||||
url: Gravatar.imageUrl(email.address, { // 42
|
||||
"default": '404', // 43
|
||||
size: 200, // 43
|
||||
secure: true // 43
|
||||
}) //
|
||||
}); //
|
||||
} //
|
||||
} // 40
|
||||
ref9 = user.emails; // 45
|
||||
for (j = 0, len1 = ref9.length; j < len1; j++) { // 45
|
||||
email = ref9[j]; //
|
||||
if (email.verified !== true) { //
|
||||
avatars.push({ // 46
|
||||
service: 'gravatar', // 47
|
||||
url: Gravatar.imageUrl(email.address, { // 47
|
||||
"default": '404', // 48
|
||||
size: 200, // 48
|
||||
secure: true // 48
|
||||
}) //
|
||||
}); //
|
||||
} //
|
||||
} // 45
|
||||
} //
|
||||
validAvatars = {}; // 2
|
||||
for (k = 0, len2 = avatars.length; k < len2; k++) { // 51
|
||||
avatar = avatars[k]; //
|
||||
try { // 52
|
||||
result = HTTP.get(avatar.url, { // 53
|
||||
npmRequestOptions: { // 53
|
||||
encoding: 'binary' // 53
|
||||
} //
|
||||
}); //
|
||||
if (result.statusCode === 200) { // 54
|
||||
blob = "data:" + result.headers['content-type'] + ";base64,"; // 55
|
||||
blob += Buffer(result.content, 'binary').toString('base64'); // 55
|
||||
avatar.blob = blob; // 55
|
||||
avatar.contentType = result.headers['content-type']; // 55
|
||||
validAvatars[avatar.service] = avatar; // 55
|
||||
} //
|
||||
} catch (_error) { //
|
||||
e = _error; // 60
|
||||
} //
|
||||
} // 51
|
||||
return validAvatars; // 63
|
||||
}; // 1
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
getAvatarSuggestion: function() { // 67
|
||||
var user; // 68
|
||||
if (!Meteor.userId()) { // 68
|
||||
throw new Meteor.Error(203, '[methods] getAvatarSuggestion -> Usuário não logado');
|
||||
} //
|
||||
this.unblock(); // 68
|
||||
user = Meteor.user(); // 68
|
||||
return getAvatarSuggestionForUser(user); //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=getAvatarSuggestion.coffee.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,28 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/getRoomIdByNameOrId.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
getRoomIdByNameOrId: function(rid) { // 2
|
||||
var room; // 4
|
||||
room = RocketChat.models.Rooms.findOneById(rid); // 4
|
||||
if (room == null) { // 6
|
||||
room = RocketChat.models.Rooms.findOneByName(rid); // 7
|
||||
} //
|
||||
if (room != null) { // 9
|
||||
rid = room._id; // 10
|
||||
} //
|
||||
return rid; // 12
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=getRoomIdByNameOrId.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/getRoomIdByNameOrId.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,uBAAqB,SAAC,GAAD;AAEpB;AAAA,WAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,GAApC,CAAP;AAEA,QAAO,YAAP;AACC,aAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,aAAxB,CAAsC,GAAtC,CAAP,CADD;KAFA;AAKA,QAAG,YAAH;AACC,YAAM,IAAI,CAAC,GAAX,CADD;KALA;AAQA,WAAO,GAAP,CAVoB;EAAA,CAArB;CADD","file":"/server/methods/getRoomIdByNameOrId.coffee.js","sourcesContent":["Meteor.methods\n\tgetRoomIdByNameOrId: (rid) ->\n\n\t\troom = RocketChat.models.Rooms.findOneById rid\n\n\t\tif not room?\n\t\t\troom = RocketChat.models.Rooms.findOneByName rid\n\n\t\tif room?\n\t\t\trid = room._id\n\n\t\treturn rid\n"]}
|
|
@ -1,25 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/getTotalChannels.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
getTotalChannels: function() { // 2
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', '[methods] getTotalChannels -> Invalid user');
|
||||
} //
|
||||
return RocketChat.models.Rooms.find({ // 6
|
||||
t: 'c' // 6
|
||||
}).count(); //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=getTotalChannels.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/getTotalChannels.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACE;AAAA,oBAAkB;AAChB,QAAG,OAAU,CAAC,MAAP,EAAP;AACE,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,4CAA7B,CAAV,CADF;KAAA;AAGA,WAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,IAAxB,CAA6B;AAAA,MAAE,GAAG,GAAL;KAA7B,CAAwC,CAAC,KAAzC,EAAP,CAJgB;EAAA,CAAlB;CADF","file":"/server/methods/getTotalChannels.coffee.js","sourcesContent":["Meteor.methods\n getTotalChannels: ->\n if not Meteor.userId()\n throw new Meteor.Error 'invalid-user', '[methods] getTotalChannels -> Invalid user'\n\n return RocketChat.models.Rooms.find({ t: 'c' }).count()\n"]}
|
|
@ -1,134 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/getUsernameSuggestion.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var slug, usernameIsAvaliable; // 1
|
||||
//
|
||||
slug = function(text) { // 1
|
||||
text = slugify(text, '.'); // 2
|
||||
return text.replace(/[^0-9a-z-_.]/g, ''); // 3
|
||||
}; // 1
|
||||
//
|
||||
usernameIsAvaliable = function(username) { // 1
|
||||
if (username.length < 1) { // 6
|
||||
return false; // 7
|
||||
} //
|
||||
if (username === 'all') { // 9
|
||||
return false; // 10
|
||||
} //
|
||||
return !RocketChat.models.Users.findOneByUsername({ // 12
|
||||
$regex: new RegExp("^" + username + "$", "i") // 12
|
||||
}); //
|
||||
}; // 5
|
||||
//
|
||||
this.generateSuggestion = function(user) { // 1
|
||||
var email, first, i, index, item, j, k, last, len, len1, len2, nameParts, ref, ref1, ref2, ref3, ref4, ref5, service, serviceName, username, usernames;
|
||||
usernames = []; // 15
|
||||
username = void 0; // 15
|
||||
if (Meteor.settings["public"].sandstorm) { // 18
|
||||
usernames.push(user.services.sandstorm.preferredHandle); // 19
|
||||
} //
|
||||
if (RocketChat.settings.get('UTF8_Names_Slugify')) { // 21
|
||||
usernames.push(slug(user.name)); // 22
|
||||
} else { //
|
||||
usernames.push(user.name); // 24
|
||||
} //
|
||||
nameParts = user != null ? (ref = user.name) != null ? ref.split(' ') : void 0 : void 0;
|
||||
if (nameParts.length > 1) { // 27
|
||||
first = nameParts[0]; // 28
|
||||
last = nameParts[nameParts.length - 1]; // 28
|
||||
if (RocketChat.settings.get('UTF8_Names_Slugify')) { // 31
|
||||
usernames.push(slug(first[0] + last)); // 32
|
||||
usernames.push(slug(first + last[0])); // 32
|
||||
} else { //
|
||||
usernames.push(first[0] + last); // 35
|
||||
usernames.push(first + last[0]); // 35
|
||||
} //
|
||||
} //
|
||||
if (((ref1 = user.profile) != null ? ref1.name : void 0) != null) { // 38
|
||||
if (RocketChat.settings.get('UTF8_Names_Slugify')) { // 39
|
||||
usernames.push(slug(user.profile.name)); // 40
|
||||
} else { //
|
||||
usernames.push(user.profile.name); // 42
|
||||
} //
|
||||
} //
|
||||
if (user.services != null) { // 44
|
||||
ref2 = user.services; // 45
|
||||
for (serviceName in ref2) { // 45
|
||||
service = ref2[serviceName]; //
|
||||
if (service.name != null) { // 46
|
||||
if (RocketChat.settings.get('UTF8_Names_Slugify')) { // 47
|
||||
usernames.push(slug(service.name)); // 48
|
||||
} else { //
|
||||
usernames.push(service.name); // 50
|
||||
} //
|
||||
} else if (service.username != null) { //
|
||||
if (RocketChat.settings.get('UTF8_Names_Slugify')) { // 52
|
||||
usernames.push(slug(service.username)); // 53
|
||||
} else { //
|
||||
usernames.push(service.username); // 55
|
||||
} //
|
||||
} //
|
||||
} // 45
|
||||
} //
|
||||
if (((ref3 = user.emails) != null ? ref3.length : void 0) > 0) { // 57
|
||||
ref4 = user.emails; // 58
|
||||
for (i = 0, len = ref4.length; i < len; i++) { // 58
|
||||
email = ref4[i]; //
|
||||
if ((email.address != null) && email.verified === true) { //
|
||||
usernames.push(slug(email.address.replace(/@.+$/, ''))); // 59
|
||||
} //
|
||||
} // 58
|
||||
ref5 = user.emails; // 61
|
||||
for (j = 0, len1 = ref5.length; j < len1; j++) { // 61
|
||||
email = ref5[j]; //
|
||||
if ((email.address != null) && email.verified === true) { //
|
||||
usernames.push(slug(email.address.replace(/(.+)@(\w+).+/, '$1.$2')));
|
||||
} //
|
||||
} // 61
|
||||
} //
|
||||
for (k = 0, len2 = usernames.length; k < len2; k++) { // 64
|
||||
item = usernames[k]; //
|
||||
if (usernameIsAvaliable(item)) { // 65
|
||||
username = item; // 66
|
||||
break; // 67
|
||||
} //
|
||||
} // 64
|
||||
if ((usernames[0] != null) && usernames[0].length > 0) { // 69
|
||||
index = 0; // 70
|
||||
while (username == null) { // 71
|
||||
index++; // 72
|
||||
if (usernameIsAvaliable(usernames[0] + '-' + index)) { // 73
|
||||
username = usernames[0] + '-' + index; // 74
|
||||
} //
|
||||
} //
|
||||
} //
|
||||
if (usernameIsAvaliable(username)) { // 76
|
||||
return username; // 77
|
||||
} //
|
||||
return void 0; // 79
|
||||
}; // 14
|
||||
//
|
||||
RocketChat.generateUsernameSuggestion = generateSuggestion; // 1
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
getUsernameSuggestion: function() { // 83
|
||||
var user; // 84
|
||||
if (!Meteor.userId()) { // 84
|
||||
throw new Meteor.Error(403, "[methods] getUsernameSuggestion -> Invalid user");
|
||||
} //
|
||||
user = Meteor.user(); // 84
|
||||
return generateSuggestion(user); // 88
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=getUsernameSuggestion.coffee.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,23 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/hideRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
hideRoom: function(rid) { // 2
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', '[methods] hideRoom -> Invalid user');
|
||||
} //
|
||||
return RocketChat.models.Subscriptions.hideByRoomIdAndUserId(rid, Meteor.userId());
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=hideRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/hideRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,YAAU,SAAC,GAAD;AACT,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,oCAA7B,CAAV,CADD;KAAA;WAGA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,qBAAhC,CAAsD,GAAtD,EAA2D,MAAM,CAAC,MAAP,EAA3D,EAJS;EAAA,CAAV;CADD","file":"/server/methods/hideRoom.coffee.js","sourcesContent":["Meteor.methods\n\thideRoom: (rid) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', '[methods] hideRoom -> Invalid user'\n\n\t\tRocketChat.models.Subscriptions.hideByRoomIdAndUserId rid, Meteor.userId()\n"]}
|
|
@ -1,48 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/joinRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
joinRoom: function(rid) { // 2
|
||||
var now, room, subscription, user; // 4
|
||||
room = RocketChat.models.Rooms.findOneById(rid); // 4
|
||||
if (room == null) { // 6
|
||||
throw new Meteor.Error(500, 'No channel with this id'); // 7
|
||||
} //
|
||||
if (room.t !== 'c' || RocketChat.authz.hasPermission(Meteor.userId(), 'view-c-room') !== true) {
|
||||
throw new Meteor.Error(403, '[methods] joinRoom -> Not allowed');
|
||||
} //
|
||||
now = new Date(); // 4
|
||||
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, Meteor.userId());
|
||||
if (subscription != null) { // 16
|
||||
return; // 17
|
||||
} //
|
||||
user = RocketChat.models.Users.findOneById(Meteor.userId()); // 4
|
||||
RocketChat.callbacks.run('beforeJoinRoom', user, room); // 4
|
||||
RocketChat.models.Rooms.addUsernameById(rid, user.username); // 4
|
||||
RocketChat.models.Subscriptions.createWithRoomAndUser(room, user, {
|
||||
ts: now, // 26
|
||||
open: true, // 26
|
||||
alert: true, // 26
|
||||
unread: 1 // 26
|
||||
}); //
|
||||
RocketChat.models.Messages.createUserJoinWithRoomIdAndUser(rid, user, {
|
||||
ts: now // 32
|
||||
}); //
|
||||
Meteor.defer(function() { // 4
|
||||
return RocketChat.callbacks.run('afterJoinRoom', user, room); //
|
||||
}); //
|
||||
return true; // 37
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=joinRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/joinRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,YAAU,SAAC,GAAD;AAET;AAAA,WAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,GAApC,CAAP;AAEA,QAAO,YAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,GAAb,EAAkB,yBAAlB,CAAV,CADD;KAFA;AAKA,QAAG,IAAI,CAAC,CAAL,KAAY,GAAZ,IAAmB,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ById rid\n\n\t\tif not room?\n\t\t\tthrow new Meteor.Error 500, 'No channel with this id'\n\n\t\tif room.t isnt 'c' or RocketChat.authz.hasPermission(Meteor.userId(), 'view-c-room') isnt true\n\t\t\tthrow new Meteor.Error 403, '[methods] joinRoom -> Not allowed'\n\n\t\tnow = new Date()\n\n\t\t# Check if user is already in room\n\t\tsubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId rid, Meteor.userId()\n\t\tif subscription?\n\t\t\treturn\n\n\t\tuser = RocketChat.models.Users.findOneById Meteor.userId()\n\n\t\tRocketChat.callbacks.run 'beforeJoinRoom', user, room\n\n\t\tRocketChat.models.Rooms.addUsernameById rid, user.username\n\n\t\tRocketChat.models.Subscriptions.createWithRoomAndUser room, user,\n\t\t\tts: now\n\t\t\topen: true\n\t\t\talert: true\n\t\t\tunread: 1\n\n\t\tRocketChat.models.Messages.createUserJoinWithRoomIdAndUser rid, user,\n\t\t\tts: now\n\n\t\tMeteor.defer ->\n\t\t\tRocketChat.callbacks.run 'afterJoinRoom', user, room\n\n\t\treturn true\n"]}
|
|
@ -1,46 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/leaveRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
leaveRoom: function(rid) { // 2
|
||||
var fromId, numOwners, removedUser, room, user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error(403, "[methods] leaveRoom -> Invalid user");
|
||||
} //
|
||||
this.unblock(); // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
room = RocketChat.models.Rooms.findOneById(rid); // 3
|
||||
user = Meteor.user(); // 3
|
||||
if (RocketChat.authz.hasRole(user._id, 'owner', room._id)) { // 13
|
||||
numOwners = RocketChat.authz.getUsersInRole('owner', room._id).fetch().length;
|
||||
if (numOwners === 1) { // 15
|
||||
throw new Meteor.Error('last-owner', 'You_are_the_last_owner_Please_set_new_owner_before_leaving_the_room');
|
||||
} //
|
||||
} //
|
||||
RocketChat.callbacks.run('beforeLeaveRoom', user, room); // 3
|
||||
RocketChat.models.Rooms.removeUsernameById(rid, user.username); // 3
|
||||
if (room.usernames.indexOf(user.username) !== -1) { // 22
|
||||
removedUser = user; // 23
|
||||
RocketChat.models.Messages.createUserLeaveWithRoomIdAndUser(rid, removedUser);
|
||||
} //
|
||||
if (room.t === 'l') { // 26
|
||||
RocketChat.models.Messages.createCommandWithRoomIdAndUser('survey', rid, user);
|
||||
} //
|
||||
RocketChat.models.Subscriptions.removeByRoomIdAndUserId(rid, Meteor.userId());
|
||||
return Meteor.defer(function() { //
|
||||
return RocketChat.callbacks.run('afterLeaveRoom', user, room); //
|
||||
}); //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=leaveRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/leaveRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,aAAW,SAAC,GAAD;AACV;AAAA,eAAa,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,GAAb,EAAkB,qCAAlB,CAAV,CADD;KAAA;AAAA,IAGA,IAAI,CAAC,OAAL,EAHA;AAAA,IAKA,SAAS,MAAM,CAAC,MAAP,EALT;AAAA,IAMA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,GAApC,CANP;AAAA,IAOA,OAAO,MAAM,CAAC,IAAP,EAPP;AAUA,QAAG,UAAU,CAAC,KAAK,CAAC,OAAjB,CAAyB,IAAI,CAAC,GAA9B,EAAmC,OAAnC,EAA4C,IAAI,CAAC,GAAjD,CAAH;AACC,kBAAY,UAAU,CAAC,KAAK,CAAC,cAAjB,CAAgC,OAAhC,EAAyC,IAAI,CAAC,GAA9C,CAAkD,CAAC,KAAnD,EAA0D,CAAC,MAAvE;AACA,UAAG,cAAa,CAAhB;AACC,cAAU,UAAM,CAAC,KAAP,CAAa,YAAb,EAA2B,qEAA3B,CAAV,CADD;OAFD;KAVA;AAAA,IAeA,UAAU,CAAC,SAAS,CAAC,GAArB,CAAyB,iBAAzB,EAA4C,IAA5C,EAAkD,IAAlD,CAfA;AAAA,IAiBA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAxB,CAA2C,GAA3C,EAAgD,IAAI,CAAC,QAArD,CAjBA;AAmBA,QAAG,IAAI,CAAC,SAAS,CAAC,OAAf,CAAuB,IAAI,CAAC,QAA5B,MAA2C,EAA9C;AACC,oBAAc,IAAd;AAAA,MACA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,gCAA3B,CAA4D,GAA5D,EAAiE,WAAjE,CADA,CADD;KAnBA;AAuBA,QAAG,IAAI,CAAC,CAAL,KAAU,GAAb;AACC,gBAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA3B,CAA0D,QAA1D,EAAoE,GAApE,EAAyE,IAAzE,EADD;KAvBA;AAAA,IA0BA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,uBAAhC,CAAwD,GAAxD,EAA6D,MAAM,CAAC,MAAP,EAA7D,CA1BA;WA4BA,MAAM,CAAC,KAAP,CAAa;aAEZ,UAAU,CAAC,SAAS,CAAC,GAArB,CAAyB,gBAAzB,EAA2C,IAA3C,EAAiD,IAAjD,EAFY;IAAA,CAAb,EA7BU;EAAA,CAAX;CADD","file":"/server/methods/leaveRoom.coffee.js","sourcesContent":["Meteor.methods\n\tleaveRoom: (rid) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error(403, \"[methods] leaveRoom -> Invalid user\")\n\n\t\tthis.unblock()\n\n\t\tfromId = Meteor.userId()\n\t\troom = RocketChat.models.Rooms.findOneById rid\n\t\tuser = Meteor.user()\n\n\t\t# If user is room owner, check if there are other owners. If there isn't anyone else, warn user to set a new owner.\n\t\tif RocketChat.authz.hasRole(user._id, 'owner', room._id)\n\t\t\tnumOwners = RocketChat.authz.getUsersInRole('owner', room._id).fetch().length\n\t\t\tif numOwners is 1\n\t\t\t\tthrow new Meteor.Error 'last-owner', 'You_are_the_last_owner_Please_set_new_owner_before_leaving_the_room'\n\n\t\tRocketChat.callbacks.run 'beforeLeaveRoom', user, room\n\n\t\tRocketChat.models.Rooms.removeUsernameById rid, user.username\n\n\t\tif room.usernames.indexOf(user.username) isnt -1\n\t\t\tremovedUser = user\n\t\t\tRocketChat.models.Messages.createUserLeaveWithRoomIdAndUser rid, removedUser\n\n\t\tif room.t is 'l'\n\t\t\tRocketChat.models.Messages.createCommandWithRoomIdAndUser 'survey', rid, user\n\n\t\tRocketChat.models.Subscriptions.removeByRoomIdAndUserId rid, Meteor.userId()\n\n\t\tMeteor.defer ->\n\n\t\t\tRocketChat.callbacks.run 'afterLeaveRoom', user, room\n"]}
|
|
@ -1,69 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/loadHistory.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
loadHistory: function(rid, end, limit, ls) { // 2
|
||||
var firstMessage, firstUnread, fromId, messages, options, records, unreadMessages, unreadNotLoaded;
|
||||
if (limit == null) { //
|
||||
limit = 20; //
|
||||
} //
|
||||
fromId = Meteor.userId(); // 3
|
||||
if (!Meteor.call('canAccessRoom', rid, fromId)) { // 4
|
||||
return false; // 5
|
||||
} //
|
||||
options = { // 3
|
||||
sort: { // 8
|
||||
ts: -1 // 9
|
||||
}, //
|
||||
limit: limit // 8
|
||||
}; //
|
||||
if (!RocketChat.settings.get('Message_ShowEditedStatus')) { // 12
|
||||
options.fields = { // 13
|
||||
'editedAt': 0 // 13
|
||||
}; //
|
||||
} //
|
||||
if (end != null) { // 15
|
||||
records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(rid, end, options).fetch();
|
||||
} else { //
|
||||
records = RocketChat.models.Messages.findVisibleByRoomId(rid, options).fetch();
|
||||
} //
|
||||
messages = _.map(records, function(message) { // 3
|
||||
message.starred = _.findWhere(message.starred, { // 21
|
||||
_id: fromId // 21
|
||||
}); //
|
||||
return message; // 22
|
||||
}); //
|
||||
unreadNotLoaded = 0; // 3
|
||||
if (ls != null) { // 26
|
||||
firstMessage = messages[messages.length - 1]; // 27
|
||||
if ((firstMessage != null ? firstMessage.ts : void 0) > ls) { // 28
|
||||
delete options.limit; // 29
|
||||
unreadMessages = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestamps(rid, ls, firstMessage.ts, {
|
||||
limit: 1, // 30
|
||||
sort: { // 30
|
||||
ts: 1 // 30
|
||||
} //
|
||||
}); //
|
||||
firstUnread = unreadMessages.fetch()[0]; // 29
|
||||
unreadNotLoaded = unreadMessages.count(); // 29
|
||||
} //
|
||||
} //
|
||||
return { // 34
|
||||
messages: messages, // 34
|
||||
firstUnread: firstUnread, // 34
|
||||
unreadNotLoaded: unreadNotLoaded // 34
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=loadHistory.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/loadHistory.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,eAAa,SAAC,GAAD,EAAM,GAAN,EAAW,KAAX,EAAqB,EAArB;AACZ;;MADuB,QAAM;KAC7B;AAAA,a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1F,CADjB;AAAA,QAEA,cAAc,cAAc,CAAC,KAAf,EAAuB,GAFrC;AAAA,QAGA,kBAAkB,cAAc,CAAC,KAAf,EAHlB,CADD;OAFD;KAvBA;AA+BA,WAAO;AAAA,MACN,UAAU,QADJ;AAAA,MAEN,aAAa,WAFP;AAAA,MAGN,iBAAiB,eAHX;KAAP,CAhCY;EAAA,CAAb;CADD","file":"/server/methods/loadHistory.coffee.js","sourcesContent":["Meteor.methods\n\tloadHistory: (rid, end, limit=20, ls) ->\n\t\tfromId = Meteor.userId()\n\t\tunless Meteor.call 'canAccessRoom', rid, fromId\n\t\t\treturn false\n\n\t\toptions =\n\t\t\tsort:\n\t\t\t\tts: -1\n\t\t\tlimit: limit\n\n\t\tif not RocketChat.settings.get 'Message_ShowEditedStatus'\n\t\t\toptions.fields = { 'editedAt': 0 }\n\n\t\tif end?\n\t\t\trecords = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(rid, end, options).fetch()\n\t\telse\n\t\t\trecords = RocketChat.models.Messages.findVisibleByRoomId(rid, options).fetch()\n\n\t\tmessages = _.map records, (message) ->\n\t\t\tmessage.starred = _.findWhere message.starred, { _id: fromId }\n\t\t\treturn message\n\n\t\tunreadNotLoaded = 0\n\n\t\tif ls?\n\t\t\tfirstMessage = messages[messages.length - 1]\n\t\t\tif firstMessage?.ts > ls\n\t\t\t\tdelete options.limit\n\t\t\t\tunreadMessages = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestamps(rid, ls, firstMessage.ts, { limit: 1, sort: { ts: 1 } })\n\t\t\t\tfirstUnread = unreadMessages.fetch()[0]\n\t\t\t\tunreadNotLoaded = unreadMessages.count()\n\n\t\treturn {\n\t\t\tmessages: messages\n\t\t\tfirstUnread: firstUnread\n\t\t\tunreadNotLoaded: unreadNotLoaded\n\t\t}\n"]}
|
|
@ -1,26 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/loadLocale.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
loadLocale: function(locale) { // 2
|
||||
var e; // 3
|
||||
try { // 3
|
||||
return Assets.getText("moment-locales/" + (locale.toLowerCase()) + ".js");
|
||||
} catch (_error) { //
|
||||
e = _error; // 6
|
||||
return console.log(e); //
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=loadLocale.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/loadLocale.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,cAAY,SAAC,MAAD;AACX;AAAA;AACC,aAAO,MAAM,CAAC,OAAP,CAAe,oBAAiB,CAAC,MAAM,CAAC,WAAP,EAAD,CAAjB,GAAuC,KAAtD,CAAP,CADD;KAAA;AAGC,MADK,UACL;aAAA,OAAO,CAAC,GAAR,CAAY,CAAZ,EAHD;KADW;EAAA,CAAZ;CADD","file":"/server/methods/loadLocale.coffee.js","sourcesContent":["Meteor.methods\n\tloadLocale: (locale) ->\n\t\ttry\n\t\t\treturn Assets.getText \"moment-locales/#{locale.toLowerCase()}.js\"\n\t\tcatch e\n\t\t\tconsole.log e\n"]}
|
|
@ -1,35 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/loadMissedMessages.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
loadMissedMessages: function(rid, start) { // 2
|
||||
var fromId, options; // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
if (!Meteor.call('canAccessRoom', rid, fromId)) { // 4
|
||||
return false; // 5
|
||||
} //
|
||||
options = { // 3
|
||||
sort: { // 8
|
||||
ts: -1 // 9
|
||||
} //
|
||||
}; //
|
||||
if (!RocketChat.settings.get('Message_ShowEditedStatus')) { // 11
|
||||
options.fields = { // 12
|
||||
'editedAt': 0 // 12
|
||||
}; //
|
||||
} //
|
||||
return RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(rid, start, options).fetch();
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=loadMissedMessages.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/loadMissedMessages.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,sBAAoB,SAAC,GAAD,EAAM,KAAN;AACnB;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AACA,eAAa,CAAC,IAAP,CAAY,eAAZ,EAA6B,GAA7B,EAAkC,MAAlC,CAAP;AACC,aAAO,KAAP,CADD;KADA;AAAA,IAIA,UACC;AAAA,YACC;AAAA,YAAI,EAAJ;OADD;KALD;AAQA,QAAG,WAAc,CAAC,QAAQ,CAAC,GAApB,CAAwB,0BAAxB,CAAP;AACC,aAAO,CAAC,MAAR,GAAiB;AAAA,QAAE,YAAY,CAAd;OAAjB,CADD;KARA;AAWA,WAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,iCAA3B,CAA6D,GAA7D,EAAkE,KAAlE,EAAyE,OAAzE,CAAiF,CAAC,KAAlF,EAAP,CAZmB;EAAA,CAApB;CADD","file":"/server/methods/loadMissedMessages.coffee.js","sourcesContent":["Meteor.methods\n\tloadMissedMessages: (rid, start) ->\n\t\tfromId = Meteor.userId()\n\t\tunless Meteor.call 'canAccessRoom', rid, fromId\n\t\t\treturn false\n\n\t\toptions =\n\t\t\tsort:\n\t\t\t\tts: -1\n\n\t\tif not RocketChat.settings.get 'Message_ShowEditedStatus'\n\t\t\toptions.fields = { 'editedAt': 0 }\n\n\t\treturn RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(rid, start, options).fetch()\n"]}
|
|
@ -1,52 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/loadNextMessages.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
loadNextMessages: function(rid, end, limit) { // 2
|
||||
var fromId, messages, options, records; // 3
|
||||
if (limit == null) { //
|
||||
limit = 20; //
|
||||
} //
|
||||
fromId = Meteor.userId(); // 3
|
||||
if (!Meteor.call('canAccessRoom', rid, fromId)) { // 5
|
||||
return false; // 6
|
||||
} //
|
||||
options = { // 3
|
||||
sort: { // 9
|
||||
ts: 1 // 10
|
||||
}, //
|
||||
limit: limit // 9
|
||||
}; //
|
||||
if (!RocketChat.settings.get('Message_ShowEditedStatus')) { // 13
|
||||
options.fields = { // 14
|
||||
'editedAt': 0 // 14
|
||||
}; //
|
||||
} //
|
||||
if (end != null) { // 16
|
||||
records = RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(rid, end, options).fetch();
|
||||
} else { //
|
||||
records = RocketChat.models.Messages.findVisibleByRoomId(rid, options).fetch();
|
||||
} //
|
||||
messages = _.map(records, function(message) { // 3
|
||||
message.starred = _.findWhere(message.starred, { // 22
|
||||
_id: fromId // 22
|
||||
}); //
|
||||
return message; // 23
|
||||
}); //
|
||||
return { // 25
|
||||
messages: messages // 25
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=loadNextMessages.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/loadNextMessages.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,oBAAkB,SAAC,GAAD,EAAM,GAAN,EAAW,KAAX;AACjB;;MAD4B,QAAM;KAClC;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AAEA,eAAa,CAAC,IAAP,CAAY,eAAZ,EAA6B,GAA7B,EAAkC,MAAlC,CAAP;AACC,aAAO,KAAP,CADD;KAFA;AAAA,IAKA,UACC;AAAA,YACC;AAAA,YAAI,CAAJ;OADD;AAAA,MAEA,OAAO,KAFP;KAND;AAUA,QAAG,WAAc,CAAC,QAAQ,CAAC,GAApB,CAAwB,0BAAxB,CAAP;AACC,aAAO,CAAC,MAAR,GAAiB;AAAA,QAAE,YAAY,CAAd;OAAjB,CADD;KAVA;AAaA,QAAG,WAAH;AACC,gBAAU,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,iCAA3B,CAA6D,GAA7D,EAAkE,GAAlE,EAAuE,OAAvE,CAA+E,CAAC,KAAhF,EAAV,CADD;KAAA;AAGC,gBAAU,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAA3B,CAA+C,GAA/C,EAAoD,OAApD,CAA4D,CAAC,KAA7D,EAAV,CAHD;KAbA;AAAA,IAkBA,WAAW,CAAC,CAAC,GAAF,CAAM,OAAN,EAAe,SAAC,OAAD;AACzB,aAAO,CAAC,OAAR,GAAkB,CAAC,CAAC,SAAF,CAAY,OAAO,CAAC,OAApB,EAA6B;AAAA,QAAE,KAAK,MAAP;OAA7B,CAAlB;AACA,aAAO,OAAP,CAFyB;IAAA,CAAf,CAlBX;AAsBA,WAAO;AAAA,MACN,UAAU,QADJ;KAAP,CAvBiB;EAAA,CAAlB;CADD","file":"/server/methods/loadNextMessages.coffee.js","sourcesContent":["Meteor.methods\n\tloadNextMessages: (rid, end, limit=20) ->\n\t\tfromId = Meteor.userId()\n\n\t\tunless Meteor.call 'canAccessRoom', rid, fromId\n\t\t\treturn false\n\n\t\toptions =\n\t\t\tsort:\n\t\t\t\tts: 1\n\t\t\tlimit: limit\n\n\t\tif not RocketChat.settings.get 'Message_ShowEditedStatus'\n\t\t\toptions.fields = { 'editedAt': 0 }\n\n\t\tif end?\n\t\t\trecords = RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(rid, end, options).fetch()\n\t\telse\n\t\t\trecords = RocketChat.models.Messages.findVisibleByRoomId(rid, options).fetch()\n\n\t\tmessages = _.map records, (message) ->\n\t\t\tmessage.starred = _.findWhere message.starred, { _id: fromId }\n\t\t\treturn message\n\n\t\treturn {\n\t\t\tmessages: messages\n\t\t}\n"]}
|
|
@ -1,73 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/loadSurroundingMessages.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
loadSurroundingMessages: function(message, limit) { // 2
|
||||
var afterMessages, fromId, messages, moreAfter, moreBefore, options, records;
|
||||
if (limit == null) { //
|
||||
limit = 50; //
|
||||
} //
|
||||
fromId = Meteor.userId(); // 3
|
||||
if (!message._id) { // 5
|
||||
return false; // 6
|
||||
} //
|
||||
message = RocketChat.models.Messages.findOneById(message._id); // 3
|
||||
if (!(message != null ? message.rid : void 0)) { // 10
|
||||
return false; // 11
|
||||
} //
|
||||
if (!Meteor.call('canAccessRoom', message.rid, fromId)) { // 13
|
||||
return false; // 14
|
||||
} //
|
||||
limit = limit - 1; // 3
|
||||
options = { // 3
|
||||
sort: { // 19
|
||||
ts: -1 // 20
|
||||
}, //
|
||||
limit: Math.ceil(limit / 2) // 19
|
||||
}; //
|
||||
if (!RocketChat.settings.get('Message_ShowEditedStatus')) { // 23
|
||||
options.fields = { // 24
|
||||
'editedAt': 0 // 24
|
||||
}; //
|
||||
} //
|
||||
records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(message.rid, message.ts, options).fetch();
|
||||
messages = _.map(records, function(message) { // 3
|
||||
message.starred = _.findWhere(message.starred, { // 28
|
||||
_id: fromId // 28
|
||||
}); //
|
||||
return message; // 29
|
||||
}); //
|
||||
moreBefore = messages.length === options.limit; // 3
|
||||
messages.push(message); // 3
|
||||
options.sort = { // 3
|
||||
ts: 1 // 35
|
||||
}; //
|
||||
options.limit = Math.floor(limit / 2); // 3
|
||||
records = RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(message.rid, message.ts, options).fetch();
|
||||
afterMessages = _.map(records, function(message) { // 3
|
||||
message.starred = _.findWhere(message.starred, { // 40
|
||||
_id: fromId // 40
|
||||
}); //
|
||||
return message; // 41
|
||||
}); //
|
||||
moreAfter = afterMessages.length === options.limit; // 3
|
||||
messages = messages.concat(afterMessages); // 3
|
||||
return { // 47
|
||||
messages: messages, // 47
|
||||
moreBefore: moreBefore, // 47
|
||||
moreAfter: moreAfter // 47
|
||||
}; //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=loadSurroundingMessages.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/loadSurroundingMessages.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,2BAAyB,SAAC,OAAD,EAAU,KAAV;AACxB;;MADkC,QAAM;KACxC;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AAEA,gBAAc,CAAC,GAAf;AACC,aAAO,KAAP,CADD;KAFA;AAAA,IAKA,UAAU,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,WAA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AO,CAAC,GAArE,EAA0E,OAAO,CAAC,EAAlF,EAAsF,OAAtF,CAA8F,CAAC,KAA/F,EAnCV;AAAA,IAoCA,gBAAgB,CAAC,CAAC,GAAF,CAAM,OAAN,EAAe,SAAC,OAAD;AAC9B,aAAO,CAAC,OAAR,GAAkB,CAAC,CAAC,SAAF,CAAY,OAAO,CAAC,OAApB,EAA6B;AAAA,QAAE,KAAK,MAAP;OAA7B,CAAlB;AACA,aAAO,OAAP,CAF8B;IAAA,CAAf,CApChB;AAAA,IAwCA,YAAY,aAAa,CAAC,MAAd,KAAwB,OAAO,CAAC,KAxC5C;AAAA,IA0CA,WAAW,QAAQ,CAAC,MAAT,CAAgB,aAAhB,CA1CX;AA4CA,WAAO;AAAA,MACN,UAAU,QADJ;AAAA,MAEN,YAAY,UAFN;AAAA,MAGN,WAAW,SAHL;KAAP,CA7CwB;EAAA,CAAzB;CADD","file":"/server/methods/loadSurroundingMessages.coffee.js","sourcesContent":["Meteor.methods\n\tloadSurroundingMessages: (message, limit=50) ->\n\t\tfromId = Meteor.userId()\n\n\t\tunless message._id\n\t\t\treturn false\n\n\t\tmessage = RocketChat.models.Messages.findOneById(message._id);\n\n\t\tunless message?.rid\n\t\t\treturn false\n\n\t\tunless Meteor.call 'canAccessRoom', message.rid, fromId\n\t\t\treturn false\n\n\t\tlimit = limit - 1\n\n\t\toptions =\n\t\t\tsort:\n\t\t\t\tts: -1\n\t\t\tlimit: Math.ceil(limit/2)\n\n\t\tif not RocketChat.settings.get 'Message_ShowEditedStatus'\n\t\t\toptions.fields = { 'editedAt': 0 }\n\n\t\trecords = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(message.rid, message.ts, options).fetch()\n\t\tmessages = _.map records, (message) ->\n\t\t\tmessage.starred = _.findWhere message.starred, { _id: fromId }\n\t\t\treturn message\n\n\t\tmoreBefore = messages.length is options.limit\n\n\t\tmessages.push message\n\n\t\toptions.sort = { ts: 1 }\n\t\toptions.limit = Math.floor(limit/2)\n\n\t\trecords = RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(message.rid, message.ts, options).fetch()\n\t\tafterMessages = _.map records, (message) ->\n\t\t\tmessage.starred = _.findWhere message.starred, { _id: fromId }\n\t\t\treturn message\n\n\t\tmoreAfter = afterMessages.length is options.limit\n\n\t\tmessages = messages.concat afterMessages\n\n\t\treturn {\n\t\t\tmessages: messages\n\t\t\tmoreBefore: moreBefore\n\t\t\tmoreAfter: moreAfter\n\t\t}\n"]}
|
|
@ -1,22 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/logoutCleanUp.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
logoutCleanUp: function(user) { // 2
|
||||
return Meteor.defer(function() { //
|
||||
return RocketChat.callbacks.run('afterLogoutCleanUp', user); //
|
||||
}); //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=logoutCleanUp.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/logoutCleanUp.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,IAAD;WACd,MAAM,CAAC,KAAP,CAAa;aAEZ,UAAU,CAAC,SAAS,CAAC,GAArB,CAAyB,oBAAzB,EAA+C,IAA/C,EAFY;IAAA,CAAb,EADc;EAAA,CAAf;CADD","file":"/server/methods/logoutCleanUp.coffee.js","sourcesContent":["Meteor.methods\r\n\tlogoutCleanUp: (user) ->\r\n\t\tMeteor.defer ->\r\n\r\n\t\t\tRocketChat.callbacks.run 'afterLogoutCleanUp', user\r\n"]}
|
|
@ -1,86 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/messageSearch.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
messageSearch: function(text, rid, limit) { // 2
|
||||
// 3
|
||||
/* // 3
|
||||
text = 'from:rodrigo mention:gabriel chat' //
|
||||
*/ //
|
||||
var from, mention, options, query, result; // 3
|
||||
result = { // 3
|
||||
messages: [], // 8
|
||||
users: [], // 8
|
||||
channels: [] // 8
|
||||
}; //
|
||||
query = {}; // 3
|
||||
options = { // 3
|
||||
sort: { // 14
|
||||
ts: -1 // 15
|
||||
}, //
|
||||
limit: limit || 20 // 14
|
||||
}; //
|
||||
from = []; // 3
|
||||
text = text.replace(/from:([a-z0-9.-_]+)/ig, function(match, username, index) {
|
||||
from.push(username); // 21
|
||||
return ''; // 22
|
||||
}); //
|
||||
if (from.length > 0) { // 24
|
||||
query['u.username'] = { // 25
|
||||
$regex: from.join('|'), // 26
|
||||
$options: 'i' // 26
|
||||
}; //
|
||||
} //
|
||||
mention = []; // 3
|
||||
text = text.replace(/mention:([a-z0-9.-_]+)/ig, function(match, username, index) {
|
||||
mention.push(username); // 33
|
||||
return ''; // 34
|
||||
}); //
|
||||
if (mention.length > 0) { // 36
|
||||
query['mentions.username'] = { // 37
|
||||
$regex: mention.join('|'), // 38
|
||||
$options: 'i' // 38
|
||||
}; //
|
||||
} //
|
||||
text = text.trim().replace(/\s\s/g, ' '); // 3
|
||||
if (text !== '') { // 44
|
||||
query.$text = { // 45
|
||||
$search: text // 46
|
||||
}; //
|
||||
options.fields = { // 45
|
||||
score: { // 49
|
||||
$meta: "textScore" // 50
|
||||
} //
|
||||
}; //
|
||||
} //
|
||||
if (Object.keys(query).length > 0) { // 56
|
||||
query.t = { // 57
|
||||
$ne: 'rm' // 57
|
||||
}; //
|
||||
query._hidden = { // 57
|
||||
$ne: true // 58
|
||||
}; //
|
||||
if (rid != null) { // 61
|
||||
query.rid = rid; // 62
|
||||
try { // 63
|
||||
if (Meteor.call('canAccessRoom', rid, this.userId) !== false) {
|
||||
result.messages = RocketChat.models.Messages.find(query, options).fetch();
|
||||
} //
|
||||
} catch (_error) {} //
|
||||
} //
|
||||
} //
|
||||
return result; // 115
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=messageSearch.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/messageSearch.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,IAAD,EAAO,GAAP,EAAY,KAAZ;AACd;AAAA;;OAAA;AAAA;AAAA,IAIA,SACC;AAAA,gBAAU,EAAV;AAAA,MACA,OAAO,EADP;AAAA,MAEA,UAAU,EAFV;KALD;AAAA,IASA,QAAQ,EATR;AAAA,IAUA,UACC;AAAA,YACC;AAAA,YAAI,EAAJ;OADD;AAAA,MAEA,OAAO,SAAS,EAFhB;KAXD;AAAA,IAgBA,OAAO,EAhBP;AAAA,IAiBA,OAAO,IAAI,CAAC,OAAL,CAAa,uBAAb,EAAsC,SAAC,KAAD,EAAQ,QAAR,EAAkB,KAAlB;AAC5C,UAAI,CAAC,IAAL,CAAU,QAAV;AACA,aAAO,EAAP,CAF4C;IAAA,CAAtC,CAjBP;AAqBA,QAAG,IAAI,CAAC,MAAL,GAAc,CAAjB;AACC,WAAM,cAAN,GACC;AAAA,gBAAQ,IAAI,CAAC,IAAL,CAAU,GAAV,CAAR;AAAA,QACA,UAAU,GADV;OADD,CADD;KArBA;AAAA,IA4BA,UAAU,EA5BV;AAAA,IA6BA,OAAO,IAAI,CAAC,OAAL,CAAa,0BAAb,EAAyC,SAAC,KAAD,EAAQ,QAAR,EAAkB,KAAlB;AAC/C,aAAO,CAAC,IAAR,CAAa,QAAb;AACA,aAAO,EAAP,CAF+C;IAAA,CAAzC,CA7BP;AAiCA,QAAG,OAAO,CAAC,MAAR,GAAiB,CAApB;AACC,WAAM,qBAAN,GACC;AAAA,gBAAQ,OAAO,CAAC,IAAR,CAAa,GAAb,CAAR;AAAA,QACA,UAAU,GADV;OADD,CADD;KAjCA;AAAA,IAwCA,OAAO,IAAI,CAAC,IAAL,EAAW,CAAC,OAAZ,CAAoB,OAApB,EAA6B,GAA7B,CAxCP;AAyCA,QAAG,SAAU,EAAb;AACC,WAAK,CAAC,KAAN,GACC;AAAA,iBAAS,IAAT;OADD;AAAA,MAGA,OAAO,CAAC,MAAR,GACC;AAAA,eACC;AAAA,iBAAO,WAAP;SADD;OAJD,CADD;KAzCA;AAqDA,QAAG,MAAM,CAAC,IAAP,CAAY,KAAZ,CAAkB,CAAC,MAAnB,GAA4B,CAA/B;AACC,WAAK,CAAC,CAAN,GAAU;AAAA,QAAE,KAAK,IAAP;OAAV;AAAA,MACA,KAAK,CAAC,OAAN,GAAgB;AAAA,QAAE,KAAK,IAAP;OADhB;AAIA,UAAG,WAAH;AACC,aAAK,CAAC,GAAN,GAAY,GAAZ;AACA;AACC,cAAG,MAAM,CAAC,IAAP,CAAY,eAAZ,EAA6B,GAA7B,EAAkC,IAAI,CAAC,MAAvC,MAAoD,KAAvD;AACC,kBAAM,CAAC,QAAP,GAAkB,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,IAA3B,CAAgC,KAAhC,EAAuC,OAAvC,CAA+C,CAAC,KAAhD,EAAlB,CADD;WADD;SAAA,kBAFD;OALD;KArDA;AAgHA,WAAO,MAAP,CAjHc;EAAA,CAAf;CADD","file":"/server/methods/messageSearch.coffee.js","sourcesContent":["Meteor.methods\n\tmessageSearch: (text, rid, limit) ->\n\t\t###\n\t\t\ttext = 'from:rodrigo mention:gabriel chat'\n\t\t###\n\n\t\tresult =\n\t\t\tmessages: []\n\t\t\tusers: []\n\t\t\tchannels: []\n\n\t\tquery = {}\n\t\toptions =\n\t\t\tsort:\n\t\t\t\tts: -1\n\t\t\tlimit: limit or 20\n\n\t\t# Query for senders\n\t\tfrom = []\n\t\ttext = text.replace /from:([a-z0-9.-_]+)/ig, (match, username, index) ->\n\t\t\tfrom.push username\n\t\t\treturn ''\n\n\t\tif from.length > 0\n\t\t\tquery['u.username'] =\n\t\t\t\t$regex: from.join('|')\n\t\t\t\t$options: 'i'\n\n\n\t\t# Query for mentions\n\t\tmention = []\n\t\ttext = text.replace /mention:([a-z0-9.-_]+)/ig, (match, username, index) ->\n\t\t\tmention.push username\n\t\t\treturn ''\n\n\t\tif mention.length > 0\n\t\t\tquery['mentions.username'] =\n\t\t\t\t$regex: mention.join('|')\n\t\t\t\t$options: 'i'\n\n\n\t\t# Query in message text\n\t\ttext = text.trim().replace(/\\s\\s/g, ' ')\n\t\tif text isnt ''\n\t\t\tquery.$text =\n\t\t\t\t$search: text\n\n\t\t\toptions.fields =\n\t\t\t\tscore:\n\t\t\t\t\t$meta: \"textScore\"\n\n\t\t\t# options.sort =\n\t\t\t# \tscore:\n\t\t\t# \t\t$meta: 'textScore'\n\n\t\tif Object.keys(query).length > 0\n\t\t\tquery.t = { $ne: 'rm' } # hide removed messages (userful when searching for user messages)\n\t\t\tquery._hidden = { $ne: true } # don't return _hidden messages\n\n\t\t\t# Filter by room\n\t\t\tif rid?\n\t\t\t\tquery.rid = rid\n\t\t\t\ttry\n\t\t\t\t\tif Meteor.call('canAccessRoom', rid, this.userId) isnt false\n\t\t\t\t\t\tresult.messages = RocketChat.models.Messages.find(query, options).fetch()\n\n\n\t\t# make sure we don't return more than limit results\n\t\t# limit -= result.messages?.length\n\n\t\t# ###\n\t\t# # USERS\n\t\t# ###\n\t\t# if from.length is 0 and mention.length is 0 and text isnt ''\n\t\t# \tquery =\n\t\t# \t\tusername:\n\t\t# \t\t\t$regex: text\n\t\t# \t\t\t$options: 'i'\n\n\t\t# \toptions =\n\t\t# \t\tlimit: 5\n\t\t# \t\tsort:\n\t\t# \t\t\tusername: 1\n\t\t# \t\tfields:\n\t\t# \t\t\tusername: 1\n\t\t# \t\t\tname: 1\n\t\t# \t\t\tstatus: 1\n\t\t# \t\t\tutcOffset: 1\n\n\t\t# \tresult.users = Meteor.users.find(query, options).fetch()\n\n\n\t\t# ###\n\t\t# # CHANNELS\n\t\t# ###\n\t\t# if from.length is 0 and mention.length is 0 and text isnt ''\n\t\t# \tquery =\n\t\t# \t\tt: 'c'\n\t\t# \t\tname:\n\t\t# \t\t\t$regex: text\n\t\t# \t\t\t$options: 'i'\n\n\t\t# \toptions =\n\t\t# \t\tlimit: 5\n\t\t# \t\tsort:\n\t\t# \t\t\tname: 1\n\t\t# \t\tfields:\n\t\t# \t\t\tusername: 1\n\t\t# \t\t\tname: 1\n\t\t# \t\t\tstatus: 1\n\t\t# \t\t\tutcOffset: 1\n\n\t\t# \tresult.channels = ChatRoom.find(query, options).fetch()\n\n\t\treturn result\n"]}
|
|
@ -1,30 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/migrate.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
migrateTo: function(version) { // 2
|
||||
var user; // 3
|
||||
user = Meteor.user(); // 3
|
||||
if ((user == null) || RocketChat.authz.hasPermission(user._id, 'run-migration') !== true) {
|
||||
throw new Meteor.Error("not-authorized", '[methods] migrateTo');
|
||||
} //
|
||||
this.unblock(); // 3
|
||||
RocketChat.Migrations.migrateTo(version); // 3
|
||||
return version; // 10
|
||||
}, //
|
||||
getMigrationVersion: function() { // 2
|
||||
return RocketChat.Migrations.getVersion(); // 13
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=migrate.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/migrate.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,aAAW,SAAC,OAAD;AACV;AAAA,WAAO,MAAM,CAAC,IAAP,EAAP;AAEA,QAAO,cAAJ,IAAa,UAAU,CAAC,KAAK,CAAC,aAAjB,CAA+B,IAAI,CAAC,GAApC,EAAyC,eAAzC,MAA+D,IAA/E;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,gBAAb,EAA+B,qBAA/B,CAAV,CADD;KAFA;AAAA,IAKA,IAAI,CAAC,OAAL,EALA;AAAA,IAMA,UAAU,CAAC,UAAU,CAAC,SAAtB,CAAgC,OAAhC,CANA;AAOA,WAAO,OAAP,CARU;EAAA,CAAX;AAAA,EAUA,qBAAqB;AACpB,WAAO,UAAU,CAAC,UAAU,CAAC,UAAtB,EAAP,CADoB;EAAA,CAVrB;CADD","file":"/server/methods/migrate.coffee.js","sourcesContent":["Meteor.methods\n\tmigrateTo: (version) ->\n\t\tuser = Meteor.user()\n\n\t\tif not user? or RocketChat.authz.hasPermission(user._id, 'run-migration') isnt true\n\t\t\tthrow new Meteor.Error \"not-authorized\", '[methods] migrateTo'\n\n\t\tthis.unblock()\n\t\tRocketChat.Migrations.migrateTo version\n\t\treturn version\n\n\tgetMigrationVersion: ->\n\t\treturn RocketChat.Migrations.getVersion()\n"]}
|
|
@ -1,50 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/muteUserInRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
muteUserInRoom: function(data) { // 2
|
||||
var fromId, fromUser, mutedUser, ref, ref1, room; // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
check(data, Match.ObjectIncluding({ // 3
|
||||
rid: String, // 4
|
||||
username: String // 4
|
||||
})); //
|
||||
if (!RocketChat.authz.hasPermission(fromId, 'mute-user', data.rid)) {
|
||||
throw new Meteor.Error('not-allowed', '[methods] muteUserInRoom -> Not allowed');
|
||||
} //
|
||||
room = RocketChat.models.Rooms.findOneById(data.rid); // 3
|
||||
if (!room) { // 10
|
||||
throw new Meteor.Error('invalid-room', '[methods] muteUserInRoom -> Room ID is invalid');
|
||||
} //
|
||||
if ((ref = room.t) !== 'c' && ref !== 'p') { // 13
|
||||
throw new Meteor.Error('invalid-room-type', '[methods] muteUserInRoom -> Invalid room type');
|
||||
} //
|
||||
if (ref1 = data.username, indexOf.call((room != null ? room.usernames : void 0) || [], ref1) < 0) {
|
||||
throw new Meteor.Error('not-in-room', '[methods] muteUserInRoom -> User is not in this room');
|
||||
} //
|
||||
mutedUser = RocketChat.models.Users.findOneByUsername(data.username);
|
||||
RocketChat.models.Rooms.muteUsernameByRoomId(data.rid, mutedUser.username);
|
||||
fromUser = RocketChat.models.Users.findOneById(fromId); // 3
|
||||
RocketChat.models.Messages.createUserMutedWithRoomIdAndUser(data.rid, mutedUser, {
|
||||
u: { // 25
|
||||
_id: fromUser._id, // 26
|
||||
username: fromUser.username // 26
|
||||
} //
|
||||
}); //
|
||||
return true; // 29
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=muteUserInRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/muteUserInRoom.coffee"],"names":[],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,gCAA3B,CAA4D,IAAI,CAAC,GAAjE,EAAsE,SAAtE,EACC;AAAA,SACC;AAAA,aAAK,QAAQ,CAAC,GAAd;AAAA,QACA,UAAU,QAAQ,CAAC,QADnB;OADD;KADD,CArBA;AA0BA,WAAO,IAAP,CA3Be;EAAA,CAAhB;CADD","file":"/server/methods/muteUserInRoom.coffee.js","sourcesContent":["Meteor.methods\n\tmuteUserInRoom: (data) ->\n\t\tfromId = Meteor.userId()\n\t\tcheck(data, Match.ObjectIncluding({ rid: String, username: String }))\n\n\t\tunless RocketChat.authz.hasPermission(fromId, 'mute-user', data.rid)\n\t\t\tthrow new Meteor.Error 'not-allowed', '[methods] muteUserInRoom -> Not allowed'\n\n\t\troom = RocketChat.models.Rooms.findOneById data.rid\n\t\tif not room\n\t\t\tthrow new Meteor.Error 'invalid-room', '[methods] muteUserInRoom -> Room ID is invalid'\n\n\t\tif room.t not in ['c', 'p']\n\t\t\tthrow new Meteor.Error 'invalid-room-type', '[methods] muteUserInRoom -> Invalid room type'\n\n\t\tif data.username not in (room?.usernames or [])\n\t\t\tthrow new Meteor.Error 'not-in-room', '[methods] muteUserInRoom -> User is not in this room'\n\n\t\tmutedUser = RocketChat.models.Users.findOneByUsername data.username\n\n\t\tRocketChat.models.Rooms.muteUsernameByRoomId data.rid, mutedUser.username\n\n\t\tfromUser = RocketChat.models.Users.findOneById fromId\n\t\tRocketChat.models.Messages.createUserMutedWithRoomIdAndUser data.rid, mutedUser,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\n\t\treturn true\n"]}
|
|
@ -1,23 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/openRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
openRoom: function(rid) { // 2
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', '[methods] openRoom -> Invalid user');
|
||||
} //
|
||||
return RocketChat.models.Subscriptions.openByRoomIdAndUserId(rid, Meteor.userId());
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=openRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/openRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACE;AAAA,YAAU,SAAC,GAAD;AACR,QAAG,OAAU,CAAC,MAAP,EAAP;AACE,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,oCAA7B,CAAV,CADF;KAAA;WAGA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,qBAAhC,CAAsD,GAAtD,EAA2D,MAAM,CAAC,MAAP,EAA3D,EAJQ;EAAA,CAAV;CADF","file":"/server/methods/openRoom.coffee.js","sourcesContent":["Meteor.methods\n openRoom: (rid) ->\n if not Meteor.userId()\n throw new Meteor.Error 'invalid-user', '[methods] openRoom -> Invalid user'\n\n RocketChat.models.Subscriptions.openByRoomIdAndUserId rid, Meteor.userId()\n"]}
|
|
@ -1,23 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/readMessages.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
readMessages: function(rid) { // 2
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', '[methods] readMessages -> Invalid user');
|
||||
} //
|
||||
return RocketChat.models.Subscriptions.setAsReadByRoomIdAndUserId(rid, Meteor.userId());
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=readMessages.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/readMessages.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,gBAAc,SAAC,GAAD;AACb,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,wCAA7B,CAAV,CADD;KAAA;WAGA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,0BAAhC,CAA2D,GAA3D,EAAgE,MAAM,CAAC,MAAP,EAAhE,EAJa;EAAA,CAAd;CADD","file":"/server/methods/readMessages.coffee.js","sourcesContent":["Meteor.methods\n\treadMessages: (rid) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', '[methods] readMessages -> Invalid user'\n\n\t\tRocketChat.models.Subscriptions.setAsReadByRoomIdAndUserId rid, Meteor.userId()\n"]}
|
|
@ -1,36 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/registerUser.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
registerUser: function(formData) { // 2
|
||||
var userData, userId; // 3
|
||||
if (RocketChat.settings.get('Accounts_RegistrationForm') === 'Disabled') {
|
||||
throw new Meteor.Error('registration-disabled', 'User registration is disabled');
|
||||
} else if (RocketChat.settings.get('Accounts_RegistrationForm') === 'Secret URL' && (!formData.secretURL || formData.secretURL !== RocketChat.settings.get('Accounts_RegistrationForm_SecretURL'))) {
|
||||
throw new Meteor.Error('registration-disabled', 'User registration is only allowed via Secret URL');
|
||||
} //
|
||||
RocketChat.validateEmailDomain(formData.email); // 3
|
||||
userData = { // 3
|
||||
email: s.trim(formData.email), // 12
|
||||
password: formData.pass // 12
|
||||
}; //
|
||||
userId = Accounts.createUser(userData); // 3
|
||||
RocketChat.models.Users.setName(userId, s.trim(formData.name)); // 3
|
||||
if (userData.email) { // 19
|
||||
Accounts.sendVerificationEmail(userId, userData.email); // 20
|
||||
} //
|
||||
return userId; // 22
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=registerUser.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/registerUser.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,gBAAc,SAAC,QAAD;AACb;AAAA,QAAG,UAAU,CAAC,QAAQ,CAAC,GAApB,CAAwB,2BAAxB,MAAwD,UAA3D;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,uBAAb,EAAsC,+BAAtC,CAAV,CADD;KAAA,MAGK,IAAG,UAAU,CAAC,QAAQ,CAAC,GAApB,CAAwB,2BAAxB,MAAwD,YAAxD,IAAyE,CAAC,SAAY,CAAC,SAAb,IAA0B,QAAQ,CAAC,SAAT,KAAwB,UAAU,CAAC,QAAQ,CAAC,GAApB,CAAwB,qCAAxB,CAAnD,CAA5E;AACJ,YAAU,UAAM,CAAC,KAAP,CAAa,uBAAb,EAAsC,kDAAtC,CAAV,CADI;KAHL;AAAA,IAMA,UAAU,CAAC,mBAAX,CAA+B,QAAQ,CAAC,KAAxC,CANA;AAAA,IAQA,WACC;AAAA,aAAO,CAAC,CAAC,IAAF,CAAO,QAAQ,CAAC,KAAhB,CAAP;AAAA,MACA,UAAU,QAAQ,CAAC,IADnB;KATD;AAAA,IAYA,SAAS,QAAQ,CAAC,UAAT,CAAoB,QAApB,CAZT;AAAA,IAcA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,OAAxB,CAAgC,MAAhC,EAAwC,CAAC,CAAC,IAAF,CAAO,QAAQ,CAAC,IAAhB,CAAxC,CAdA;AAgBA,QAAG,QAAQ,CAAC,KAAZ;AACC,cAAQ,CAAC,qBAAT,CAA+B,MAA/B,EAAuC,QAAQ,CAAC,KAAhD,EADD;KAhBA;AAmBA,WAAO,MAAP,CApBa;EAAA,CAAd;CADD","file":"/server/methods/registerUser.coffee.js","sourcesContent":["Meteor.methods\n\tregisterUser: (formData) ->\n\t\tif RocketChat.settings.get('Accounts_RegistrationForm') is 'Disabled'\n\t\t\tthrow new Meteor.Error 'registration-disabled', 'User registration is disabled'\n\n\t\telse if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL' and (not formData.secretURL or formData.secretURL isnt RocketChat.settings.get('Accounts_RegistrationForm_SecretURL'))\n\t\t\tthrow new Meteor.Error 'registration-disabled', 'User registration is only allowed via Secret URL'\n\n\t\tRocketChat.validateEmailDomain(formData.email);\n\n\t\tuserData =\n\t\t\temail: s.trim(formData.email)\n\t\t\tpassword: formData.pass\n\n\t\tuserId = Accounts.createUser userData\n\n\t\tRocketChat.models.Users.setName userId, s.trim(formData.name)\n\n\t\tif userData.email\n\t\t\tAccounts.sendVerificationEmail(userId, userData.email);\n\n\t\treturn userId\n"]}
|
|
@ -1,58 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/removeRoomModerator.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
removeRoomModerator: function(rid, userId) { // 2
|
||||
var fromUser, subscription, user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { // 4
|
||||
method: 'removeRoomModerator' // 4
|
||||
}); //
|
||||
} //
|
||||
check(rid, String); // 3
|
||||
check(userId, String); // 3
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'set-moderator', rid)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 10
|
||||
method: 'removeRoomModerator' // 10
|
||||
}); //
|
||||
} //
|
||||
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, userId);
|
||||
if (subscription == null) { // 13
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 14
|
||||
method: 'removeRoomModerator' // 14
|
||||
}); //
|
||||
} //
|
||||
RocketChat.models.Subscriptions.removeRoleById(subscription._id, 'moderator');
|
||||
user = RocketChat.models.Users.findOneById(userId); // 3
|
||||
fromUser = RocketChat.models.Users.findOneById(Meteor.userId()); // 3
|
||||
RocketChat.models.Messages.createSubscriptionRoleRemovedWithRoomIdAndUser(rid, user, {
|
||||
u: { // 21
|
||||
_id: fromUser._id, // 22
|
||||
username: fromUser.username // 22
|
||||
}, //
|
||||
role: 'moderator' // 21
|
||||
}); //
|
||||
RocketChat.Notifications.notifyAll('roles-change', { // 3
|
||||
type: 'removed', // 26
|
||||
_id: 'moderator', // 26
|
||||
u: { // 26
|
||||
_id: user._id, // 26
|
||||
username: user.username // 26
|
||||
}, //
|
||||
scope: rid // 26
|
||||
}); //
|
||||
return true; // 28
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=removeRoomModerator.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/removeRoomModerator.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,uBAAqB,SAAC,GAAD,EAAM,MAAN;AACpB;AAAA,eAAa,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,K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xB;AAAA,MAAqC,GAAG;AAAA,QAAE,KAAK,IAAI,CAAC,GAAZ;AAAA,QAAiB,UAAU,IAAI,CAAC,QAAhC;OAAxC;AAAA,MAAoF,OAAO,GAA3F;KAAnD,CAvBA;AAyBA,WAAO,IAAP,CA1BoB;EAAA,CAArB;CADD","file":"/server/methods/removeRoomModerator.coffee.js","sourcesContent":["Meteor.methods\n\tremoveRoomModerator: (rid, userId) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'removeRoomModerator' }\n\n\t\tcheck rid, String\n\t\tcheck userId, String\n\n\t\tunless RocketChat.authz.hasPermission Meteor.userId(), 'set-moderator', rid\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'removeRoomModerator' }\n\n\t\tsubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId rid, userId\n\t\tunless subscription?\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: 'removeRoomModerator' }\n\n\t\tRocketChat.models.Subscriptions.removeRoleById(subscription._id, 'moderator')\n\n\t\tuser = RocketChat.models.Users.findOneById userId\n\t\tfromUser = RocketChat.models.Users.findOneById Meteor.userId()\n\t\tRocketChat.models.Messages.createSubscriptionRoleRemovedWithRoomIdAndUser rid, user,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\t\t\trole: 'moderator'\n\n\t\tRocketChat.Notifications.notifyAll('roles-change', { type: 'removed', _id: 'moderator', u: { _id: user._id, username: user.username }, scope: rid });\n\n\t\treturn true\n"]}
|
|
@ -1,64 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/removeRoomOwner.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
removeRoomOwner: function(rid, userId) { // 2
|
||||
var fromUser, numOwners, subscription, user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { // 4
|
||||
method: 'removeRoomOwner' // 4
|
||||
}); //
|
||||
} //
|
||||
check(rid, String); // 3
|
||||
check(userId, String); // 3
|
||||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'set-owner', rid)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 10
|
||||
method: 'removeRoomOwner' // 10
|
||||
}); //
|
||||
} //
|
||||
subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(rid, userId);
|
||||
if (subscription == null) { // 13
|
||||
throw new Meteor.Error('error-invalid-room', 'Invalid room', { // 14
|
||||
method: 'removeRoomOwner' // 14
|
||||
}); //
|
||||
} //
|
||||
numOwners = RocketChat.authz.getUsersInRole('owner', rid).count();
|
||||
if (numOwners === 1) { // 17
|
||||
throw new Meteor.Error('error-remove-last-owner', 'This is the last owner. Please set a new owner before removing this one.', {
|
||||
method: 'removeRoomOwner' // 18
|
||||
}); //
|
||||
} //
|
||||
RocketChat.models.Subscriptions.removeRoleById(subscription._id, 'owner');
|
||||
user = RocketChat.models.Users.findOneById(userId); // 3
|
||||
fromUser = RocketChat.models.Users.findOneById(Meteor.userId()); // 3
|
||||
RocketChat.models.Messages.createSubscriptionRoleRemovedWithRoomIdAndUser(rid, user, {
|
||||
u: { // 25
|
||||
_id: fromUser._id, // 26
|
||||
username: fromUser.username // 26
|
||||
}, //
|
||||
role: 'owner' // 25
|
||||
}); //
|
||||
RocketChat.Notifications.notifyAll('roles-change', { // 3
|
||||
type: 'removed', // 30
|
||||
_id: 'owner', // 30
|
||||
u: { // 30
|
||||
_id: user._id, // 30
|
||||
username: user.username // 30
|
||||
}, //
|
||||
scope: rid // 30
|
||||
}); //
|
||||
return true; // 32
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=removeRoomOwner.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/removeRoomOwner.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,mBAAiB,SAAC,GAAD,EAAM,MAAN;AAChB;AAAA,eAAa,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,iBAAV;OAAnD,CAAV,CADD;KAAA;AAAA,IAGA,MAAM,GAAN,EAAW,MAAX,CAHA;AAAA,IAIA,MAAM,MAAN,EAAc,MAAd,CAJA;AAMA,mBAAiB,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAAM,CAAC,MAAP,EAA/B,EAAgD,WAAhD,EAA6D,GAA7D,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,mBAAb,EAAkC,aAAlC,EAAiD;AAAA,QAAE,QAAQ,iBAAV;OAAjD,CAAV,CADD;KANA;AAAA,IASA,eAAe,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,wBAAhC,CAAyD,GAAzD,EAA8D,MAA9D,CATf;AAUA,QAAO,oBAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,oBAAb,EAAmC,cAAnC,EAAmD;AAAA,QAAE,QAAQ,iBAAV;OAAnD,CAAV,CADD;KAVA;AAAA,IAaA,YAAY,UAAU,CAAC,KAAK,CAAC,cAAjB,CAAgC,OAAhC,EAAyC,GAAzC,CAA6C,CAAC,KAA9C,EAbZ;AAcA,QAAG,cAAa,CAAhB;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,yBAAb,EAAwC,0EAAxC,EAAoH;AAAA,QAAE,QAAQ,iBAAV;OAApH,CAAV,CADD;KAdA;AAAA,IAiBA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,cAAhC,CAA+C,YAAY,CAAC,GAA5D,EAAiE,OAAjE,CAjBA;AAAA,IAmBA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAApC,CAnBP;AAAA,IAoBA,WAAW,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAAM,CAAC,MAAP,EAApC,CApBX;AAAA,IAqBA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,8CAA3B,CAA0E,GAA1E,EAA+E,IAA/E,EACC;AAAA,SACC;AAAA,aAAK,QAAQ,CAAC,GAAd;AAAA,QACA,UAAU,QAAQ,CAAC,QADnB;OADD;AAAA,MAGA,MAAM,OAHN;KADD,CArBA;AAAA,IA2BA,UAAU,CAAC,aAAa,CAAC,SAAzB,CAAmC,cAAnC,EAAmD;AAAA,MAAE,MAAM,SAAR;AAAA,MAAmB,KAAK,OAAxB;AAAA,MAAiC,GAAG;AAAA,QAAE,KAAK,IAAI,CAAC,GAAZ;AAAA,QAAiB,UAAU,IAAI,CAAC,QAAhC;OAApC;AAAA,MAAgF,OAAO,GAAvF;KAAnD,CA3BA;AA6BA,WAAO,IAAP,CA9BgB;EAAA,CAAjB;CADD","file":"/server/methods/removeRoomOwner.coffee.js","sourcesContent":["Meteor.methods\n\tremoveRoomOwner: (rid, userId) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'removeRoomOwner' }\n\n\t\tcheck rid, String\n\t\tcheck userId, String\n\n\t\tunless RocketChat.authz.hasPermission Meteor.userId(), 'set-owner', rid\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'removeRoomOwner' }\n\n\t\tsubscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId rid, userId\n\t\tunless subscription?\n\t\t\tthrow new Meteor.Error 'error-invalid-room', 'Invalid room', { method: 'removeRoomOwner' }\n\n\t\tnumOwners = RocketChat.authz.getUsersInRole('owner', rid).count()\n\t\tif numOwners is 1\n\t\t\tthrow new Meteor.Error 'error-remove-last-owner', 'This is the last owner. Please set a new owner before removing this one.', { method: 'removeRoomOwner' }\n\n\t\tRocketChat.models.Subscriptions.removeRoleById(subscription._id, 'owner')\n\n\t\tuser = RocketChat.models.Users.findOneById userId\n\t\tfromUser = RocketChat.models.Users.findOneById Meteor.userId()\n\t\tRocketChat.models.Messages.createSubscriptionRoleRemovedWithRoomIdAndUser rid, user,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\t\t\trole: 'owner'\n\n\t\tRocketChat.Notifications.notifyAll('roles-change', { type: 'removed', _id: 'owner', u: { _id: user._id, username: user.username }, scope: rid });\n\n\t\treturn true\n"]}
|
|
@ -1,52 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/removeUserFromRoom.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
//
|
||||
Meteor.methods({ // 1
|
||||
removeUserFromRoom: function(data) { // 2
|
||||
var fromId, fromUser, ref, ref1, removedUser, room; // 3
|
||||
fromId = Meteor.userId(); // 3
|
||||
check(data, Match.ObjectIncluding({ // 3
|
||||
rid: String, // 4
|
||||
username: String // 4
|
||||
})); //
|
||||
if (!RocketChat.authz.hasPermission(fromId, 'remove-user', data.rid)) {
|
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { // 7
|
||||
method: 'removeUserFromRoom' // 7
|
||||
}); //
|
||||
} //
|
||||
room = RocketChat.models.Rooms.findOneById(data.rid); // 3
|
||||
if (ref = data.username, indexOf.call((room != null ? room.usernames : void 0) || [], ref) < 0) {
|
||||
throw new Meteor.Error('error-user-not-in-room', 'User is not in this room', {
|
||||
method: 'removeUserFromRoom' // 12
|
||||
}); //
|
||||
} //
|
||||
removedUser = RocketChat.models.Users.findOneByUsername(data.username);
|
||||
RocketChat.models.Rooms.removeUsernameById(data.rid, data.username);
|
||||
RocketChat.models.Subscriptions.removeByRoomIdAndUserId(data.rid, removedUser._id);
|
||||
if ((ref1 = room.t) === 'c' || ref1 === 'p') { // 20
|
||||
RocketChat.authz.removeUserFromRoles(removedUser._id, ['moderator', 'owner'], data.rid);
|
||||
} //
|
||||
fromUser = RocketChat.models.Users.findOneById(fromId); // 3
|
||||
RocketChat.models.Messages.createUserRemovedWithRoomIdAndUser(data.rid, removedUser, {
|
||||
u: { // 25
|
||||
_id: fromUser._id, // 26
|
||||
username: fromUser.username // 26
|
||||
} //
|
||||
}); //
|
||||
return true; // 29
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=removeUserFromRoom.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/removeUserFromRoom.coffee"],"names":[],"mappings":";;;;;;;;;AAAA;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,sBAAoB,SAAC,IAAD;AACnB;AAAA,aAAS,MAAM,CAAC,MAAP,EAAT;AAAA,IACA,MAAM,IAAN,EAAY,KAAK,CAAC,eAAN,CAAsB;AAAA,MAAE,KAAK,MAAP;AAAA,MAAe,UAAU,MAAzB;KAAtB,CAAZ,CADA;AAGA,mBAAiB,CAAC,KAAK,CAAC,aAAjB,CAA+B,MAA/B,EAAuC,aAAvC,EAAsD,IAAI,CAAC,GAA3D,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,mBAAb,EAAkC,aAAlC,EAAiD;AAAA,QAAE,QAAQ,oBAAV;OAAjD,CAAV,CADD;KAHA;AAAA,IAMA,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,IAAI,CAAC,GAAzC,CANP;AAQA,cAAG,IAAI,CAAC,QAAL,+BAAsB,IAAI,CAAE,mBAAN,IAAmB,EAAzC,UAAH;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,wBAAb,EAAuC,0BAAvC,EAAmE;AAAA,QAAE,QAAQ,oBAAV;OAAnE,CAAV,CADD;KARA;AAAA,IAWA,cAAc,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAxB,CAA0C,IAAI,CAAC,QAA/C,CAXd;AAAA,IAaA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAxB,CAA2C,IAAI,CAAC,GAAhD,EAAqD,IAAI,CAAC,QAA1D,CAbA;AAAA,IAeA,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,uBAAhC,CAAwD,IAAI,CAAC,GAA7D,EAAkE,WAAW,CAAC,GAA9E,CAfA;AAiBA,gBAAG,IAAI,CAAC,EAAL,KAAY,GAAZ,aAAiB,GAApB;AACC,gBAAU,CAAC,KAAK,CAAC,mBAAjB,CAAqC,WAAW,CAAC,GAAjD,EAAsD,CAAC,WAAD,EAAc,OAAd,CAAtD,EAA8E,IAAI,CAAC,GAAnF,EADD;KAjBA;AAAA,IAoBA,WAAW,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,WAAxB,CAAoC,MAApC,CApBX;AAAA,IAqBA,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,kCAA3B,CAA8D,IAAI,CAAC,GAAnE,EAAwE,WAAxE,EACC;AAAA,SACC;AAAA,aAAK,QAAQ,CAAC,GAAd;AAAA,QACA,UAAU,QAAQ,CAAC,QADnB;OADD;KADD,CArBA;AA0BA,WAAO,IAAP,CA3BmB;EAAA,CAApB;CADD","file":"/server/methods/removeUserFromRoom.coffee.js","sourcesContent":["Meteor.methods\n\tremoveUserFromRoom: (data) ->\n\t\tfromId = Meteor.userId()\n\t\tcheck(data, Match.ObjectIncluding({ rid: String, username: String }))\n\n\t\tunless RocketChat.authz.hasPermission(fromId, 'remove-user', data.rid)\n\t\t\tthrow new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'removeUserFromRoom' }\n\n\t\troom = RocketChat.models.Rooms.findOneById data.rid\n\n\t\tif data.username not in (room?.usernames or [])\n\t\t\tthrow new Meteor.Error 'error-user-not-in-room', 'User is not in this room', { method: 'removeUserFromRoom' }\n\n\t\tremovedUser = RocketChat.models.Users.findOneByUsername data.username\n\n\t\tRocketChat.models.Rooms.removeUsernameById data.rid, data.username\n\n\t\tRocketChat.models.Subscriptions.removeByRoomIdAndUserId data.rid, removedUser._id\n\n\t\tif room.t in [ 'c', 'p' ]\n\t\t\tRocketChat.authz.removeUserFromRoles(removedUser._id, ['moderator', 'owner'], data.rid)\n\n\t\tfromUser = RocketChat.models.Users.findOneById fromId\n\t\tRocketChat.models.Messages.createUserRemovedWithRoomIdAndUser data.rid, removedUser,\n\t\t\tu:\n\t\t\t\t_id: fromUser._id\n\t\t\t\tusername: fromUser.username\n\n\t\treturn true\n"]}
|
|
@ -1,26 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/reportMessage.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
reportMessage: function(message, description) { // 2
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error('invalid-user', "[methods] reportMessage -> Invalid user");
|
||||
} //
|
||||
if ((description == null) || description.trim() === '') { // 6
|
||||
throw new Meteor.Error('invalid-description', "[methods] reportMessage -> Invalid description");
|
||||
} //
|
||||
return RocketChat.models.Reports.createWithMessageDescriptionAndUserId(message, description, Meteor.userId());
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=reportMessage.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/reportMessage.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,iBAAe,SAAC,OAAD,EAAU,WAAV;AACd,QAAG,OAAU,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,cAAb,EAA6B,yCAA7B,CAAV,CADD;KAAA;AAGA,QAAO,qBAAJ,IAAoB,WAAW,CAAC,IAAZ,OAAsB,EAA7C;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,qBAAb,EAAoC,gDAApC,CAAV,CADD;KAHA;WAMA,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,qCAA1B,CAAgE,OAAhE,EAAyE,WAAzE,EAAsF,MAAM,CAAC,MAAP,EAAtF,EAPc;EAAA,CAAf;CADD","file":"/server/methods/reportMessage.coffee.js","sourcesContent":["Meteor.methods\n\treportMessage: (message, description) ->\n\t\tif not Meteor.userId()\n\t\t\tthrow new Meteor.Error 'invalid-user', \"[methods] reportMessage -> Invalid user\"\n\n\t\tif not description? or description.trim() is ''\n\t\t\tthrow new Meteor.Error 'invalid-description', \"[methods] reportMessage -> Invalid description\"\n\n\t\tRocketChat.models.Reports.createWithMessageDescriptionAndUserId message, description, Meteor.userId()\n"]}
|
|
@ -1,40 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/resetAvatar.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
resetAvatar: function(image, service) { // 2
|
||||
var user; // 3
|
||||
if (!Meteor.userId()) { // 3
|
||||
throw new Meteor.Error(403, "[methods] resetAvatar -> Invalid user");
|
||||
} //
|
||||
if (!RocketChat.settings.get("Accounts_AllowUserAvatarChange")) { // 6
|
||||
throw new Meteor.Error(403, "[methods] resetAvatar -> Invalid access");
|
||||
} //
|
||||
user = Meteor.user(); // 3
|
||||
RocketChatFileAvatarInstance.deleteFile(user.username + ".jpg"); // 3
|
||||
RocketChat.models.Users.unsetAvatarOrigin(user._id); // 3
|
||||
RocketChat.Notifications.notifyAll('updateAvatar', { // 3
|
||||
username: user.username // 15
|
||||
}); //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
DDPRateLimiter.addRule({ // 1
|
||||
type: 'method', // 20
|
||||
name: 'resetAvatar', // 20
|
||||
userId: function() { // 20
|
||||
return true; // 22
|
||||
} //
|
||||
}, 1, 60000); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=resetAvatar.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/resetAvatar.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,eAAa,SAAC,KAAD,EAAQ,OAAR;AACZ;AAAA,eAAa,CAAC,MAAP,EAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,GAAb,EAAkB,uCAAlB,CAAV,CADD;KAAA;AAGA,mBAAiB,CAAC,QAAQ,CAAC,GAApB,CAAwB,gCAAxB,CAAP;AACC,YAAU,UAAM,CAAC,KAAP,CAAa,GAAb,EAAkB,yCAAlB,CAAV,CADD;KAHA;AAAA,IAMA,OAAO,MAAM,CAAC,IAAP,EANP;AAAA,IAQA,4BAA4B,CAAC,UAA7B,CAA2C,IAAI,CAAC,QAAN,GAAe,MAAzD,CARA;AAAA,IAUA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAxB,CAA0C,IAAI,CAAC,GAA/C,CAVA;AAAA,IAYA,UAAU,CAAC,aAAa,CAAC,SAAzB,CAAmC,cAAnC,EAAmD;AAAA,MAAC,UAAU,IAAI,CAAC,QAAhB;KAAnD,CAZA,CADY;EAAA,CAAb;CADD;;AAAA,cAkBc,CAAC,OAAf,CACC;AAAA,QAAM,QAAN;AAAA,EACA,MAAM,aADN;AAAA,EAEA,QAAQ;AAAG,WAAO,IAAP,CAAH;EAAA,CAFR;CADD,EAIE,CAJF,EAIK,KAJL,CAlBA","file":"/server/methods/resetAvatar.coffee.js","sourcesContent":["Meteor.methods\n\tresetAvatar: (image, service) ->\n\t\tunless Meteor.userId()\n\t\t\tthrow new Meteor.Error(403, \"[methods] resetAvatar -> Invalid user\")\n\n\t\tunless RocketChat.settings.get(\"Accounts_AllowUserAvatarChange\")\n\t\t\tthrow new Meteor.Error(403, \"[methods] resetAvatar -> Invalid access\")\n\n\t\tuser = Meteor.user()\n\n\t\tRocketChatFileAvatarInstance.deleteFile \"#{user.username}.jpg\"\n\n\t\tRocketChat.models.Users.unsetAvatarOrigin user._id\n\n\t\tRocketChat.Notifications.notifyAll 'updateAvatar', {username: user.username}\n\t\treturn\n\n# Limit changing avatar once per minute\nDDPRateLimiter.addRule\n\ttype: 'method'\n\tname: 'resetAvatar'\n\tuserId: -> return true\n, 1, 60000\n"]}
|
|
@ -1,59 +0,0 @@
|
|||
(function(){
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// server/methods/saveUserPreferences.coffee.js //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
__coffeescriptShare = typeof __coffeescriptShare === 'object' ? __coffeescriptShare : {}; var share = __coffeescriptShare;
|
||||
Meteor.methods({ // 1
|
||||
saveUserPreferences: function(settings) { // 2
|
||||
var preferences; // 3
|
||||
if (Meteor.userId()) { // 3
|
||||
preferences = {}; // 4
|
||||
if (settings.language != null) { // 6
|
||||
RocketChat.models.Users.setLanguage(Meteor.userId(), settings.language);
|
||||
} //
|
||||
if (settings.disableNewRoomNotification != null) { // 9
|
||||
preferences.disableNewRoomNotification = settings.disableNewRoomNotification === "1" ? true : false;
|
||||
} //
|
||||
if (settings.disableNewMessageNotification != null) { // 12
|
||||
preferences.disableNewMessageNotification = settings.disableNewMessageNotification === "1" ? true : false;
|
||||
} //
|
||||
if (settings.useEmojis != null) { // 15
|
||||
preferences.useEmojis = settings.useEmojis === "1" ? true : false;
|
||||
} //
|
||||
if (settings.convertAsciiEmoji != null) { // 18
|
||||
preferences.convertAsciiEmoji = settings.convertAsciiEmoji === "1" ? true : false;
|
||||
} //
|
||||
if (settings.saveMobileBandwidth != null) { // 21
|
||||
preferences.saveMobileBandwidth = settings.saveMobileBandwidth === "1" ? true : false;
|
||||
} //
|
||||
if (settings.collapseMediaByDefault != null) { // 24
|
||||
preferences.collapseMediaByDefault = settings.collapseMediaByDefault === "1" ? true : false;
|
||||
} //
|
||||
if (settings.compactView != null) { // 27
|
||||
preferences.compactView = settings.compactView === "1" ? true : false;
|
||||
} //
|
||||
if (settings.unreadRoomsMode != null) { // 30
|
||||
preferences.unreadRoomsMode = settings.unreadRoomsMode === "1" ? true : false;
|
||||
} //
|
||||
if (settings.autoImageLoad != null) { // 33
|
||||
preferences.autoImageLoad = settings.autoImageLoad === "1" ? true : false;
|
||||
} //
|
||||
if (settings.emailNotificationMode != null) { // 36
|
||||
preferences.emailNotificationMode = settings.emailNotificationMode;
|
||||
} //
|
||||
preferences.highlights = settings.highlights; // 4
|
||||
RocketChat.models.Users.setPreferences(Meteor.userId(), preferences);
|
||||
return true; // 43
|
||||
} //
|
||||
} //
|
||||
}); //
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}).call(this);
|
||||
|
||||
//# sourceMappingURL=saveUserPreferences.coffee.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["meteor://💻app/server/methods/saveUserPreferences.coffee"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,OAAP,CACC;AAAA,uBAAqB,SAAC,QAAD;AACpB;AAAA,QAAG,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C,aAAZ,GAA+B,QAAQ,CAAC,aAAT,KAA0B,GAA7B,GAAsC,IAAtC,GAAgD,KAA5E,CADD;OA7BA;AAgCA,UAAG,sCAAH;AACC,mBAAW,CAAC,qBAAZ,GAAoC,QAAQ,CAAC,qBAA7C,CADD;OAhCA;AAAA,MAmCA,WAAW,CAAC,UAAZ,GAAyB,QAAQ,CAAC,UAnClC;AAAA,MAqCA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,cAAxB,CAAuC,MAAM,CAAC,MAAP,EAAvC,EAAwD,WAAxD,CArCA;AAuCA,aAAO,IAAP,CAxCD;KADoB;EAAA,CAArB;CADD","file":"/server/methods/saveUserPreferences.coffee.js","sourcesContent":["Meteor.methods\n\tsaveUserPreferences: (settings) ->\n\t\tif Meteor.userId()\n\t\t\tpreferences = {}\n\n\t\t\tif settings.language?\n\t\t\t\tRocketChat.models.Users.setLanguage Meteor.userId(), settings.language\n\n\t\t\tif settings.disableNewRoomNotification?\n\t\t\t\tpreferences.disableNewRoomNotification = if settings.disableNewRoomNotification is \"1\" then true else false\n\n\t\t\tif settings.disableNewMessageNotification?\n\t\t\t\tpreferences.disableNewMessageNotification = if settings.disableNewMessageNotification is \"1\" then true else false\n\n\t\t\tif settings.useEmojis?\n\t\t\t\tpreferences.useEmojis = if settings.useEmojis is \"1\" then true else false\n\n\t\t\tif settings.convertAsciiEmoji?\n\t\t\t\tpreferences.convertAsciiEmoji = if settings.convertAsciiEmoji is \"1\" then true else false\n\n\t\t\tif settings.saveMobileBandwidth?\n\t\t\t\tpreferences.saveMobileBandwidth = if settings.saveMobileBandwidth is \"1\" then true else false\n\n\t\t\tif settings.collapseMediaByDefault?\n\t\t\t\tpreferences.collapseMediaByDefault = if settings.collapseMediaByDefault is \"1\" then true else false\n\n\t\t\tif settings.compactView?\n\t\t\t\tpreferences.compactView = if settings.compactView is \"1\" then true else false\n\n\t\t\tif settings.unreadRoomsMode?\n\t\t\t\tpreferences.unreadRoomsMode = if settings.unreadRoomsMode is \"1\" then true else false\n\n\t\t\tif settings.autoImageLoad?\n\t\t\t\tpreferences.autoImageLoad = if settings.autoImageLoad is \"1\" then true else false\n\n\t\t\tif settings.emailNotificationMode?\n\t\t\t\tpreferences.emailNotificationMode = settings.emailNotificationMode\n\n\t\t\tpreferences.highlights = settings.highlights\n\n\t\t\tRocketChat.models.Users.setPreferences Meteor.userId(), preferences\n\n\t\t\treturn true\n"]}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue