Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::Beta::Button.new(
tag: :a,
label: BacklogBucket.human_model_name,
href: new_dialog_project_backlogs_backlog_buckets_path(project, all_backlogs_params),
href: new_dialog_project_backlogs_buckets_path(project, all_backlogs_params),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

data: {
controller: "async-dialog",
test_selector: "op-backlog-buckets--new-backlog-bucket-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ See COPYRIGHT and LICENSE files for more details.
menu.with_item(
id: dom_target(backlog_bucket, :menu, :edit_backlog_bucket),
label: t(".action_menu.edit_backlog_bucket"),
href: edit_dialog_project_backlogs_backlog_bucket_path(project, backlog_bucket, all_backlogs_params),
href: edit_dialog_project_backlogs_bucket_path(project, backlog_bucket, all_backlogs_params),
content_arguments: { data: { controller: "async-dialog" } }
) do |item|
item.with_leading_visual_icon(icon: :pencil)
Expand All @@ -60,7 +60,7 @@ See COPYRIGHT and LICENSE files for more details.
id: dom_target(backlog_bucket, :menu, :delete_backlog_bucket),
label: t(".action_menu.delete_backlog_bucket"),
scheme: :danger,
href: destroy_dialog_project_backlogs_backlog_bucket_path(project, backlog_bucket, all_backlogs_params),
href: destroy_dialog_project_backlogs_bucket_path(project, backlog_bucket, all_backlogs_params),
content_arguments: { data: { controller: "async-dialog" } }
) do |item|
item.with_leading_visual_icon(icon: :trash)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def details

def form_arguments
{
action: project_backlogs_backlog_bucket_path(backlog_bucket.project,
action: project_backlogs_bucket_path(backlog_bucket.project,
backlog_bucket,
helpers.all_backlogs_params),
Comment thread
toy marked this conversation as resolved.
method: :delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def http_verb

def form_url
if @backlog_bucket.new_record?
project_backlogs_backlog_buckets_path(@backlog_bucket.project, all_backlogs_params)
project_backlogs_buckets_path(@backlog_bucket.project, all_backlogs_params)
else
project_backlogs_backlog_bucket_path(@backlog_bucket.project, @backlog_bucket, all_backlogs_params)
project_backlogs_bucket_path(@backlog_bucket.project, @backlog_bucket, all_backlogs_params)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions modules/backlogs/app/components/backlogs/sprint_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def wrapper_uniq_by
private

def show_start_sprint_action?
sprint.in_planning? && ::Sprints::StartContract.can_start?(user: current_user, sprint:, project:)
sprint.in_planning? && ::Backlogs::Sprints::StartContract.can_start?(user: current_user, sprint:, project:)
end

def show_finish_sprint_action?
sprint.active? && ::Sprints::StartContract.can_start_or_complete?(user: current_user, sprint:)
sprint.active? && ::Backlogs::Sprints::StartContract.can_start_or_complete?(user: current_user, sprint:)
end

def disable_start_sprint_action?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class BacklogBuckets::BaseContract < ModelContract
class Backlogs::Buckets::BaseContract < ModelContract
validate :user_authorized

def self.model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module BacklogBuckets
module Backlogs::Buckets
class CreateContract < BaseContract
attribute :project_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module BacklogBuckets
module Backlogs::Buckets
class DeleteContract < ::DeleteContract
delete_permission :create_sprints
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Sprints
module Backlogs::Buckets
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have matched with modules/backlogs/app/contracts/backlogs/sprints/update_contract.rb instead

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - rename heuristics are a bit wonky!

class UpdateContract < BaseContract
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Projects
module Backlogs::Projects
class BacklogSettingsContract < ::ModelContract
stored_attribute :sprint_sharing, store: :settings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Projects
module Backlogs::Projects
class BacklogsTypesAndStatusesContract < ::ModelContract
validate :validate_permissions
validate :validate_done_status_ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Sprints
module Backlogs::Sprints
class BaseContract < ::ModelContract
validate :user_authorized

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Sprints
module Backlogs::Sprints
class CreateContract < BaseContract
validate :no_receiving_project

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Sprints
module Backlogs::Sprints
class FinishContract < ModelContract
validate :sprint_must_be_active
validate :user_allowed_to_finish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module Sprints
module Backlogs::Sprints
class StartContract < ::BaseContract
validate :validate_permission
validate :validate_status_in_planning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module BacklogBuckets
module Backlogs::Sprints
Comment on lines 30 to +31
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have matched with modules/backlogs/app/contracts/backlogs/buckets/update_contract.rb instead

class UpdateContract < BaseContract
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
# ++

module WorkPackages
module Backlogs::WorkPackages
# Contract used for moving work packages between two sprints at the end
# of a sprint. It does not enforce permissions as this change is carried
# out in the background.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

module WorkPackages
module Backlogs::WorkPackages
# Contract used for moving work packages to the product backlog (sprint = nil, backlog_bucket = nil):
# * at the end of a sprint
# * upon bucket deletion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

module Backlogs
class BacklogController < BaseController
include WorkPackages::WithSplitView
include ::WorkPackages::WithSplitView

current_menu_item %i[show details] do
:backlog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#++

module Backlogs
class BacklogBucketsController < BaseController
class BucketsController < BaseController
include OpTurbo::ComponentStream

before_action :find_backlog_bucket, only: %i[edit_dialog destroy_dialog update destroy]
Expand All @@ -49,7 +49,7 @@ def destroy_dialog
end

def create
call = ::BacklogBuckets::CreateService
call = ::Backlogs::Buckets::CreateService
.new(user: current_user)
.call(attributes: backlog_bucket_params)

Expand All @@ -63,7 +63,7 @@ def create
end

def update
call = ::BacklogBuckets::UpdateService
call = ::Backlogs::Buckets::UpdateService
.new(user: current_user, model: @backlog_bucket)
.call(attributes: edit_backlog_bucket_params)

Expand All @@ -77,7 +77,7 @@ def update
end

def destroy
call = ::BacklogBuckets::DeleteService
call = ::Backlogs::Buckets::DeleteService
.new(user: current_user, model: @backlog_bucket)
.call

Expand Down
16 changes: 8 additions & 8 deletions modules/backlogs/app/controllers/backlogs/sprints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SprintsController < BaseController
before_action :authorize_finish!, only: :finish

def new_dialog
call = ::Sprints::SetAttributesService.new(
call = ::Backlogs::Sprints::SetAttributesService.new(
user: current_user,
model: Sprint.new,
contract_class: ::EmptyContract
Expand All @@ -65,7 +65,7 @@ def refresh_form
id = edit_sprint_params.dig(:sprint, :id)
sprint = id.present? ? Sprint.for_project(@project).visible.find(id) : Sprint.new

call = ::Sprints::SetAttributesService.new(
call = ::Backlogs::Sprints::SetAttributesService.new(
user: current_user,
model: sprint,
contract_class: ::EmptyContract
Expand All @@ -77,7 +77,7 @@ def refresh_form
end

def create # rubocop:disable Metrics/AbcSize
call = ::Sprints::CreateService
call = ::Backlogs::Sprints::CreateService
.new(user: current_user)
.call(attributes: converted_sprint_params)

Expand All @@ -91,7 +91,7 @@ def create # rubocop:disable Metrics/AbcSize
end

def update
call = ::Sprints::UpdateService
call = ::Backlogs::Sprints::UpdateService
.new(user: current_user, model: @sprint)
.call(attributes: sprint_params[:sprint])

Expand Down Expand Up @@ -184,13 +184,13 @@ def converted_sprint_params
end

def start_sprint
::Sprints::StartService
::Backlogs::Sprints::StartService
.new(user: current_user, model: @sprint)
.call(send_notifications: false)
end

def finish_sprint
::Sprints::FinishService
::Backlogs::Sprints::FinishService
.new(user: current_user, model: @sprint)
.call(
unfinished_action: params[:unfinished_action],
Expand Down Expand Up @@ -221,12 +221,12 @@ def start_finish_failure_message(action, reason)

def authorize_start!
deny_access unless current_user.allowed_in_project?(:view_sprints, @project) &&
::Sprints::StartContract.can_start?(user: current_user, sprint: @sprint, project: @project)
::Backlogs::Sprints::StartContract.can_start?(user: current_user, sprint: @sprint, project: @project)
end

def authorize_finish!
deny_access unless current_user.allowed_in_project?(:view_sprints, @project) &&
::Sprints::StartContract.can_start_or_complete?(user: current_user, sprint: @sprint)
::Backlogs::Sprints::StartContract.can_start_or_complete?(user: current_user, sprint: @sprint)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def move
# Capture the source before the call; the service reloads @work_package internally via #move_after.
source = @work_package.sprint

call = Stories::UpdateService.new(user: current_user, story: @work_package)
call = ::Backlogs::WorkPackages::UpdateService.new(user: current_user, story: @work_package)
.call(**move_params.to_h.symbolize_keys)

if call.success?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def show; end

def update
call = Projects::UpdateService
.new(model: @project, user: current_user, contract_class: Projects::BacklogSettingsContract)
.new(model: @project, user: current_user, contract_class: ::Backlogs::Projects::BacklogSettingsContract)
.call(backlog_settings_params)

if call.success?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def update
call = Projects::UpdateService
.new(model: @project,
user: current_user,
contract_class: Projects::BacklogsTypesAndStatusesContract)
contract_class: ::Backlogs::Projects::BacklogsTypesAndStatusesContract)
.call(backlogs_settings_params)

if call.success?
Expand All @@ -50,7 +50,7 @@ def update
end

def rebuild_positions
WorkPackages::RebuildPositionsService.new(project: @project).call
::Backlogs::WorkPackages::RebuildPositionsService.new(project: @project).call
flash[:notice] = I18n.t("backlogs.positions_rebuilt_successfully")

redirect_back_or_to_backlogs_settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class BacklogBuckets::CreateService < BaseServices::Create
class Backlogs::Buckets::CreateService < BaseServices::Create
def instance_class
BacklogBucket
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class BacklogBuckets::DeleteService < BaseServices::Delete
class Backlogs::Buckets::DeleteService < BaseServices::Delete
private

def after_validate(service_call)
Expand All @@ -39,8 +39,8 @@ def after_validate(service_call)

def move_to_backlog
model.work_packages.order(position: :asc).map do |wp|
WorkPackages::UpdateService
.new(user:, model: wp, contract_class: WorkPackages::MoveToBacklogContract)
::WorkPackages::UpdateService
.new(user:, model: wp, contract_class: ::Backlogs::WorkPackages::MoveToBacklogContract)
.call(backlog_bucket: nil)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class BacklogBuckets::SetAttributesService < BaseServices::SetAttributes
class Backlogs::Buckets::SetAttributesService < BaseServices::SetAttributes
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class BacklogBuckets::UpdateService < BaseServices::Update
class Backlogs::Buckets::UpdateService < BaseServices::Update
def instance_class
BacklogBucket
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class Sprints::CreateService < BaseServices::Create
class Backlogs::Sprints::CreateService < BaseServices::Create
def instance_class
Sprint
end
Expand Down
Loading
Loading