Class: BookmarksBulkAction
- Inherits:
-
Object
- Object
- BookmarksBulkAction
- Defined in:
- lib/bookmarks_bulk_action.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(user, bookmark_ids, operation, options = {}) ⇒ BookmarksBulkAction
constructor
A new instance of BookmarksBulkAction.
- #perform! ⇒ Object
Constructor Details
#initialize(user, bookmark_ids, operation, options = {}) ⇒ BookmarksBulkAction
Returns a new instance of BookmarksBulkAction.
4 5 6 7 8 9 10 |
# File 'lib/bookmarks_bulk_action.rb', line 4 def initialize(user, bookmark_ids, operation, = {}) @user = user @bookmark_ids = bookmark_ids @operation = operation @changed_ids = [] @options = end |
Class Method Details
.operations ⇒ Object
12 13 14 |
# File 'lib/bookmarks_bulk_action.rb', line 12 def self.operations @operations ||= %w[clear_reminder delete] end |
Instance Method Details
#perform! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bookmarks_bulk_action.rb', line 16 def perform! if BookmarksBulkAction.operations.exclude?(@operation[:type]) raise Discourse::InvalidParameters.new(:operation) end case @operation[:type] when "clear_reminder" clear_reminder when "delete" delete end @changed_ids.sort end |