Created
January 25, 2017 12:22
-
-
Save Findeton/c307775b2229105ea9b26e141277c71a to your computer and use it in GitHub Desktop.
Disable editing/removing comments and editing issues on gitlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 10609b0bd79e8d981a3f8bf6c6a2393c20e9924a Mon Sep 17 00:00:00 2001 | |
| From: Findeton <felrobelv@gmail.com> | |
| Date: Wed, 25 Jan 2017 13:12:04 +0100 | |
| Subject: [PATCH] disable editing and removing comments, editing issues | |
| --- | |
| app/controllers/projects/issues_controller.rb | 1 + | |
| app/controllers/projects/notes_controller.rb | 2 ++ | |
| app/views/projects/issues/show.html.haml | 3 --- | |
| app/views/projects/notes/_note.html.haml | 6 ------ | |
| 4 files changed, 3 insertions(+), 9 deletions(-) | |
| diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb | |
| index 8472ceca32..e9df1fcb57 100644 | |
| --- a/app/controllers/projects/issues_controller.rb | |
| +++ b/app/controllers/projects/issues_controller.rb | |
| @@ -68,6 +68,7 @@ class Projects::IssuesController < Projects::ApplicationController | |
| end | |
| def edit | |
| + raise "nVotes decided you can't edit issues" | |
| respond_with(@issue) | |
| end | |
| diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb | |
| index c5d93ce25b..5eefe7203d 100644 | |
| --- a/app/controllers/projects/notes_controller.rb | |
| +++ b/app/controllers/projects/notes_controller.rb | |
| @@ -37,6 +37,7 @@ class Projects::NotesController < Projects::ApplicationController | |
| end | |
| def update | |
| + raise "nVotes decided you can't edit comments" | |
| @note = Notes::UpdateService.new(project, current_user, note_params).execute(note) | |
| if @note.is_a?(Note) | |
| @@ -50,6 +51,7 @@ class Projects::NotesController < Projects::ApplicationController | |
| end | |
| def destroy | |
| + raise "nVotes decided you can't remove comments" | |
| if note.editable? | |
| Notes::DeleteService.new(project, current_user).execute(note) | |
| end | |
| diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml | |
| index 9fa00811af..6dd52c58e3 100644 | |
| --- a/app/views/projects/issues/show.html.haml | |
| +++ b/app/views/projects/issues/show.html.haml | |
| @@ -38,8 +38,6 @@ | |
| = link_to 'Reopen issue', issue_path(@issue, issue: { state_event: :reopen }, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' | |
| %li | |
| = link_to 'Close issue', issue_path(@issue, issue: { state_event: :close }, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' | |
| - %li | |
| - = link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue) | |
| - if @issue.submittable_as_spam? && current_user.admin? | |
| %li | |
| = link_to 'Submit as spam', mark_as_spam_namespace_project_issue_path(@project.namespace, @project, @issue), method: :post, class: 'btn-spam', title: 'Submit as spam' | |
| @@ -52,7 +50,6 @@ | |
| = link_to 'Close issue', issue_path(@issue, issue: { state_event: :close }, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "hidden-xs hidden-sm btn btn-grouped btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' | |
| - if @issue.submittable_as_spam? && current_user.admin? | |
| = link_to 'Submit as spam', mark_as_spam_namespace_project_issue_path(@project.namespace, @project, @issue), method: :post, class: 'hidden-xs hidden-sm btn btn-grouped btn-spam', title: 'Submit as spam' | |
| - = link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue), class: 'hidden-xs hidden-sm btn btn-grouped issuable-edit' | |
| .issue-details.issuable-details | |
| diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml | |
| index 36c388c331..ca23db8a22 100644 | |
| --- a/app/views/projects/notes/_note.html.haml | |
| +++ b/app/views/projects/notes/_note.html.haml | |
| @@ -55,12 +55,6 @@ | |
| = link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do | |
| = icon('spinner spin') | |
| = icon('smile-o', class: 'link-highlight') | |
| - | |
| - - if note_editable | |
| - = link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do | |
| - = icon('pencil', class: 'link-highlight') | |
| - = link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do | |
| - = icon('trash-o', class: 'danger-highlight') | |
| .note-body{ class: note_editable ? 'js-task-list-container' : '' } | |
| .note-text.md | |
| = preserve do | |
| -- | |
| 2.11.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment