fixed error for old bans that don't have a creator

validation failed on editing older bans that do not have a creator. Added a check to make sure this is still working.
This commit is contained in:
Absurdon 2017-03-08 01:45:33 +01:00 committed by GitHub
parent a3a7e92789
commit 035f15648a

View file

@ -71,7 +71,7 @@ class Ban < ActiveRecord::Base
end end
def validate_permission def validate_permission
unless creator.admin? or (creator.gather_moderator? and self.ban_type == TYPE_GATHER) unless creator and (creator.admin? or (creator.gather_moderator? and self.ban_type == TYPE_GATHER))
errors.add :ban_type, 'Gather Moderators can only create gather bans' errors.add :ban_type, 'Gather Moderators can only create gather bans'
end end
end end