Module: Redd::Models::Moderatable
- Included in:
- Comment, Submission
- Defined in:
- lib/redd/models/moderatable.rb
Overview
A model that can be managed by a moderator (i.e. Submissions and Comments).
Instance Method Summary collapse
-
#approve ⇒ Object
Approve a submission.
-
#distinguish(how = :yes) ⇒ Object
Distinguish a link or comment with a sigil to show that it has been created by a moderator.
-
#ignore_reports ⇒ Object
Stop getting any moderator-related reports on the thing.
-
#remove(spam: false) ⇒ Object
Remove a submission.
-
#undistinguish ⇒ Object
Remove the sigil that shows a thing was created by a moderator.
-
#unignore_reports ⇒ Object
Start getting moderator-related reports on the thing again.
Instance Method Details
#approve ⇒ Object
Approve a submission.
8 9 10 |
# File 'lib/redd/models/moderatable.rb', line 8 def approve @client.post('/api/approve', id: get_attribute(:name)) end |
#distinguish(how = :yes) ⇒ Object
:sticky is for comments. see Submission#make_sticky for posts.
Distinguish a link or comment with a sigil to show that it has been created by a moderator.
21 22 23 24 25 26 27 28 |
# 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 ⇒ Object
Stop getting any moderator-related reports on the thing.
36 37 38 |
# File 'lib/redd/models/moderatable.rb', line 36 def ignore_reports @client.post('/api/ignore_reports', id: get_attribute(:name)) end |
#remove(spam: false) ⇒ Object
Remove a submission.
14 15 16 |
# File 'lib/redd/models/moderatable.rb', line 14 def remove(spam: false) @client.post('/api/remove', id: get_attribute(:name), spam: spam) end |
#undistinguish ⇒ Object
Remove the sigil that shows a thing was created by a moderator.
31 32 33 |
# File 'lib/redd/models/moderatable.rb', line 31 def undistinguish distinguish(:no) end |
#unignore_reports ⇒ Object
Start getting moderator-related reports on the thing again.
41 42 43 |
# File 'lib/redd/models/moderatable.rb', line 41 def unignore_reports @client.post('/api/unignore_reports', id: get_attribute(:name)) end |