Feature #8757
closedAdd hook for bulk edit post-save state
Description
There is a hook which gets invoked just after an individual issue gets updated, which allows for plugins to perform any post-save actions. There ought to be a similar hook for when a number of issues have been updated via the bulk-editing process. I've patched the core code to enable such a hook - `controller_issues_bulk_edit_after_save`.
Patch available at https://github.com/7citylearning/redmine/commit/f88c6ca01e89246b5bcd62fa26cc651ee33ba212
Files
Related issues
Updated by Etienne Massip about 15 years ago
- Category changed from Issues to Plugin API
Updated by An Phan over 11 years ago
+1. Some of the webhook plugins out there is not complete because of this hook missing, for example Redmine Webhook.
I've no idea why this takes so long to be merged. There was even a patch 4 years ago: #5714. I mean, how hard can it be to add this one liner into issues_controller.rb?
call_hook(:controller_issues_bulk_edit_after_save, { :params => params, :issue => issue, :journal => journal })
Updated by Hiroshi Miura over 11 years ago
+1. To improve user productivity with webhook or other plugins, and chat platforms such as hipchat, slack, kandan and hubot.
Updated by Adam Pfeiffer over 10 years ago
I absolutely need this as well. It does seem to be a simple change that should have been there from the beginning. I will modify my code locally to make sure this works with my plugin.
THanks
Updated by Joel SCHAAL about 10 years ago
+1
I would like to see that change in the next version.
Is this change too risky or too dirty ?
Does it need to be adapted before acceptance ?
Updated by Toshi MARUYAMA about 10 years ago
- Category changed from Plugin API to Hook requests
Updated by Tobias Böhm over 9 years ago
- File issues_controller_bulk_update_after_save_hook.patch issues_controller_bulk_update_after_save_hook.patch added
I just created a patch for this issue that applies to the current master code base. Please find it attached.
Updated by Toshi MARUYAMA over 9 years ago
- Related to Feature #25454: Add bulk edit after save hook added
Updated by Serghei Zagorinyak over 9 years ago
This patch is wrong.
Implemented this way, if an exception is raised within bulk_edit_after_save it will prevent succeeding issues from being saved while they should be processed and only the problematic issue should be rejected.
Updated by Tobias Böhm over 9 years ago
You are right, exceptions raising from the hook are not handled. But this applies also to the already existing hook :controller_issues_bulk_edit_after_save. If an exception is raised there, all following issues will not be processed.
This should be addressed for the whole process (before-hook, save, after-hook) or loop at once, I guess, in a separate issue and patch.
Updated by Serghei Zagorinyak over 9 years ago
Tobias Böhm wrote:
You are right, exceptions raising from the hook are not handled. But this applies also to the already existing hook
:controller_issues_bulk_edit_after_save. If an exception is raised there, all following issues will not be processed.This should be addressed for the whole process (before-hook, save, after-hook) or loop at once, I guess, in a separate issue and patch.
Yes, didn't notice that first. Hope this will be fixed someday.
Updated by Toshi MARUYAMA over 9 years ago
- Related to deleted (Feature #25454: Add bulk edit after save hook)
Updated by Toshi MARUYAMA over 9 years ago
- Has duplicate Feature #25454: Add bulk edit after save hook added
Updated by Julián Maestri almost 8 years ago
- File controller_issues_bulk_edit_after_save.patch controller_issues_bulk_edit_after_save.patch added
Patch based on redmine v3.4.6
To avoid the problems with stopping the bulk update if something fails on the hook, iterate over the saved issues after saving them.
Updated by Marius BĂLTEANU almost 8 years ago
- Has duplicate Feature #29897: hook: controller_issues_bulk_edit_after_save added
Updated by Go MAEDA almost 8 years ago
- Has duplicate Patch #5714: Request for controller_issues_bulk_edit_after_save hook added
Updated by Jethro Yu almost 8 years ago
+1
I am modifying a plugin that reads journal of bulk edit issues, too.
https://github.com/jcppkkk/redmine_hipchat/commit/45d740de41bcaa68f64d5def16a9367e6291ed8b#diff-a7f255c397e668f358fc183f6802c3f3R25
Julián Maestri wrote:
Patch based on redmine v3.4.6
To avoid the problems with stopping the bulk update if something fails on the hook, iterate over the saved issues after saving them.
Updated by Julián Maestri over 7 years ago
Any chance for this to be included in the roadmap? at least as Unplanned?
Updated by Go MAEDA 16 days ago
- File 0001-Add-controller_issues_bulk_edit_after_save-hook.patch 0001-Add-controller_issues_bulk_edit_after_save-hook.patch added
- Target version set to Candidate for next major release
I have attached a patch based on Tobias Böhm's patch in #note-8, with tests added. The change to IssuesController is the same as in his patch.
I believe this hook should be added for consistency with the existing hooks. As the following table shows, bulk edit is the only operation that lacks an after_save hook.
| Operation | before_save | after_save |
|---|---|---|
| New | controller_issues_new_before_save |
controller_issues_new_after_save |
| Edit | controller_issues_edit_before_save |
controller_issues_edit_after_save |
| Bulk edit | controller_issues_bulk_edit_before_save |
(missing) |
I did not adopt the approach in #note-15, which calls the hook after all issues have been saved to avoid interrupting the bulk update, in order to keep the hook consistent with the others. As discussed in #note-10 to #note-12, exception handling in hooks would be better addressed separately.