show image decryption error

This commit is contained in:
Bruno Windels 2020-10-29 10:29:08 +01:00
parent d1e78a735a
commit 862a0ba56b
3 changed files with 11 additions and 4 deletions

View File

@ -50,7 +50,7 @@ export class ImageTile extends MessageTile {
} }
} catch (err) { } catch (err) {
this._error = err; this._error = err;
this.emitChange("label"); this.emitChange("error");
} }
} }
@ -97,10 +97,14 @@ export class ImageTile extends MessageTile {
} }
get label() { get label() {
return this._getContent().body;
}
get error() {
if (this._error) { if (this._error) {
return `Could not decrypt image: ${this._error.message}`; return `Could not decrypt image: ${this._error.message}`;
} }
return this._getContent().body; return null;
} }
get shape() { get shape() {

View File

@ -613,7 +613,7 @@ ul.Timeline > li.messageStatus .message-container > p {
flex: 0 0 200px; flex: 0 0 200px;
} }
.Settings .error { .error {
color: red; color: red;
font-weight: 600; font-weight: 600;
} }

View File

@ -32,7 +32,10 @@ export class ImageView extends TemplateView {
}); });
const linkContainer = t.a({ const linkContainer = t.a({
style: `padding-top: ${heightRatioPercent}%; width: ${vm.thumbnailWidth}px;` style: `padding-top: ${heightRatioPercent}%; width: ${vm.thumbnailWidth}px;`
}, image); }, [
image,
t.if(vm => vm.error, t.createTemplate((t, vm) => t.p({className: "error"}, vm.error)))
]);
return renderMessage(t, vm, return renderMessage(t, vm,
[t.div(linkContainer), t.p(t.time(vm.date + " " + vm.time))] [t.div(linkContainer), t.p(t.time(vm.date + " " + vm.time))]