diaspora/app/models/role.rb
Lukas Matt 5c9a3aaf3e Added post report feature
You can report a single post by clicking the correct icon in the controler section

Workflow:
* Report a post as offensive
* Trigger alerts to every pod-admin
* Pod-admin can review it in the admin interface
* Delete the post or mark it as reviewed
2014-01-14 15:00:55 -05:00

18 lines
450 B
Ruby

#NOTE add the person object you want to attach role to...
class Role < ActiveRecord::Base
belongs_to :person
scope :admins, -> { where(name: 'admin') }
def self.is_admin?(person)
find_by_person_id_and_name(person.id, 'admin')
end
def self.add_admin(person)
find_or_create_by_person_id_and_name(person.id, 'admin')
end
def self.add_spotlight(person)
find_or_create_by_person_id_and_name(person.id, 'spotlight')
end
end