forked from mystiq/hydrogen-web
rerender tile when becoming or stopped being redacted
This commit is contained in:
parent
af45810582
commit
cb622be653
4 changed files with 8 additions and 6 deletions
|
@ -18,7 +18,7 @@ import {BaseTextTile} from "./BaseTextTile.js";
|
||||||
|
|
||||||
export class RedactedTile extends BaseTextTile {
|
export class RedactedTile extends BaseTextTile {
|
||||||
get shape() {
|
get shape() {
|
||||||
return "message-status"
|
return "redacted";
|
||||||
}
|
}
|
||||||
|
|
||||||
_getBodyAsString() {
|
_getBodyAsString() {
|
||||||
|
|
|
@ -83,13 +83,14 @@ export class SimpleTile extends ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update received for already included (falls within sort keys) entry
|
// update received for already included (falls within sort keys) entry
|
||||||
updateEntry(entry, params) {
|
updateEntry(entry, param) {
|
||||||
if (entry.isRedacted) {
|
const renderedAsRedacted = this.shape === "redacted";
|
||||||
|
if (entry.isRedacted !== renderedAsRedacted) {
|
||||||
// recreate the tile if the entry becomes redacted
|
// recreate the tile if the entry becomes redacted
|
||||||
return UpdateAction.Replace(params);
|
return UpdateAction.Replace("shape");
|
||||||
} else {
|
} else {
|
||||||
this._entry = entry;
|
this._entry = entry;
|
||||||
return UpdateAction.Update(params);
|
return UpdateAction.Update(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ function viewClassForEntry(entry) {
|
||||||
case "announcement": return AnnouncementView;
|
case "announcement": return AnnouncementView;
|
||||||
case "message":
|
case "message":
|
||||||
case "message-status":
|
case "message-status":
|
||||||
|
case "redacted":
|
||||||
return TextMessageView;
|
return TextMessageView;
|
||||||
case "image": return ImageView;
|
case "image": return ImageView;
|
||||||
case "video": return VideoView;
|
case "video": return VideoView;
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function renderMessage(t, vm, children) {
|
||||||
unsent: vm.isUnsent,
|
unsent: vm.isUnsent,
|
||||||
unverified: vm.isUnverified,
|
unverified: vm.isUnverified,
|
||||||
continuation: vm => vm.isContinuation,
|
continuation: vm => vm.isContinuation,
|
||||||
messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file",
|
messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file" || vm.shape === "redacted",
|
||||||
};
|
};
|
||||||
|
|
||||||
const profile = t.div({className: "profile"}, [
|
const profile = t.div({className: "profile"}, [
|
||||||
|
|
Loading…
Reference in a new issue