Remove assigned_(issues|merge_requests) methods from the issuable
This commit is contained in:
parent
d910a777cc
commit
59a330f4cd
4 changed files with 4 additions and 10 deletions
|
@ -194,7 +194,7 @@ module IssuablesHelper
|
|||
|
||||
def assigned_issuables_count(assignee, issuable_type, state)
|
||||
params = { assignee_id: assignee.id, state: state }
|
||||
Object::const_get("#{issuable_type.to_s.camelize}Finder").new(current_user, params).execute.count
|
||||
Object.const_get("#{issuable_type.to_s.camelize}Finder").new(current_user, params).execute.count
|
||||
end
|
||||
|
||||
def sidebar_gutter_collapsed?
|
||||
|
|
|
@ -99,9 +99,6 @@ class User < ActiveRecord::Base
|
|||
has_many :award_emoji, dependent: :destroy
|
||||
has_many :triggers, dependent: :destroy, class_name: 'Ci::Trigger', foreign_key: :owner_id
|
||||
|
||||
has_many :assigned_issues, dependent: :nullify, foreign_key: :assignee_id, class_name: "Issue"
|
||||
has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest"
|
||||
|
||||
# Issues that a user owns are expected to be moved to the "ghost" user before
|
||||
# the user is destroyed. If the user owns any issues during deletion, this
|
||||
# should be treated as an exceptional condition.
|
||||
|
@ -893,13 +890,13 @@ class User < ActiveRecord::Base
|
|||
|
||||
def assigned_open_merge_request_count(force: false)
|
||||
Rails.cache.fetch(['users', id, 'assigned_open_merge_request_count'], force: force) do
|
||||
assigned_merge_requests.opened.count
|
||||
MergeRequestsFinder.new(self, assignee_id: self.id, state: 'opened').execute.count
|
||||
end
|
||||
end
|
||||
|
||||
def assigned_open_issues_count(force: false)
|
||||
Rails.cache.fetch(['users', id, 'assigned_open_issues_count'], force: force) do
|
||||
assigned_issues.opened.count
|
||||
IssuesFinder.new(self, assignee_id: self.id, state: 'opened').execute.count
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,9 +24,7 @@ describe User, models: true do
|
|||
it { is_expected.to have_many(:recent_events).class_name('Event') }
|
||||
it { is_expected.to have_many(:issues).dependent(:restrict_with_exception) }
|
||||
it { is_expected.to have_many(:notes).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:assigned_issues).dependent(:nullify) }
|
||||
it { is_expected.to have_many(:merge_requests).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:assigned_merge_requests).dependent(:nullify) }
|
||||
it { is_expected.to have_many(:identities).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:spam_logs).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:todos).dependent(:destroy) }
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Members::AuthorizedDestroyService, services: true do
|
||||
let(:user) { create(:user) }
|
||||
let(:member_user) { create(:user) }
|
||||
let(:project) { create(:empty_project, :public) }
|
||||
let(:group) { create(:group, :public) }
|
||||
let(:group_project) { create(:empty_project, :public, group: group) }
|
||||
|
||||
def number_of_assigned_issuables(user)
|
||||
user.assigned_issues.count + user.assigned_merge_requests.count
|
||||
Issue.assigned_to(user).count + MergeRequest.assigned_to(user).count
|
||||
end
|
||||
|
||||
context 'Group member' do
|
||||
|
|
Loading…
Reference in a new issue