summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/framework/lists.scss2
-rw-r--r--app/assets/stylesheets/framework/secondary_navigation_elements.scss5
-rw-r--r--app/channels/issues_channel.rb13
-rw-r--r--app/services/issues/update_service.rb4
-rw-r--r--app/services/projects/update_statistics_service.rb35
-rw-r--r--app/views/projects/buttons/_download.html.haml4
-rw-r--r--app/views/projects/buttons/_remove_tag.html.haml4
-rw-r--r--app/views/projects/tags/_tag.html.haml2
-rw-r--r--app/views/projects/tags/index.html.haml4
-rw-r--r--app/views/projects/tags/new.html.haml4
-rw-r--r--app/views/projects/tags/releases/edit.html.haml4
11 files changed, 50 insertions, 31 deletions
diff --git a/app/assets/stylesheets/framework/lists.scss b/app/assets/stylesheets/framework/lists.scss
index df2ba718c72..a3e8b2c245c 100644
--- a/app/assets/stylesheets/framework/lists.scss
+++ b/app/assets/stylesheets/framework/lists.scss
@@ -146,7 +146,7 @@ ul.content-list {
> .btn,
> .btn-group,
> .dropdown.inline {
- margin-right: $gl-padding-top;
+ margin-right: $grid-size;
display: inline-block;
margin-top: 3px;
margin-bottom: 4px;
diff --git a/app/assets/stylesheets/framework/secondary_navigation_elements.scss b/app/assets/stylesheets/framework/secondary_navigation_elements.scss
index 27b7cac2df5..f904ef11f5b 100644
--- a/app/assets/stylesheets/framework/secondary_navigation_elements.scss
+++ b/app/assets/stylesheets/framework/secondary_navigation_elements.scss
@@ -182,6 +182,11 @@
width: 100%;
}
+ /* This resets the width of the control so that the search button doesn't wrap */
+ .gl-search-box-by-click .form-control {
+ width: 1%;
+ }
+
.dropdown-menu-toggle {
margin-bottom: 0;
}
diff --git a/app/channels/issues_channel.rb b/app/channels/issues_channel.rb
deleted file mode 100644
index 5f3909b7716..00000000000
--- a/app/channels/issues_channel.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class IssuesChannel < ApplicationCable::Channel
- def subscribed
- project = Project.find_by_full_path(params[:project_path])
- return reject unless project
-
- issue = project.issues.find_by_iid(params[:iid])
- return reject unless issue && Ability.allowed?(current_user, :read_issue, issue)
-
- stream_for issue
- end
-end
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index 19365374e10..899e03d1570 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -42,10 +42,6 @@ module Issues
).execute(spam_params: spam_params)
end
- def after_update(issue)
- IssuesChannel.broadcast_to(issue, event: 'updated') if Gitlab::ActionCable::Config.in_app? || Feature.enabled?(:broadcast_issue_updates, issue.project)
- end
-
def handle_changes(issue, options)
old_associations = options.fetch(:old_associations, {})
old_labels = old_associations.fetch(:labels, [])
diff --git a/app/services/projects/update_statistics_service.rb b/app/services/projects/update_statistics_service.rb
index a0793cff2df..71f5a8e633d 100644
--- a/app/services/projects/update_statistics_service.rb
+++ b/app/services/projects/update_statistics_service.rb
@@ -2,18 +2,49 @@
module Projects
class UpdateStatisticsService < BaseService
+ include ::Gitlab::Utils::StrongMemoize
+
+ STAT_TO_CACHED_METHOD = {
+ repository_size: :size,
+ commit_count: :commit_count
+ }.freeze
+
def execute
return unless project
Gitlab::AppLogger.info("Updating statistics for project #{project.id}")
- project.statistics.refresh!(only: statistics.map(&:to_sym))
+ expire_repository_caches
+ expire_wiki_caches
+ project.statistics.refresh!(only: statistics)
end
private
+ def expire_repository_caches
+ if statistics.empty?
+ project.repository.expire_statistics_caches
+ elsif method_caches_to_expire.present?
+ project.repository.expire_method_caches(method_caches_to_expire)
+ end
+ end
+
+ def expire_wiki_caches
+ return unless project.wiki_enabled? && statistics.include?(:wiki_size)
+
+ project.wiki.repository.expire_method_caches([:size])
+ end
+
+ def method_caches_to_expire
+ strong_memoize(:method_caches_to_expire) do
+ statistics.map { |stat| STAT_TO_CACHED_METHOD[stat] }.compact
+ end
+ end
+
def statistics
- params[:statistics]
+ strong_memoize(:statistics) do
+ params[:statistics]&.map(&:to_sym)
+ end
end
end
end
diff --git a/app/views/projects/buttons/_download.html.haml b/app/views/projects/buttons/_download.html.haml
index 3071e5ea5f8..2f89a3f62ed 100644
--- a/app/views/projects/buttons/_download.html.haml
+++ b/app/views/projects/buttons/_download.html.haml
@@ -4,9 +4,9 @@
- archive_prefix = "#{project.path}-#{ref.tr('/', '-')}"
.project-action-button.dropdown.inline>
%button.gl-button.btn.btn-default.has-tooltip{ title: s_('DownloadSource|Download'), 'data-toggle' => 'dropdown', 'aria-label' => s_('DownloadSource|Download'), 'data-display' => 'static', data: { qa_selector: 'download_source_code_button' } }
- = sprite_icon('download')
+ = sprite_icon('download', css_class: 'gl-icon')
%span.sr-only= _('Select Archive Format')
- = sprite_icon("chevron-down")
+ = sprite_icon('chevron-down', css_class: 'gl-icon')
.dropdown-menu.dropdown-menu-right{ role: 'menu' }
%section
%h5.m-0.dropdown-bold-header= _('Download source code')
diff --git a/app/views/projects/buttons/_remove_tag.html.haml b/app/views/projects/buttons/_remove_tag.html.haml
index cdf6336a259..58af0d91f30 100644
--- a/app/views/projects/buttons/_remove_tag.html.haml
+++ b/app/views/projects/buttons/_remove_tag.html.haml
@@ -2,5 +2,5 @@
- tag = local_assigns.fetch(:tag, nil)
- return unless project && tag
-%button{ type: "button", class: "js-remove-tag js-confirm-modal-button gl-button btn btn-danger btn-icon has-tooltip gl-ml-3 #{protected_tag?(project, tag) ? 'disabled' : ''}", title: s_('TagsPage|Delete tag'), data: { container: 'body', path: project_tag_path(@project, tag.name), modal_attributes: delete_tag_modal_attributes(tag.name) } }
- = sprite_icon("remove")
+%button{ type: "button", class: "js-remove-tag js-confirm-modal-button gl-button btn btn-default btn-icon has-tooltip gl-ml-3\! #{protected_tag?(project, tag) ? 'disabled' : ''}", title: s_('TagsPage|Delete tag'), data: { container: 'body', path: project_tag_path(@project, tag.name), modal_attributes: delete_tag_modal_attributes(tag.name) } }
+ = sprite_icon('remove', css_class: 'gl-icon')
diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml
index a178ec6979a..83a3cac487f 100644
--- a/app/views/projects/tags/_tag.html.haml
+++ b/app/views/projects/tags/_tag.html.haml
@@ -42,5 +42,5 @@
- if can?(current_user, :admin_tag, @project)
= link_to edit_project_tag_release_path(@project, tag.name), class: 'btn gl-button btn-default btn-icon btn-edit has-tooltip', title: s_('TagsPage|Edit release notes'), data: { container: "body" } do
- = sprite_icon("pencil")
+ = sprite_icon('pencil', css_class: 'gl-icon')
= render 'projects/buttons/remove_tag', project: @project, tag: tag
diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml
index 5065a784b09..79205a51d71 100644
--- a/app/views/projects/tags/index.html.haml
+++ b/app/views/projects/tags/index.html.haml
@@ -10,11 +10,11 @@
.nav-controls
#js-tags-sort-dropdown{ data: { filter_tags_path: filter_tags_path, sort_options: tags_sort_options_hash.to_json } }
+ = link_to project_tags_path(@project, rss_url_options), title: _("Tags feed"), class: 'btn gl-button btn-default btn-icon has-tooltip gl-ml-auto' do
+ = sprite_icon('rss', css_class: 'gl-icon qa-rss-icon')
- if can?(current_user, :admin_tag, @project)
= link_to new_project_tag_path(@project), class: 'btn gl-button btn-confirm', data: { qa_selector: "new_tag_button" } do
= s_('TagsPage|New tag')
- = link_to project_tags_path(@project, rss_url_options), title: _("Tags feed"), class: 'btn gl-button btn-default btn-icon d-none d-sm-inline-block has-tooltip' do
- = sprite_icon('rss', css_class: 'qa-rss-icon')
= render_if_exists 'projects/commits/mirror_status'
diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml
index 2ef1891089f..fe00772d1d6 100644
--- a/app/views/projects/tags/new.html.haml
+++ b/app/views/projects/tags/new.html.haml
@@ -51,7 +51,7 @@
= render layout: 'shared/md_preview', locals: { url: preview_markdown_path(@project), referenced_users: true } do
= render 'shared/zen', attr: :release_description, classes: 'note-textarea', placeholder: s_('TagsPage|Write your release notes or drag files here…'), current_text: @release_description, qa_selector: 'release_notes_field'
= render 'shared/notes/hints'
- .form-actions
- = button_tag s_('TagsPage|Create tag'), class: 'gl-button btn btn-confirm', data: { qa_selector: "create_tag_button" }
+ .form-actions.gl-display-flex
+ = button_tag s_('TagsPage|Create tag'), class: 'gl-button btn btn-confirm gl-mr-3', data: { qa_selector: "create_tag_button" }
= link_to s_('TagsPage|Cancel'), project_tags_path(@project), class: 'gl-button btn btn-default btn-cancel'
%script#availableRefs{ type: "application/json" }= @project.repository.ref_names.to_json.html_safe
diff --git a/app/views/projects/tags/releases/edit.html.haml b/app/views/projects/tags/releases/edit.html.haml
index f181212b328..88594209c3b 100644
--- a/app/views/projects/tags/releases/edit.html.haml
+++ b/app/views/projects/tags/releases/edit.html.haml
@@ -14,6 +14,6 @@
= render 'shared/zen', f: f, attr: :description, classes: 'note-textarea', placeholder: "Write your release notes or drag files here…"
= render 'shared/notes/hints'
.error-alert
- .gl-mt-3
- = f.submit 'Save changes', class: 'btn gl-button btn-confirm'
+ .gl-mt-5.gl-display-flex
+ = f.submit 'Save changes', class: 'btn gl-button btn-confirm gl-mr-3'
= link_to "Cancel", project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel"