Skip to content

Commit

Permalink
Merge pull request #17546 from opf/disable-subject-editing
Browse files Browse the repository at this point in the history
Disable subject editing
  • Loading branch information
NobodysNightmare authored Jan 8, 2025
2 parents 4a96220 + efa3f18 commit df381fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
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

0 comments on commit df381fd

Please sign in to comment.