Module: SnippetsActions
- Extended by:
- ActiveSupport::Concern
- Includes:
- Gitlab::NoteableMetadata, PaginatedCollection, ProductAnalyticsTracking, RendersBlob, RendersNotes, Snippets::SendBlob, SnippetsSort
- Included in:
- Projects::SnippetsController, SnippetsController
- Defined in:
- app/controllers/concerns/snippets_actions.rb
Instance Method Summary collapse
- #edit ⇒ Object
- #js_request? ⇒ Boolean
-
#raw ⇒ Object
This endpoint is being replaced by Snippets::BlobController#raw Support for old raw links will be maintainted via this action but it will only return the first blob found, see: gitlab.com/gitlab-org/gitlab/-/issues/217775.
-
#show ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables.
Methods included from Gitlab::Tracking::Helpers
#dnt_enabled?, #trackable_html_request?
Methods included from SnippetsSort
Methods included from Snippets::SendBlob
Methods included from SendsBlob
Methods included from Gitlab::NoteableMetadata
Methods included from RendersBlob
#blob_json, #conditionally_expand_blob, #conditionally_expand_blobs, #render_blob_json
Methods included from RendersNotes
Instance Method Details
#edit ⇒ Object
23 |
# File 'app/controllers/concerns/snippets_actions.rb', line 23 def edit; end |
#js_request? ⇒ Boolean
47 48 49 |
# File 'app/controllers/concerns/snippets_actions.rb', line 47 def js_request? request.format.js? end |
#raw ⇒ Object
This endpoint is being replaced by Snippets::BlobController#raw Support for old raw links will be maintainted via this action but it will only return the first blob found, see: gitlab.com/gitlab-org/gitlab/-/issues/217775
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/concerns/snippets_actions.rb', line 29 def raw workhorse_set_content_type! # Until we don't migrate all snippets to version # snippets we need to support old `SnippetBlob` # blobs if defined?(blob.snippet) send_data( convert_line_endings(blob.data), type: 'text/plain; charset=utf-8', disposition: content_disposition, filename: Snippet.sanitized_file_name(blob.name) ) else send_snippet_blob(snippet, blob) end end |
#show ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/concerns/snippets_actions.rb', line 52 def show respond_to do |format| format.html do @note = Note.new(noteable: @snippet, project: @snippet.project) @noteable = @snippet @discussions = @snippet.discussions @notes = prepare_notes_for_rendering(@discussions.flat_map(&:notes)) render 'show' end format.js do if @snippet. (blobs) render 'shared/snippets/show' else head :not_found end end end end |