Skip to content

Fix authored message when snippet is viewed by unauthenticated users

Himanshu Kapoor requested to merge 220303-public-snippet into master

What does this MR do?

Issue: #220303 (closed)

Fix authored message when snippet is viewed by unauthenticated users

Unauthenticated users cannot view author information for public snippets if public profiles are disabled in the admin area. So for those cases, just display the creation time and omit the author information. (Instead of omitting the entire message right now due to a console error.)

How to test locally

  1. Restrict public visibility in Admin > Settings > General > Visibility and Access Controls:

    image
  2. Open any public snippet in incognito.

Screenshots

Snippet viewed in incognito (public profiles not restricted / before and after) Snippet viewed in incognito (public profiles restricted / before) Snippet viewed in incognito (public profiles restricted / after)
image image image
Message: Authored 1 month ago by Administrator. Message is absent and a console error is shown. Message: Authored 1 month ago.
image

Does this MR meet the acceptance criteria?

Conformity

Edited by Himanshu Kapoor

Merge request reports