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

Mark restricted comment with different color shades

Kabiru Mwenjae77899a0ecda
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 7ef52962646..eee43422bdf 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
@@ -17,7 +17,11 @@
}
)
) do |border_box_component|
- border_box_component.with_header(px: 2, py: 1, data: { test_selector: "op-journal-notes-header" }) do
+ border_box_component.with_header(
+ px: 2, py: 1,
+ data: { test_selector: "op-journal-notes-header" },
+ classes: comment_header_classes
+ ) do
flex_layout(align_items: :center, justify_content: :space_between) do |header_container|
header_container.with_column(
flex_layout: true,
@@ -75,6 +79,20 @@
end
end
+ if journal.restricted?
+ header_end_container.with_column(mr: 2) do
+ render(
+ Primer::Beta::Octicon.new(
+ :lock,
+ classes: "work-packages-activities-tab-journals-item-component--restricted-icon",
+ size: :small,
+ aria: { label: I18n.t("activities.work_packages.activity_tab.restricted_journal") },
+ data: { test_selector: "op-journal-restricted-icon" }
+ )
+ )
+ end
+ end
+
unless OpenProject::FeatureDecisions.work_package_comment_id_url_active?
header_end_container.with_column do
activity_anchor_link(journal)
@@ -100,7 +118,7 @@
end
end
border_box_component.with_body(
- classes: "work-packages-activities-tab-journals-item-component--journal-notes-body",
+ classes: comment_body_classes,
data: { test_selector: "op-journal-notes-body" }
) do
if noop?
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 879f6bfb117..2284108be39 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component.rb
@@ -60,6 +60,22 @@ module WorkPackages
}
end
+ def comment_header_classes
+ [].tap do |classes|
+ if journal.restricted?
+ classes << "work-packages-activities-tab-journals-item-component__header--restricted-comment"
+ end
+ end
+ end
+
+ def comment_body_classes
+ ["work-packages-activities-tab-journals-item-component--journal-notes-body"].tap do |classes|
+ if journal.restricted?
+ classes << "work-packages-activities-tab-journals-item-component__journal-notes-body--restricted-comment"
+ end
+ end
+ end
+
def show_comment_container?
(journal.notes.present? || noop?) && filter != :only_changes
end
diff --git a/app/components/work_packages/activities_tab/journals/item_component.sass b/app/components/work_packages/activities_tab/journals/item_component.sass
index 31c09142304..79cdd833541 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.sass
+++ b/app/components/work_packages/activities_tab/journals/item_component.sass
@@ -11,5 +11,8 @@
color: var(--bgColor-accent-emphasis)
&--header-start-container
flex-grow: 1
-
+ &__header--restricted-comment
+ background-color: #ffd8b5 !important // base-color-orange-1 not defined in design tokens
+ &__journal-notes-body--restricted-comment
+ background-color: #ffe7d1 !important // base-color-orange-0 not defined in design tokens
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8c4d1d6549a..aeadc1833b9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -48,6 +48,7 @@ en:
changed: "changed"
created: "created"
commented: "commented"
+ restricted_journal: Only visible to a limited group of members.
admin:
plugins: