Project

General

Profile

Actions

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.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
2010-06-20
Due date:
% Done:

0%

Estimated time:

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

controller_issues_bulk_edit_after_save.patch (1.19 KB) controller_issues_bulk_edit_after_save.patch Patch adding controller_issues_bulk_edit_after_save and :journal (Redmine 0.9.4) Andriy Lesyuk, 2010-06-20 15:26
controller_issues_bulk_edit_after_save.patch (899 Bytes) controller_issues_bulk_edit_after_save.patch More recent patch working with later code Andriy Lesyuk, 2010-08-24 16:47

Related issues

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

Actions
Actions #1

Updated by Holger Just over 14 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.

Actions #2

Updated by Mischa The Evil over 14 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... ;/

Actions #3

Updated by Andriy Lesyuk over 14 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...

Actions #4

Updated by Holger Just over 14 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.

Actions #5

Updated by Andriy Lesyuk over 14 years ago

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

Actions #6

Updated by Holger Just over 14 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.

Actions #7

Updated by Andriy Lesyuk about 14 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

Actions #8

Updated by Eric Davis almost 14 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

Actions #9

Updated by Andriy Lesyuk over 13 years ago

  • Status changed from New to Resolved

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

Actions #10

Updated by Jan Niggemann (redmine.org team member) almost 12 years ago

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

Actions #11

Updated by Jan Niggemann (redmine.org team member) almost 12 years ago

  • Status changed from Resolved to Closed
Actions #12

Updated by Go MAEDA about 6 years ago

  • Is duplicate of Patch #8757: Add hook for bulk edit post-save state added
Actions

Also available in: Atom PDF