very basic way of sending a reaction

This commit is contained in:
Bruno Windels 2021-06-03 19:16:53 +02:00
parent b722691e85
commit 20abb01ee8
3 changed files with 11 additions and 1 deletions

View File

@ -122,6 +122,10 @@ export class BaseMessageTile extends SimpleTile {
return this._reactions; return this._reactions;
} }
react(key) {
this._room.sendEvent("m.reaction", this._entry.annotate(key));
}
_updateReactions() { _updateReactions() {
const {annotations} = this._entry; const {annotations} = this._entry;
if (!annotations) { if (!annotations) {

View File

@ -16,6 +16,7 @@ limitations under the License.
import {BaseEntry} from "./BaseEntry.js"; import {BaseEntry} from "./BaseEntry.js";
import {REDACTION_TYPE} from "../../common.js"; import {REDACTION_TYPE} from "../../common.js";
import {createAnnotation} from "../relations.js";
export class BaseEventEntry extends BaseEntry { export class BaseEventEntry extends BaseEntry {
constructor(fragmentIdComparer) { constructor(fragmentIdComparer) {
@ -80,4 +81,8 @@ export class BaseEventEntry extends BaseEntry {
// so don't clear _pendingRedactions here // so don't clear _pendingRedactions here
} }
} }
annotate(key) {
return createAnnotation(this.id, key);
}
} }

View File

@ -99,6 +99,7 @@ export class BaseMessageView extends TemplateView {
} else if (vm.canRedact) { } else if (vm.canRedact) {
options.push(Menu.option(vm.i18n`Delete`, () => vm.redact()).setDestructive()); options.push(Menu.option(vm.i18n`Delete`, () => vm.redact()).setDestructive());
} }
options.push(Menu.option(vm.i18n`React with 👍`, () => vm.react("👍")))
return options; return options;
} }