Commit 8e8eb978 authored by Tiago Botelho's avatar Tiago Botelho
Browse files

Removes pending delete from filter scopes

parent 129138986594
...@@ -97,7 +97,7 @@ def show ...@@ -97,7 +97,7 @@ def show
end end
if @project.pending_delete? if @project.pending_delete?
flash[:alert] = _("Project '%{project_name}' queued for deletion.") % { project_name: @project.name } flash.now[:alert] = _("Project '%{project_name}' queued for deletion.") % { project_name: @project.name }
end end
respond_to do |format| respond_to do |format|
......
...@@ -97,8 +97,8 @@ def groups_autocomplete(term, limit = 5) ...@@ -97,8 +97,8 @@ def groups_autocomplete(term, limit = 5)
# Autocomplete results for the current user's projects # Autocomplete results for the current user's projects
def projects_autocomplete(term, limit = 5) def projects_autocomplete(term, limit = 5)
current_user.authorized_projects.search_by_title(term) current_user.authorized_projects.search_by_title(term).
.sorted_by_stars.non_archived.limit(limit).map do |p| sorted_by_stars.non_archived.limit(limit).map do |p|
{ {
category: "Projects", category: "Projects",
id: p.id, id: p.id,
......
...@@ -222,9 +222,8 @@ def set_last_repository_updated_at ...@@ -222,9 +222,8 @@ def set_last_repository_updated_at
has_many :uploads, as: :model, dependent: :destroy has_many :uploads, as: :model, dependent: :destroy
# Scopes # Scopes
default_scope { where(pending_delete: false) } scope :with_deleted, -> { where(pending_delete: true) }
scope :without_deleted, -> { where(pending_delete: false) }
scope :with_deleted, -> { unscope(where: :pending_delete) }
scope :sorted_by_activity, -> { reorder(last_activity_at: :desc) } scope :sorted_by_activity, -> { reorder(last_activity_at: :desc) }
scope :sorted_by_stars, -> { reorder('projects.star_count DESC') } scope :sorted_by_stars, -> { reorder('projects.star_count DESC') }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
- if projects.any? - if projects.any?
%ul.projects-list %ul.projects-list
- projects.each_with_index do |project, i| - projects.each_with_index do |project, i|
- css_class = (i >= projects_limit) ? 'hide' : nil - css_class = (i >= projects_limit) || project.pending_delete? ? 'hide' : nil
= render "shared/projects/project", project: project, skip_namespace: skip_namespace, = render "shared/projects/project", project: project, skip_namespace: skip_namespace,
avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar, avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar,
forks: forks, show_last_commit_as_description: show_last_commit_as_description forks: forks, show_last_commit_as_description: show_last_commit_as_description
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment