-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Convert Theme Package to JS #6491
Conversation
|
||
const less = Npm.require('less'); | ||
const Autoprefixer = Npm.require('less-plugin-autoprefix'); | ||
const crypto = Npm.require('crypto'); |
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.
Use import
const prefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || ''; | ||
if (path === (`${ prefix }/__cordova/theme.css`) || path === (`${ prefix }/theme.css`)) { | ||
css = RocketChat.theme.getCss(); | ||
hash = crypto.createHash('sha1').update(css).digest('hex'); |
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.
Declare css
and hash
here
|
||
const path = req.url.split('?')[0]; | ||
const prefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || ''; | ||
if (path === (`${ prefix }/__cordova/theme.css`) || path === (`${ prefix }/theme.css`)) { |
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.
No need for these parenthesis
const css = RocketChat.theme.getCss(); | ||
if (css.trim() !== '') { | ||
hash = crypto.createHash('sha1').update(css).digest('hex'); | ||
themeManifestItem = _.find(manifest, function(item) { |
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.
Declare hash
and themeManifestItem
here
RocketChat.settings.add('css', ''); | ||
RocketChat.settings.addGroup('Layout'); | ||
RocketChat.settings.onload('css', Meteor.bindEnvironment(() => { | ||
return function(key, value, initialLoad) { |
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.
There is no need for this function
, pass the params directly to the above arrow function
value | ||
}; | ||
if (persist === true) { | ||
config = { |
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.
Declare config
here
addPublicColor(name, value, section, editor) { | ||
if (editor == null) { | ||
editor = 'color'; | ||
} |
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.
Use default values
} | ||
|
||
getVariablesAsLess() { | ||
return Object.keys(this.variables).map((obj, name) => { |
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.
map((obj, name) => {
is wrong, the correct is map((name) => {
// Bulk-add settings for color scheme | ||
let value; | ||
Object.keys(majorColors).forEach((key) => { | ||
value = majorColors[key]; |
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.
Declare value
here using const
}); | ||
|
||
Object.keys(minorColors).forEach((key) => { | ||
value = minorColors[key]; |
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.
Declare value
here using const
this.variables[name] = { | ||
type, | ||
value | ||
}; | ||
if (persist === true) { |
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.
Why did you remove this if
?
…nto clarapy-v4 Changed over home.coffee & help.coffee to .js * 'develop' of https://github.com/RocketChat/Rocket.Chat: (162 commits) Remove coffeescript package from ui-flextab Remove coffeescript package from ui-sidenav Update PULL_REQUEST_TEMPLATE.md Fix Outgoing Webhooks Retrying Not Respecting Enabled Status (RocketChat#6478) Convert Theme Package to JS (RocketChat#6491) Fix typo of the safari pinned tab label (RocketChat#6487) fix channel merge option of user preferences (RocketChat#6493) converted Rocketchat logger coffee to js (RocketChat#6495) converted rocketchat-integrations coffee to js (RocketChat#6502) 'allow reacting' should be a toggle option (RocketChat#6522) Add to HISTORY.md Fix backup codes remaining not showing Fix ESLint Fix ESLint Fix review Fix review Fix review fix import issue fix fix ... # Conflicts: # packages/rocketchat-lib/server/lib/PushNotification.js # packages/rocketchat-ui/client/views/app/home.coffee # packages/rocketchat-ui/package.js
@RocketChat/core