Skip to content

Fix Wiki comments not being visible when user has no edit permissions

What does this MR do and why?

Fix Wiki comments not being visible when user has no edit permissions.

Context

The wiki app component is being shown on all of the create, edit and show views. The comment section however should only be visible on persisted pages, aka on the edit and show view, not when creating the page because you can't create comments on a page that doesn't exist.

To achieve that we've previously checked pagePersisted. However, when the user had no edit permissions, pagePersisted was undefined – resulting in the comment section ("wikiNotesApp") not being visible at all, even on the show view. The fix was easy: Only run the pagePersisted check when on an edit path – a shown page is always persisted.

App specs

Since the notes app should only be hidden when the page doesn't exist yet,

While fixing this issue I realised there was no spec for app/assets/javascripts/wikis/app.vue, so I added one.

References

Fixes #580198

Screenshots or screen recordings

Before After
Screenshot_2025-11-11_at_13.16.53 Screenshot_2025-11-11_at_13.17.39

How to set up and validate locally

  1. Create a wiki inside a project
  2. login as a user with reporter access on the wiki's project
  3. ensure you can now view and post comments on the wiki page

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Janis Altherr

Merge request reports

Loading