From: Matthias Schmidt Date: Sun, 24 May 2020 08:46:12 +0000 (+0200) Subject: Use new popover improvements for anchor template plugin X-Git-Tag: 5.3.0_Alpha_1~20 X-Git-Url: https://git.stricted.de/?p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git;a=commitdiff_plain;h=ce8c322f5c788c33d62fa95612be3f8350d9ec11 Use new popover improvements for anchor template plugin See WoltLab/WCF#3318 --- diff --git a/files/js/WCF.Conversation.js b/files/js/WCF.Conversation.js index d30c839..c0b1865 100644 --- a/files/js/WCF.Conversation.js +++ b/files/js/WCF.Conversation.js @@ -1186,6 +1186,7 @@ WCF.Conversation.Label.Manager = Class.extend({ * Provides a flexible conversation preview. * * @see WCF.Popover + * @deprecated 5.3 handled via `WoltLabSuite/Core/Controller/Popover` */ WCF.Conversation.Preview = WCF.Popover.extend({ /** diff --git a/files/js/WoltLabSuite/Core/Conversation/Ui/Subject/Editor.js b/files/js/WoltLabSuite/Core/Conversation/Ui/Subject/Editor.js index 5456ff1..d7e9e85 100644 --- a/files/js/WoltLabSuite/Core/Conversation/Ui/Subject/Editor.js +++ b/files/js/WoltLabSuite/Core/Conversation/Ui/Subject/Editor.js @@ -66,7 +66,7 @@ define(['Ajax', 'EventKey', 'Language', 'Ui/Dialog', 'Ui/Notification'], functio */ _getCurrentValue: function () { var value = ''; - elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-conversation-id="' + _objectId + '"]', undefined, function (subject) { + elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-object-id="' + _objectId + '"]', undefined, function (subject) { value = subject.textContent; }); @@ -76,7 +76,7 @@ define(['Ajax', 'EventKey', 'Language', 'Ui/Dialog', 'Ui/Notification'], functio _ajaxSuccess: function (data) { UiDialog.close(this); - elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-conversation-id="' + _objectId + '"]', undefined, function (subject) { + elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-object-id="' + _objectId + '"]', undefined, function (subject) { subject.textContent = data.returnValues.subject; }); diff --git a/files/lib/data/conversation/Conversation.class.php b/files/lib/data/conversation/Conversation.class.php index 51b93fc..98d11bf 100644 --- a/files/lib/data/conversation/Conversation.class.php +++ b/files/lib/data/conversation/Conversation.class.php @@ -1,10 +1,10 @@ isActiveParticipant; } + /** + * @inheritDoc + */ + public function getPopoverLinkClass() { + return 'conversationLink'; + } + /** * Returns true if the given user id (default: current user) is participant * of all given conversation ids. diff --git a/files/lib/data/conversation/ConversationAction.class.php b/files/lib/data/conversation/ConversationAction.class.php index 4af7126..9a1dec1 100644 --- a/files/lib/data/conversation/ConversationAction.class.php +++ b/files/lib/data/conversation/ConversationAction.class.php @@ -6,6 +6,7 @@ use wcf\data\conversation\message\ConversationMessageList; use wcf\data\conversation\message\SimplifiedViewableConversationMessageList; use wcf\data\AbstractDatabaseObjectAction; use wcf\data\IClipboardAction; +use wcf\data\IPopoverAction; use wcf\data\IVisitableObjectAction; use wcf\system\clipboard\ClipboardHandler; use wcf\system\conversation\ConversationHandler; @@ -31,7 +32,7 @@ use wcf\system\WCF; * @method ConversationEditor[] getObjects() * @method ConversationEditor getSingleObject() */ -class ConversationAction extends AbstractDatabaseObjectAction implements IClipboardAction, IVisitableObjectAction { +class ConversationAction extends AbstractDatabaseObjectAction implements IClipboardAction, IPopoverAction, IVisitableObjectAction { /** * @inheritDoc */ @@ -433,11 +434,9 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo } /** - * Validates the get message preview action. - * - * @throws PermissionDeniedException + * @inheritDoc */ - public function validateGetMessagePreview() { + public function validateGetPopover() { $this->conversation = $this->getSingleObject(); if (!Conversation::isParticipant([$this->conversation->conversationID])) { throw new PermissionDeniedException(); @@ -445,25 +444,40 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo } /** - * Returns a preview of a message in a specific conversation. - * - * @return string[] + * @inheritDoc */ - public function getMessagePreview() { + public function getPopover() { $messageList = new SimplifiedViewableConversationMessageList(); - $messageList->getConditionBuilder()->add("conversation_message.messageID = ?", [$this->conversation->firstMessageID]); $messageList->readObjects(); - $messages = $messageList->getObjects(); - WCF::getTPL()->assign([ - 'message' => reset($messages) - ]); return [ - 'template' => WCF::getTPL()->fetch('conversationMessagePreview') + 'template' => WCF::getTPL()->fetch('conversationMessagePreview', 'wcf', [ + 'message' => $messageList->getSingleObject(), + ]), ]; } + /** + * Validates the get message preview action. + * + * @throws PermissionDeniedException + * @deprecated 5.3 Use `validateGetPopover()` instead. + */ + public function validateGetMessagePreview() { + $this->validateGetPopover(); + } + + /** + * Returns a preview of a message in a specific conversation. + * + * @return string[] + * @deprecated 5.3 Use `getPopover()` instead. + */ + public function getMessagePreview() { + return $this->getPopover(); + } + /** * Validates parameters to close conversations. * diff --git a/language/de.xml b/language/de.xml index 9c865e5..fe3abf7 100644 --- a/language/de.xml +++ b/language/de.xml @@ -182,7 +182,7 @@ - conversationID}">{$conversation->subject}]]> + diff --git a/language/en.xml b/language/en.xml index c028c0e..209ba2d 100644 --- a/language/en.xml +++ b/language/en.xml @@ -182,7 +182,7 @@ - conversationID}">{$conversation->subject}]]> + diff --git a/templates/conversationList.tpl b/templates/conversationList.tpl index 58c6618..0d45e3b 100644 --- a/templates/conversationList.tpl +++ b/templates/conversationList.tpl @@ -201,7 +201,7 @@ {/hascontent}

- {$conversation->subject} + {$conversation->subject} {if $conversation->replies} {@$conversation->replies|shortUnit} {/if} @@ -296,7 +296,7 @@