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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Include requested changes
Mir Bhatia246f7bddf120
diff --git a/app/components/activities/item_component.html.erb b/app/components/activities/item_component.html.erbindex bd2610f92f4..9f0b6a5b650 100644--- a/app/components/activities/item_component.html.erb+++ b/app/components/activities/item_component.html.erb@@ -10,16 +10,17 @@datetime: @event.event_datetime,is_creation: @event.journal.initial?))%>- <% if @event.event_description.present? -%>+ <% if comment.present? -%>+ <ul class="op-activity-list--item-details">+ <li class="op-activity-list--item-detail">+ <strong>Comment added</strong>+ <p class="op-uc-p"><%= helpers.truncate_formatted_text(comment) %></p>+ </li>+ </ul>+ <% end -%>+ <% if description.present? -%><div class="op-activity-list--item-description">- <% if @event.journal.journable_type == "WorkPackage" -%>- <ul class="op-activity-list--item-description-comment">- <li class="op-activity-list--item-description-detail"><strong>Comment added</strong></li>- <%= helpers.truncate_formatted_text(@event.event_description) %>- </ul>- <% else -%>- <%= helpers.truncate_formatted_text(@event.event_description) %>- <% end -%>+ <%= helpers.truncate_formatted_text(description) %></div><% end -%><% if display_details? -%>diff --git a/app/components/activities/item_component.rb b/app/components/activities/item_component.rbindex ccfba09fb02..495162637ab 100644--- a/app/components/activities/item_component.rb+++ b/app/components/activities/item_component.rb@@ -61,4 +61,20 @@ class Activities::ItemComponent < ViewComponent::Basedef format_activity_title(text)helpers.truncate_single_line(text, length: 100)end++ def comment+ return unless work_package?++ @event.event_description+ end++ def description+ return if work_package?++ @event.event_description+ end++ def work_package?+ @event.journal.journable_type == "WorkPackage"+ endenddiff --git a/app/models/journal.rb b/app/models/journal.rbindex bb6a4c3b53e..419d48f9c38 100644--- a/app/models/journal.rb+++ b/app/models/journal.rb@@ -44,7 +44,6 @@ class Journal < ApplicationRecordregister_journal_formatter :template, OpenProject::JournalFormatter::Templateregister_journal_formatter :visibility, OpenProject::JournalFormatter::Visibilityregister_journal_formatter :subproject_named_association, OpenProject::JournalFormatter::SubprojectNamedAssociation- register_journal_formatter :subproject_plaintext, OpenProject::JournalFormatter::SubprojectPlaintext# Make sure each journaled model instance only has unique version idsvalidates :version, uniqueness: { scope: %i[journable_id journable_type] }diff --git a/app/models/project.rb b/app/models/project.rbindex c402cc8323f..15d38d18df4 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -106,8 +106,8 @@ class Project < ApplicationRecordregister_journal_formatted_fields(:active_status, 'active')register_journal_formatted_fields(:template, 'templated')- register_journal_formatted_fields(:subproject_plaintext, 'identifier')- register_journal_formatted_fields(:subproject_plaintext, 'name')+ register_journal_formatted_fields(:plaintext, 'identifier')+ register_journal_formatted_fields(:plaintext, 'name')register_journal_formatted_fields(:diff, 'description')register_journal_formatted_fields(:visibility, 'public')register_journal_formatted_fields(:subproject_named_association, 'parent_id')diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 1bc43e71f6a..02fac87c461 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -988,9 +988,6 @@ en:updated_on: "updated on %{datetime}"parent_without_of: "Subproject"parent_no_longer: "No longer subproject of"- text_journal_changed_html: "%{label} changed from %{old} %{linebreak}to %{new}"- text_journal_deleted: "%{label} %{old}"- text_journal_of: "%{label} %{value}"filter:changeset: "Changesets"message: "Forums"@@ -2843,12 +2840,14 @@ en:text_work_packages_destroy_confirmation: "Are you sure you want to delete the selected work package(s)?"text_work_packages_ref_in_commit_messages: "Referencing and fixing work packages in commit messages"text_journal_added: "%{label} %{value} added"- text_journal_changed_html: "%{label} changed from %{old} %{linebreak}<strong>to</strong> %{new}"+ text_journal_changed_html: "%{label} changed from %{old} %{linebreak}to %{new}"text_journal_changed_plain: "%{label} changed from %{old} %{linebreak}to %{new}"text_journal_changed_no_detail: "%{label} updated"text_journal_changed_with_diff: "%{label} changed (%{link})"text_journal_deleted: "%{label} deleted (%{old})"+ text_journal_deleted_subproject: "%{label} %{old}"text_journal_deleted_with_diff: "%{label} deleted (%{link})"+ text_journal_of: "%{label} %{value}"text_journal_set_to: "%{label} set to %{value}"text_journal_set_with_diff: "%{label} set (%{link})"text_journal_label_value: "%{label} %{value}"diff --git a/frontend/src/global_styles/content/_activity_list.sass b/frontend/src/global_styles/content/_activity_list.sassindex 84ec89408c1..92f71498b8f 100644--- a/frontend/src/global_styles/content/_activity_list.sass+++ b/frontend/src/global_styles/content/_activity_list.sass@@ -23,17 +23,6 @@@include spot-body-smallcolor: $spot-color-basic-gray-2- &-comment- @include spot-body-small- list-style-type: disc- padding: $spot-spacing-0_5- padding-left: $spot-spacing-2- margin: 0-- &-detail- &:not(:last-child)- margin-bottom: $spot-spacing-0_25-&-details@include spot-body-smalllist-style-type: discdiff --git a/lib/open_project/journal_formatter/subproject_named_association.rb b/lib/open_project/journal_formatter/subproject_named_association.rbindex f9984ab011e..18c1c282aa9 100644--- a/lib/open_project/journal_formatter/subproject_named_association.rb+++ b/lib/open_project/journal_formatter/subproject_named_association.rb@@ -52,13 +52,13 @@ class OpenProject::JournalFormatter::SubprojectNamedAssociation < JournalFormattenddef render_ternary_detail_text(label, value, old_value, options)- return I18n.t("activity.item.text_journal_deleted", label:, old: old_value) if value.blank?- return I18n.t("activity.item.text_journal_of", label:, value:) if old_value.blank?+ return I18n.t(:text_journal_deleted_subproject, label:, old: old_value) if value.blank?+ return I18n.t(:text_journal_of, label:, value:) if old_value.blank?linebreak = should_linebreak?(old_value.to_s, value.to_s)if options[:html]- I18n.t("activity.item.text_journal_changed_html",+ I18n.t(:text_journal_changed_html,label:,linebreak: linebreak ? "<br/>".html_safe : '',old: old_value,diff --git a/lib/open_project/journal_formatter/subproject_plaintext.rb b/lib/open_project/journal_formatter/subproject_plaintext.rbdeleted file mode 100644index 278d241a4d5..00000000000--- a/lib/open_project/journal_formatter/subproject_plaintext.rb+++ /dev/null@@ -1,51 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2023 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++-class OpenProject::JournalFormatter::SubprojectPlaintext < JournalFormatter::Base- private-- def render_ternary_detail_text(label, value, old_value, options)- return I18n.t(:text_journal_deleted, label:, old: old_value) if value.blank?- return I18n.t(:text_journal_set_to, label:, value:) if old_value.blank?-- linebreak = should_linebreak?(old_value.to_s, value.to_s)-- if options[:html]- I18n.t("activity.item.text_journal_changed_html",- label:,- linebreak: linebreak ? "<br/>".html_safe : '',- old: old_value,- new: value)- else- I18n.t(:text_journal_changed_plain,- label:,- linebreak: linebreak ? "\n" : '',- old: old_value,- new: value)- end- end-end