Commit 6b4f1ab2 authored by Jan Provaznik's avatar Jan Provaznik

Use resource_parent instead of parent

'parent' method name is used by models which use parent-child
hierarchy, so for referencing project/group resource_parent
is used.
parent 7cb49bad
......@@ -13,7 +13,7 @@ module Boards
end
def board_parent
@board_parent ||= board.parent
@board_parent ||= board.resource_parent
end
def record_not_found(exception)
......
......@@ -9,7 +9,7 @@ module Boards
skip_before_action :authenticate_user!, only: [:index]
def index
lists = Boards::Lists::ListService.new(board.parent, current_user).execute(board)
lists = Boards::Lists::ListService.new(board.resource_parent, current_user).execute(board)
List.preload_preferences_for_user(lists, current_user)
......@@ -17,7 +17,7 @@ module Boards
end
def create
list = Boards::Lists::CreateService.new(board.parent, current_user, create_list_params).execute(board)
list = Boards::Lists::CreateService.new(board.resource_parent, current_user, create_list_params).execute(board)
if list.valid?
render json: serialize_as_json(list)
......
......@@ -35,7 +35,7 @@ module MilestoneActions
render json: tabs_json("shared/milestones/_labels_tab", {
labels: milestone_labels.map do |label|
label.present(issuable_subject: @milestone.parent)
label.present(issuable_subject: @milestone.resource_parent)
end
})
end
......
......@@ -44,7 +44,7 @@ class Groups::MilestonesController < Groups::ApplicationController
# all projects milestones states at once.
milestones, update_params = get_milestones_for_update
milestones.each do |milestone|
Milestones::UpdateService.new(milestone.parent, current_user, update_params).execute(milestone)
Milestones::UpdateService.new(milestone.resource_parent, current_user, update_params).execute(milestone)
end
redirect_to milestone_path
......
......@@ -76,10 +76,10 @@ module GitlabRoutingHelper
end
def edit_milestone_path(entity, *args)
if entity.parent.is_a?(Group)
edit_group_milestone_path(entity.parent, entity, *args)
if entity.resource_parent.is_a?(Group)
edit_group_milestone_path(entity.resource_parent, entity, *args)
else
edit_project_milestone_path(entity.parent, entity, *args)
edit_project_milestone_path(entity.resource_parent, entity, *args)
end
end
......
......@@ -45,8 +45,8 @@ module TodosHelper
end
def todo_parent_path(todo)
if todo.parent.is_a?(Group)
link_to todo.parent.name, group_path(todo.parent)
if todo.resource_parent.is_a?(Group)
link_to todo.resource_parent.name, group_path(todo.resource_parent)
else
link_to_project(todo.project)
end
......@@ -64,7 +64,7 @@ module TodosHelper
if todo.for_commit?
project_commit_path(todo.project, todo.target, path_options)
else
path = [todo.parent, todo.target]
path = [todo.resource_parent, todo.target]
path.unshift(:pipelines) if todo.build_failed?
......
......@@ -16,10 +16,9 @@ class Board < ApplicationRecord
!group
end
def parent
@parent ||= group || project
def resource_parent
@resource_parent ||= group || project
end
alias_method :resource_parent, :parent
def group_board?
group_id.present?
......
......@@ -11,7 +11,7 @@ class GlobalMilestone
delegate :title, :state, :due_date, :start_date, :participants, :project,
:group, :expires_at, :closed?, :iid, :group_milestone?, :safe_title,
:milestoneish_id, :parent, to: :milestone
:milestoneish_id, :resource_parent, to: :milestone
def to_hash
{
......
......@@ -257,10 +257,9 @@ class Milestone < ApplicationRecord
title.to_slug.normalize.to_s
end
def parent
def resource_parent
group || project
end
alias_method :resource_parent, :parent
def group_milestone?
group_id.present?
......
......@@ -483,10 +483,9 @@ class Note < ApplicationRecord
Upload.find_by(model: self, path: paths)
end
def parent
def resource_parent
project
end
alias_method :resource_parent, :parent
private
......
......@@ -144,10 +144,9 @@ class Todo < ApplicationRecord
end
end
def parent
def resource_parent
project
end
alias_method :resource_parent, :parent
def unmergeable?
action == UNMERGEABLE
......
......@@ -3,7 +3,7 @@
class BoardPolicy < BasePolicy
include FindGroupProjects
delegate { @subject.parent }
delegate { @subject.resource_parent }
condition(:is_group_board) { @subject.group_board? }
condition(:is_project_board) { @subject.project_board? }
......@@ -19,7 +19,7 @@ class BoardPolicy < BasePolicy
condition(:reporter_of_group_projects) do
next unless @user
group_projects_for(user: @user, group: @subject.parent)
group_projects_for(user: @user, group: @subject.resource_parent)
.visible_to_user_and_access_level(@user, ::Gitlab::Access::REPORTER)
.exists?
end
......
# frozen_string_literal: true
class MilestonePolicy < BasePolicy
delegate { @subject.parent }
delegate { @subject.resource_parent }
end
......@@ -50,7 +50,7 @@ module Notes
return if update_params.empty?
return unless supported?(note)
self.class.noteable_update_service(note).new(note.parent, current_user, update_params).execute(note.noteable)
self.class.noteable_update_service(note).new(note.resource_parent, current_user, update_params).execute(note.noteable)
end
end
end
......
- parent = board.parent
- parent = board.resource_parent
- milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
- weights = Gitlab.ee? ? ([Issue::WEIGHT_ANY] + Issue.weight_options) : []
......
......@@ -3,6 +3,6 @@
Add list
.dropdown-menu.dropdown-extended-height.dropdown-menu-paging.dropdown-menu-right.dropdown-menu-issues-board-new.dropdown-menu-selectable.js-tab-container-labels
= render partial: "shared/issuable/label_page_default", locals: { show_footer: true, show_create: true, show_boards_content: true, title: "Add list" }
- if can?(current_user, :admin_label, board.parent)
- if can?(current_user, :admin_label, board.resource_parent)
= render partial: "shared/issuable/label_page_create", locals: { show_add_list: true, add_list: true, add_list_class: 'd-none' }
= dropdown_loading
......@@ -2,7 +2,7 @@
- board = local_assigns.fetch(:board, nil)
- is_not_boards_modal_or_productivity_analytics = type != :boards_modal && type != :productivity_analytics
- block_css_class = is_not_boards_modal_or_productivity_analytics ? 'row-content-block second-block' : ''
- user_can_admin_list = board && can?(current_user, :admin_list, board.parent)
- user_can_admin_list = board && can?(current_user, :admin_list, board.resource_parent)
.issues-filters{ class: ("w-100" if type == :boards_modal) }
.issues-details-filters.filtered-search-block.d-flex.flex-column.flex-md-row{ class: block_css_class, "v-pre" => type == :boards_modal }
......
......@@ -15,7 +15,7 @@ module Boards
# rubocop: disable CodeReuse/Finder
def finder_service
parent = @board.parent
parent = @board.resource_parent
finder_params =
if parent.is_a?(Group)
......
......@@ -16,10 +16,10 @@ module Boards
# rubocop: disable CodeReuse/Finder
def finder_service
@finder_service ||=
if @board.parent.is_a?(Group)
GroupMembersFinder.new(@board.parent)
if @board.resource_parent.is_a?(Group)
GroupMembersFinder.new(@board.resource_parent)
else
MembersFinder.new(@board.parent, @current_user)
MembersFinder.new(@board.resource_parent, @current_user)
end
end
# rubocop: enable CodeReuse/Finder
......
......@@ -20,7 +20,7 @@ module EE
return false if cookies['hide_burndown_message'].present?
return false unless milestone.supports_burndown_charts?
warning.nil? && can?(current_user, :admin_milestone, milestone.parent)
warning.nil? && can?(current_user, :admin_milestone, milestone.resource_parent)
end
def data_warning_for(burndown)
......
......@@ -32,7 +32,7 @@ module EE
)
designs_project_issue_path(
todo.parent,
todo.resource_parent,
design.issue,
path_options
)
......
......@@ -16,7 +16,7 @@ module EE
design = @note.noteable
@target_url = ::Gitlab::Routing.url_helpers.designs_project_issue_url(
@note.parent,
@note.resource_parent,
design.issue,
note_target_url_query_params.merge(vueroute: design.filename)
)
......
......@@ -28,7 +28,7 @@ module EE
override :scoped?
def scoped?
return super unless parent.feature_available?(:scoped_issue_board)
return super unless resource_parent.feature_available?(:scoped_issue_board)
EMPTY_SCOPE_STATE.exclude?(milestone_id) ||
EMPTY_SCOPE_STATE.exclude?(weight) ||
......@@ -37,7 +37,7 @@ module EE
end
def milestone
return unless parent&.feature_available?(:scoped_issue_board)
return unless resource_parent&.feature_available?(:scoped_issue_board)
case milestone_id
when ::Milestone::Upcoming.id
......
......@@ -23,10 +23,10 @@ module EE
base.validates :max_issue_count, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
base.validates :list_type,
exclusion: { in: %w[assignee], message: _('Assignee lists not available with your current license') },
unless: -> { board&.parent&.feature_available?(:board_assignee_lists) }
unless: -> { board&.resource_parent&.feature_available?(:board_assignee_lists) }
base.validates :list_type,
exclusion: { in: %w[milestone], message: _('Milestone lists not available with your current license') },
unless: -> { board&.parent&.feature_available?(:board_milestone_lists) }
unless: -> { board&.resource_parent&.feature_available?(:board_milestone_lists) }
end
def assignee=(user)
......
......@@ -11,13 +11,13 @@ module EE
end
def supports_weight?
parent&.feature_available?(:issue_weights)
resource_parent&.feature_available?(:issue_weights)
end
def supports_burndown_charts?
feature_name = group_milestone? ? :group_burndown_charts : :burndown_charts
parent&.feature_available?(feature_name) && supports_weight?
resource_parent&.feature_available?(feature_name) && supports_weight?
end
end
end
......@@ -57,11 +57,10 @@ module EE
noteable_type == DesignManagement::Design.name
end
override :parent
def parent
override :resource_parent
def resource_parent
for_epic? ? noteable.group : super
end
alias_method :resource_parent, :parent
def notify_after_create
noteable&.after_note_created(self)
......
......@@ -9,11 +9,10 @@ module EE
include UsageStatistics
end
override :parent
def parent
override :resource_parent
def resource_parent
project || group
end
alias_method :resource_parent, :parent
def for_design?
target_type == DesignManagement::Design.name
......
......@@ -25,7 +25,7 @@ module EE
private
def list_type_features_availability(board)
parent = board.parent
parent = board.resource_parent
LICENSED_LIST_TYPES.each_with_object({}) do |list_type, hash|
list_type_key = ::List.list_types[list_type]
......
......@@ -16,7 +16,7 @@ module EE
end
def max_issue_count?(list)
params.has_key?(:max_issue_count) && list.board.parent.feature_available?(:wip_limits)
params.has_key?(:max_issue_count) && list.board.resource_parent.feature_available?(:wip_limits)
end
def update_max_issue_count(list)
......
- assignee_lists_available = board.parent.feature_available?(:board_assignee_lists)
- milestone_lists_available = board.parent.feature_available?(:board_milestone_lists)
- assignee_lists_available = board.resource_parent.feature_available?(:board_assignee_lists)
- milestone_lists_available = board.resource_parent.feature_available?(:board_milestone_lists)
- if assignee_lists_available || milestone_lists_available
.dropdown.boards-add-list.prepend-left-10#js-add-list
......@@ -24,7 +24,7 @@
.tab-content
#tab-labels.tab-pane.tab-pane-labels.active.js-tab-container-labels{ role: 'tabpanel' }
= render partial: "shared/issuable/label_page_default", locals: { show_title: false, show_footer: true, show_create: true, show_boards_content: true, content_title: _('Label lists show all issues with the selected label.') }
- if can?(current_user, :admin_label, board.parent)
- if can?(current_user, :admin_label, board.resource_parent)
= render partial: "shared/issuable/label_page_create", locals: { show_close: false }
- if assignee_lists_available
......
......@@ -147,7 +147,7 @@ module EE
expose :name
expose :group, using: ::API::Entities::BasicGroupDetails
with_options if: ->(board, _) { board.parent.feature_available?(:scoped_issue_board) } do
with_options if: ->(board, _) { board.resource_parent.feature_available?(:scoped_issue_board) } do
expose :milestone do |board|
if board.milestone.is_a?(Milestone)
::API::Entities::Milestone.represent(board.milestone)
......@@ -168,7 +168,7 @@ module EE
prepended do
expose :milestone, using: ::API::Entities::Milestone, if: -> (entity, _) { entity.milestone? }
expose :user, as: :assignee, using: ::API::Entities::UserSafe, if: -> (entity, _) { entity.assignee? }
expose :max_issue_count, if: -> (list, _) { list.board.parent.feature_available?(:wip_limits) }
expose :max_issue_count, if: -> (list, _) { list.board.resource_parent.feature_available?(:wip_limits) }
end
end
......
......@@ -41,7 +41,7 @@ describe 'Multiple Issue Boards', :js do
end
it 'shows a license warning when group has more than one board' do
create(:board, parent: parent)
create(:board, resource_parent: parent)
visit boards_path
wait_for_requests
......
......@@ -76,12 +76,12 @@ describe Note do
end
end
describe '#parent' do
describe '#resource_parent' do
it 'returns group for epic notes' do
group = create(:group)
note = create(:note_on_epic, noteable: create(:epic, group: group))
expect(note.parent).to eq(group)
expect(note.resource_parent).to eq(group)
end
end
......
......@@ -4,8 +4,8 @@ require 'spec_helper'
describe Boards::ListService do
shared_examples 'boards list service' do
let(:service) { described_class.new(parent, double) }
let!(:boards) { create_list(:board, 3, parent: parent) }
let(:service) { described_class.new(resource_parent, double) }
let!(:boards) { create_list(:board, 3, resource_parent: resource_parent) }
describe '#execute' do
it 'returns all issue boards when multiple issue boards is enabled' do
......@@ -25,11 +25,11 @@ describe Boards::ListService do
end
it_behaves_like 'boards list service' do
let(:parent) { create(:project, :empty_repo) }
let(:resource_parent) { create(:project, :empty_repo) }
end
it_behaves_like 'boards list service' do
let(:parent) { create(:group) }
let(:resource_parent) { create(:group) }
it 'returns the first issue board when multiple issue boards is disabled' do
stub_licensed_features(multiple_group_issue_boards: false)
......
......@@ -68,7 +68,7 @@ describe Boards::UpdateService, services: true do
context '#set_labels' do
def expect_label_assigned(user, board, input_labels, expected_labels)
service = described_class.new(board.parent, user, labels: input_labels.join(','))
service = described_class.new(board.resource_parent, user, labels: input_labels.join(','))
service.execute(board)
expect(board.reload.labels.map(&:title)).to contain_exactly(*expected_labels)
......@@ -146,7 +146,7 @@ describe Boards::UpdateService, services: true do
other_group_label = create(:group_label, title: 'other_group_label')
label_ids = [group_label.id, label.id, other_project_label.id, other_group_label.id]
described_class.new(board.parent, user, label_ids: label_ids).execute(board)
described_class.new(board.resource_parent, user, label_ids: label_ids).execute(board)
expect(board.reload.labels).to contain_exactly(group_label, label)
end
......
......@@ -10,7 +10,7 @@ describe Boards::Issues::CreateService do
let(:label) { create(:label, project: project, name: 'in-progress') }
subject(:service) do
described_class.new(board.parent, project, user, board_id: board.id, list_id: list.id, title: 'New issue')
described_class.new(board.resource_parent, project, user, board_id: board.id, list_id: list.id, title: 'New issue')
end
before do
......
......@@ -11,8 +11,8 @@ describe Boards::Lists::ListService do
context 'when the feature is enabled' do
before do
allow(board.parent).to receive(:feature_available?).with(:board_assignee_lists).and_return(true)
allow(board.parent).to receive(:feature_available?).with(:board_milestone_lists).and_return(false)
allow(board.resource_parent).to receive(:feature_available?).with(:board_assignee_lists).and_return(true)
allow(board.resource_parent).to receive(:feature_available?).with(:board_milestone_lists).and_return(false)
end
it 'returns all lists' do
......@@ -34,8 +34,8 @@ describe Boards::Lists::ListService do
context 'when the feature is enabled' do
before do
allow(board.parent).to receive(:feature_available?).with(:board_assignee_lists).and_return(false)
allow(board.parent).to receive(:feature_available?).with(:board_milestone_lists).and_return(true)
allow(board.resource_parent).to receive(:feature_available?).with(:board_assignee_lists).and_return(false)
allow(board.resource_parent).to receive(:feature_available?).with(:board_milestone_lists).and_return(true)
end
it 'returns all lists' do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
shared_examples 'multiple issue boards show' do
let!(:board1) { create(:board, parent: parent, name: 'b') }
let!(:board2) { create(:board, parent: parent, name: 'a') }
let!(:board1) { create(:board, resource_parent: parent, name: 'b') }
let!(:board2) { create(:board, resource_parent: parent, name: 'a') }
context 'when multiple issue boards is enabled' do
it 'lets user view board1' do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
shared_examples 'returns recently visited boards' do
let(:boards) { create_list(:board, 8, parent: parent) }
let(:boards) { create_list(:board, 8, resource_parent: parent) }
context 'unauthenticated' do
it 'returns a 401' do
......@@ -28,7 +28,7 @@ shared_examples 'returns recently visited boards' do
end
shared_examples 'redirects to last visited board' do
let(:boards) { create_list(:board, 3, parent: parent) }
let(:boards) { create_list(:board, 3, resource_parent: parent) }
before do
visit_board(boards[2], Time.now + 1.minute)
......
......@@ -988,11 +988,11 @@ module API
def todo_target_url(todo)
target_type = todo.target_type.underscore
target_url = "#{todo.parent.class.to_s.underscore}_#{target_type}_url"
target_url = "#{todo.resource_parent.class.to_s.underscore}_#{target_type}_url"
Gitlab::Routing
.url_helpers
.public_send(target_url, todo.parent, todo.target, anchor: todo_target_anchor(todo)) # rubocop:disable GitlabSecurity/PublicSend
.public_send(target_url, todo.resource_parent, todo.target, anchor: todo_target_anchor(todo)) # rubocop:disable GitlabSecurity/PublicSend
end
def todo_target_anchor(todo)
......
......@@ -7,7 +7,7 @@ FactoryBot.define do
group { nil }
project_id { nil }
group_id { nil }
parent { nil }
resource_parent { nil }
end
after(:build, :stub) do |board, evaluator|
......@@ -19,9 +19,9 @@ FactoryBot.define do
board.project = evaluator.project
elsif evaluator.project_id
board.project_id = evaluator.project_id
elsif evaluator.parent
id = evaluator.parent.id
evaluator.parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
elsif evaluator.resource_parent
id = evaluator.resource_parent.id
evaluator.resource_parent.is_a?(Group) ? board.group_id = id : evaluator.project_id = id
else
board.project = create(:project, :empty_repo)
end
......
......@@ -9,7 +9,7 @@ FactoryBot.define do
group { nil }
project_id { nil }
group_id { nil }
parent { nil }
resource_parent { nil }
end
trait :active do
......@@ -34,9 +34,9 @@ FactoryBot.define do
milestone.project = evaluator.project
elsif evaluator.project_id
milestone.project_id = evaluator.project_id
elsif evaluator.parent
id = evaluator.parent.id
evaluator.parent.is_a?(Group) ? evaluator.group_id = id : evaluator.project_id = id
elsif evaluator.resource_parent
id = evaluator.resource_parent.id
evaluator.resource_parent.is_a?(Group) ? evaluator.group_id = id : evaluator.project_id = id
else
milestone.project = create(:project)
end
......
......@@ -12,7 +12,7 @@ describe "User deletes milestone", :js do
end
context "when milestone belongs to project" do
let!(:milestone) { create(:milestone, parent: project, title: "project milestone") }
let!(:milestone) { create(:milestone, resource_parent: project, title: "project milestone") }
it "deletes milestone" do
project.add_developer(user)
......@@ -30,8 +30,8 @@ describe "User deletes milestone", :js do
end
context "when milestone belongs to group" do
let!(:milestone_to_be_deleted) { create(:milestone, parent: group, title: "group milestone 1") }
let!(:milestone) { create(:milestone, parent: group, title: "group milestone 2") }
let!(:milestone_to_be_deleted) { create(:milestone, resource_parent: group, title: "group milestone 1") }
let!(:milestone) { create(:milestone, resource_parent: group, title: "group milestone 2") }
it "deletes milestone" do
group.add_developer(user)
......
......@@ -10,7 +10,7 @@ describe Boards::VisitsFinder do
let(:project) { create(:project) }
let(:project_board) { create(:board, project: project) }
subject(:finder) { described_class.new(project_board.parent, user) }
subject(:finder) { described_class.new(project_board.resource_parent, user) }
it 'returns nil when there is no user' do
finder.current_user = nil
......@@ -27,7 +27,7 @@ describe Boards::VisitsFinder do
it 'queries for last N visits' do
expect(BoardProjectRecentVisit).to receive(:latest).with(user, project, count: 5).once
described_class.new(project_board.parent, user).latest(5)
described_class.new(project_board.resource_parent, user).latest(5)
end
end
......@@ -35,7 +35,7 @@ describe Boards::VisitsFinder do
let(:group) { create(:group) }
let(:group_board) { create(:board, group: group) }
subject(:finder) { described_class.new(group_board.parent, user) }
subject(:finder) { described_class.new(group_board.resource_parent, user) }
it 'returns nil when there is no user' do
finder.current_user = nil
......@@ -52,7 +52,7 @@ describe Boards::VisitsFinder do
it 'queries for last N visits' do
expect(BoardGroupRecentVisit).to receive(:latest).with(user, group, count: 5).once
described_class.new(group_board.parent, user).latest(5)
described_class.new(group_board.resource_parent, user).latest(5)
end
end
end
......
......@@ -972,13 +972,13 @@ describe Note do
project = create(:project)
note = create(:note_on_issue, project: project)
expect(note.parent).to eq(project)
expect(note.resource_parent).to eq(project)
end
it 'returns nil for personal snippet note' do
note = create(:note_on_personal_snippet)
expect(note.parent).to be_nil
expect(note.resource_parent).to be_nil
end
end
......
......@@ -10,7 +10,7 @@ describe Boards::Issues::CreateService do
let(:label) { create(:label, project: project, name: 'in-progress') }
let!(:list) { create(:list, board: board, label: label, position: 0) }
subject(:service) { described_class.new(board.parent, project, user, board_id: board.id, list_id: list.id, title: 'New issue') }
subject(:service) { described_class.new(board.resource_parent, project, user, board_id: board.id, list_id: list.id, title: 'New issue') }
before do
project.add_developer(user)
......
......@@ -9,9 +9,9 @@ describe Boards::Lists::UpdateService do
shared_examples 'moving list' do
context 'when user can admin list' do
it 'calls Lists::MoveService to update list position' do
board.parent.add_developer(user)
board.resource_parent.add_developer(user)
expect(Boards::Lists::MoveService).to receive(:new).with(board.parent, user, params).and_call_original
expect(Boards::Lists::MoveService).to receive(:new).with(board.resource_parent, user, params).and_call_original
expect_any_instance_of(Boards::Lists::MoveService).to receive(:execute).with(list)
service.execute(list)
......@@ -30,7 +30,7 @@ describe Boards::Lists::UpdateService do
shared_examples 'updating list preferences' do
context 'when user can read list' do
it 'updates list preference for user' do
board.parent.add_guest(user)
board.resource_parent.add_guest(user)
service.execute(list)
......@@ -48,7 +48,7 @@ describe Boards::Lists::UpdateService do
end
describe '#execute' do
let(:service) { described_class.new(board.parent, user, params) }
let(:service) { described_class.new(board.resource_parent, user, params) }
context 'when position parameter is present' do
let(:params) { { position: 1 } }
......
......@@ -10,7 +10,7 @@ describe Boards::Visits::CreateService do
let(:project) { create(:project) }
let(:project_board) { create(:board, project: project) }
subject(:service) { described_class.new(project_board.parent, user) }
subject(:service) { described_class.new(project_board.resource_parent, user) }
it 'returns nil when there is no user' do
service.current_user = nil
......@@ -35,7 +35,7 @@ describe Boards::Visits::CreateService do
let(:group) { create(:group) }
let(:group_board) { create(:board, group: group) }
subject(:service) { described_class.new(group_board.parent, user) }
subject(:service) { described_class.new(group_board.resource_parent, user) }
it 'returns nil when there is no user' do
service.current_user = nil
......
......@@ -171,7 +171,7 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
if board_parent.try(:namespace)
board_parent.update(namespace: owner.namespace)
else
board.parent.add_owner(owner)
board.resource_parent.add_owner(owner)
end
end
......
......@@ -205,7 +205,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
describe "DELETE #{route_definition}/:milestone_id" do
it "rejects a member with reporter access from deleting a milestone" do
reporter = create(:user)
milestone.parent.add_reporter(reporter)
milestone.resource_parent.add_reporter(reporter)
delete api(resource_route, reporter)
......
......@@ -17,7 +17,7 @@ shared_examples 'boards create service' do
context 'when parent has a board' do
before do
create(:board, parent: parent)
create(:board, resource_parent: parent)
end
it 'does not create a new board' do
......
......@@ -15,7 +15,7 @@ shared_examples 'boards list service' do
context 'when parent has a board' do
before do
create(:board, parent: parent)
create(:board, resource_parent: parent)
end
it 'does not create a new board' do
......@@ -24,7 +24,7 @@ shared_examples 'boards list service' do
end
it 'returns parent boards' do
board = create(:board, parent: parent)
board = create(:board, resource_parent: parent)
expect(service.execute).to eq [board]
end
......
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