Merge pull request #3851 from matrix-org/jryans/download-file-icon

Compute download file icon immediately
This commit is contained in:
J. Ryan Stinnett 2020-01-16 16:53:25 +00:00 committed by GitHub
commit e375b1d31f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -1,16 +1,17 @@
const en = require("../src/i18n/strings/en_EN"); const en = require("../src/i18n/strings/en_EN");
module.exports = jest.fn((opts, cb) => { module.exports = jest.fn((opts, cb) => {
if (opts.url.endsWith("languages.json")) { const url = opts.url || opts.uri;
if (url && url.endsWith("languages.json")) {
cb(undefined, {status: 200}, JSON.stringify({ cb(undefined, {status: 200}, JSON.stringify({
"en": { "en": {
"fileName": "en_EN.json", "fileName": "en_EN.json",
"label": "English", "label": "English",
}, },
})); }));
} else if (opts.url.endsWith("en_EN.json")) { } else if (url && url.endsWith("en_EN.json")) {
cb(undefined, {status: 200}, JSON.stringify(en)); cb(undefined, {status: 200}, JSON.stringify(en));
} else { } else {
cb(undefined, {status: 404}, ""); cb(true, {status: 404}, "");
} }
}); });

View file

@ -143,10 +143,14 @@ class Tinter {
* over time then the best bet is to register a single callback for the * over time then the best bet is to register a single callback for the
* entire set. * entire set.
* *
* To ensure the tintable work happens at least once, it is also called as
* part of registration.
*
* @param {Function} tintable Function to call when the tint changes. * @param {Function} tintable Function to call when the tint changes.
*/ */
registerTintable(tintable) { registerTintable(tintable) {
this.tintables.push(tintable); this.tintables.push(tintable);
tintable();
} }
getKeyRgb() { getKeyRgb() {