提交 02eca79e 编写于 作者: U uran

Changed activity notes to display first MEANINGFUL line.

上级 a034a466
......@@ -187,13 +187,6 @@ module ApplicationHelper
end
end
def first_line(str)
lines = str.split("\n")
line = lines.first
line += "..." if lines.size > 1
line
end
def broadcast_message
BroadcastMessage.current
end
......
......@@ -136,7 +136,7 @@ module EventsHelper
end
def event_note(text)
text = first_line(text)
text = first_line_in_markdown(text)
text = truncate(text, length: 150)
sanitize(markdown(text), tags: %w(a img b pre p))
end
......
......@@ -51,6 +51,14 @@ module GitlabMarkdownHelper
@markdown.render(text).html_safe
end
def first_line_in_markdown(text)
line = text.split("\n").detect do |i|
i.present? && markdown(i).present?
end
line += '...' unless line.nil?
line
end
def render_wiki_content(wiki_page)
if wiki_page.format == :markdown
markdown(wiki_page.content)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册