summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GITLAB_PAGES_VERSION2
-rw-r--r--app/controllers/projects/tags_controller.rb5
-rw-r--r--app/helpers/button_helper.rb2
-rw-r--r--app/views/projects/tags/_tag.atom.builder19
-rw-r--r--app/views/projects/tags/index.atom.builder7
-rw-r--r--app/views/projects/tags/index.html.haml4
-rw-r--r--changelogs/unreleased/fix-download-dropdown-link.yml5
-rw-r--r--changelogs/unreleased/fj-2635-enable-rss-for-tags.yml5
-rw-r--r--changelogs/unreleased/sh-bump-gitlab-pages-v1-1-0.yml5
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/features/projects/tags/user_views_tags_spec.rb69
-rw-r--r--spec/helpers/button_helper_spec.rb14
12 files changed, 137 insertions, 3 deletions
diff --git a/GITLAB_PAGES_VERSION b/GITLAB_PAGES_VERSION
index 3eefcb9dd5b..9084fa2f716 100644
--- a/GITLAB_PAGES_VERSION
+++ b/GITLAB_PAGES_VERSION
@@ -1 +1 @@
-1.0.0
+1.1.0
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb
index b17753222a0..7f2c3ca38ad 100644
--- a/app/controllers/projects/tags_controller.rb
+++ b/app/controllers/projects/tags_controller.rb
@@ -17,6 +17,11 @@ class Projects::TagsController < Projects::ApplicationController
tag_names = @tags.map(&:name)
@tags_pipelines = @project.pipelines.latest_successful_for_refs(tag_names)
@releases = project.releases.where(tag: tag_names)
+
+ respond_to do |format|
+ format.html
+ format.atom { render layout: 'xml.atom' }
+ end
end
def show
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb
index 7adc882bc47..26e3850a540 100644
--- a/app/helpers/button_helper.rb
+++ b/app/helpers/button_helper.rb
@@ -67,7 +67,7 @@ module ButtonHelper
def http_dropdown_description(protocol)
if current_user.try(:require_password_creation_for_git?)
_("Set a password on your account to pull or push via %{protocol}.") % { protocol: protocol }
- else
+ elsif current_user.try(:require_personal_access_token_creation_for_git_auth?)
_("Create a personal access token on your account to pull or push via %{protocol}.") % { protocol: protocol }
end
end
diff --git a/app/views/projects/tags/_tag.atom.builder b/app/views/projects/tags/_tag.atom.builder
new file mode 100644
index 00000000000..60d4b21b9d1
--- /dev/null
+++ b/app/views/projects/tags/_tag.atom.builder
@@ -0,0 +1,19 @@
+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
diff --git a/app/views/projects/tags/index.atom.builder b/app/views/projects/tags/index.atom.builder
new file mode 100644
index 00000000000..b9b58b7beaa
--- /dev/null
+++ b/app/views/projects/tags/index.atom.builder
@@ -0,0 +1,7 @@
+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?
diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml
index dab95ba09f2..20b4705521c 100644
--- a/app/views/projects/tags/index.html.haml
+++ b/app/views/projects/tags/index.html.haml
@@ -1,6 +1,8 @@
- @no_container = true
- @sort ||= sort_value_recently_updated
- 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 }
.top-area.adjust
@@ -25,6 +27,8 @@
- if can?(current_user, :push_code, @project)
= link_to new_project_tag_path(@project), class: 'btn btn-create new-tag-btn' do
= 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'
diff --git a/changelogs/unreleased/fix-download-dropdown-link.yml b/changelogs/unreleased/fix-download-dropdown-link.yml
new file mode 100644
index 00000000000..998476b07bd
--- /dev/null
+++ b/changelogs/unreleased/fix-download-dropdown-link.yml
@@ -0,0 +1,5 @@
+---
+title: Hide PAT creation advice for HTTP clone if PAT exists
+merge_request: 18208
+author: George Thomas @thegeorgeous
+type: fixed
diff --git a/changelogs/unreleased/fj-2635-enable-rss-for-tags.yml b/changelogs/unreleased/fj-2635-enable-rss-for-tags.yml
new file mode 100644
index 00000000000..ee197572385
--- /dev/null
+++ b/changelogs/unreleased/fj-2635-enable-rss-for-tags.yml
@@ -0,0 +1,5 @@
+---
+title: Added atom feed for tags
+merge_request: 21428
+author:
+type: added
diff --git a/changelogs/unreleased/sh-bump-gitlab-pages-v1-1-0.yml b/changelogs/unreleased/sh-bump-gitlab-pages-v1-1-0.yml
new file mode 100644
index 00000000000..bc5b6b36ac5
--- /dev/null
+++ b/changelogs/unreleased/sh-bump-gitlab-pages-v1-1-0.yml
@@ -0,0 +1,5 @@
+---
+title: Bump GitLab Pages to v1.1.0
+merge_request: 21419
+author:
+type: fixed
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 2eb69695406..fad653908ab 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -5411,6 +5411,9 @@ msgstr[1] ""
msgid "Tags"
msgstr ""
+msgid "Tags feed"
+msgstr ""
+
msgid "Tags:"
msgstr ""
diff --git a/spec/features/projects/tags/user_views_tags_spec.rb b/spec/features/projects/tags/user_views_tags_spec.rb
new file mode 100644
index 00000000000..f344b682715
--- /dev/null
+++ b/spec/features/projects/tags/user_views_tags_spec.rb
@@ -0,0 +1,69 @@
+# 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
diff --git a/spec/helpers/button_helper_spec.rb b/spec/helpers/button_helper_spec.rb
index 0c0a0003231..eebae1d7290 100644
--- a/spec/helpers/button_helper_spec.rb
+++ b/spec/helpers/button_helper_spec.rb
@@ -40,12 +40,24 @@ describe ButtonHelper do
end
context 'when user has no personal access tokens' do
- it 'has a personal access token text on the dropdown description ' do
+ it 'has a personal access token text on the dropdown description' do
description = element.search('.dropdown-menu-inner-content').first
expect(description.inner_text).to eq 'Create a personal access token on your account to pull or push via HTTP.'
end
end
+
+ context 'when user has personal access tokens' do
+ before do
+ create(:personal_access_token, user: user)
+ end
+
+ it 'does not have a personal access token text on the dropdown description' do
+ description = element.search('.dropdown-menu-inner-content').first
+
+ expect(description).to be_nil
+ end
+ end
end
context 'when user is ldap user' do