Update `Ui/Object/Action` implementation
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / ts / WoltLabSuite / Core / Conversation / Ui / Object / Action / RemoveParticipant.ts
1 /**
2 * Reacts to participants being removed from a conversation.
3 *
4 * @author Matthias Schmidt
5 * @copyright 2001-2021 WoltLab GmbH
6 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7 * @module WoltLabSuite/Core/Conversation/Ui/Object/Action/RemoveParticipant
8 */
9
10 import UiObjectActionHandler from "WoltLabSuite/Core/Ui/Object/Action/Handler";
11 import { ObjectActionData } from "WoltLabSuite/Core/Ui/Object/Data";
12
13 function removeParticipant(data: ObjectActionData): void {
14 data.objectElement.querySelector(".userLink")!.classList.add("conversationLeft");
15 data.objectElement.querySelector(".jsObjectAction[data-object-action='removeParticipant']")!.remove();
16 }
17
18 export function setup(): void {
19 new UiObjectActionHandler("removeParticipant", [], removeParticipant);
20 }