diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-02-28 12:50:57 -0800 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-02-28 12:50:57 -0800 |
commit | a2670ee06b05c1abf31c11972319c6a59ef6940a (patch) | |
tree | 618c159bac47314bd0861ac79538ae44a365a869 /app | |
parent | 05c8ec6cb85a3943b53cbd5757e7baea300dac68 (diff) | |
download | gitlab-ce-a2670ee06b05c1abf31c11972319c6a59ef6940a.tar.gz |
Show public RSS feeds to anonymous users
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/rss_helper.rb | 5 | ||||
-rw-r--r-- | app/views/dashboard/_activities.html.haml | 7 | ||||
-rw-r--r-- | app/views/dashboard/activity.html.haml | 3 | ||||
-rw-r--r-- | app/views/dashboard/issues.html.haml | 12 | ||||
-rw-r--r-- | app/views/dashboard/projects/index.atom.builder | 2 | ||||
-rw-r--r-- | app/views/dashboard/projects/index.html.haml | 3 | ||||
-rw-r--r-- | app/views/groups/_activities.html.haml | 7 | ||||
-rw-r--r-- | app/views/groups/activity.html.haml | 3 | ||||
-rw-r--r-- | app/views/groups/issues.html.haml | 16 | ||||
-rw-r--r-- | app/views/groups/show.atom.builder | 2 | ||||
-rw-r--r-- | app/views/groups/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/_activity.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/commits/show.atom.builder | 2 | ||||
-rw-r--r-- | app/views/projects/commits/show.html.haml | 10 | ||||
-rw-r--r-- | app/views/projects/issues/index.html.haml | 8 | ||||
-rw-r--r-- | app/views/projects/show.atom.builder | 2 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/tree/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/users/show.html.haml | 13 |
19 files changed, 49 insertions, 62 deletions
diff --git a/app/helpers/rss_helper.rb b/app/helpers/rss_helper.rb new file mode 100644 index 00000000000..ea5d2932ef4 --- /dev/null +++ b/app/helpers/rss_helper.rb @@ -0,0 +1,5 @@ +module RssHelper + def rss_url_options + { format: :atom, private_token: current_user.try(:private_token) } + end +end diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml index 0dbb0ca6958..89d991abe54 100644 --- a/app/views/dashboard/_activities.html.haml +++ b/app/views/dashboard/_activities.html.haml @@ -2,10 +2,9 @@ = render "events/event_last_push", event: @last_push .nav-block - - if current_user - .controls - = link_to dashboard_projects_path(:atom, { private_token: current_user.private_token }), class: 'btn rss-btn has-tooltip', title: 'Subscribe' do - %i.fa.fa-rss + .controls + = link_to dashboard_projects_path(rss_url_options), class: 'btn rss-btn has-tooltip', title: 'Subscribe' do + %i.fa.fa-rss = render 'shared/event_filter' .content_list diff --git a/app/views/dashboard/activity.html.haml b/app/views/dashboard/activity.html.haml index aa57df14c23..190ad4b40a5 100644 --- a/app/views/dashboard/activity.html.haml +++ b/app/views/dashboard/activity.html.haml @@ -1,6 +1,5 @@ = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity") + = auto_discovery_link_tag(:atom, dashboard_projects_url(rss_url_options), title: "All activity") - page_title "Activity" - header_title "Activity", activity_dashboard_path diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 653052f7c54..9a4e423f896 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -1,17 +1,15 @@ - page_title "Issues" - header_title "Issues", issues_dashboard_path(assignee_id: current_user.id) = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, url_for(params.merge(format: :atom, private_token: current_user.private_token)), title: "#{current_user.name} issues") + = auto_discovery_link_tag(:atom, params.merge(rss_url_options), title: "#{current_user.name} issues") .top-area = render 'shared/issuable/nav', type: :issues .nav-controls - - if current_user - = link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn' do - = icon('rss') - %span.icon-label - Subscribe + = link_to params.merge(rss_url_options), class: 'btn' do + = icon('rss') + %span.icon-label + Subscribe = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" = render 'shared/issuable/filter', type: :issues diff --git a/app/views/dashboard/projects/index.atom.builder b/app/views/dashboard/projects/index.atom.builder index fb5be63b472..13f7a8ddcec 100644 --- a/app/views/dashboard/projects/index.atom.builder +++ b/app/views/dashboard/projects/index.atom.builder @@ -1,7 +1,7 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "Activity" - xml.link href: dashboard_projects_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" + xml.link href: dashboard_projects_url(rss_url_options), rel: "self", type: "application/atom+xml" xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html" xml.id dashboard_projects_url xml.updated @events[0].updated_at.xmlschema if @events[0] diff --git a/app/views/dashboard/projects/index.html.haml b/app/views/dashboard/projects/index.html.haml index b82b933c3ad..f0adbad8412 100644 --- a/app/views/dashboard/projects/index.html.haml +++ b/app/views/dashboard/projects/index.html.haml @@ -1,6 +1,5 @@ = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity") + = auto_discovery_link_tag(:atom, dashboard_projects_url(rss_url_options), title: "All activity") - page_title "Projects" - header_title "Projects", dashboard_projects_path diff --git a/app/views/groups/_activities.html.haml b/app/views/groups/_activities.html.haml index c442cf056c3..d7851c79990 100644 --- a/app/views/groups/_activities.html.haml +++ b/app/views/groups/_activities.html.haml @@ -2,10 +2,9 @@ = render "events/event_last_push", event: @last_push .nav-block - - if current_user - .controls - = link_to group_path(@group, format: :atom, private_token: current_user.private_token), class: 'btn rss-btn has-tooltip' , title: 'Subscribe' do - %i.fa.fa-rss + .controls + = link_to group_path(@group, rss_url_options), class: 'btn rss-btn has-tooltip' , title: 'Subscribe' do + %i.fa.fa-rss = render 'shared/event_filter' .content_list diff --git a/app/views/groups/activity.html.haml b/app/views/groups/activity.html.haml index d7375b23524..3969e56f937 100644 --- a/app/views/groups/activity.html.haml +++ b/app/views/groups/activity.html.haml @@ -1,6 +1,5 @@ = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, group_url(@group, format: :atom, private_token: current_user.private_token), title: "#{@group.name} activity") + = auto_discovery_link_tag(:atom, group_url(@group, rss_url_options), title: "#{@group.name} activity") - page_title "Activity" = render 'groups/head' diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 939bddf3fe9..f4c17dc2d16 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -1,19 +1,17 @@ - page_title "Issues" = render "head_issues" = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, url_for(params.merge(format: :atom, private_token: current_user.private_token)), title: "#{@group.name} issues") + = auto_discovery_link_tag(:atom, params.merge(rss_url_options), title: "#{@group.name} issues") - if group_issues(@group).exists? .top-area = render 'shared/issuable/nav', type: :issues - - if current_user - .nav-controls - = link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn' do - = icon('rss') - %span.icon-label - Subscribe - = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" + .nav-controls + = link_to params.merge(rss_url_options), class: 'btn' do + = icon('rss') + %span.icon-label + Subscribe + = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" = render 'shared/issuable/filter', type: :issues diff --git a/app/views/groups/show.atom.builder b/app/views/groups/show.atom.builder index b68bf444d27..914091dfd15 100644 --- a/app/views/groups/show.atom.builder +++ b/app/views/groups/show.atom.builder @@ -1,7 +1,7 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{@group.name} activity" - xml.link href: group_url(@group, format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" + xml.link href: group_url(@group, rss_url_options), rel: "self", type: "application/atom+xml" xml.link href: group_url(@group), rel: "alternate", type: "text/html" xml.id group_url(@group) xml.updated @events[0].updated_at.xmlschema if @events[0] diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 3d7b469660a..8f0f2708194 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,8 +1,7 @@ - @no_container = true = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, group_url(@group, format: :atom, private_token: current_user.private_token), title: "#{@group.name} activity") + = auto_discovery_link_tag(:atom, group_url(@group, rss_url_options), title: "#{@group.name} activity") = render 'groups/head' = render 'groups/home_panel' diff --git a/app/views/projects/_activity.html.haml b/app/views/projects/_activity.html.haml index 4268337fd6d..aa0cb3e1a50 100644 --- a/app/views/projects/_activity.html.haml +++ b/app/views/projects/_activity.html.haml @@ -2,10 +2,9 @@ %div{ class: container_class } .nav-block.activity-filter-block - - if current_user - .controls - = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Subscribe", class: 'btn rss-btn has-tooltip' do - = icon('rss') + .controls + = link_to namespace_project_path(@project.namespace, @project, rss_url_options), title: "Subscribe", class: 'btn rss-btn has-tooltip' do + = icon('rss') = render 'shared/event_filter' diff --git a/app/views/projects/commits/show.atom.builder b/app/views/projects/commits/show.atom.builder index 30bb7412073..2f0b6e39800 100644 --- a/app/views/projects/commits/show.atom.builder +++ b/app/views/projects/commits/show.atom.builder @@ -1,7 +1,7 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{@project.name}:#{@ref} commits" - xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" + xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), rel: "self", type: "application/atom+xml" xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref), rel: "alternate", type: "text/html" xml.id namespace_project_commits_url(@project.namespace, @project, @ref) xml.updated @commits.first.committed_date.xmlschema if @commits.any? diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml index 08cb8a04413..38dbf2ac10b 100644 --- a/app/views/projects/commits/show.html.haml +++ b/app/views/projects/commits/show.html.haml @@ -2,8 +2,7 @@ - page_title "Commits", @ref = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits") + = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits") = content_for :sub_nav do = render "head" @@ -27,10 +26,9 @@ .control = form_tag(namespace_project_commits_path(@project.namespace, @project, @id), method: :get, class: 'commits-search-form') do = search_field_tag :search, params[:search], { placeholder: 'Filter by commit message', id: 'commits-search', class: 'form-control search-text-input input-short', spellcheck: false } - - if current_user && current_user.private_token - .control - = link_to namespace_project_commits_path(@project.namespace, @project, @ref, { format: :atom, private_token: current_user.private_token }), title: "Commits Feed", class: 'btn' do - = icon("rss") + .control + = link_to namespace_project_commits_path(@project.namespace, @project, @ref, rss_url_options), title: "Commits Feed", class: 'btn' do + = icon("rss") %div{ id: dom_id(@project) } %ol#commits-list.list-unstyled.content_list diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 8ea1a3a45e1..7b7d7b1e00e 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -10,17 +10,15 @@ = page_specific_javascript_bundle_tag('filtered_search') = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, url_for(params.merge(format: :atom, private_token: current_user.private_token)), title: "#{@project.name} issues") + = auto_discovery_link_tag(:atom, params.merge(rss_url_options), title: "#{@project.name} issues") - if project_issues(@project).exists? %div{ class: (container_class) } .top-area = render 'shared/issuable/nav', type: :issues .nav-controls - - if current_user - = link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn append-right-10 has-tooltip', title: 'Subscribe' do - = icon('rss') + = link_to params.merge(rss_url_options), class: 'btn append-right-10 has-tooltip', title: 'Subscribe' do + = icon('rss') - if can? current_user, :create_issue, @project = link_to new_namespace_project_issue_path(@project.namespace, @project, diff --git a/app/views/projects/show.atom.builder b/app/views/projects/show.atom.builder index 11310d5e1e1..5c7f2e315f0 100644 --- a/app/views/projects/show.atom.builder +++ b/app/views/projects/show.atom.builder @@ -1,7 +1,7 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{@project.name} activity" - xml.link href: namespace_project_url(@project.namespace, @project, format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" + xml.link href: namespace_project_url(@project.namespace, @project, rss_url_options), rel: "self", type: "application/atom+xml" xml.link href: namespace_project_url(@project.namespace, @project), rel: "alternate", type: "text/html" xml.id namespace_project_url(@project.namespace, @project) xml.updated @events[0].updated_at.xmlschema if @events[0] diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 80d4081dd7b..e3d8daf5066 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,8 +1,7 @@ - @no_container = true = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "#{@project.name} activity") + = auto_discovery_link_tag(:atom, namespace_project_path(@project.namespace, @project, rss_url_options), title: "#{@project.name} activity") = content_for :flash_message do - if current_user && can?(current_user, :download_code, @project) diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 9864be3562a..a2a26039220 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -2,8 +2,7 @@ - page_title @path.presence || "Files", @ref = content_for :meta_tags do - - if current_user - = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits") + = auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits") = render "projects/commits/head" = render 'projects/last_push' diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index c130f3d9e17..af091f9ab88 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -24,13 +24,12 @@ = link_to new_abuse_report_path(user_id: @user.id, ref_url: request.referrer), class: 'btn btn-gray', title: 'Report abuse', data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } do = icon('exclamation-circle') - - if current_user - = link_to user_path(@user, :atom, { private_token: current_user.private_token }), class: 'btn btn-gray' do - = icon('rss') - - if current_user.admin? - = link_to [:admin, @user], class: 'btn btn-gray', title: 'View user in admin area', - data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do - = icon('users') + = link_to user_path(@user, rss_url_options), class: 'btn btn-gray' do + = icon('rss') + - if current_user && current_user.admin? + = link_to [:admin, @user], class: 'btn btn-gray', title: 'View user in admin area', + data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do + = icon('users') .profile-header .avatar-holder |