Project

General

Profile

Actions

Defect #15044

closed

Patch for giving controller_issues_edit_after_save api hook the correct context

Added by Jordan Hollinger about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Plugin API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The API hooks "controller_issues_edit_before/after_save" are not given the correct context (i.e. the same context that "controller_issues_new_before/after_save" get.)

Expected behavior: "controller_issues_new_after_save" and "controller_issues_edit_after_save" should be given the same context.

Actual behavior: "controller_issues_edit_after_save"'s context lacks a controller, project, request, and hook_caller. Plugins must use crazy work-arounds to gain access to them.

Fix: Issue#save_issue_with_child_records has no particular need to be in the Issue model. Moving it to IssuesController allows for a simple fix with minimal impact.

This is my first Redmine patch, and I'm happy to submit it through github, svn, etc, but I've attached it here for comment.


Files

git.patch (3.25 KB) git.patch Jordan Hollinger, 2013-10-04 23:12
Actions #1

Updated by Jean-Philippe Lang about 11 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.4.0
  • Resolution set to Fixed

You're right about this, patch committed in r12219.

Note that your patch broke a few tests with a undefined local variable or method `project' error, project had to be replaced with @issue.project.

Actions

Also available in: Atom PDF