Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/15.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
HDinger committed Nov 29, 2024
2 parents 2dd1c4d + bc6a30e commit d2a0bbb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ def initialize(work_package:, relation:, base_errors: nil)
end

def related_work_package
@related_work_package ||= @relation.to
@related_work_package ||= begin
related = @relation.to
# We cannot rely on the related WorkPackage being the "to",
# depending on the relation it can also be "from"
related.id == @work_package.id ? @relation.from : related
end
end

def submit_url_options
Expand Down
2 changes: 0 additions & 2 deletions docs/installation-and-operations/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ OPENPROJECT_SEED_ADMIN_USER_MAIL="[email protected]" # Email attribute to assign

Optionally, you can also lock the admin user that gets created right away. This is useful when you have an LDAP or SSO integration set up and you want to prevent the admin user from logging in.

```shell

> [!WARNING]
> With the admin user seeding disabled, you need to have an LDAP or SSO integration set up through environment variables.
> Otherwise, you will not be able to retain access to the system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,29 @@ def label_for_relation_type(relation_type)
expect(page).to have_no_css("[data-test-selector='op-relation-row-#{child_wp.id}-edit-button']")
end
end

context "with the shown WorkPackage being the 'to' relation part" do
let(:another_wp) { create(:work_package, type: type2, subject: "related to main") }

let(:relation_to) do
create(:relation,
from: another_wp,
to: work_package,
relation_type: Relation::TYPE_FOLLOWS)
end

it "shows the correct related WorkPackage in the dialog (regression #59771)" do
scroll_to_element relations_panel

relations_tab.open_relation_dialog(relation_to)

within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
expect(page).to have_field("Work package",
readonly: true,
with: "#{another_wp.type.name.upcase} ##{another_wp.id} - #{another_wp.subject}")
end
end
end
end

describe "creating a relation" do
Expand Down
32 changes: 14 additions & 18 deletions spec/support/components/work_packages/relations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,7 @@ def add_relation(type:, relatable:, description: nil)
end

def add_description_to_relation(relatable, description)
actual_relatable = find_relatable(relatable)
relation_row = find_row(actual_relatable)

within relation_row do
page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu").click
page.find_test_selector("op-relation-row-#{actual_relatable.id}-edit-button").click
end

wait_for_reload if using_cuprite?
open_relation_dialog(relatable)

within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
expect(page).to have_field("Work package", readonly: true)
Expand All @@ -192,15 +184,7 @@ def add_description_to_relation(relatable, description)
end

def edit_relation_description(relatable, description)
actual_relatable = find_relatable(relatable)
relation_row = find_row(actual_relatable)

within relation_row do
page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu").click
page.find_test_selector("op-relation-row-#{actual_relatable.id}-edit-button").click
end

wait_for_reload if using_cuprite?
open_relation_dialog(relatable)

within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
expect(page).to have_field("Work package", readonly: true)
Expand All @@ -214,6 +198,18 @@ def edit_relation_description(relatable, description)
end
end

def open_relation_dialog(relatable)
actual_relatable = find_relatable(relatable)
relation_row = find_row(actual_relatable)

within relation_row do
page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu").click
page.find_test_selector("op-relation-row-#{actual_relatable.id}-edit-button").click
end

wait_for_reload if using_cuprite?
end

def expect_relation(relatable)
find_row(relatable)
end
Expand Down

0 comments on commit d2a0bbb

Please sign in to comment.