lib/redd/models/moderatable.rb in redd-0.8.6 vs lib/redd/models/moderatable.rb in redd-0.8.7

- old
+ new

@@ -13,14 +13,16 @@ # @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. + # 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) + # @param sticky [Boolean] (for comments) whether to sticky the comment to the top + def distinguish(how = :yes, sticky: nil) + params = { id: get_attribute(:name), how: how } + params[:sticky] = sticky unless sticky.nil? + @client.post('/api/distinguish', params) end # Remove the sigil that shows a thing was created by a moderator. def undistinguish distinguish(:no)