Handling project identifier change¶
After changing the identifier Redmine seems to work fine but I can’t tell the same about every third-party Redmine/ChiliProject tool/plugin. When authors were writing such tools/plugins they were believing the identifier can’t be changed... So their tools can be not ready for the change as far as the Project Alias plugin, in fact, breaks Redmine’s internal rules. This page is aimed to help the authors of such third-party tools to support the identifier change.
For third-party plugins using the project identifier the Project Alias plugin provides the :controller_project_aliases_rename_after
hook:
call_hook(:controller_project_aliases_rename_after,
{ :project => @alias.project,
:old_identifier => old_identifier,
:new_identifier => new_identifier })
The following additional data are passed to the hook in the :context
hash:
:project
- the project the identifier of which has been changed;:old_identifier
- the previous identifier which has become an alias;:new_identifier
- the new identifier.
To handle the identifier change you need to write:
class YourCustomHook < Redmine::Hook::ViewListener
def controller_project_aliases_rename_after(context = {})
# Old identifier is stored in context[:old_identifier]
# New identifier is stored in context[:new_identifier]
end
end