Patch #5714

Request for controller_issues_bulk_edit_after_save hook

Added by Andriy Lesyuk over 11 years ago. Updated almost 9 years ago.

Status:ClosedStart date:2010-06-20
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-

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

controller_issues_bulk_edit_after_save.patch Magnifier - Patch adding controller_issues_bulk_edit_after_save and :journal (Redmine 0.9.4) (1.19 KB) Andriy Lesyuk, 2010-06-20 15:26

controller_issues_bulk_edit_after_save.patch Magnifier - More recent patch working with later code (899 Bytes) Andriy Lesyuk, 2010-08-24 16:47


Related issues

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

History

#1 Updated by Holger Just over 11 years ago

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.

#2 Updated by Mischa The Evil over 11 years ago

  • 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... ;/

#3 Updated by Andriy Lesyuk about 11 years ago

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...

#4 Updated by Holger Just about 11 years ago

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.

#5 Updated by Andriy Lesyuk about 11 years ago

Journal.after_save is also called before the journal is actually added...

#6 Updated by Holger Just about 11 years ago

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.

#7 Updated by Andriy Lesyuk about 11 years ago

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

#8 Updated by Eric Davis almost 11 years ago

  • 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

#9 Updated by Andriy Lesyuk over 10 years ago

  • Status changed from New to Resolved

I don't need applying this patch any more... So do whatever you want with it.

#10 Updated by Jan Niggemann (redmine.org team member) almost 9 years ago

Closing this, status is resolved since 400 days and more (issue was last updated more than 400 days ago)...

#11 Updated by Jan Niggemann (redmine.org team member) almost 9 years ago

  • Status changed from Resolved to Closed

#12 Updated by Go MAEDA almost 3 years ago

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

Also available in: Atom PDF