Patch #5714
closed
Request for controller_issues_bulk_edit_after_save hook
Added by Andriy Lesyuk over 14 years ago.
Updated almost 12 years ago.
Description
I suggest adding controller_issues_bulk_edit_after_save hook to Issues controller.
Issue controller has hooks:
- controller_issues_new_before_save
- controller_issues_new_after_save
- controller_issues_edit_before_save
- controller_issues_edit_after_save
- controller_issues_bulk_edit_before_save
That is pairs - ..._before_save/..._after_save. All but the controller_issues_bulk_edit_before_save hook.
I need this hook to notify external tool about adding journal to database. So I also suggest adding '':journal => journal'' to:
- controller_issues_bulk_edit_before_save
- controller_issues_bulk_edit_before_save
Thanks
Files
You could register your code to the default active record before_save
hook of the Journal and/or the Issue model. Also, the current journal is available as the @current_journal
instance variable in the controller.
- Category changed from Issues to Plugin API
- Assignee set to Eric Davis
Eric, hook-requests are to be assigned to you as I remember correctly... ;/
Holger Just wrote:
You could register your code to the default active record before_save
hook of the Journal and/or the Issue model. Also, the current journal is available as the @current_journal
instance variable in the controller.
The before_save
hook is called before the Journal is created. That is if an external tool tries to get such Journal by ID it failes to find it...
Then hook yourself into Journal.after_save
. You can filter for issue journals there. Be aware that the whole journal stuff is currently undergoing changes. So don't trust that you will only have journal entries of issues.
Also, the current journal of an issue can be retrieved using @issue.current_journal
.
Journal.after_save
is also called before the journal is actually added...
Well, no.
Journal#save
is currently only called in Issue#create_journal
, which is called as an after_save hook of Issue
. Thus, once the journal is saved, its respective issue was already saved to the DB. Methods registered to the Journal#after_save
hook are only called once the Journal object was correctly saved to the database.
Depending on the transaction isolation level of your database, you will not see the journal entry from another transaction before the first one is actually committed though. This will only happen after the request was successfully completed.
Anyway my patch works... Without it I had troubles...
Redmine's code contains other hooks in pairs - [before|after]_save. So I believe it is logical to add controller_issues_bulk_edit_before_save. And it is very easy to add this hook - just by applying this path. Can I expect this to be done? Otherwise I will need to patch Redmine's code on every upgrade. Please...
Thanks
- Assignee deleted (
Eric Davis)
I am stepping down from working on Redmine. If someone else is interesting in working on this issue, feel free to reassign it to them.
Eric Davis
- Status changed from New to Resolved
I don't need applying this patch any more... So do whatever you want with it.
Closing this, status is resolved since 400 days and more (issue was last updated more than 400 days ago)...
- Status changed from Resolved to Closed
- Is duplicate of Patch #8757: Add hook for bulk edit post-save state added
Also available in: Atom
PDF