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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0df18ca9
Commit
0df18ca9
authored
Sep 03, 2018
by
Francisco Javier López
Committed by
Sean McGivern
Sep 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added atom feed for tags
parent
990278be
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
0 deletions
+112
-0
app/controllers/projects/tags_controller.rb
app/controllers/projects/tags_controller.rb
+5
-0
app/views/projects/tags/_tag.atom.builder
app/views/projects/tags/_tag.atom.builder
+19
-0
app/views/projects/tags/index.atom.builder
app/views/projects/tags/index.atom.builder
+7
-0
app/views/projects/tags/index.html.haml
app/views/projects/tags/index.html.haml
+4
-0
changelogs/unreleased/fj-2635-enable-rss-for-tags.yml
changelogs/unreleased/fj-2635-enable-rss-for-tags.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/features/projects/tags/user_views_tags_spec.rb
spec/features/projects/tags/user_views_tags_spec.rb
+69
-0
No files found.
app/controllers/projects/tags_controller.rb
View file @
0df18ca9
...
@@ -17,6 +17,11 @@ class Projects::TagsController < Projects::ApplicationController
...
@@ -17,6 +17,11 @@ class Projects::TagsController < Projects::ApplicationController
tag_names
=
@tags
.
map
(
&
:name
)
tag_names
=
@tags
.
map
(
&
:name
)
@tags_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
tag_names
)
@tags_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
tag_names
)
@releases
=
project
.
releases
.
where
(
tag:
tag_names
)
@releases
=
project
.
releases
.
where
(
tag:
tag_names
)
respond_to
do
|
format
|
format
.
html
format
.
atom
{
render
layout:
'xml.atom'
}
end
end
end
def
show
def
show
...
...
app/views/projects/tags/_tag.atom.builder
0 → 100644
View file @
0df18ca9
commit = @repository.commit(tag.dereferenced_target)
release = @releases.find { |r| r.tag == tag.name }
tag_url = project_tag_url(@project, tag.name)
if commit
xml.entry do
xml.id tag_url
xml.link href: tag_url
xml.title truncate(tag.name, length: 80)
xml.summary strip_gpg_signature(tag.message)
xml.content markdown_field(release, :description), type: 'html'
xml.updated release.updated_at.xmlschema if release
xml.media :thumbnail, width: '40', height: '40', url: image_url(avatar_icon_for_email(commit.author_email))
xml.author do |author|
xml.name commit.author_name
xml.email commit.author_email
end
end
end
app/views/projects/tags/index.atom.builder
0 → 100644
View file @
0df18ca9
xml.title "#{@project.name} tags"
xml.link href: project_tags_url(@project, @ref, rss_url_options), rel: 'self', type: 'application/atom+xml'
xml.link href: project_tags_url(@project, @ref), rel: 'alternate', type: 'text/html'
xml.id project_tags_url(@project, @ref)
xml.updated @releases.first.updated_at.xmlschema if @releases.any?
xml << render(partial: 'tag', collection: @tags) if @tags.any?
app/views/projects/tags/index.html.haml
View file @
0df18ca9
-
@no_container
=
true
-
@no_container
=
true
-
@sort
||=
sort_value_recently_updated
-
@sort
||=
sort_value_recently_updated
-
page_title
s_
(
'TagsPage|Tags'
)
-
page_title
s_
(
'TagsPage|Tags'
)
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
project_tags_url
(
@project
,
rss_url_options
),
title:
"
#{
@project
.
name
}
tags"
)
.flex-list
{
class:
container_class
}
.flex-list
{
class:
container_class
}
.top-area.adjust
.top-area.adjust
...
@@ -25,6 +27,8 @@
...
@@ -25,6 +27,8 @@
-
if
can?
(
current_user
,
:push_code
,
@project
)
-
if
can?
(
current_user
,
:push_code
,
@project
)
=
link_to
new_project_tag_path
(
@project
),
class:
'btn btn-create new-tag-btn'
do
=
link_to
new_project_tag_path
(
@project
),
class:
'btn btn-create new-tag-btn'
do
=
s_
(
'TagsPage|New tag'
)
=
s_
(
'TagsPage|New tag'
)
=
link_to
project_tags_path
(
@project
,
rss_url_options
),
title:
_
(
"Tags feed"
),
class:
'btn rss-btn has-tooltip'
do
=
icon
(
"rss"
)
=
render_if_exists
'projects/commits/mirror_status'
=
render_if_exists
'projects/commits/mirror_status'
...
...
changelogs/unreleased/fj-2635-enable-rss-for-tags.yml
0 → 100644
View file @
0df18ca9
---
title
:
Added atom feed for tags
merge_request
:
21428
author
:
type
:
added
locale/gitlab.pot
View file @
0df18ca9
...
@@ -5411,6 +5411,9 @@ msgstr[1] ""
...
@@ -5411,6 +5411,9 @@ msgstr[1] ""
msgid "Tags"
msgid "Tags"
msgstr ""
msgstr ""
msgid "Tags feed"
msgstr ""
msgid "Tags:"
msgid "Tags:"
msgstr ""
msgstr ""
...
...
spec/features/projects/tags/user_views_tags_spec.rb
0 → 100644
View file @
0df18ca9
# frozen_string_literal: true
require
'spec_helper'
describe
'User views tags'
,
:feature
do
context
'rss'
do
shared_examples
'has access to the tags RSS feed'
do
it
do
visit
project_tags_path
(
project
,
format: :atom
)
expect
(
page
).
to
have_gitlab_http_status
(
200
)
end
end
shared_examples
'does not have access to the tags RSS feed'
do
it
do
visit
project_tags_path
(
project
,
format: :atom
)
expect
(
page
).
to
have_gitlab_http_status
(
401
)
end
end
context
'when project public'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
context
'when user signed in'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
project_tags_path
(
project
)
end
it_behaves_like
"it has an RSS button with current_user's feed token"
it_behaves_like
"an autodiscoverable RSS feed with current_user's feed token"
it_behaves_like
'has access to the tags RSS feed'
end
context
'when user signed out'
do
before
do
visit
project_tags_path
(
project
)
end
it_behaves_like
'it has an RSS button without a feed token'
it_behaves_like
'an autodiscoverable RSS feed without a feed token'
it_behaves_like
'has access to the tags RSS feed'
end
end
context
'when project is not public'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
}
context
'when user signed in'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
end
it_behaves_like
'has access to the tags RSS feed'
end
context
'when user signed out'
do
it_behaves_like
'does not have access to the tags RSS feed'
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