summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-03 22:32:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-03 22:32:18 +0000
commitb7a47b151165e1313c9c526e1af8032601f7afd7 (patch)
tree8966651a39b27595341c180ef14d65f147c2b527 /app
parentfa206403d6b6a501488b70173ba873189776edc6 (diff)
downloadgitlab-ce-b7a47b151165e1313c9c526e1af8032601f7afd7.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-9-stable-ee
Diffstat (limited to 'app')
-rw-r--r--app/helpers/wiki_page_version_helper.rb20
-rw-r--r--app/views/shared/wikis/show.html.haml2
2 files changed, 21 insertions, 1 deletions
diff --git a/app/helpers/wiki_page_version_helper.rb b/app/helpers/wiki_page_version_helper.rb
new file mode 100644
index 00000000000..ae20717ad99
--- /dev/null
+++ b/app/helpers/wiki_page_version_helper.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+module WikiPageVersionHelper
+ def wiki_page_version_author_url(wiki_page_version)
+ user = wiki_page_version.author
+ user.nil? ? "mailto:#{wiki_page_version.author_email}" : Gitlab::UrlBuilder.build(user)
+ end
+
+ def wiki_page_version_author_avatar(wiki_page_version)
+ image_tag(avatar_icon_for_email(wiki_page_version.author_email, 24), class: "avatar s24 float-none gl-mr-0!")
+ end
+
+ def wiki_page_version_author_header(wiki_page_version)
+ avatar = wiki_page_version_author_avatar(wiki_page_version)
+ name = "<strong>".html_safe + wiki_page_version.author_name + "</strong>".html_safe
+ link_start = "<a href='".html_safe + wiki_page_version_author_url(wiki_page_version) + "'>".html_safe
+
+ html_escape(_("Last edited by %{link_start}%{avatar} %{name}%{link_end}")) % { avatar: avatar, name: name, link_start: link_start, link_end: '</a>'.html_safe }
+ end
+end
diff --git a/app/views/shared/wikis/show.html.haml b/app/views/shared/wikis/show.html.haml
index 6d14ba8fe7b..8a5cd94bde9 100644
--- a/app/views/shared/wikis/show.html.haml
+++ b/app/views/shared/wikis/show.html.haml
@@ -7,7 +7,7 @@
.nav-text.flex-fill
%span.wiki-last-edit-by
- if @page.last_version
- = html_escape(_("Last edited by %{link_start}%{avatar} %{name}%{link_end}")) % { avatar: image_tag(avatar_icon_for_email(@page.last_version.author_email, 24), class: "avatar s24 float-none gl-mr-0!"), name: "<strong>#{@page.last_version.author_name}</strong>".html_safe, link_start: "<a href='#{@page.last_version.author_url}'>".html_safe, link_end: '</a>'.html_safe }
+ = wiki_page_version_author_header(@page.last_version)
= time_ago_with_tooltip(@page.last_version.authored_date)
.nav-controls.pb-md-3.pb-lg-0