mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-12 21:00:58 +00:00
Users only get messages sent to their primary team and removed some duplicated methods in User model
This commit is contained in:
parent
97755834f8
commit
aef90cb0bf
1 changed files with 1 additions and 14 deletions
|
@ -73,7 +73,6 @@ class User < ActiveRecord::Base
|
||||||
has_many :past_ref_matches, :class_name => "Match", :foreign_key => "referee_id",
|
has_many :past_ref_matches, :class_name => "Match", :foreign_key => "referee_id",
|
||||||
:conditions => "match_time < UTC_TIMESTAMP()"
|
:conditions => "match_time < UTC_TIMESTAMP()"
|
||||||
has_many :received_personal_messages, :class_name => "Message", :as => "recipient", :dependent => :destroy
|
has_many :received_personal_messages, :class_name => "Message", :as => "recipient", :dependent => :destroy
|
||||||
has_many :received_team_messages, :through => :active_teams, :source => :received_messages
|
|
||||||
has_many :sent_personal_messages, :class_name => "Message", :as => "sender", :dependent => :destroy
|
has_many :sent_personal_messages, :class_name => "Message", :as => "sender", :dependent => :destroy
|
||||||
has_many :sent_team_messages, :through => :active_teams, :source => :sent_messages
|
has_many :sent_team_messages, :through => :active_teams, :source => :sent_messages
|
||||||
has_many :match_teams, :through => :matchers, :source => :teams, :uniq => true
|
has_many :match_teams, :through => :matchers, :source => :teams, :uniq => true
|
||||||
|
@ -199,10 +198,6 @@ class User < ActiveRecord::Base
|
||||||
groups.exists? id: Group::STAFF
|
groups.exists? id: Group::STAFF
|
||||||
end
|
end
|
||||||
|
|
||||||
def staff?
|
|
||||||
groups.exists? :id => Group::STAFF
|
|
||||||
end
|
|
||||||
|
|
||||||
def caster?
|
def caster?
|
||||||
groups.exists? id: Group::CASTERS
|
groups.exists? id: Group::CASTERS
|
||||||
end
|
end
|
||||||
|
@ -220,14 +215,6 @@ class User < ActiveRecord::Base
|
||||||
admin? or moderator?
|
admin? or moderator?
|
||||||
end
|
end
|
||||||
|
|
||||||
def gather_moderator?
|
|
||||||
groups.exists? id: Group::GATHER_MODERATORS
|
|
||||||
end
|
|
||||||
|
|
||||||
def allowed_to_ban?
|
|
||||||
admin? or gather_moderator?
|
|
||||||
end
|
|
||||||
|
|
||||||
def verified?
|
def verified?
|
||||||
# created_at < DateTime.now.ago(VERIFICATION_TIME)
|
# created_at < DateTime.now.ago(VERIFICATION_TIME)
|
||||||
true
|
true
|
||||||
|
@ -242,7 +229,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def received_messages
|
def received_messages
|
||||||
received_personal_messages + received_team_messages
|
received_personal_messages + team.received_messages
|
||||||
end
|
end
|
||||||
|
|
||||||
def sent_messages
|
def sent_messages
|
||||||
|
|
Loading…
Reference in a new issue