Skip to content
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

[FIX] Compile CSS color variables #6939

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/rocketchat-lib/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ RocketChat.settings = {
return _(actions).reduceRight(_.wrap, (err, success) => callback(err, success))();
},
load(key, value, initialLoad) {
['*', key].forEach(key => {
if (RocketChat.settings.callbacks[key]) {
RocketChat.settings.callbacks[key].forEach(callback => callback(key, value, initialLoad));
['*', key].forEach(item => {
if (RocketChat.settings.callbacks[item]) {
RocketChat.settings.callbacks[item].forEach(callback => callback(key, value, initialLoad));
}
});
Object.keys(RocketChat.settings.regexCallbacks).forEach(cbKey => {
Expand Down
8 changes: 3 additions & 5 deletions packages/rocketchat-theme/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,23 @@ RocketChat.theme = new class {
this.compileDelayed = _.debounce(Meteor.bindEnvironment(this.compile.bind(this)), 100);
Meteor.startup(() => {
RocketChat.settings.onAfterInitialLoad(() => {
RocketChat.settings.get('*', Meteor.bindEnvironment((key, value) => {
RocketChat.settings.get(/^theme-./, Meteor.bindEnvironment((key, value) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this RegExp correct? looks like it's missing +

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works cuz the regex does not define the end ($)

if (key === 'theme-custom-css' && value != null) {
this.customCSS = value;
} else if (/^theme-.+/.test(key) === true) {
} else {
const name = key.replace(/^theme-[a-z]+-/, '');
if (this.variables[name] != null) {
this.variables[name].value = value;
}
} else {
return;
}

this.compileDelayed();
}));
});
});
}

compile() {

let content = [this.getVariablesAsLess()];

content.push(...this.files.map((name) => Assets.getText(name)));
Expand Down