Skip to content

Commit c6dfdc4

Browse files
authored
Use commands for article actions (#6415)
* Introduce the command `PublishArticle` * Introduce the command `RestoreArticle` * Introduce the command `SoftDeleteArticle` * Introduce the command `UnpublishArticle` * Introduce the command `SetArticleCategory` * Endpoint and command to mark all article or one article as read * Use the commands `EnableI18n` and `DisableI18n` * Use the command `ResetUserStorageForUnreadArticles` * Remove unused ACP Article InlineEditor * Remove the `unmarkItems` method, as the clipboard no longer exists for Article. * Apply code suggestions. Adjustment of corresponding files and references * Mark `validate…` methods as deprecated * Make command members private * Commands should not check whether a condition is true or not, just execute the action. The caller of this command must ensure that the conditions are correct.
1 parent 9f574d7 commit c6dfdc4

29 files changed

+603
-1003
lines changed

ts/WoltLabSuite/Core/Acp/Ui/Article/InlineEditor.ts

Lines changed: 0 additions & 431 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Mark all articles as read
3+
*
4+
* @author Olaf Braun
5+
* @copyright 2001-2025 WoltLab GmbH
6+
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7+
* @since 6.3
8+
*/
9+
10+
import { prepareRequest } from "WoltLabSuite/Core/Ajax/Backend";
11+
import { ApiResult, apiResultFromError, apiResultFromValue } from "WoltLabSuite/Core/Api/Result";
12+
13+
export async function markAllArticlesAsRead(): Promise<ApiResult<[]>> {
14+
try {
15+
await prepareRequest(new URL(`${window.WSC_RPC_API_URL}core/articles/mark-all-as-read`))
16+
.post()
17+
.fetchAsJson();
18+
} catch (e) {
19+
return apiResultFromError(e);
20+
}
21+
22+
return apiResultFromValue([]);
23+
}

ts/WoltLabSuite/Core/Ui/Article/MarkAllAsRead.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
*/
99

1010
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
11-
import { dboAction } from "../../Ajax";
11+
import { markAllArticlesAsRead } from "WoltLabSuite/Core/Api/Articles/MarkAllArticlesAsRead";
1212

1313
async function markAllAsRead(): Promise<void> {
14-
await dboAction("markAllAsRead", "wcf\\data\\article\\ArticleAction").dispatch();
14+
await markAllArticlesAsRead();
1515

1616
document.querySelectorAll(".contentItemList .contentItemBadgeNew").forEach((el: HTMLElement) => el.remove());
1717
document.querySelectorAll(".boxMenu .active .badge").forEach((el: HTMLElement) => el.remove());

wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Article/InlineEditor.js

Lines changed: 0 additions & 344 deletions
This file was deleted.

0 commit comments

Comments
 (0)