0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 09:05:23 +08:00
discourse/spec
Régis Hanol beba9d0c11
FIX: Hide posts while media added by an edit awaits review
When an edit adds media that `skip_review_media_groups` requires staff to
approve, queueing a reviewable is not enough. At creation the check holds the
whole post back until it is approved, but on the edit path the media stayed
publicly visible until a moderator got to the queue, defeating the point of a
review meant to happen before publication.

The post is now hidden — and the topic unlisted when it is the first post —
under a dedicated hidden reason while the review is pending. Approving through
the existing approve-and-unhide action restores both. The author is told what
happened in a PM, and every placeholder (app, crawler view, RSS) explains the
post is awaiting media review instead of claiming it was flagged by the
community.

Reusing the hidden flag means the flag system could unhide the post while the
media review was still pending: a moderator disagreeing with an unrelated
flag, a user withdrawing one, or the author editing a flag-hidden post would
all have published the unreviewed media. Unhiding now refuses while a media
review is pending unless it is forced, which only the review's approval and a
staff member explicitly unhiding the post do.

Since this hide is not a flag:

- the flag cooldown no longer locks the author out of editing — editing a
  media-hidden post never unhides it, so there is nothing to game;
- hiding no longer overwrites the visibility reason of a topic that was
  already unlisted, so approving the media cannot silently relist a topic a
  moderator deliberately unlisted (which also fixes the same long-standing
  clobber on the flag path);
- the system message options only include a flag reason when there is an
  actual flag, since interpolating `flag_reasons.` with no type stuffed the
  entire translation subtree into the job arguments.

Hiding is only worth doing if the content is actually hidden, so the topic's
og:image and the RSS channel description — which rendered the first post's
raw — no longer advertise the content of a hidden first post.

System-driven revisions (`skip_validations`) are exempt from the check,
matching creation where programmatic post creation never goes through the
new-post checks; refreshing a topic embed should not unlist a blog topic.
2026-08-04 17:11:08 +02:00
..
db
fabricators FIX: can_create_discourse_post_event? not checking user groups correctly (#42284) 2026-08-04 16:09:50 +10:00
fixtures DEV: Add image-processing regression coverage (#42117) 2026-07-30 15:28:07 +08:00
generator
helpers UX: Hide signup when the site is in read only or staff only mode (#42101) 2026-07-28 20:05:04 +02:00
import_export
initializers FIX: Do not notify new sites or plugins enabled of old upcoming changes (#42045) 2026-07-30 09:51:08 +10:00
integration FIX: store method in route matcher (#41512) 2026-07-07 11:49:56 -04:00
integrity DEV: hide and disable upcoming changes for disabled plugins (#41657) 2026-07-16 14:35:20 +04:00
jobs FEATURE: Reclassify likely crawlers in site traffic reporting (#42199) 2026-08-04 10:08:53 +08:00
lib FIX: Hide posts while media added by an edit awaits review 2026-08-04 17:11:08 +02:00
mailers DEV: remove simple email subject upcoming change metadata (#41807) 2026-07-20 14:43:00 +04:00
migrations FIX: Ensure each flag gets a unique name_key (#40899) 2026-06-24 16:37:59 +02:00
models FIX: Hide posts while media added by an edit awaits review 2026-08-04 17:11:08 +02:00
multisite
queries/reports FEATURE: Change default upcoming change promotion status to Beta (#41275) 2026-07-06 09:13:37 +10:00
requests FIX: Enforce per-section sidebar link cap on partial updates (#42309) 2026-08-04 09:17:17 -05:00
script DEV: Fix UC status report when reverted files encountered (#41821) 2026-07-20 16:37:35 +10:00
serializers FIX: Hide posts while media added by an edit awaits review 2026-08-04 17:11:08 +02:00
services FIX: Ensure language header selections do not silently get added to 'Languages I understand' (#42294) 2026-08-04 14:46:41 +08:00
support DEV: Add image-processing regression coverage (#42117) 2026-07-30 15:28:07 +08:00
system SECURITY: Escape embed URL for HTML attribute context in footer (#42314) 2026-08-04 09:59:30 -05:00
tasks DEV: Prefer RSpec primitives for test setup (#42122) 2026-07-30 11:17:22 +08:00
views
rails_helper.rb DEV: Prefer RSpec primitives for test setup (#42122) 2026-07-30 11:17:22 +08:00
regenerate_swagger_docs
swagger_helper.rb