Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable subject editing #17546

Merged
merged 1 commit into from
Jan 8, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def available_custom_fields

def writable?(property)
property = property.to_s
return false if property == "subject" && type&.replacement_pattern_defined_for?(:subject)

# Special case for milestones + date property
property = "start_date" if property == "date" && milestone?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@
expect(subject).to be_writable(:priority)
end
end

describe "subject" do
it { is_expected.to be_writable(:subject) }

context "when the type has automatic subject generation enabled" do
let(:type) { build_stubbed(:type, patterns: { subject: { blueprint: "Hello world", enabled: true } }) }

it { is_expected.not_to be_writable(:subject) }
end
end
end

describe "#assignable_custom_field_values" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@
it "finish date is writable" do
expect(subject).to be_writable(:due_date)
end

it "subject is writable" do
expect(subject).to be_writable(:subject)
end

context "when the type has automatic subject generation enabled" do
let(:type) { create(:type, patterns: { subject: { blueprint: "Hello world", enabled: true } }) }

it "subject is not writable" do
expect(subject).not_to be_writable(:subject)
end
end
end

describe "#milestone?" do
Expand Down
Loading