From 6122caa12576ada6830da51f6542026e5b4d48f3 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Sun, 19 May 2019 18:03:58 -0400 Subject: [PATCH] Add gather moderators Fix few gather issues --- app/models/gatherer.rb | 4 ++-- app/views/gathers/_running.html.erb | 2 +- app/views/gathers/_status.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/gatherer.rb b/app/models/gatherer.rb index d6697bf..071b0c2 100644 --- a/app/models/gatherer.rb +++ b/app/models/gatherer.rb @@ -149,7 +149,7 @@ class Gatherer < ActiveRecord::Base def can_update? cuser, params = {} return false unless cuser if params.keys.include? "username" - if cuser.admin? + if cuser.admin? or cuser.gather_moderator? return true else return false @@ -166,6 +166,6 @@ class Gatherer < ActiveRecord::Base end def can_destroy? cuser - cuser and ((user == cuser or cuser.admin?) and gather.status == Gather::STATE_RUNNING) + cuser and ((user == cuser or cuser.admin? or gather_moderator) and gather.status == Gather::STATE_RUNNING) end end diff --git a/app/views/gathers/_running.html.erb b/app/views/gathers/_running.html.erb index de2d68f..c29b896 100644 --- a/app/views/gathers/_running.html.erb +++ b/app/views/gathers/_running.html.erb @@ -9,7 +9,7 @@ 0 %> class="away"<% end %>> <%= flag gatherer.user.country %> <%= namelink gatherer.user %> - <% if cuser and cuser.admin? %> + <% if cuser and (cuser.admin? or cuser.gather_moderator?) %> <%= link_to gatherer, method: :delete, class: 'delete' do %> <%= icon 'times' %> <% end %> diff --git a/app/views/gathers/_status.html.erb b/app/views/gathers/_status.html.erb index c74e92d..6fe60c2 100644 --- a/app/views/gathers/_status.html.erb +++ b/app/views/gathers/_status.html.erb @@ -69,7 +69,7 @@ <%= link_to "Mute", '#', id: "mute", class: 'button tiny' %> - <% if cuser and cuser.admin? %> + <% if cuser and (cuser.admin? or cuser.gather_moderators?) %> <%= link_to "Admin Page", edit_gather_url, class: 'admin button' %> <% end %>