Skip to content

Commit 47d50ec

Browse files
authored
Merge pull request #6439 from WoltLab/6.2-unify-interactions
Unify bulk interactions with normal interactions
2 parents 57022cd + 2553fc4 commit 47d50ec

10 files changed

+85
-21
lines changed

wcfsetup/install/files/lib/acp/action/ArticleCategoryAction.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public function handle(ServerRequestInterface $request): ResponseInterface
3434
$request->getQueryParams(),
3535
<<<'EOT'
3636
array {
37-
objectIDs: positive-int[]
37+
ids: positive-int[]
3838
}
3939
EOT
4040
);
4141

42-
if ($parameters['objectIDs'] === []) {
42+
if ($parameters['ids'] === []) {
4343
throw new IllegalLinkException();
4444
}
4545

@@ -62,7 +62,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6262
WHERE articleID = ?";
6363
$statement = WCF::getDB()->prepare($sql);
6464

65-
foreach ($parameters['objectIDs'] as $articleID) {
65+
foreach ($parameters['ids'] as $articleID) {
6666
$statement->execute([$data['categoryID'], $articleID]);
6767
}
6868

wcfsetup/install/files/lib/acp/action/TagSynonymAction.class.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ public function handle(ServerRequestInterface $request): ResponseInterface
4242
$parameters = Helper::mapQueryParameters(
4343
$request->getQueryParams(),
4444
<<<'EOT'
45-
array {
46-
objectIDs: array<positive-int>
47-
}
48-
EOT,
45+
array {
46+
ids: array<positive-int>
47+
}
48+
EOT
4949
);
5050
} catch (MappingError) {
5151
throw new IllegalLinkException();
5252
}
5353

54-
if (\count($parameters['objectIDs']) < 2) {
54+
if (\count($parameters['ids']) < 2) {
5555
throw new IllegalLinkException();
5656
}
5757

5858
$tagList = new TagList();
59-
$tagList->setObjectIDs($parameters['objectIDs']);
59+
$tagList->setObjectIDs($parameters['ids']);
6060
$tagList->readObjects();
6161

6262
$form = $this->getForm($tagList->getObjects());

wcfsetup/install/files/lib/action/AbstractModerationAction.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public function handle(ServerRequestInterface $request): ResponseInterface
4040
<<<'EOT'
4141
array {
4242
id?: positive-int,
43-
objectIDs?: positive-int[]
43+
ids?: positive-int[]
4444
}
4545
EOT
4646
);
4747

48-
if (!isset($parameters['id']) && !isset($parameters['objectIDs'])) {
48+
if (!isset($parameters['id']) && !isset($parameters['ids'])) {
4949
throw new IllegalLinkException();
5050
}
5151

52-
$objectIDs = $parameters['objectIDs'] ?? [$parameters['id']];
52+
$objectIDs = $parameters['ids'] ?? [$parameters['id']];
5353
$moderationList = new ModerationQueueList();
5454
$moderationList->setObjectIDs($objectIDs);
5555
$moderationList->readObjects();

wcfsetup/install/files/lib/system/gridView/admin/ArticleGridView.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public function render(mixed $value, DatabaseObject $row): string
103103
);
104104
}
105105
if ($row->publicationStatus === Article::UNPUBLISHED) {
106+
if ($badges !== '') {
107+
$badges .= ' ';
108+
}
106109
$badges .= \sprintf(
107110
'<span class="badge">%s</span>',
108111
WCF::getLanguage()->get('wcf.acp.article.publicationStatus.unpublished')
@@ -118,6 +121,9 @@ public function render(mixed $value, DatabaseObject $row): string
118121
WCF::getLanguage()->getLocale()
119122
);
120123

124+
if ($badges !== '') {
125+
$badges .= ' ';
126+
}
121127
$badges .= \sprintf(
122128
'<span class="badge" title="%s">%s</span>',
123129
$dateTime,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace wcf\system\interaction\bulk;
4+
5+
use wcf\system\interaction\InteractionConfirmationType;
6+
7+
/**
8+
* Represents a disable interaction.
9+
*
10+
* @author Marcel Werk
11+
* @copyright 2001-2025 WoltLab GmbH
12+
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13+
* @since 6.2
14+
*/
15+
class BulkDisableInteraction extends BulkRpcInteraction
16+
{
17+
public function __construct(
18+
string $endpoint,
19+
?\Closure $isAvailableCallback = null
20+
) {
21+
parent::__construct(
22+
'disable',
23+
$endpoint,
24+
'wcf.global.button.disable',
25+
InteractionConfirmationType::Disable,
26+
isAvailableCallback: $isAvailableCallback
27+
);
28+
}
29+
}

wcfsetup/install/files/lib/system/interaction/bulk/BulkFormBuilderDialogInteraction.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use wcf\util\StringUtil;
1010

1111
/**
12-
* Represents a bulk interaction that call a form builder action.
12+
* Represents a bulk interaction that calls a form builder action.
1313
*
1414
* @author Olaf Braun
1515
* @copyright 2001-2025 WoltLab GmbH
@@ -35,7 +35,7 @@ public function render(array $objects): string
3535
$objectIDs = \array_values(\array_map(fn(DatabaseObject $object) => $object->getObjectID(), $objects));
3636
$endpoint = StringUtil::encodeHTML(
3737
LinkHandler::getInstance()->getControllerLink($this->controller, [
38-
'objectIDs' => $objectIDs
38+
'ids' => $objectIDs
3939
])
4040
);
4141

wcfsetup/install/files/lib/system/interaction/bulk/BulkTrashInteraction.class.php renamed to wcfsetup/install/files/lib/system/interaction/bulk/BulkSoftDeleteInteraction.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
use wcf\system\interaction\InteractionConfirmationType;
66

77
/**
8-
* Represents a bulk trash interaction.
8+
* Represents a bulk soft-delete interaction.
99
*
1010
* @author Olaf Braun
1111
* @copyright 2001-2025 WoltLab GmbH
1212
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
1313
* @since 6.2
1414
*/
15-
class BulkTrashInteraction extends BulkRpcInteraction
15+
class BulkSoftDeleteInteraction extends BulkRpcInteraction
1616
{
1717
public function __construct(
1818
string $endpoint,
1919
?\Closure $isAvailableCallback = null
2020
) {
2121
parent::__construct(
22-
'trash',
22+
'soft-delete',
2323
$endpoint,
2424
'wcf.global.button.trash',
2525
InteractionConfirmationType::Custom,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace wcf\system\interaction\bulk;
4+
5+
use wcf\system\interaction\InteractionConfirmationType;
6+
7+
/**
8+
* Represents a bulk soft-delete interaction that allows the user to enter a reason.
9+
*
10+
* @author Marcel Werk
11+
* @copyright 2001-2025 WoltLab GmbH
12+
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13+
* @since 6.2
14+
*/
15+
class BulkSoftDeleteWithReasonInteraction extends BulkRpcInteraction
16+
{
17+
public function __construct(
18+
string $endpoint,
19+
?\Closure $isAvailableCallback = null
20+
) {
21+
parent::__construct(
22+
'soft-delete',
23+
$endpoint,
24+
'wcf.global.button.trash',
25+
InteractionConfirmationType::SoftDeleteWithReason,
26+
isAvailableCallback: $isAvailableCallback
27+
);
28+
}
29+
}

wcfsetup/install/files/lib/system/interaction/bulk/admin/ArticleBulkInteractions.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use wcf\system\interaction\bulk\BulkFormBuilderDialogInteraction;
1414
use wcf\system\interaction\bulk\BulkRestoreInteraction;
1515
use wcf\system\interaction\bulk\BulkRpcInteraction;
16-
use wcf\system\interaction\bulk\BulkTrashInteraction;
16+
use wcf\system\interaction\bulk\BulkSoftDeleteInteraction;
1717
use wcf\system\interaction\InteractionConfirmationType;
1818

1919
/**
@@ -29,7 +29,7 @@ final class ArticleBulkInteractions extends AbstractBulkInteractionProvider
2929
public function __construct()
3030
{
3131
$this->addInteractions([
32-
new BulkTrashInteraction('core/articles/%s/trash', function (ViewableArticle $article): bool {
32+
new BulkSoftDeleteInteraction('core/articles/%s/soft-delete', function (ViewableArticle $article): bool {
3333
if (!$article->canDelete()) {
3434
return false;
3535
}

wcfsetup/install/files/lib/system/interaction/bulk/user/ArticleBulkInteractions.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use wcf\system\interaction\bulk\BulkDeleteInteraction;
1212
use wcf\system\interaction\bulk\BulkRestoreInteraction;
1313
use wcf\system\interaction\bulk\BulkRpcInteraction;
14-
use wcf\system\interaction\bulk\BulkTrashInteraction;
14+
use wcf\system\interaction\bulk\BulkSoftDeleteInteraction;
1515
use wcf\system\interaction\InteractionConfirmationType;
1616
use wcf\system\WCF;
1717

@@ -32,7 +32,7 @@ public function __construct()
3232
}
3333

3434
$this->addInteractions([
35-
new BulkTrashInteraction('core/articles/%s/trash', function (ViewableArticle $article): bool {
35+
new BulkSoftDeleteInteraction('core/articles/%s/soft-delete', function (ViewableArticle $article): bool {
3636
if (!$article->canDelete()) {
3737
return false;
3838
}

0 commit comments

Comments
 (0)