Skip to content

Commit

Permalink
Remove link to work package fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Sep 26, 2024
1 parent a73e90b commit c787d59
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ export class WorkPackageNotificationService extends HalResourceNotificationServi
type: 'success',
};

// The WorkPackageNotificationService is injected for the whole wpIsolatedQuerySpace as the notification service.
// However, when logging time on a WP, the provided resource is a TimeEntryResource.
// Thus, the link in the toast would link to the WP with the ID of the TimeEntryResource (see #50731).
// That is why, we check for WorkPackageResources and show the link only for them.
if (resource.$halType === 'WorkPackage') {
this.addWorkPackageFullscreenLink(message, resource);
}

this.ToastService.addSuccess(message);
}

Expand All @@ -75,14 +67,4 @@ export class WorkPackageNotificationService extends HalResourceNotificationServi

return super.showCustomError(errorResource, resource);
}

private addWorkPackageFullscreenLink(message:IToast, resource:HalResource) {
// Don't show the 'Show in full screen' link if we're there already
if (!this.$state.includes('work-packages.show')) {
message.link = {
target: () => this.$state.go('work-packages.show.tabs', { tabIdentifier: 'activity', workPackageId: resource.id }),
text: this.I18n.t('js.work_packages.message_successful_show_in_fullscreen'),
};
}
}
}
2 changes: 1 addition & 1 deletion modules/bim/spec/features/bcf/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
create_page.save!

index_page.expect_and_dismiss_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

if with_viewpoints
Expand Down
2 changes: 1 addition & 1 deletion modules/my_page/spec/features/my/assigned_to_me_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
project_field.set_value project.name

embedded_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

wp = WorkPackage.last
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
split_page.save!

wp_table.expect_and_dismiss_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)
wp = WorkPackage.last
expect(wp.subject).to eq "Foobar!"
Expand Down Expand Up @@ -140,7 +140,7 @@
subject_field.submit_by_enter

wp_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)
wp_table.dismiss_toaster!

Expand Down Expand Up @@ -203,7 +203,7 @@
subject_field.submit_by_enter

wp_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)
wp_table.dismiss_toaster!

Expand Down
15 changes: 5 additions & 10 deletions spec/features/work_packages/new/new_work_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def create_work_package_globally(type, project_name)
# safeguards
wp_page.dismiss_toaster!
wp_page.expect_no_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

subject_field.expect_state_text(subject)
Expand All @@ -115,7 +115,7 @@ def create_work_package_globally(type, project_name)
# safeguards
wp_page.dismiss_toaster!
wp_page.expect_no_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

wp_page.edit_field(:subject).expect_text(subject)
Expand Down Expand Up @@ -190,7 +190,7 @@ def create_work_package_globally(type, project_name)
end

it do
ids = custom_fields.map(&:id)
custom_fields.map(&:id)
cf1 = find(".#{custom_fields.first.attribute_name(:camel_case)} input")
expect(cf1).not_to be_nil

Expand Down Expand Up @@ -231,12 +231,7 @@ def create_work_package_globally(type, project_name)
create_work_package(type_task)
save_work_package!

wp_page.expect_toast message: "Successful creation. Click here to open this work package in fullscreen view."
page.find(".op-toast--target-link", text: "Click here to open this work package in fullscreen view.").click

full_page = Pages::FullWorkPackage.new(WorkPackage.last)
full_page.ensure_page_loaded
full_page.expect_subject
wp_page.expect_toast message: "Successful creation."
end

it "reloads the table and selects the new work package" do
Expand All @@ -262,7 +257,7 @@ def create_work_package_globally(type, project_name)
table_subject.expect_state_text new_subject

wp_page.expect_toast(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

new_wp.reload
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_packages/sorting/manual_sorting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def expect_query_order(query, expected)
subject_field.submit_by_enter

wp_table.expect_and_dismiss_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

wp_table.expect_work_package_subject "Foobar!"
Expand Down
4 changes: 2 additions & 2 deletions spec/features/work_packages/table/edit_work_packages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
subject_field.expect_text("New subject!")

wp_table.expect_toast(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

work_package.reload
Expand Down Expand Up @@ -187,7 +187,7 @@
cf_list.expect_inactive!

wp_table.expect_toast(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

work_package.reload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
callback.call

wp_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

# Expect new create row to exist
Expand All @@ -71,7 +71,7 @@
# safeguards
wp_table.dismiss_toaster!
wp_table.expect_no_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

# Expect no inline create open
Expand Down Expand Up @@ -127,7 +127,7 @@
subject_field.save!

wp_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

created_wp = WorkPackage.last
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def new_work_package_in_both(subject, description)
expect(page).to have_no_css(".wp-inline-create-row")

wp_table.expect_toast(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)
wp_table.dismiss_toaster!

Expand Down
10 changes: 5 additions & 5 deletions spec/features/work_packages/table/switch_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def req_text_field
text_field.save!

wp_table.expect_and_dismiss_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

# Switch type
Expand All @@ -98,7 +98,7 @@ def req_text_field
req_text_field.save!

wp_table.expect_and_dismiss_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

expect { text_field.display_element }.to raise_error(Capybara::ElementNotFound)
Expand All @@ -107,7 +107,7 @@ def req_text_field
type_field.set_value type_task.name

wp_table.expect_and_dismiss_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

expect(page).to have_no_css "#{req_text_field.selector} #{req_text_field.display_selector}"
Expand All @@ -133,7 +133,7 @@ def req_text_field
type_field.set_value type_task.name

wp_table.expect_and_dismiss_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)
end

Expand Down Expand Up @@ -167,7 +167,7 @@ def req_text_field
req_text_field.update "foobar"

wp_table.expect_and_dismiss_toaster(
message: "Successful update. Click here to open this work package in fullscreen view."
message: "Successful update."
)

req_text_field.expect_state_text "foobar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
subject_field.submit_by_enter

work_package_view.expect_and_dismiss_toaster(
message: "Successful creation. Click here to open this work package in fullscreen view."
message: "Successful creation."
)

work_package_view.expect_work_package_subject "Foobar!"
Expand Down

0 comments on commit c787d59

Please sign in to comment.