From 1f383516dc56e0ebfc2a465e3d1250b4353a72b3 Mon Sep 17 00:00:00 2001 From: albertlast Date: Wed, 29 Jul 2026 17:01:35 +0200 Subject: [PATCH] Stops flagging new topics as posted in an unapproved topic Post2::submit() marked a post as unapproved whenever Topic::$info->is_approved was empty. When starting a new topic there is no topic yet, so Topic::$info is null and empty() reports it as an unapproved topic. Every non-approver who started a topic therefore got $_SESSION['becomesUnapproved'] set, and was greeted with "Your message was not approved because it was posted in an unapproved topic" even though the topic was in fact approved. The post itself was unaffected, because prepareNewTopic() resets $becomes_approved afterwards. Only the message was wrong. In 2.1 this block lived inside "if (!empty($topic))". Restores that guard, which was lost when the code was moved into Post2. Co-Authored-By: Claude Opus 5 --- Sources/Actions/Post2.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Actions/Post2.php b/Sources/Actions/Post2.php index 458498073f..5685ed274f 100644 --- a/Sources/Actions/Post2.php +++ b/Sources/Actions/Post2.php @@ -180,7 +180,9 @@ public function submit(): void $this->submitAttachments(); // Replies to unapproved topics are unapproved by default (but not for moderators) - if (empty(Topic::$info->is_approved) && !$this->can_approve) { + // There is no topic yet when starting a new one, so Topic::$info is null + // in that case and must not be mistaken for an unapproved topic. + if ($this->intent !== self::INTENT_NEW_TOPIC && empty(Topic::$info->is_approved) && !$this->can_approve) { $this->becomes_approved = false; // Set a nice session var...