Sha256: c4514b9da8d553ce51b63f08b8e7838636b2ca77e7e2f2ccb56251ec6d52c5b3

Contents?: true

Size: 1.29 KB

Versions: 9

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Redd
  module Models
    # A model that can be managed by a moderator (i.e. Submissions and Comments).
    module Moderatable
      # Approve a submission.
      def approve
        @client.post('/api/approve', id: get_attribute(:name))
      end

      # Remove a submission.
      # @param spam [Boolean] whether or not this item is removed due to it being spam
      def remove(spam: false)
        @client.post('/api/remove', id: get_attribute(:name), spam: spam)
      end

      # Distinguish a link or comment with a sigil to show that it has
      # been created by a moderator.
      # @param how [:yes, :no, :admin, :special] how to distinguish the thing
      def distinguish(how = :yes)
        @client.post('/api/distinguish', id: get_attribute(:name), how: how)
      end

      # Remove the sigil that shows a thing was created by a moderator.
      def undistinguish
        distinguish(:no)
      end

      # Stop getting any moderator-related reports on the thing.
      def ignore_reports
        @client.post('/api/ignore_reports', id: get_attribute(:name))
      end

      # Start getting moderator-related reports on the thing again.
      def unignore_reports
        @client.post('/api/unignore_reports', id: get_attribute(:name))
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
redd-0.8.6 lib/redd/models/moderatable.rb
redd-0.8.5 lib/redd/models/moderatable.rb
redd-0.8.4 lib/redd/models/moderatable.rb
redd-0.8.3 lib/redd/models/moderatable.rb
redd-0.8.2 lib/redd/models/moderatable.rb
redd-0.8.1 lib/redd/models/moderatable.rb
redd-0.8.0 lib/redd/models/moderatable.rb
redd-0.8.0.pre.2 lib/redd/models/moderatable.rb
redd-0.8.0.pre.1 lib/redd/models/moderatable.rb