PERIODS = USER_BLOCK_PERIODS
+ ##
+ # scope to match active blocks
+ def self.active
+ self.where("needs_view or ends_at > ?", Time.now.getutc)
+ end
+
##
# return a renderable version of the reason text.
def reason
# revokes the block, allowing the user to use the API again. the argument
# is the user object who is revoking the ban.
def revoke!(revoker)
- update_attributes({
+ update_attributes(
:ends_at => Time.now.getutc(),
:revoker_id => revoker.id,
:needs_view => false
- }, :without_protection => true)
+ )
end
private