Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] dev from opf:dev #501

Merged
merged 138 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
8bc4a19
Introduce work package restricted comments as part of journal notes
akabiru Feb 26, 2025
6c55715
Bare-bones for writing restricted journals
akabiru Feb 27, 2025
7de921d
Exclude journals with restricted flag from aggregation
akabiru Feb 27, 2025
a3e685e
Update work package note contract with restriction
akabiru Feb 28, 2025
f8422e6
Add unit test case for restricted note in service
akabiru Feb 28, 2025
bd537a7
add default permissions
brunopagno Feb 27, 2025
7b47777
add new permissions for comments with restricted visibility
brunopagno Feb 27, 2025
12ee79e
Merge pull request #18095 from opf/impl/60978-new-permissions-for-com…
brunopagno Mar 4, 2025
d9f597f
Merge branch 'dev' into implementation/60980-introduce-work-package-r…
akabiru Mar 7, 2025
0774b69
hide restricted journals when user does not have access
brunopagno Mar 3, 2025
01a376a
include specs
brunopagno Mar 5, 2025
f2eb4e6
implement scope for fetching restricted journals
brunopagno Mar 6, 2025
a69319a
Update spec/models/journal_spec.rb
brunopagno Mar 10, 2025
47103e1
Use same restriction aggregation model
akabiru Mar 10, 2025
b509d86
Merge branch 'dev' into implementation/60980-introduce-work-package-r…
akabiru Mar 10, 2025
00e093c
Merge remote-tracking branch 'origin/impl/60978-new-permissions-for-c…
akabiru Mar 10, 2025
b452aec
Merge branch 'implementation/60980-introduce-work-package-restricted-…
akabiru Mar 10, 2025
f0a222a
Merge pull request #18131 from opf/impl/60989-hide-restricted-comments
brunopagno Mar 10, 2025
9d1dc35
introduce feature flag for comments with restricted visibility
brunopagno Mar 10, 2025
49b74d2
Merge pull request #18217 from opf/impl/62009-restricted-comments-fea…
brunopagno Mar 11, 2025
ceb7d8f
rename permission from write to add
brunopagno Mar 12, 2025
1ed6670
Merge pull request #18253 from opf/impl/60978-rename-permission
brunopagno Mar 12, 2025
90b98f8
[#60979] Add capability to create work package comments with restrict…
akabiru Feb 28, 2025
e77899a
Mark restricted comment with different color shades
akabiru Mar 4, 2025
d3969f1
change primer icon size so it fits well with lock icon
akabiru Mar 4, 2025
30c0351
Draft out restricted comment box
akabiru Mar 4, 2025
de48bdb
Implement design refresh with primer colors
akabiru Mar 5, 2025
25f4652
Relocate restricted comment stimulus controller closer to comment
akabiru Mar 5, 2025
bb00f00
Add visibility explainer
akabiru Mar 5, 2025
0b5277d
Use simpler default caption interface
akabiru Mar 5, 2025
a89f437
Use domain names for stimulus action and target
akabiru Mar 5, 2025
c0b97e8
Use cascade instead of primer classes
akabiru Mar 5, 2025
44c0b2a
Adapt existing BEM format
akabiru Mar 5, 2025
483aac6
Revert "Use simpler default caption interface"
akabiru Mar 6, 2025
273864b
Add border top to restricted comment input
akabiru Mar 6, 2025
631104b
Revert "Revert "Use simpler default caption interface""
akabiru Mar 6, 2025
8da2669
fix: ensure form state is reset on submit
akabiru Mar 7, 2025
e427094
Ensure background color is reset on form submit end
akabiru Mar 7, 2025
570cb30
Declare restricted comment highlight class as stimulus class attributes
akabiru Mar 11, 2025
99ff0f8
Simplify highlight toggle via `classList.toggle()`
akabiru Mar 11, 2025
139751f
Adopt permission model for restricted comments
akabiru Mar 11, 2025
ce611a2
Include test scenarios for restricted comments edit
akabiru Mar 11, 2025
021515c
Revert "Simplify highlight toggle via `classList.toggle()`"
akabiru Mar 11, 2025
7a97fcc
Remove leftover debug logs
akabiru Mar 12, 2025
b901590
Extend comments with restricted visibility feature flag (#18245)
akabiru Mar 12, 2025
450e34a
Update add restricted comment permission name
akabiru Mar 12, 2025
457a3f8
feature flag icon size
akabiru Mar 12, 2025
ab54c8f
[#60979] Add capability to create work package comments with restrict…
akabiru Feb 28, 2025
5f83b65
Merge pull request #18144 from opf/implementation/60979-add-capabilit…
akabiru Mar 12, 2025
bc62ffb
Amend editor dismiss strategy to be less eager
akabiru Mar 12, 2025
0ab37fd
Delete unused function
akabiru Mar 12, 2025
5bc284a
Use safe navigation syntax sugar
akabiru Mar 12, 2025
50e32dd
Add feature specs for Esc key dismiss strategy
akabiru Mar 12, 2025
c0cb078
Require confirmation on Kbd Esc with editor content
akabiru Mar 12, 2025
e6b510e
Enable comments with restricted visibility feature flag in pull preview
akabiru Mar 13, 2025
01cd498
Merge branch 'dev' into implementation/60980-introduce-work-package-r…
akabiru Mar 13, 2025
380678e
[rubocop] Use `expect(journal: [:notes, :restricted])` instead.
akabiru Mar 13, 2025
b790c4a
Touch up aggregation explainer
akabiru Mar 13, 2025
ab38e68
Merge branch 'implementation/60980-introduce-work-package-restricted-…
akabiru Mar 13, 2025
85fac25
[#62139] Implement redesign of "restricted visibility" checkbox place…
akabiru Mar 13, 2025
210f8aa
Rename editor close action to be more logical
akabiru Mar 13, 2025
81002ac
Attempt to align learn more link
akabiru Mar 13, 2025
7dfb97d
Ensure form is reset on cancel
akabiru Mar 13, 2025
cf74eb3
Add specs for cancel action + several fixes
akabiru Mar 13, 2025
99d25c4
Let the editor take the full width
akabiru Mar 13, 2025
25b5f9c
[rubocop] Consider using explicit block argument in the surrounding m…
akabiru Mar 13, 2025
fc3d8a5
Exclude learn more link on mobile layout
akabiru Mar 14, 2025
9c9b2f2
[stimulus] Duplicate definition of Stimulus Value "notificationCenter…
akabiru Mar 14, 2025
5871427
Replace inheritance attempt with stimulus outlets instead
akabiru Mar 14, 2025
1fa19e0
add failed contract error message
akabiru Mar 17, 2025
9bb1da4
Enhance wp note contract to include feature flag
akabiru Mar 17, 2025
ba6b54a
[rubocop] Assignment Branch Condition size for wrapper_data_attribute…
akabiru Mar 17, 2025
08212a6
remove individual workpackage permissions for comments with restricte…
brunopagno Mar 17, 2025
2af602f
remove editorEscape event listener on disconnect
akabiru Mar 18, 2025
dd3288b
remove debugLog, seemingly unneeded
akabiru Mar 18, 2025
5b39084
translation should be in base yml
akabiru Mar 18, 2025
ee6448c
Merge pull request #18262 from opf/implementation/62138-adjust-activi…
akabiru Mar 18, 2025
8c7636f
Merge pull request #18302 from opf/implementation/62139-implement-red…
akabiru Mar 18, 2025
8e9398b
Merge branch 'dev' into implementation/60980-introduce-work-package-r…
akabiru Mar 18, 2025
466e469
Make Git SCM interactions frozen string compatible
NobodysNightmare Mar 18, 2025
fbd9a4f
Merge pull request #18332 from opf/fix/60978-permissions-only-on-project
brunopagno Mar 18, 2025
7c44824
stop event bubbling on kbd esc emit
akabiru Mar 18, 2025
6d0f593
[eslint] ensure values in comparison are of the same type
akabiru Mar 18, 2025
53ced0d
Fix typo in comments
akabiru Mar 18, 2025
8e82584
Allow browser confirm dialog
akabiru Mar 18, 2025
29ffb75
Enable comments ID URL feature in pull preview
akabiru Mar 18, 2025
357b68b
Use method call instead
akabiru Mar 18, 2025
11a3585
Ensure cancel and submit buttons are always aligned to the right
akabiru Mar 19, 2025
a7bdade
adjust query for restricted visibility "events"
brunopagno Mar 19, 2025
5e05264
Fix failing test in mentions
akabiru Mar 19, 2025
277ff43
Merge branch 'implementation/60980-introduce-work-package-restricted-…
brunopagno Mar 19, 2025
1041225
Primer Colors for Work Package Comments with Restricted Visibility
akabiru Mar 18, 2025
078c326
Define restricted extension on work package journals for query safety
akabiru Mar 19, 2025
d0715a2
[62300] Fix 500 error when clicking manual scheduling mode button
cbliard Mar 19, 2025
9ea722b
Update to brown pallette
akabiru Mar 20, 2025
1a46fc8
Replace implicit block with named parameter for clarity
akabiru Mar 20, 2025
3026eeb
adjust pluck to select + inline
brunopagno Mar 20, 2025
7a0092b
docs fixes (#18385)
MayaBerd Mar 20, 2025
6b8b48f
update omniauth-saml to 10.1.6, remove duplicate definition
machisuji Mar 20, 2025
01d8ede
[62341] Correctly convert dates when timezone is negative in datepicker
cbliard Mar 20, 2025
1564355
Merge pull request #18376 from opf/bug/62300-activerecordrecordnotfou…
cbliard Mar 20, 2025
b364205
[62362] Show "working days only" checkbox only if date form is shown too
cbliard Mar 20, 2025
23c2e0f
Update test with single date mode
cbliard Mar 20, 2025
4186257
Merge pull request #18391 from opf/bug/62362-calendar-resets-if-user-…
cbliard Mar 20, 2025
b0ffd90
Merge pull request #18389 from opf/bug/62341-date-picker-not-working-…
cbliard Mar 20, 2025
dbf468a
Update i18n config
dombesz Mar 10, 2025
c8f1454
[62261] Fix error displayed when switching parent to automatic
cbliard Mar 20, 2025
fa430e5
Merge pull request #18387 from opf/maintenance/update-omniauth-saml
machisuji Mar 20, 2025
8405080
Merge pull request #18392 from opf/bug/62261-invalid-error-displayed-…
cbliard Mar 20, 2025
fb82c3c
Deindent OIDC authentication request specs
NobodysNightmare Mar 20, 2025
f794f26
Merge pull request #18366 from opf/implementation/60980-use-ar-extens…
akabiru Mar 20, 2025
0ebca28
Merge pull request #18367 from opf/fix/60989-improve-fetcher-query
brunopagno Mar 20, 2025
97bae84
Add release-notes file
machisuji Mar 20, 2025
ced4b9c
Update publiccode.yml
machisuji Mar 20, 2025
0c6e9ea
Bumped version to 15.4.2
machisuji Mar 20, 2025
f568373
Extact quote comments into standalone controller
akabiru Mar 20, 2025
35735b6
Use `display-brown-borderColor-emphasis` for the border
akabiru Mar 20, 2025
be9afb3
Merge remote-tracking branch 'origin/dev' into implementation/60980-i…
brunopagno Mar 20, 2025
c1bbbab
update locales from crowdin [ci skip]
openprojectci Mar 21, 2025
240a17e
Bump codemirror from 5.65.18 to 5.65.19 in /frontend
dependabot[bot] Mar 21, 2025
e4662a8
Bump aws-sdk-core from 3.220.1 to 3.220.2 in the aws-gems group
dependabot[bot] Mar 21, 2025
c90e61a
Translate CostEntry model
top4ek Mar 21, 2025
29919e7
Merge pull request #18401 from top4ek/patch-4
klaustopher Mar 21, 2025
c4ea004
Merge branch 'dev' into merge-release/15.4-20250321034135
klaustopher Mar 21, 2025
e0bd03f
Merge pull request #18397 from opf/merge-release/15.4-20250321034135
klaustopher Mar 21, 2025
308b152
Merge pull request #18402 from opf/deindent-specs
NobodysNightmare Mar 21, 2025
dfa5033
Define restricted comments quoting criteria
akabiru Mar 20, 2025
1aea415
Add test case for quoting multiple restricted and unrestricted comments
akabiru Mar 21, 2025
9254492
Define shared stimulus controllers mixin for activities tab
akabiru Mar 21, 2025
a40079f
[#62317] redefine WorkPackageCustomField#visible_by_user scope
EinLama Mar 19, 2025
97587b6
Merge pull request #18399 from opf/dependabot/bundler/dev/aws-gems-eb…
klaustopher Mar 21, 2025
dd666a2
Merge pull request #18210 from opf/fix-update-i18n-config
dombesz Mar 21, 2025
af9ebbd
Merge pull request #18398 from opf/dependabot/npm_and_yarn/frontend/d…
dombesz Mar 21, 2025
2f716a0
Merge pull request #18091 from opf/implementation/60980-introduce-wor…
brunopagno Mar 21, 2025
ed267b7
Merge pull request #18405 from opf/bug/62317-use-correct-scope-for-re…
ulferts Mar 21, 2025
eb7b437
Merge pull request #18349 from opf/git-frozen-strings
NobodysNightmare Mar 21, 2025
acfbbfa
Merge pull request #18360 from opf/open-point/61949-primer-colors-for…
akabiru Mar 21, 2025
16dc8a2
Merge pull request #18388 from opf/implementation/60983-define-quotin…
akabiru Mar 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
echo "OPENPROJECT_LOOKBOOK__ENABLED=true" >> .env.pullpreview
echo "OPENPROJECT_HSTS=false" >> .env.pullpreview
echo "OPENPROJECT_NOTIFICATIONS_POLLING_INTERVAL=10000" >> .env.pullpreview
echo "OPENPROJECT_FEATURE_WORK_PACKAGE_COMMENT_ID_URL_ACTIVE=true" >> .env.pullpreview
echo "OPENPROJECT_FEATURE_COMMENTS_WITH_RESTRICTED_VISIBILITY_ACTIVE=true" >> .env.pullpreview
- name: Boot as BIM edition
if: contains(github.ref, 'bim/') || contains(github.head_ref, 'bim/')
run: |
Expand Down
11 changes: 5 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ PATH
remote: modules/auth_saml
specs:
openproject-auth_saml (1.0.0)
omniauth-saml (~> 1.10.5)
omniauth-saml (~> 1.10.6)

PATH
remote: modules/avatars
Expand Down Expand Up @@ -353,8 +353,8 @@ GEM
awesome_nested_set (3.8.0)
activerecord (>= 4.0.0, < 8.1)
aws-eventstream (1.3.2)
aws-partitions (1.1062.0)
aws-sdk-core (3.220.1)
aws-partitions (1.1071.0)
aws-sdk-core (3.220.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand Down Expand Up @@ -1369,7 +1369,6 @@ DEPENDENCIES
omniauth!
omniauth-openid-connect!
omniauth-openid_connect-providers!
omniauth-saml (~> 1.10.1)
op-clamav-client (~> 3.4)
openproject-auth_plugins!
openproject-auth_saml!
Expand Down Expand Up @@ -1516,8 +1515,8 @@ CHECKSUMS
auto_strip_attributes (2.6.0) sha256=a7e2e0cf744de2bcd947fd68014220702bcc88c81274c1cd9ce6f7316aae39b0
awesome_nested_set (3.8.0) sha256=469daff411d80291dbb80d1973133e498048a7afc2519c545f62d2cdebc60eda
aws-eventstream (1.3.2) sha256=7e2c3a55ca70d7861d5d3c98e47daa463ed539c349caba22b48305b8919572d7
aws-partitions (1.1062.0) sha256=b7095f9a71d209da2c33396a339771039ed1c31e45f2b0c01c4eff4be496576a
aws-sdk-core (3.220.1) sha256=9e10ccfd63c8061fb70a0f1e26cf7dd81cb5070931301501fb6f49587cc54d32
aws-partitions (1.1071.0) sha256=e7417a3fbdb81fd9baaa096c04e7eea46f2e0184e8f9cb4a860681b7847b9ee2
aws-sdk-core (3.220.2) sha256=b6b2cd7fbe9310fed3ba9c89cb1de820d882dd448ffc797b0621c4046694cd63
aws-sdk-kms (1.99.0) sha256=ba292fc3ffd672532aae2601fe55ff424eee78da8e23c23ba6ce4037138275a8
aws-sdk-s3 (1.182.0) sha256=d0fc3579395cb6cb69bf6e975240ce031fc673190e74c8dddbdd6c18572b450d
aws-sdk-sns (1.97.0) sha256=e0489eb11cc107496738c2b39628842df970f4534bdc81a2254d2b49f7d0b7f6
Expand Down
6 changes: 0 additions & 6 deletions Gemfile.modules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
##
# Defines OpenProject (CE) modules and their dependencies
# the dependencies from the gemspec from a git repo are ignored
# see also https://github.com/bundler/bundler/issues/1041
gem 'omniauth-saml', '~> 1.10.1'

group :development, :test do
gem 'ladle'
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 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.
# ++

module WorkPackages
module ActivitiesTab
module StimulusControllers
def index_stimulus_controller(suffix = nil) = "work-packages--activities-tab--index#{suffix}"
def restricted_comment_stimulus_controller(suffix = nil) = "work-packages--activities-tab--restricted-comment#{suffix}"
def quote_comments_stimulus_controller(suffix = nil) = "work-packages--activities-tab--quote-comment#{suffix}"

def items_index_selector = "##{WorkPackages::ActivitiesTab::IndexComponent.wrapper_key}"

def add_comment_selector
"##{WorkPackages::ActivitiesTab::IndexComponent.add_comment_wrapper_key}"
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
end
if adding_comment_allowed?
journals_wrapper_container.with_row(
id: add_comment_wrapper_key,
classes: "work-packages-activities-tab-index-component--input-container work-packages-activities-tab-index-component--input-container_sort-#{journal_sorting}",
px: 2,
py: 3,
bg: :subtle
bg: :subtle,
data: add_comment_wrapper_data_attributes
) do
render(
WorkPackages::ActivitiesTab::Journals::NewComponent.new(work_package:)
Expand Down
46 changes: 33 additions & 13 deletions app/components/work_packages/activities_tab/index_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class IndexComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
include WorkPackages::ActivitiesTab::SharedHelpers
include WorkPackages::ActivitiesTab::StimulusControllers

def initialize(work_package:, last_server_timestamp:, filter: :all, deferred: false)
super
Expand All @@ -45,26 +46,41 @@ def initialize(work_package:, last_server_timestamp:, filter: :all, deferred: fa
@deferred = deferred
end

def self.add_comment_wrapper_key = "work-packages-activities-tab-add-comment-component"
delegate :add_comment_wrapper_key, to: :class

private

attr_reader :work_package, :filter, :last_server_timestamp, :deferred

def wrapper_data_attributes
stimulus_controller = "work-packages--activities-tab--index"

def wrapper_data_attributes # rubocop:disable Metrics/AbcSize
{
test_selector: "op-wp-activity-tab",
controller: stimulus_controller,
controller: index_stimulus_controller,
"application-target": "dynamic",
"#{stimulus_controller}-update-streams-path-value": update_streams_work_package_activities_path(work_package),
"#{stimulus_controller}-sorting-value": journal_sorting,
"#{stimulus_controller}-filter-value": filter,
"#{stimulus_controller}-user-id-value": User.current.id,
"#{stimulus_controller}-work-package-id-value": work_package.id,
"#{stimulus_controller}-polling-interval-in-ms-value": polling_interval,
"#{stimulus_controller}-notification-center-path-name-value": notifications_path,
"#{stimulus_controller}-show-conflict-flash-message-url-value": show_conflict_flash_message_work_packages_path,
"#{stimulus_controller}-last-server-timestamp-value": last_server_timestamp
index_stimulus_controller("-notification-center-path-name-value") => notifications_path,
index_stimulus_controller("-update-streams-path-value") => update_streams_work_package_activities_path(work_package),
index_stimulus_controller("-sorting-value") => journal_sorting,
index_stimulus_controller("-filter-value") => filter,
index_stimulus_controller("-user-id-value") => User.current.id,
index_stimulus_controller("-work-package-id-value") => work_package.id,
index_stimulus_controller("-polling-interval-in-ms-value") => polling_interval,
index_stimulus_controller("-show-conflict-flash-message-url-value") => show_conflict_flash_message_work_packages_path,
index_stimulus_controller("-last-server-timestamp-value") => last_server_timestamp,
index_stimulus_controller("-unsaved-changes-confirmation-message-value") => unsaved_changes_confirmation_message
}
end

def add_comment_wrapper_data_attributes
{
test_selector: "op-work-package-journal--new-comment-component",
controller: restricted_comment_stimulus_controller,
"application-target": "dynamic",
restricted_comment_stimulus_controller("-target") => "formContainer",
action: index_stimulus_controller(":onSubmit-end@window->#{restricted_comment_stimulus_controller}#onSubmitEnd"),
restricted_comment_stimulus_controller("-highlight-class") => "work-packages-activities-tab-journals-new-component--journal-notes-body__restricted-comment", # rubocop:disable Layout/LineLength
restricted_comment_stimulus_controller("-hidden-class") => "d-none",
restricted_comment_stimulus_controller("-#{index_stimulus_controller}-outlet") => "##{wrapper_key}"
}
end

Expand All @@ -80,6 +96,10 @@ def polling_interval
def adding_comment_allowed?
User.current.allowed_in_work_package?(:add_work_package_notes, @work_package)
end

def unsaved_changes_confirmation_message
I18n.t("activities.work_packages.activity_tab.unsaved_changes_confirmation_message")
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def fetch_journals
API::V3::Activities::ActivityEagerLoadingWrapper.wrap(
work_package
.journals
.restricted_visible
.includes(:user, :customizable_journals, :attachable_journals, :storable_journals, :notifications)
.reorder(version: journal_sorting)
.with_sequence_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
data: {
"anchor-activity-id": journal.sequence_version,
"anchor-comment-id": journal.id
}
},
classes: container_classes
)
) 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,
Expand Down Expand Up @@ -63,18 +68,33 @@
end
header_container.with_column(flex_layout: true, align_items: :center) do |header_end_container|
if has_unread_notifications?
header_end_container.with_column(mr: 2, pt: 1) do
header_end_container.with_column(mr: 2) do
render(
Primer::Beta::Octicon.new(
:"dot-fill", # color is set via CSS as requested by UI/UX Team
classes: "work-packages-activities-tab-journals-item-component--notification-dot-icon",
size: :medium,
size: (OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? ? :small : :medium),
data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }
)
)
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" },
color: (journal.restricted? ? :attention : :default)
)
)
end
end

unless OpenProject::FeatureDecisions.work_package_comment_id_url_active?
header_end_container.with_column do
activity_anchor_link(journal)
Expand All @@ -100,7 +120,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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ module ActivitiesTab
module Journals
class ItemComponent < ApplicationComponent
include ApplicationHelper
include WorkPackages::ActivitiesTab::SharedHelpers
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
include WorkPackages::ActivitiesTab::SharedHelpers
include WorkPackages::ActivitiesTab::StimulusControllers

def initialize(journal:, filter:, grouped_emoji_reactions:, state: :show)
super
Expand All @@ -60,6 +61,30 @@ def wrapper_data_attributes
}
end

def container_classes
[].tap do |classes|
if journal.restricted?
classes << "work-packages-activities-tab-journals-item-component--container__restricted-comment"
end
end
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
Expand Down Expand Up @@ -116,18 +141,27 @@ def quote_action_item(menu)
menu.with_item(label: t("js.label_quote_comment"),
tag: :button,
content_arguments: {
data: {
action: "click->work-packages--activities-tab--index#quote",
"content-param": journal.notes,
"user-id-param": journal.user_id,
"user-name-param": journal.user.name,
"text-wrote-param": t(:text_wrote),
test_selector: "op-wp-journal-#{journal.id}-quote"
}
data: quote_action_data_attributes
}) do |item|
item.with_leading_visual_icon(icon: :quote)
end
end

def quote_action_data_attributes # rubocop:disable Metrics/AbcSize
{
controller: quote_comments_stimulus_controller,
"application-target": "dynamic",
action: "click->#{quote_comments_stimulus_controller}#quote:prevent",
quote_comments_stimulus_controller("-content-param") => journal.notes,
quote_comments_stimulus_controller("-user-id-param") => journal.user_id,
quote_comments_stimulus_controller("-user-name-param") => journal.user.name,
quote_comments_stimulus_controller("-is-restricted-param") => journal.restricted?,
quote_comments_stimulus_controller("-text-wrote-param") => I18n.t(:text_wrote),
quote_comments_stimulus_controller("-#{index_stimulus_controller}-outlet") => items_index_selector,
quote_comments_stimulus_controller("-#{restricted_comment_stimulus_controller}-outlet") => add_comment_selector,
test_selector: "op-wp-journal-#{journal.id}-quote"
}
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@
color: var(--bgColor-accent-emphasis)
&--header-start-container
flex-grow: 1

&--container__restricted-comment
border-color: var(--display-brown-borderColor-emphasis)
&--header__restricted-comment
border-color: var(--display-brown-borderColor-emphasis)
background-color: var(--display-brown-bgColor-muted)
&--journal-notes-body__restricted-comment
border-color: var(--display-brown-borderColor-emphasis)

Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def render_notification_bubble(container)
render(Primer::Beta::Octicon.new(
:"dot-fill", # color is set via CSS as requested by UI/UX Team
classes: "work-packages-activities-tab-journals-item-component-details--notification-dot-icon",
size: :medium,
size: (OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? ? :small : :medium),
data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }
))
end
Expand Down
Loading
Loading