Map repository authors to Redmine login names
This patch maps the repository authors to the Redmine user database and displays the users name in the format which is set in the Redmine settings. As this patch just adds a new method (self.author_to_name) to the user model and just slightly modifies some views, it can be safely applied for testing and reverted when it is not needed anymore. It can be a solution of the feature request #1383. I just tested it with Subversion, but it should work with every SCM in which the author is in the same format as the login names of the Redmine users.
Unfortunately the patch is not very effectively, because everytime an author is used in a view, it is checked against the Redmine user table. And because of this while blaming a big file, a lot of database querys are performed (one for each line). I tried to use a hash lookup variable, which stores the pair (author, name) in order to query each author only once per page request. But a longer use of the lookup variable is not possible, because the lookup table could store an old value when the user's name or the Redmine name format setting is changed. I used a class variable (@variable) which is stored over the whole Redmine uptime and hence it is not useable. Can somebody explain me, how to create and use a class variable which is just active while one page request? Then I will improve the patch and upload it here.
This is the first time I wrote Ruby (and Ruby on Rails) code. I hope the patch has a good code quality and please give me feedback in order to improve the patch. Maybe I forgot to modify some views to use the new function. Please report this. Then I can add this view to the patch. Thanks a lot. And Jean-Philippe, thanks for this incredible piece of software.
#1 Updated by Jean-Philippe Lang almost 9 years ago
- Status changed from New to Closed