Skip to content

Commit

Permalink
Add migration guide for quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyperghost committed Jan 16, 2025
1 parent abd9dc5 commit 96d29d0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/migration/wsc61/deprecations_removals.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ With version 6.2, we have deprecated certain components and removed several othe
- `wcf\data\user\avatar\UserAvatarAction` ([WoltLab/WCF#6051](https://github.com/WoltLab/WCF/pull/6051))
- `wcf\data\user\avatar\UserAvatarEditor` ([WoltLab/WCF#6051](https://github.com/WoltLab/WCF/pull/6051))
- `wcf\data\user\avatar\UserAvatarList` ([WoltLab/WCF#6051](https://github.com/WoltLab/WCF/pull/6051))
- `wcf\data\user\avatar\UserAvatarList` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163))
- `wcf\lib\system\message\quote\AbstractMessageQuoteHandler` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\lib\system\message\quote\IMessageQuoteHandler` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\lib\system\message\quote\QuotedMessage` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\data\user\avatar\UserAvatarList` ([WoltLab/WCF#6051](https://github.com/WoltLab/WCF/pull/6051))
- `wcf\data\IMessageQuoteAction` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\system\message\quote\AbstractMessageQuoteHandler` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\system\message\quote\IMessageQuoteHandler` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))
- `wcf\system\message\quote\QuotedMessage` ([WoltLab/WCF#6163](https://github.com/WoltLab/WCF/pull/6163/))

#### Methods

Expand Down
78 changes: 78 additions & 0 deletions docs/migration/wsc61/quotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Migrating from WoltLab Suite 6.1 – Quotes

In the upcoming version of WoltLab Suite, the handling of quotes has been revamped to enhance user experience.
Quotes are now stored client-side in the browser's local storage, allowing synchronization across browser tabs.

## Using the New Quote System

The interfaces `wcf\data\IMessageQuoteAction` and `wcf\system\message\quote\IMessageQuoteHandler` are no longer required to generate the quotes, and the implemented classes or functions can be completely removed.

The object that can be quoted:

- **must** have implemented the interface `wcf\data\IMessage`.
- should have implemented the interface `wcf\data\IEmbeddedMessageObject`.

Using of `WoltLabSuite/Core/Ui/Message/Quote` is no longer required and only `WoltLabSuite/Core/Component/Quote/Message::registerContainer()` should be used so that a message can be quoted

```smarty
<!-- Previous -->
<script data-relocate="true">
$(function() {
require(["WoltLabSuite/Core/Ui/Message/Quote"], ({ UiMessageQuote }) => {
{include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=true}
new UiMessageQuote($quoteManager, "wcf\\data\\foo\\Foo", "com.woltlab.foo", ".message", ".messageBody", ".messageBody > .messageText", true);
});
});
</script>
<!-- Use instead -->
<script data-relocate="true">
require(["WoltLabSuite/Core/Component/Quote/Message"], ({ registerContainer }) => {
registerContainer(".message", ".messageBody", "wcf\\data\\foo\\Foo", "com.woltlab.foo");
});
</script>
```

## Adjustments to the forms

The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` must be called both in the form for creating and editing the entry.
This is necessary if the text input does support quotes. Regardless of whether the entry itself can be quoted later or not.

```PHP
use wcf\system\message\quote\MessageQuoteManager;

class FooAddForm extends \wcf\form\MessageForm {

#[\Override]
protected function readFormParameters()
{
parent::readFormParameters();

// …

// Read the quotes that are to be deleted after the message has been successfully saved
MessageQuoteManager::getInstance()->readFormParameters();
}

#[\Override]
protected function saved()
{
parent::saved();

// …

// Save the used quotes so that they're deleted on the client with the next request
MessageQuoteManager::getInstance()->saved();
}
}
```

### Pre-filling of text

The automatic pre-filling of text when creating a new entry with previously marked quotes is no longer supported and has been removed in the new version.

### Changes to the FormBuilder

The functions `WysiwygFormContainer::quoteData()` and `WysiwygFormField::quoteData()` are no longer required, it is sufficient to use the function `supportQuotes()`.
The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` are called by `WysiwygFormField` and don't need to be called separately.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ nav:
- 'From WoltLab Suite 6.1':
- 'Deprecations and Removals': 'migration/wsc61/deprecations_removals.md'
- 'Templates': 'migration/wsc61/templates.md'
- 'Quotes': 'migration/wsc61/quotes.md'
- 'From WoltLab Suite 6.0':
- 'PHP API': 'migration/wsc60/php.md'
- 'Templates': 'migration/wsc60/templates.md'
Expand Down

0 comments on commit 96d29d0

Please sign in to comment.