rerender tile when becoming or stopped being redacted

This commit is contained in:
Bruno Windels 2021-05-25 12:58:20 +02:00
parent af45810582
commit cb622be653
4 changed files with 8 additions and 6 deletions

View file

@ -18,7 +18,7 @@ import {BaseTextTile} from "./BaseTextTile.js";
export class RedactedTile extends BaseTextTile {
get shape() {
return "message-status"
return "redacted";
}
_getBodyAsString() {

View file

@ -83,13 +83,14 @@ export class SimpleTile extends ViewModel {
}
// update received for already included (falls within sort keys) entry
updateEntry(entry, params) {
if (entry.isRedacted) {
updateEntry(entry, param) {
const renderedAsRedacted = this.shape === "redacted";
if (entry.isRedacted !== renderedAsRedacted) {
// recreate the tile if the entry becomes redacted
return UpdateAction.Replace(params);
return UpdateAction.Replace("shape");
} else {
this._entry = entry;
return UpdateAction.Update(params);
return UpdateAction.Update(param);
}
}

View file

@ -29,6 +29,7 @@ function viewClassForEntry(entry) {
case "announcement": return AnnouncementView;
case "message":
case "message-status":
case "redacted":
return TextMessageView;
case "image": return ImageView;
case "video": return VideoView;

View file

@ -24,7 +24,7 @@ export function renderMessage(t, vm, children) {
unsent: vm.isUnsent,
unverified: vm.isUnverified,
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"}, [