diff --git a/src/domain/session/room/timeline/tiles/BaseMessageTile.js b/src/domain/session/room/timeline/tiles/BaseMessageTile.js index b03e2fee..f480f0db 100644 --- a/src/domain/session/room/timeline/tiles/BaseMessageTile.js +++ b/src/domain/session/room/timeline/tiles/BaseMessageTile.js @@ -122,6 +122,10 @@ export class BaseMessageTile extends SimpleTile { return this._reactions; } + react(key) { + this._room.sendEvent("m.reaction", this._entry.annotate(key)); + } + _updateReactions() { const {annotations} = this._entry; if (!annotations) { diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index 4bf09ed5..a036e8c6 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -16,6 +16,7 @@ limitations under the License. import {BaseEntry} from "./BaseEntry.js"; import {REDACTION_TYPE} from "../../common.js"; +import {createAnnotation} from "../relations.js"; export class BaseEventEntry extends BaseEntry { constructor(fragmentIdComparer) { @@ -80,4 +81,8 @@ export class BaseEventEntry extends BaseEntry { // so don't clear _pendingRedactions here } } -} \ No newline at end of file + + annotate(key) { + return createAnnotation(this.id, key); + } +} diff --git a/src/platform/web/ui/session/room/timeline/BaseMessageView.js b/src/platform/web/ui/session/room/timeline/BaseMessageView.js index 0c9c0c0e..2f41fa75 100644 --- a/src/platform/web/ui/session/room/timeline/BaseMessageView.js +++ b/src/platform/web/ui/session/room/timeline/BaseMessageView.js @@ -99,6 +99,7 @@ export class BaseMessageView extends TemplateView { } else if (vm.canRedact) { options.push(Menu.option(vm.i18n`Delete`, () => vm.redact()).setDestructive()); } + options.push(Menu.option(vm.i18n`React with 👍`, () => vm.react("👍"))) return options; }