Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix inversed templated formatter

Christophe Bliard59a6e80b2714
diff --git a/lib/open_project/journal_formatter/template.rb b/lib/open_project/journal_formatter/template.rb
index 8821063ce16..2ed6e7b7fb7 100644
--- a/lib/open_project/journal_formatter/template.rb
+++ b/lib/open_project/journal_formatter/template.rb
@@ -29,7 +29,7 @@
class OpenProject::JournalFormatter::Template < JournalFormatter::Base
def render(_key, values, options = { html: true })
label_text = options[:html] ? content_tag('strong', "Template:") : "Template:"
- activated_text = values.last ? "Project un-marked as template" : "Project marked as template"
+ activated_text = values.last ? "Project marked as template" : "Project un-marked as template"
I18n.t(:text_journal_label_value, label: label_text, value: activated_text)
end
diff --git a/spec/lib/journal_formatter/template_spec.rb b/spec/lib/journal_formatter/template_spec.rb
index cb2056c38e8..5011b6fc79d 100644
--- a/spec/lib/journal_formatter/template_spec.rb
+++ b/spec/lib/journal_formatter/template_spec.rb
@@ -31,19 +31,23 @@ require 'spec_helper'
describe OpenProject::JournalFormatter::Template do
let(:instance) { described_class.new(build(:journal)) }
- it "renders correctly when un-marked as template" do
+ it "renders correctly when marked as template" do
html = instance.render("templated", [false, true], html: true)
- expect(html).to eq("<strong>Template:</strong> Project un-marked as template")
+ expect(html).to eq("<strong>Template:</strong> Project marked as template")
html = instance.render("templated", [false, true], html: false)
- expect(html).to eq("Template: Project un-marked as template")
+ expect(html).to eq("Template: Project marked as template")
+ html = instance.render("templated", [nil, true], html: false)
+ expect(html).to eq("Template: Project marked as template")
end
- it "renders correctly when marked as template" do
+ it "renders correctly when un-marked as template" do
html = instance.render("templated", [true, false], html: true)
- expect(html).to eq("<strong>Template:</strong> Project marked as template")
+ expect(html).to eq("<strong>Template:</strong> Project un-marked as template")
html = instance.render("templated", [true, false], html: false)
- expect(html).to eq("Template: Project marked as template")
+ expect(html).to eq("Template: Project un-marked as template")
+ html = instance.render("templated", [nil, false], html: false)
+ expect(html).to eq("Template: Project un-marked as template")
end
end