Skip to content
Merged
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
2 changes: 1 addition & 1 deletion app/models/work_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def to_s

def infoline(show_standard_type: true)
type_name = show_standard_type || !type.is_standard ? type.name : ""
"#{type_name}: #{subject} (##{id})"
"#{type_name}: #{subject} (#{formatted_id})"
end

# Return true if the work_package is closed, otherwise false
Expand Down
28 changes: 28 additions & 0 deletions spec/models/work_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,32 @@ def stub_shared_versions(version = nil)
end
end
end

describe "#infoline" do
let(:infoline_type) { create(:type, name: "Task") }
let(:infoline_work_package) do
create(:work_package, subject: "Hello world", project: infoline_project, type: infoline_type)
end

context "when semantic mode is active",
with_flag: { semantic_work_package_ids: true },
with_settings: { work_packages_identifier: "semantic" } do
let(:infoline_project) { create(:project, identifier: "MYPROJ") }

before { infoline_work_package }

it "renders the semantic identifier without a hash prefix" do
expect(infoline_work_package.reload.infoline).to eq("Task: Hello world (MYPROJ-1)")
end
end

context "when semantic mode is not active",
with_flag: { semantic_work_package_ids: false } do
let(:infoline_project) { create(:project) }

it "renders the hash-prefixed numeric id" do
expect(infoline_work_package.infoline).to eq("Task: Hello world (##{infoline_work_package.id})")
end
end
end
end
Loading