Skip to content

[3.0] Say how many members are viewing, instead of always saying none - #9431

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/who-viewing-count
Open

[3.0] Say how many members are viewing, instead of always saying none#9431
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/who-viewing-count

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Found while triaging the Display and MessageIndex areas of the #7933 split. Not
a theme slice — it stands on its own.

With Show who is viewing → numbers only, the topic and board pages count the
members present by passing a literal zero:

Lang::getTxt('number_of_members', [0], file: 'General')

so the line always reads "0 members is viewing this topic", while num_viewing
in the very same sentence counts them properly and picks the singular to match.
Two numbers disagreeing inside one sentence:

release-3.0 this branch
one member on the topic 0 members is viewing this topic. 1 member is viewing this topic.
two members 0 members is viewing this topic. 2 members are viewing this topic.

Both templates have the same line, so both are fixed.

Why view_members_list and not view_members. The list is what the sentence
describes: view_members_list holds the members this reader is allowed to see,
and anyone hidden gets their own mention right after it. view_members holds
everyone including the hidden, so counting that would put them in both halves —
"3 members and 3 hidden" for three people, one of whom is hidden.

Testing

Several people on one topic, with display_who_viewing set to 1:

  • as a moderator, who sees hidden members in the list and gets no separate
    mention of them: 3 viewers → 3 members are viewing this topic.
  • as an ordinary member, with every other viewer hidden: 0 members and 3 hidden are viewing this topic. — no one counted twice.

The plural follows correctly in each case, and the two numbers in the sentence
now agree.

Issues References (Fixes|Related|Closes)

Related to #7933

With "Show who is viewing" set to numbers only, the topic and board pages count
the members present by passing a literal zero:

	Lang::getTxt('number_of_members', [0], file: 'General')

so the line always reads "0 members is viewing this topic", while the rest of the
same sentence counts them properly and picks the singular to match. On a board
with one other person on it you get the two numbers disagreeing inside one
sentence.

Counted from view_members_list rather than view_members, because that is the list
the sentence is describing: it holds the members this reader is allowed to see,
and anyone hidden gets their own mention right after it. Counting view_members
would put the hidden ones in both halves.

Verified with several people on one topic: as a moderator, who sees hidden
members in the list and gets no separate mention of them, and as an ordinary
member, who sees neither. The two numbers in the sentence now agree in both
cases, and the plural follows.

Signed-off-by: Mathias Albert <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants