Feature #25454

Add bulk edit after save hook

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

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
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

Duplicates Redmine - Patch #8757: Add hook for bulk edit post-save state New 2011-07-06

History

#1 Updated by Toshi MARUYAMA over 4 years ago

  • Related to Patch #8757: Add hook for bulk edit post-save state added

#2 Updated by Toshi MARUYAMA over 4 years ago

  • Related to deleted (Patch #8757: Add hook for bulk edit post-save state)

#3 Updated by Toshi MARUYAMA over 4 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Duplicate of #8757.

#4 Updated by Toshi MARUYAMA over 4 years ago

  • Duplicates Patch #8757: Add hook for bulk edit post-save state added

Also available in: Atom PDF