Skip to content

[3.0] Count the posts a board is holding for approval - #9400

Merged
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/unapproved-message-counts
Aug 11, 2026
Merged

[3.0] Count the posts a board is holding for approval#9400
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/unapproved-message-counts

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

A board with posts waiting for approval always said it had none:

There are 0 topics and 0 posts awaiting approval in this board. Click here to view them all.

$txt['there_are_unapproved_topics'] puts both counts through ICU plural arguments, and carries its own link to the moderation queue:

There are {topics, plural, one {# topic} other {# topics}} and {posts, plural,
one {# post} other {# posts}} awaiting approval in this board.
Click <a href="{url}">here</a> to view them all.

MessageIndex::buildUnapprovedPostsMessage() wrapped each count in a link of its own before handing it over. ICU wants a number for a plural argument, gets a string, reads it as zero, and drops the markup on the floor — so the counts read zero and the extra links never appeared anyway.

Straight off the running forum, on a board carrying three unapproved topics and five unapproved posts:

before  There are 0 topics and 0 posts awaiting approval in this board. Click <a href="…">here</a> …
after   There are 3 topics and 2 posts awaiting approval in this board. Click <a href="…">here</a> …

Three topics and two posts, the two being the replies — unapproved_posts counts the topic starters as well, which is why the existing code subtracts.

Reduced to the pattern on its own, so the coercion is easy to see:

$args = ['topics' => '<a href="…">3</a>', 'posts' => '<a href="…">2</a>', 'url' => …]
  → There are 0 topics and 0 posts awaiting approval …

$args = ['topics' => 3, 'posts' => 2, 'url' => …]
  → There are 3 topics and 2 posts awaiting approval …

$args = ['topics' => 1, 'posts' => 1, 'url' => …]
  → There are 1 topic and 1 post awaiting approval …

The url argument is already built for whichever queue is the more useful one, so nothing is lost by letting the string place the single link itself.

This is one of the fixes carried on the #7933 branch. It touches no theme template, so per the grouping asked for on that PR it comes over on its own, straight to release-3.0.

Issues References (Fixes|Related|Closes)

Related to #7933

there_are_unapproved_topics puts both counts through ICU plural arguments,
and the string carries its own link to the moderation queue. The two counts
were being wrapped in links of their own before being handed over, so ICU
saw a string where it wanted a number, read it as zero, and dropped the
markup.

Every board with something waiting therefore said "There are 0 topics and
0 posts awaiting approval in this board", whatever it was actually holding.
With three unapproved topics and five unapproved posts it now says three
topics and two posts, the two being the replies.

Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 6 milestone Aug 8, 2026
@live627
live627 merged commit 779bd53 into SimpleMachines:release-3.0 Aug 11, 2026
4 checks passed
@jdarwood007 jdarwood007 modified the milestones: 3.0 Alpha 6, 3.0 Alpha 5 Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants