Skip to content

Commit 9163623

Browse files
committed
Merge branch '6.2' into 6.3
2 parents 06cfddc + f5c7b77 commit 9163623

6 files changed

Lines changed: 75 additions & 6 deletions

File tree

ts/WoltLabSuite/Core/Component/Confirmation.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ class ConfirmationPrefab {
150150

151151
dialog.content.append(dl);
152152

153+
if (!isOptional) {
154+
dialog.addEventListener("validate", (event) => {
155+
if (reason.value.trim() === "") {
156+
event.preventDefault();
157+
158+
dl.classList.add("formError");
159+
DomUtil.innerError(reason, getPhrase("wcf.global.form.error.empty"));
160+
} else {
161+
dl.classList.remove("formError");
162+
DomUtil.innerError(reason, false);
163+
}
164+
});
165+
}
166+
153167
dialog.show(question);
154168

155169
return new Promise<ResultConfirmationWithReason>((resolve) => {

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Confirmation.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/lib/acp/form/CategoryAddFormBuilderForm.class.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use wcf\system\form\builder\data\processor\CustomFormDataProcessor;
2424
use wcf\system\form\builder\field\acl\AclFormField;
2525
use wcf\system\form\builder\field\BooleanFormField;
26+
use wcf\system\form\builder\field\IntegerFormField;
2627
use wcf\system\form\builder\field\MultilineTextFormField;
2728
use wcf\system\form\builder\field\SelectFormField;
2829
use wcf\system\form\builder\field\ShowOrderFormField;
@@ -243,6 +244,23 @@ protected function getPositionFormFields(): array
243244
$categoryNodeTree->setMaxDepth($maximumNestingLevel - 1);
244245
}
245246

247+
$positionFormField = null;
248+
if ($maximumNestingLevel === 0) {
249+
$positionFormField = ShowOrderFormField::create()
250+
->description($processor->getLanguageVariable('showOrder.description', true))
251+
->options($categoryNodeTree, true)
252+
->nullable()
253+
->required();
254+
} else {
255+
// Provide a simple integer input instead because we cannot
256+
// dynamically filter the list of categories in the position field.
257+
$positionFormField = IntegerFormField::create('showOrder')
258+
->label('wcf.form.field.showOrder')
259+
->description($processor->getLanguageVariable('showOrder.description', true))
260+
->minimum(0)
261+
->required();
262+
}
263+
246264
return [
247265
SelectFormField::create('parentCategoryID')
248266
->label($processor->getLanguageVariable('parentCategoryID'))
@@ -336,11 +354,7 @@ static function (SelectFormField $formField) use ($processor) {
336354
}
337355
)
338356
),
339-
ShowOrderFormField::create()
340-
->description($processor->getLanguageVariable('showOrder.description', true))
341-
->options($categoryNodeTree, true)
342-
->nullable()
343-
->required(),
357+
$positionFormField,
344358
];
345359
}
346360

wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function supportsNestedOptions()
6363
public function validate()
6464
{
6565
if ($this->isRequired() || $this->getValue() !== '') {
66-
if (!isset($this->getOptions()[$this->getValue()])) {
66+
if ($this->getValue() === null || !isset($this->getOptions()[$this->getValue()])) {
6767
$this->addValidationError(
6868
new FormFieldValidationError(
6969
'invalidValue',

wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentCommentModerationQueueHandler.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,20 @@ public function populate(array $queues)
143143
}
144144
}
145145

146+
/**
147+
* @inheritDoc
148+
*/
149+
public function canRemoveContent(ModerationQueue $queue)
150+
{
151+
if ($this->isValid($queue->objectID)) {
152+
$comment = $this->getComment($queue->objectID);
153+
154+
return $this->getCommentManager($comment)->canDeleteComment($comment);
155+
}
156+
157+
return false;
158+
}
159+
146160
/**
147161
* @inheritDoc
148162
*/

wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentResponseModerationQueueHandler.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,18 @@ public function isAffectedUser(ModerationQueue $queue, $userID)
187187
UserProfileRuntimeCache::getInstance()->getObject($userID)
188188
);
189189
}
190+
191+
/**
192+
* @inheritDoc
193+
*/
194+
public function canRemoveContent(ModerationQueue $queue)
195+
{
196+
if ($this->isValid($queue->objectID)) {
197+
$response = $this->getResponse($queue->objectID);
198+
199+
return $this->getCommentManager($response->getComment())->canDeleteResponse($response);
200+
}
201+
202+
return false;
203+
}
190204
}

0 commit comments

Comments
 (0)