[go: up one dir, main page]

Skip to content

Hide 'Embed' button for public snippets but in a non-public project or project's snippets visibility is `Only Project Members`

Summary

Snippets of private/internal projects or projects with Snippets visibility set to Only Project Members are not embeddable; however, the UI still shows the Embed button.

Steps to reproduce

  1. Create a public snippet inside a private project
  2. On the snippet page, you will see the Embed button. In the end, you won't be able to embed it (404)

What is the current bug behavior?

The Embed button is shown even though the snippet is not embeddable

What is the expected correct behavior?

The Embed button in the snippet page should be hidden for projects where snippets are not viewable

Relevant logs and/or screenshots

Public Snippet in Private Project:

image

Visiting the javascript file (used for embedding):

image

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Possible fixes

Improve checks for embeddable() in https://gitlab.com/gitlab-org/gitlab/-/blob/a8ea55db8badde24e8e0e019c65f0320f5b103fd/app/assets/javascripts/snippets/components/show.vue

Edited by Pham Sy Minh