Project

General

Profile

Actions

Feature #25454

closed

Add bulk edit after save hook

Added by Serghei Zagorinyak over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate

Description

Correct me if I'm mistaken, but now there only exists a issue_bulk_edit_before_save controller hook. This makes it impossible to provide consistent behavior for plugins implementing edit_after_save controller hooks.

Say, a user edits an issue via issue view and triggers a issue_edit_after_save_hook which handles the issue in a proper way. The same is expected to happen when an issue is edited via context menu (right click) in any multiple issues view, but there is no way to provide that as bulk_edit method is called for context menus and there is no issue_bulk_edit_after_save hook which makes issue_edit_after_save hook useless.

I think it would be useful to have something like this in issues#bulk_edit controller method:

def bulk_edit
  ...
  @issues.each do |orig_issue|
    ...

    begin        
      Issue.transaction do          
        call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })          
        issue.save!          
        call_hook(:controller_issues_bulk_edit_after_save,  { :params => params, :issue => issue })          
      end        
    saved_issues << issue
    rescue ActiveRecord::RecordNotSaved => e        
      unsaved_issues << orig_issue
    end

    ...
  end
  ...
end

Hope someone can make a proper patch out of this or provide a better way of managing after_save hooks for bulk edit. Thanks.


Related issues

Is duplicate of Redmine - Patch #8757: Add hook for bulk edit post-save stateNew2011-07-06

Actions
Actions

Also available in: Atom PDF