module Redd::Models::Moderatable

A model that can be managed by a moderator (i.e. Submissions and Comments).

Public Instance Methods

approve() click to toggle source

Approve a submission.

# File lib/redd/models/moderatable.rb, line 8
def approve
  @client.post('/api/approve', id: get_attribute(:name))
end
distinguish(how = :yes) click to toggle source

Distinguish a link or comment with a sigil to show that it has been created by a moderator. @param how [:yes, :no, :admin, :special, :sticky] how to distinguish the thing @note :sticky is for comments. see {Submission#make_sticky} for posts.

# File lib/redd/models/moderatable.rb, line 21
def distinguish(how = :yes)
  params = { id: get_attribute(:name), how: how }
  if how == :sticky
    params[:how] = :yes
    params[:sticky] = true
  end
  @client.post('/api/distinguish', params)
end
ignore_reports() click to toggle source

Stop getting any moderator-related reports on the thing.

# File lib/redd/models/moderatable.rb, line 36
def ignore_reports
  @client.post('/api/ignore_reports', id: get_attribute(:name))
end
remove(spam: false) click to toggle source

Remove a submission. @param spam [Boolean] whether or not this item is removed due to it being spam

# File lib/redd/models/moderatable.rb, line 14
def remove(spam: false)
  @client.post('/api/remove', id: get_attribute(:name), spam: spam)
end
undistinguish() click to toggle source

Remove the sigil that shows a thing was created by a moderator.

# File lib/redd/models/moderatable.rb, line 31
def undistinguish
  distinguish(:no)
end
unignore_reports() click to toggle source

Start getting moderator-related reports on the thing again.

# File lib/redd/models/moderatable.rb, line 41
def unignore_reports
  @client.post('/api/unignore_reports', id: get_attribute(:name))
end