* Provides methods to remove participants from conversations.
*
* @see WCF.Action.Delete
+ * @deprecated 5.4 Handled via `WoltLabSuite/Core/Ui/Object/Action`.
*/
WCF.Conversation.RemoveParticipant = WCF.Action.Delete.extend({
/**
--- /dev/null
+/**
+ * Reacts to objects being toggled.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Ui/Object/Action/Toggle
+ */
+define(["require", "exports", "tslib", "WoltLabSuite/Core/Ui/Object/Action/Handler"], function (require, exports, tslib_1, Handler_1) {
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.setup = void 0;
+ Handler_1 = tslib_1.__importDefault(Handler_1);
+ function removeParticipant(data, objectElement) {
+ objectElement.querySelector(".userLink").classList.add("conversationLeft");
+ objectElement.querySelector(".jsObjectAction[data-object-action='removeParticipant']").remove();
+ }
+ function setup() {
+ new Handler_1.default("removeParticipant", [], removeParticipant);
+ }
+ exports.setup = setup;
+});
*/
public function validateRemoveParticipant()
{
- $this->readInteger('userID');
+ // The previous request from `WCF.Action.Delete` used `userID`, while the new `Ui/Object/Action`
+ // module passes `userId`.
+ try {
+ $this->readInteger('userID');
+ } catch (UserInputException $e) {
+ $this->readInteger('userId');
+ $this->parameters['userID'] = $this->parameters['userId'];
+ }
// validate conversation
$this->conversation = $this->getSingleObject();
<section class="section">
<h2 class="sectionTitle">{lang}wcf.conversation.participants{/lang}</h2>
- <ul class="containerBoxList tripleColumned conversationParticipantList">
+ <ul class="containerBoxList tripleColumned conversationParticipantList jsObjectActionContainer" data-object-action-class-name="wcf\data\conversation\ConversationAction">
{foreach from=$participants item=participant}
- <li class="jsParticipant{if !$participant->userID || $participant->hideConversation == 2 || $participant->leftAt > 0} conversationLeft{/if}">
+ <li class="jsParticipant jsObjectActionObject{if !$participant->userID || $participant->hideConversation == 2 || $participant->leftAt > 0} conversationLeft{/if}" data-object-id="{@$conversation->getObjectID()}">
<div class="box24">
{user object=$participant type='avatar24' ariaHidden='true' tabindex='-1'}
<div>
{user object=$participant}
{if $participant->isInvisible}<small>({lang}wcf.conversation.invisible{/lang})</small>{/if}
{if $participant->userID && ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2 && $participant->leftAt == 0}
- <a href="#" class="jsDeleteButton jsTooltip jsOnly" title="{lang}wcf.conversation.participants.removeParticipant{/lang}" data-confirm-message-html="{lang __encode=true}wcf.conversation.participants.removeParticipant.confirmMessage{/lang}" data-object-id="{@$participant->userID}"><span class="icon icon16 fa-times"></span></a>
+ <a href="#" class="jsObjectAction jsTooltip jsOnly" data-object-action="removeParticipant" title="{lang}wcf.conversation.participants.removeParticipant{/lang}" data-confirm-message="{lang __encode=true}wcf.conversation.participants.removeParticipant.confirmMessage{/lang}" data-object-action-parameter-user-id="{@$participant->getObjectID()}"><span class="icon icon16 fa-times"></span></a>
{/if}
</p>
<dl class="plain inlineDataList small">
{if $__wcf->session->getPermission('user.profile.canReportContent')}
new WCF.Moderation.Report.Content('com.woltlab.wcf.conversation.message', '.jsReportConversationMessage');
{/if}
- new WCF.Conversation.RemoveParticipant({@$conversation->conversationID});
+ });
+
+ require(['WoltLabSuite/Core/Conversation/Ui/Object/Action/RemoveParticipant'], (UiObjectActionRemoveParticipant) => {
+ UiObjectActionRemoveParticipant.setup();
});
</script>
--- /dev/null
+/**
+ * Reacts to participants being removed from a conversation.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Conversation/Ui/Object/Action/RemoveParticipant
+ */
+
+import UiObjectActionHandler from "WoltLabSuite/Core/Ui/Object/Action/Handler";
+import { DatabaseObjectActionResponse } from "WoltLabSuite/Core/Ajax/Data";
+
+function removeParticipant(data: DatabaseObjectActionResponse, objectElement: HTMLElement): void {
+ objectElement.querySelector(".userLink")!.classList.add("conversationLeft");
+ objectElement.querySelector(".jsObjectAction[data-object-action='removeParticipant']")!.remove();
+}
+
+export function setup(): void {
+ new UiObjectActionHandler("removeParticipant", [], removeParticipant);
+}