Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3e543192
Commit
3e543192
authored
Jan 19, 2021
by
Himanshu Kapoor
Committed by
Kushal Pandya
Jan 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wiki: Add author avatar and link
Add author avatar and link to a wiki's last modified info
parent
9a8b1dfd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
3 deletions
+41
-3
app/views/shared/wikis/show.html.haml
app/views/shared/wikis/show.html.haml
+1
-1
changelogs/unreleased/288325-wiki-avatar.yml
changelogs/unreleased/288325-wiki-avatar.yml
+5
-0
lib/gitlab/git/wiki_page_version.rb
lib/gitlab/git/wiki_page_version.rb
+6
-1
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/lib/gitlab/git/wiki_page_version_spec.rb
spec/lib/gitlab/git/wiki_page_version_spec.rb
+28
-0
No files found.
app/views/shared/wikis/show.html.haml
View file @
3e543192
...
...
@@ -7,7 +7,7 @@
.nav-text.flex-fill
%span
.wiki-last-edit-by
-
if
@page
.
last_version
=
(
_
(
"Last edited by %{name}"
)
%
{
name:
"<strong>
#{
@page
.
last_version
.
author_name
}
</strong>"
}).
html_safe
=
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
}
=
time_ago_with_tooltip
(
@page
.
last_version
.
authored_date
)
.nav-controls.pb-md-3.pb-lg-0
...
...
changelogs/unreleased/288325-wiki-avatar.yml
0 → 100644
View file @
3e543192
---
title
:
'
Wiki:
Add
author
avatar
and
link'
merge_request
:
51273
author
:
type
:
changed
lib/gitlab/git/wiki_page_version.rb
View file @
3e543192
...
...
@@ -10,7 +10,12 @@ module Gitlab
@format
=
format
end
delegate
:message
,
:sha
,
:id
,
:author_name
,
:authored_date
,
to: :commit
delegate
:message
,
:sha
,
:id
,
:author_name
,
:author_email
,
:authored_date
,
to: :commit
def
author_url
user
=
::
User
.
find_by_any_email
(
author_email
)
user
.
nil?
?
"mailto:
#{
author_email
}
"
:
Gitlab
::
UrlBuilder
.
build
(
user
)
end
end
end
end
locale/gitlab.pot
View file @
3e543192
...
...
@@ -16498,7 +16498,7 @@ msgstr ""
msgid "Last edited %{date}"
msgstr ""
msgid "Last edited by %{
name
}"
msgid "Last edited by %{
link_start}%{avatar} %{name}%{link_end
}"
msgstr ""
msgid "Last item before this page loaded in your browser:"
...
...
spec/lib/gitlab/git/wiki_page_version_spec.rb
0 → 100644
View file @
3e543192
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Git
::
WikiPageVersion
do
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
create
(
:user
,
username:
'someone'
)
}
describe
'#author_url'
do
subject
(
:author_url
)
{
described_class
.
new
(
commit
,
nil
).
author_url
}
context
'user exists in gitlab'
do
let
(
:commit
)
{
create
(
:commit
,
project:
project
,
author:
user
)
}
it
'returns the profile link of the user'
do
expect
(
author_url
).
to
eq
(
'http://localhost/someone'
)
end
end
context
'user does not exist in gitlab'
do
let
(
:commit
)
{
create
(
:commit
,
project:
project
,
author_email:
"someone@somewebsite.com"
)
}
it
'returns a mailto: url'
do
expect
(
author_url
).
to
eq
(
'mailto:someone@somewebsite.com'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment