-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rocketchat-lib part1 #6553
rocketchat-lib part1 #6553
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
RocketChat.AdminBox = new class { | ||
constructor() { | ||
this.options = new ReactiveVar([]); | ||
} | ||
addOption(option) { | ||
return Tracker.nonreactive(() => { | ||
const actual = this.options.get(); | ||
actual.push(option); | ||
return this.options.set(actual); | ||
}); | ||
} | ||
getOptions() { | ||
return _.filter(this.options.get(), function(option) { | ||
if ((option.permissionGranted == null) || option.permissionGranted()) { | ||
return true; | ||
} | ||
}); | ||
} | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* globals LoggerManager */ | ||
RocketChat.settings.get('Log_Package', function(key, value) { | ||
return (typeof LoggerManager !== 'undefined') && LoggerManager !== null && (LoggerManager.showPackage = value); | ||
}); | ||
|
||
RocketChat.settings.get('Log_File', function(key, value) { | ||
return typeof LoggerManager !== 'undefined' && LoggerManager !== null && (LoggerManager.showFileAndLine = value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
}); | ||
|
||
RocketChat.settings.get('Log_Level', function(key, value) { | ||
if (value != null) { | ||
if (typeof LoggerManager !== 'undefined' && LoggerManager !== null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simplify to |
||
LoggerManager.logLevel = parseInt(value); | ||
} | ||
Meteor.setTimeout(() => { | ||
return typeof LoggerManager !== 'undefined' && LoggerManager !== null && LoggerManager.enable(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
}, 200); | ||
} | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the .coffee file? |
||
/* | ||
* Kick off the global namespace for RocketChat. | ||
* @namespace RocketChat | ||
*/ | ||
RocketChat = { | ||
models: {} | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this comment |
||
// hasProp = {}.hasOwnProperty; | ||
|
||
RocketChat.models.Reports = new class extends RocketChat.models._Base { | ||
constructor() { | ||
super('reports'); | ||
} | ||
createWithMessageDescriptionAndUserId(message, description, userId, extraData) { | ||
const record = { | ||
message, | ||
description, | ||
ts: new Date(), | ||
userId | ||
}; | ||
_.extend(record, extraData); | ||
record._id = this.insert(record); | ||
return record; | ||
} | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Meteor.methods({ | ||
'public-settings/get'(updatedAt) { | ||
this.unblock(); | ||
const records = RocketChat.models.Settings.find().fetch().filter(function(record) { | ||
return record.hidden !== true && record['public'] === true; | ||
}); | ||
if (updatedAt instanceof Date) { | ||
return { | ||
update: records.filter(function(record) { | ||
return record._updatedAt > updatedAt; | ||
}), | ||
remove: RocketChat.models.Settings.trashFindDeletedAfter(updatedAt, { | ||
hidden: { | ||
$ne: true | ||
}, | ||
'public': true | ||
}, { | ||
fields: { | ||
_id: 1, | ||
_deletedAt: 1 | ||
} | ||
}).fetch() | ||
}; | ||
} | ||
return records; | ||
}, | ||
'private-settings/get'(updatedAt) { | ||
if (!Meteor.userId()) { | ||
return []; | ||
} | ||
this.unblock(); | ||
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'view-privileged-setting')) { | ||
return []; | ||
} | ||
const records = RocketChat.models.Settings.find().fetch().filter(function(record) { | ||
return record.hidden !== true; | ||
}); | ||
if (updatedAt instanceof Date) { | ||
return { | ||
update: records.filter(function(record) { | ||
return record._updatedAt > updatedAt; | ||
}), | ||
remove: RocketChat.models.Settings.trashFindDeletedAfter(updatedAt, { | ||
hidden: { | ||
$ne: true | ||
} | ||
}, { | ||
fields: { | ||
_id: 1, | ||
_deletedAt: 1 | ||
} | ||
}).fetch() | ||
}; | ||
} | ||
return records; | ||
} | ||
}); | ||
|
||
RocketChat.models.Settings.cache.on('changed', function(type, setting) { | ||
if (setting['public'] === true) { | ||
RocketChat.Notifications.notifyAllInThisInstance('public-settings-changed', type, _.pick(setting, '_id', 'value')); | ||
} | ||
return RocketChat.Notifications.notifyLoggedInThisInstance('private-settings-changed', type, setting); | ||
}); | ||
|
||
RocketChat.Notifications.streamAll.allowRead('private-settings-changed', function() { | ||
if (this.userId == null) { | ||
return false; | ||
} | ||
return RocketChat.authz.hasPermission(this.userId, 'view-privileged-setting'); | ||
}); |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify to
LoggerManager && LoggerManager.showPackage = value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, if the variable
LoggerManager
have never been declared, It will throw an exception