From 0b3db18477c221088130dcfc38aebfea3711cfee Mon Sep 17 00:00:00 2001 From: echarp Date: Sun, 27 Dec 2015 12:56:33 +0100 Subject: [PATCH] Only a moderator can delete an organisation --- app/controllers/orgas_controller.rb | 5 +++-- app/views/orgas/show.html.haml | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/orgas_controller.rb b/app/controllers/orgas_controller.rb index 96ee76f1..dff9d250 100644 --- a/app/controllers/orgas_controller.rb +++ b/app/controllers/orgas_controller.rb @@ -2,9 +2,10 @@ class OrgasController < ApplicationController before_action :set_orga, except: [:index, :new, :create] before_action :set_mailer_host - before_action :authenticate_user!, only: [:edit, :update, :cancel, :destroy], + before_action :authenticate_user!, only: [:edit, :update], unless: :check_secret - before_action :authenticate_user!, only: [:validate, :accept] + before_action :authenticate_user!, only: [:validate, :accept, :cancel, + :destroy] def index @search = Orga.moderated.includes(:kind).includes(:region).search params[:q] diff --git a/app/views/orgas/show.html.haml b/app/views/orgas/show.html.haml index 85c95ece..858c38a7 100644 --- a/app/views/orgas/show.html.haml +++ b/app/views/orgas/show.html.haml @@ -51,10 +51,11 @@ = link_to edit_orga_path @orga do %em.fa.fa-lg.fa-pencil = t '.edit' - %h2 - = link_to cancel_orga_path @orga do - %em.fa.fa-lg.fa-thumbs-down - = t '.cancel' + - if user_signed_in? + %h2 + = link_to cancel_orga_path @orga do + %em.fa.fa-lg.fa-thumbs-down + = t '.cancel' %h3= t '.description' .description