mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
b58867b6e9
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
40 lines
628 B
Ruby
40 lines
628 B
Ruby
class Reviewable < ActiveRecord::Base
|
|
class Collection
|
|
class Item
|
|
include ActiveModel::Serialization
|
|
attr_reader :id
|
|
|
|
def initialize(id)
|
|
@id = id
|
|
end
|
|
end
|
|
|
|
def initialize(reviewable, guardian, args = nil)
|
|
args ||= {}
|
|
|
|
@reviewable, @guardian, @args = reviewable, guardian, args
|
|
@content = []
|
|
end
|
|
|
|
def has?(id)
|
|
@content.any? { |a| a.id.to_s == id.to_s }
|
|
end
|
|
|
|
def blank?
|
|
@content.blank?
|
|
end
|
|
|
|
def present?
|
|
!blank?
|
|
end
|
|
|
|
def each
|
|
@content.each { |i| yield i }
|
|
end
|
|
|
|
def to_a
|
|
@content
|
|
end
|
|
end
|
|
end
|