Project

General

Profile

Patch #6690 » redmine-userlink.diff

Ahmad Azhar, 2010-10-18 06:49

View differences:

app/helpers/application_helper.rb (working copy)
591 591
  #  Forum messages:
592 592
  #     message#1218 -> Link to message with id 1218
593 593
  def parse_redmine_links(text, project, obj, attr, only_path, options)
594
    text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m|
594
    text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(attachment|document|version|commit|source|export|message|project|user)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m|
595 595
      leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8
596 596
      link = nil
597 597
      if esc.nil?
......
634 634
            if p = Project.visible.find_by_id(oid)
635 635
              link = link_to_project(p, {:only_path => only_path}, :class => 'project')
636 636
            end
637
          when 'user'
638
            if u = User.find_by_id(oid)
639
              link = link_to_user(u)
640
            end
637 641
          end
638 642
        elsif sep == ':'
639 643
          # removes the double quotes if any
......
676 680
            if p = Project.visible.find(:first, :conditions => ["identifier = :s OR LOWER(name) = :s", {:s => name.downcase}])
677 681
              link = link_to_project(p, {:only_path => only_path}, :class => 'project')
678 682
            end
683
          when 'user'
684
            if u = User.find_by_login(name)
685
              link = link_to_user(u)
686
            end
679 687
          end
680 688
        end
681 689
      end
(1-1/3)