Skip to content

Commit be242d4

Browse files
committed
Add migration guide for board and thread subscriptions
1 parent 54a158e commit be242d4

File tree

2 files changed

+104
-2
lines changed

2 files changed

+104
-2
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Migrating from WSC 5.4 - WoltLab Suite Forum
2+
3+
## Subscriptions
4+
5+
With WoltLab Suite Forum 5.5 we introduced a new system to subscribe threads and boards including the possibility to ignore threads and boards.
6+
[You can read more about this feature in our blog](https://www.woltlab.com/article/260-new-features-in-woltlab-suite-5-5-revision-of-buttons-and-ignoring-threads/).
7+
The new system uses an own system to manage the subscribed forums as well as the subscribed threads.
8+
This has made the previously used object type `com.woltlab.wcf.user.objectWatch` obsolete, as it no longer meets the requirements we need for the new more flexible system.
9+
In addition, having our own implementation also makes it much easier to use, as we work with our own tables and we can thus create correct foreign keys.
10+
Therefore, we had to create a new API to manage subscriptions.
11+
12+
### Subscribe to threads
13+
14+
#### Previously
15+
16+
```php
17+
$action = new UserObjectWatchAction([], 'subscribe', [
18+
'data' => [
19+
'objectID' => $threadID,
20+
'objectType' => 'com.woltlab.wbb.thread',
21+
]
22+
]);
23+
$action->executeAction();
24+
```
25+
26+
#### Now
27+
```php
28+
ThreadStatusHandler::saveSubscriptionStatus(
29+
$threadID,
30+
ThreadStatusHandler::SUBSCRIPTION_MODE_WATCHING
31+
);
32+
```
33+
34+
### Filter Ignored Threads
35+
36+
To filter ignored threads from a given `ThreadList`, you can use the method `ThreadStatusHandler::addFilterForIgnoredThreads()` to append the filter for ignored threads.
37+
The `ViewableThreadList` filters ignored threads by default.
38+
39+
As an example:
40+
41+
```php
42+
$threadList = new ThreadList();
43+
ThreadStatusHandler::addFilterForIgnoredThreads(
44+
$threadList,
45+
// This parameter is optional. If null, the current user will be used. Otherwise, the filter is executed
46+
// for the given user.
47+
WCF::getUser()
48+
);
49+
$threadList->readObjects();
50+
```
51+
52+
### Filter Ignored Users
53+
54+
Ignoring threads should surpress the notifications for the user.
55+
Therefore we ship also a method, which can filter the `userIDs`, which are ignoring a specific thread.
56+
57+
```php
58+
$userIDs = [1, 2, 3];
59+
$users = ThreadStatusHandler::filterIgnoredUserIDs(
60+
$userIDs,
61+
$thread->threadID
62+
);
63+
```
64+
65+
### Subscribe to boards
66+
67+
#### Previously
68+
69+
```php
70+
$action = new UserObjectWatchAction([], 'subscribe', [
71+
'data' => [
72+
'objectID' => $boardID,
73+
'objectType' => 'com.woltlab.wbb.board',
74+
]
75+
]);
76+
$action->executeAction();
77+
```
78+
79+
#### Now
80+
```php
81+
BoardStatusHandler::saveSubscriptionStatus(
82+
$boardID,
83+
ThreadStatusHandler::SUBSCRIPTION_MODE_WATCHING
84+
);
85+
```
86+
87+
### Filter Ignored Boards
88+
89+
With the new system, notifications from ignored boards should be surpressed.
90+
Therefore, we introduced a method, which filters userIDs which ignoring a specific board.
91+
92+
```php
93+
$userIDs = [1, 2, 3];
94+
$users = BoardStatusHandler::filterIgnoredUserIDs(
95+
$userIDs,
96+
$board->boardID
97+
);
98+
```

docs/migration/wsc54/php.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ See [WoltLab/WCF#4398](https://github.com/WoltLab/WCF/pull/4398) for details.
272272

273273
### Search Form
274274

275-
After the overhaul of the search form, search providers are no longer bound to `SearchForm` and `SearchResultPage`.
275+
After the overhaul of the search form, search providers are no longer bound to `SearchForm` and `SearchResultPage`.
276276
The interface `ISearchObjectType` and the abstract implementation `AbstractSearchableObjectType` have been replaced by `ISearchProvider` and `AbstractSearchProvider`.
277277

278278
Please use [`ArticleSearch`](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/search/ArticleSearch.class.php) as a template for your own implementation
@@ -337,7 +337,7 @@ is deprecated and should be replaced with the new structure with an explicit `<i
337337
filepath="migration/wsc54/en_new.xml",
338338
) }}
339339

340-
Additionally, to now also support deleting phrases with this package installation plugin, support for a `<delete>` element has been added:
340+
Additionally, to now also support deleting phrases with this package installation plugin, support for a `<delete>` element has been added:
341341

342342
{jinja{ codebox(
343343
language="xml",
@@ -349,6 +349,10 @@ Note that when deleting phrases, the category does not have to be specified beca
349349

350350
!!! warning "Mixing the old structure and the new structure is not supported and will result in an error message during the import!"
351351

352+
## Board and Thread Subscriptions
353+
354+
See [here](form_subscriptions.md) for details.
355+
352356
## Miscellaneous Changes
353357

354358
### View Counters

0 commit comments

Comments
 (0)