"use strict";

const addCommonFields = require("../event-add-common-fields");
const mapMaybeRedacted = require("../map-maybe-redacted");

module.exports = function mapReactionEvent(event, _context) {
	return addCommonFields({
		type: "reaction",
		user: event.sender,
		... mapMaybeRedacted(event, () => ({
			body: event.content["m.relates_to"].key,
			reactionTo: event.content["m.relates_to"].event_id
		}))
	});
};
