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

added support for retracted journal entries

Jonas Jabari27e5956d196b
diff --git a/app/components/work_packages/activities_tab/journals/item_component.html.erb b/app/components/work_packages/activities_tab/journals/item_component.html.erb
index 5b945076288..09f463e2551 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component.html.erb
@@ -63,7 +63,11 @@
classes: "work-packages-activities-tab-journals-item-component--journal-notes-body",
data: { "test_selector": "op-journal-notes-body" }
) do
- content
+ unless noop?
+ content
+ else
+ render(Primer::Beta::Text.new(font_style: :italic, color: :subtle, mt: 1)) { I18n.t(:"journals.changes_retracted") }
+ end
end
end
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component.rb b/app/components/work_packages/activities_tab/journals/item_component.rb
index 8bdb2a4c138..15c512a5705 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component.rb
@@ -73,7 +73,11 @@ module WorkPackages
end
def show_comment_container?
- journal.notes.present? && filter != :only_changes
+ (journal.notes.present? || noop?) && filter != :only_changes
+ end
+
+ def noop?
+ journal.noop?
end
def activity_url
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
index 355308c8fb5..868fc847b82 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
@@ -2,7 +2,7 @@
case filter
when :only_comments
flex_layout(my: 0, border: :left, classes: "work-packages-activities-tab-journals-item-component-details--journal-details-container") do |details_container|
- render_empty_line(details_container) unless journal.notes.blank?
+ render_empty_line(details_container) unless journal.notes.blank? && !journal.noop?
end
when :only_changes
if journal.details.any?
diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rb
index 774610ea012..4aaf8df7ae5 100644
--- a/spec/features/activities/work_package/activities_spec.rb
+++ b/spec/features/activities/work_package/activities_spec.rb
@@ -926,21 +926,30 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
activity_tab.expect_journal_container_at_top
end
end
+ end
- # describe "scrolling to the bottom when sorting set to asc" do
- # it "scrolls to the bottom when the oldest journal entry is on top", :aggregate_failures do
- # # add a comment
- # activity_tab.add_comment(text: "First comment by admin")
+ describe "retracted journal entries" do
+ let(:work_package) { create(:work_package, project:, author: admin) }
+ let!(:first_comment_by_admin) do
+ create(:work_package_journal, user: admin, notes: "First comment by admin", journable: work_package, version: 2)
+ end
+ let!(:second_comment_by_admin) do
+ create(:work_package_journal, user: admin, notes: "Second comment by admin", journable: work_package, version: 3)
+ end
- # # scroll to the top
- # page.execute_script("document.querySelector('.op-wp-journals-container').scrollTop = 0")
+ current_user { admin }
- # # add another comment
- # activity_tab.add_comment(text: "Second comment by admin")
+ before do
+ second_comment_by_admin.update!(notes: "")
- # # expect the oldest comment to be at the bottom
- # activity_tab.expect_journal_notes(text: "First comment by admin")
- # end
- # end
+ wp_page.visit!
+ wp_page.wait_for_activity_tab
+ end
+
+ it "shows rectracted journal entries", :aggregate_failures do
+ activity_tab.within_journal_entry(second_comment_by_admin) do
+ expect(page).to have_text(I18n.t(:"journals.changes_retracted"))
+ end
+ end
end
end