Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fileDelete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
<file>acp/update_com.woltlab.wcf.conversation_5.5_cleanup_orphaned_attachments.php</file>
<file>js/WoltLab/Conversation/UI/Participant/Add.js</file>
<file>js/WoltLab/Conversation/Ui/Participant/Add.js</file>
<file>js/WoltLab/Conversation/Ui/Message/Quote.js</file>
<file>js/require.build.js</file>
<file>js/require.build.min.js</file>
<file>lib/form/ConversationMessageAddForm.class.php</file>
<file>lib/form/ConversationMessageEditForm.class.php</file>
<file>lib/page/ConversationLogPage.class.php</file>
<file>lib/system/message/quote/ConversationMessageQuoteHandler.class.php</file>
<file>lib/system/event/listener/UserGroupAddCanBeAddedAsParticipantListener.class.php</file>
<file>lib/system/user/online/location/ConversationLocation.class.php</file>
<file>style/conversation.less</file>
Expand Down
20 changes: 0 additions & 20 deletions files/js/WoltLabSuite/Core/Conversation/Ui/Message/Quote.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use wcf\data\attachment\GroupedAttachmentList;
use wcf\data\conversation\Conversation;
use wcf\data\DatabaseObject;
use wcf\data\IEmbeddedMessageObject;
use wcf\data\IMessage;
use wcf\data\object\type\ObjectTypeCache;
use wcf\data\TUserContent;
use wcf\system\html\output\HtmlOutputProcessor;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
Expand Down Expand Up @@ -33,7 +35,7 @@
* @property-read int $editCount number of times the conversation message has been edited
* @property-read int $hasEmbeddedObjects number of embedded objects in the conversation message
*/
class ConversationMessage extends DatabaseObject implements IMessage
class ConversationMessage extends DatabaseObject implements IMessage, IEmbeddedMessageObject
{
use TUserContent;

Expand Down Expand Up @@ -215,4 +217,19 @@ public function __toString(): string
{
return $this->getFormattedMessage();
}

#[\Override]
public function loadEmbeddedObjects(): void
{
if ($this->hasEmbeddedObjects) {
ObjectTypeCache::getInstance()
->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'com.woltlab.wcf.conversation.message')
->getProcessor()
->cacheObjects([$this->messageID]);
MessageEmbeddedObjectManager::getInstance()->loadObjects(
'com.woltlab.wcf.conversation.message',
[$this->messageID]
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use wcf\data\DatabaseObject;
use wcf\data\IAttachmentMessageQuickReplyAction;
use wcf\data\IMessageInlineEditorAction;
use wcf\data\IMessageQuoteAction;
use wcf\data\object\type\ObjectTypeCache;
use wcf\data\smiley\SmileyCache;
use wcf\event\message\MessageSpamChecking;
use wcf\system\attachment\AttachmentHandler;
Expand Down Expand Up @@ -48,8 +46,7 @@
*/
class ConversationMessageAction extends AbstractDatabaseObjectAction implements
IAttachmentMessageQuickReplyAction,
IMessageInlineEditorAction,
IMessageQuoteAction
IMessageInlineEditorAction
{
/**
* @inheritDoc
Expand Down Expand Up @@ -595,140 +592,6 @@ public function getRedirectUrl(DatabaseObject $container, DatabaseObject $messag
return $message->getLink();
}

/**
* @inheritDoc
*/
public function validateSaveFullQuote()
{
$this->message = $this->getSingleObject();

if (!Conversation::isParticipant([$this->message->conversationID])) {
throw new PermissionDeniedException();
}
}

private function loadEmbeddedObjects(): void
{
if ($this->message->hasEmbeddedObjects) {
ObjectTypeCache::getInstance()
->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'com.woltlab.wcf.conversation.message')
->getProcessor()
->cacheObjects([$this->message->messageID]);
MessageEmbeddedObjectManager::getInstance()->loadObjects(
'com.woltlab.wcf.conversation.message',
[$this->message->messageID]
);
}
}

/**
* @inheritDoc
*/
public function saveFullQuote()
{
$this->loadEmbeddedObjects();

$quoteID = MessageQuoteManager::getInstance()->addQuote(
'com.woltlab.wcf.conversation.message',
$this->message->conversationID,
$this->message->messageID,
$this->message->getExcerpt(),
$this->message->getMessage()
);

if ($quoteID === false) {
$removeQuoteID = MessageQuoteManager::getInstance()->getQuoteID(
'com.woltlab.wcf.conversation.message',
$this->message->messageID,
$this->message->getExcerpt(),
$this->message->getMessage()
);
MessageQuoteManager::getInstance()->removeQuote($removeQuoteID);
}

$returnValues = [
'count' => MessageQuoteManager::getInstance()->countQuotes(),
'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(
['com.woltlab.wcf.conversation.message']
),
];

if ($quoteID) {
$returnValues['renderedQuote'] = MessageQuoteManager::getInstance()->getQuoteComponents($quoteID);
}

return $returnValues;
}

/**
* @inheritDoc
*/
public function validateSaveQuote()
{
$this->readString('message');
$this->readBoolean('renderQuote', true);
$this->message = $this->getSingleObject();

if (!Conversation::isParticipant([$this->message->conversationID])) {
throw new PermissionDeniedException();
}
}

/**
* @inheritDoc
*/
public function saveQuote()
{
$this->loadEmbeddedObjects();

$quoteID = MessageQuoteManager::getInstance()->addQuote(
'com.woltlab.wcf.conversation.message',
$this->message->conversationID,
$this->message->messageID,
$this->parameters['message'],
false
);

$returnValues = [
'count' => MessageQuoteManager::getInstance()->countQuotes(),
'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(
['com.woltlab.wcf.conversation.message']
),
];

if ($this->parameters['renderQuote']) {
$returnValues['renderedQuote'] = MessageQuoteManager::getInstance()->getQuoteComponents($quoteID);
}

return $returnValues;
}

/**
* @inheritDoc
*/
public function validateGetRenderedQuotes()
{
$this->readInteger('parentObjectID');

$this->conversation = new Conversation($this->parameters['parentObjectID']);
if (!$this->conversation->conversationID) {
throw new UserInputException('parentObjectID');
}
}

/**
* @inheritDoc
*/
public function getRenderedQuotes()
{
$quotes = MessageQuoteManager::getInstance()
->getQuotesByParentObjectID('com.woltlab.wcf.conversation.message', $this->conversation->conversationID);

return [
'template' => \implode("\n\n", $quotes),
];
}

/**
* @inheritDoc
*/
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion objectType.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<type>
<name>com.woltlab.wcf.conversation.message</name>
<definitionname>com.woltlab.wcf.message.quote</definitionname>
<classname>wcf\system\message\quote\ConversationMessageQuoteHandler</classname>
</type>
<type>
<name>com.woltlab.wcf.conversation.message</name>
Expand Down
14 changes: 4 additions & 10 deletions templates/conversation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,12 @@
var $inlineEditor = new WCF.Conversation.InlineEditor('.conversation');
$inlineEditor.setEditorHandler($editorHandler);
{assign var=__supportPaste value=true}
{if !$conversation->canReply()}{assign var=__supportPaste value=false}{/if}
{include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=$__supportPaste}
require(["WoltLabSuite/Core/Conversation/Ui/Message/Quote"], ({ UiConversationMessageQuote }) => {
new UiConversationMessageQuote($quoteManager);
});
{if $conversation->canReply()}
require(['WoltLabSuite/Core/Conversation/Ui/Message/Reply'], function({ Reply }) {
new Reply({
ajax: {
className: 'wcf\\data\\conversation\\message\\ConversationMessageAction'
},
quoteManager: $quoteManager
});
});
{/if}
Expand All @@ -189,10 +180,13 @@
require([
'WoltLabSuite/Core/Conversation/Ui/Object/Action/RemoveParticipant',
'WoltLabSuite/Core/Conversation/Ui/Message/InlineEditor',
], (UiObjectActionRemoveParticipant, { UiConversationMessageInlineEditor }) => {
'WoltLabSuite/Core/Component/Quote/Message',
], (UiObjectActionRemoveParticipant, { UiConversationMessageInlineEditor }, { registerContainer }) => {
new UiConversationMessageInlineEditor({$conversation->conversationID});
UiObjectActionRemoveParticipant.setup();
registerContainer(".message", ".messageBody", "wcf\\data\\conversation\\message\\ConversationMessage", "com.woltlab.wcf.conversation.message");
});
</script>

Expand Down
4 changes: 0 additions & 4 deletions templates/conversationAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@
});
{/if}
});
$(function() {
{include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=true}
});
</script>

{include file='shared_wysiwyg'}
Expand Down
6 changes: 2 additions & 4 deletions templates/conversationMessageList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,14 @@
<li
class="jsQuoteMessage"
data-object-id="{$message->messageID}"
data-is-quoted="{if $__quoteFullQuote|isset && $message->messageID|in_array:$__quoteFullQuote}1{else}0{/if}"
>
<a
href="#"
<button type="button"
title="{lang}wcf.message.quote.quoteMessage{/lang}"
class="button jsTooltip{if $__quoteFullQuote|isset && $message->messageID|in_array:$__quoteFullQuote} active{/if}"
>
{icon name='quote-left' type='solid'}
<span class="invisible">{lang}wcf.message.quote.quoteMessage{/lang}</span>
</a>
</button>
</li>
{if $message->userID != $__wcf->getUser()->userID && $__wcf->session->getPermission('user.profile.canReportContent')}
<li>
Expand Down
Loading
Loading