Partially fix gather removal bug

This commit is contained in:
Ari Timonen 2019-06-07 22:47:21 +03:00
parent d0f0db6165
commit 91a8cdca59
3 changed files with 4 additions and 3 deletions

View file

@ -51,8 +51,9 @@ class GatherersController < ApplicationController
def destroy
raise AccessError unless @gatherer.can_destroy? cuser
@gather = @gatherer.gather
@gatherer.destroy
redirect_to @gatherer.gather
redirect_to @gather
end
private

View file

@ -166,6 +166,6 @@ class Gatherer < ActiveRecord::Base
end
def can_destroy? cuser
cuser and ((user == cuser or cuser.admin? or gather_moderator) and gather.status == Gather::STATE_RUNNING)
cuser and ((user == cuser or cuser.admin? or cuser.gather_moderator?) and gather.status == Gather::STATE_RUNNING)
end
end

View file

@ -9,7 +9,7 @@
<li<% if gatherer.status > 0 %> class="away"<% end %>>
<%= flag gatherer.user.country %>
<%= namelink gatherer.user %>
<% if cuser and (cuser.admin? or cuser.gather_moderator?) %>
<% if cuser and gatherer.can_destroy?(cuser) %>
<%= link_to gatherer, method: :delete, class: 'delete' do %>
<%= icon 'times' %>
<% end %>