Project

General

Profile

Patch #6690 » userlink-1.4.4.patch

Vincent Metalhead, 2012-09-16 07:48

View differences:

app/helpers/application_helper.rb 2012-09-16 07:43:35.019105400 +0200
668 668
  #     identifier:version:1.0.0
669 669
  #     identifier:source:some/file
670 670
  def parse_redmine_links(text, project, obj, attr, only_path, options)
671
    text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
671
    text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export|user)?(((#)|((([a-z0-9\-]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
672 672
      leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17
673 673
      link = nil
674 674
      if project_identifier
......
728 728
            if p = Project.visible.find_by_id(oid)
729 729
              link = link_to_project(p, {:only_path => only_path}, :class => 'project')
730 730
            end
731
          when 'user'
732
            if u = User.find_by_id(oid)
733
              link = link_to_user(u)
734
           end
731 735
          end
732 736
        elsif sep == ':'
733 737
          # removes the double quotes if any
......
792 796
            if p = Project.visible.find(:first, :conditions => ["identifier = :s OR LOWER(name) = :s", {:s => name.downcase}])
793 797
              link = link_to_project(p, {:only_path => only_path}, :class => 'project')
794 798
            end
799
          when 'user'
800
            if u = User.find_by_login(name)
801
              link = link_to_user(u)
802
            end
795 803
          end
796 804
        end
797 805
      end
(3-3/3)