mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-02-28 14:51:40 +00:00
Partially fix gather removal bug
This commit is contained in:
parent
d0f0db6165
commit
91a8cdca59
3 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 %>
|
||||
|
|
Loading…
Reference in a new issue