mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-02-28 23:01:05 +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
|
def destroy
|
||||||
raise AccessError unless @gatherer.can_destroy? cuser
|
raise AccessError unless @gatherer.can_destroy? cuser
|
||||||
|
|
||||||
|
@gather = @gatherer.gather
|
||||||
@gatherer.destroy
|
@gatherer.destroy
|
||||||
redirect_to @gatherer.gather
|
redirect_to @gather
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -166,6 +166,6 @@ class Gatherer < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_destroy? cuser
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<li<% if gatherer.status > 0 %> class="away"<% end %>>
|
<li<% if gatherer.status > 0 %> class="away"<% end %>>
|
||||||
<%= flag gatherer.user.country %>
|
<%= flag gatherer.user.country %>
|
||||||
<%= namelink gatherer.user %>
|
<%= 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 %>
|
<%= link_to gatherer, method: :delete, class: 'delete' do %>
|
||||||
<%= icon 'times' %>
|
<%= icon 'times' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue