[#19] can reference all users and groups
This commit is contained in:
parent
94d7865f14
commit
49feaf9d73
|
@ -51,6 +51,10 @@ class Group < Avatar
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fullname
|
||||||
|
return description.present? ? "#{uname} (#{description})" : uname
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def add_owner_to_members
|
def add_owner_to_members
|
||||||
|
|
|
@ -100,7 +100,7 @@ module Modules
|
||||||
REFERENCE_PATTERN = %r{
|
REFERENCE_PATTERN = %r{
|
||||||
(?<prefix>[\W\/])? # Prefix
|
(?<prefix>[\W\/])? # Prefix
|
||||||
( # Reference
|
( # Reference
|
||||||
@(?<user>[a-zA-Z][a-zA-Z0-9_\-\.]*) # User uname
|
@(?<user>[a-zA-Z][a-zA-Z0-9_\-\.]*) # User/Group uname
|
||||||
|(?<issue>(?:[a-zA-Z0-9\-_]*\/)?(?:[a-zA-Z0-9\-_]*)?\#[0-9]+) # Issue ID
|
|(?<issue>(?:[a-zA-Z0-9\-_]*\/)?(?:[a-zA-Z0-9\-_]*)?\#[0-9]+) # Issue ID
|
||||||
|(?<commit>[\h]{6,40}) # Commit ID
|
|(?<commit>[\h]{6,40}) # Commit ID
|
||||||
)
|
)
|
||||||
|
@ -161,9 +161,9 @@ module Modules
|
||||||
end
|
end
|
||||||
|
|
||||||
def reference_user(identifier)
|
def reference_user(identifier)
|
||||||
member = @project.all_members.select {|u| u.uname == identifier}
|
member = User.where(uname: identifier).first || Group.where(uname: identifier).first
|
||||||
if member[0]
|
if member
|
||||||
link_to("@#{identifier}", user_path(identifier), html_options.merge(title: member[0].fullname, class: "gfm gfm-team_member #{html_options[:class]}"))
|
link_to("@#{identifier}", "/#{identifier}", html_options.merge(title: member.fullname, class: "gfm gfm-member #{html_options[:class]}"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue