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
adjust internal comments internal representation
Bruno Pagno97ccf0bfc570
diff --git a/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb b/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rbindex 246ec976f66..8855b59e40a 100644--- a/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb+++ b/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb@@ -32,7 +32,7 @@ module WorkPackagesmodule ActivitiesTabmodule StimulusControllersdef 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 internal_comment_stimulus_controller(suffix = nil) = "work-packages--activities-tab--internal-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}"diff --git a/app/components/settings/project_work_packages/header_component.rb b/app/components/settings/project_work_packages/header_component.rbindex 0d2d8af0372..e34faf4e07f 100644--- a/app/components/settings/project_work_packages/header_component.rb+++ b/app/components/settings/project_work_packages/header_component.rb@@ -61,7 +61,7 @@ module Settingsdef activity_titlelabel = t("label_activity").html_safe- unless EnterpriseToken.allows_to?(:comments_with_restricted_visibility)+ unless EnterpriseToken.allows_to?(:internal_comments)label << render(Primer::Beta::Octicon.new(icon: "op-enterprise-addons", classes: "upsale-colored", ml: 2))endlabeldiff --git a/app/components/work_packages/activities_tab/index_component.rb b/app/components/work_packages/activities_tab/index_component.rbindex d41535ead15..9944aa36bee 100644--- a/app/components/work_packages/activities_tab/index_component.rb+++ b/app/components/work_packages/activities_tab/index_component.rb@@ -74,14 +74,14 @@ module WorkPackagesdef add_comment_wrapper_data_attributes{test_selector: "op-work-package-journal--new-comment-component",- controller: restricted_comment_stimulus_controller,+ controller: internal_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}",- restricted_comment_stimulus_controller("-is-restricted-value") => false # Initial value+ internal_comment_stimulus_controller("-target") => "formContainer",+ action: index_stimulus_controller(":onSubmit-end@window->#{internal_comment_stimulus_controller}#onSubmitEnd"),+ internal_comment_stimulus_controller("-highlight-class") => "work-packages-activities-tab-journals-new-component--journal-notes-body__internal-comment", # rubocop:disable Layout/LineLength+ internal_comment_stimulus_controller("-hidden-class") => "d-none",+ internal_comment_stimulus_controller("-#{index_stimulus_controller}-outlet") => "##{wrapper_key}",+ internal_comment_stimulus_controller("-is-internal-value") => false # Initial value}enddiff --git a/app/components/work_packages/activities_tab/journals/index_component.rb b/app/components/work_packages/activities_tab/journals/index_component.rbindex 7b9477103c8..83df5efc70a 100644--- a/app/components/work_packages/activities_tab/journals/index_component.rb+++ b/app/components/work_packages/activities_tab/journals/index_component.rb@@ -71,7 +71,7 @@ module WorkPackagesAPI::V3::Activities::ActivityEagerLoadingWrapper.wrap(work_package.journals- .restricted_visible+ .internal_visible.includes(:user, :customizable_journals, :attachable_journals, :storable_journals, :notifications).reorder(version: journal_sorting).with_sequence_versiondiff --git a/app/components/work_packages/activities_tab/journals/item_component.html.erb b/app/components/work_packages/activities_tab/journals/item_component.html.erbindex 80b23ea7652..bc1471f0d89 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@@ -73,23 +73,23 @@Primer::Beta::Octicon.new(:"dot-fill", # color is set via CSS as requested by UI/UX Teamclasses: "work-packages-activities-tab-journals-item-component--notification-dot-icon",- size: (OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? ? :small : :medium),+ size: (OpenProject::FeatureDecisions.internal_comments_active? ? :small : :medium),data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }))endend- if journal.restricted?+ if journal.internal?header_end_container.with_column(mr: 2) dorender(Primer::Beta::Octicon.new(:lock,- classes: "work-packages-activities-tab-journals-item-component--restricted-icon",+ classes: "work-packages-activities-tab-journals-item-component--internal-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)+ aria: { label: I18n.t("activities.work_packages.activity_tab.internal_journal") },+ data: { test_selector: "op-journal-internal-icon" },+ color: (journal.internal? ? :attention : :default)))enddiff --git a/app/components/work_packages/activities_tab/journals/item_component.rb b/app/components/work_packages/activities_tab/journals/item_component.rbindex 80b005b78f2..df653d65afd 100644--- a/app/components/work_packages/activities_tab/journals/item_component.rb+++ b/app/components/work_packages/activities_tab/journals/item_component.rb@@ -63,24 +63,24 @@ module WorkPackagesdef container_classes[].tap do |classes|- if journal.restricted?- classes << "work-packages-activities-tab-journals-item-component--container__restricted-comment"+ if journal.internal?+ classes << "work-packages-activities-tab-journals-item-component--container__internal-comment"endendenddef comment_header_classes[].tap do |classes|- if journal.restricted?- classes << "work-packages-activities-tab-journals-item-component--header__restricted-comment"+ if journal.internal?+ classes << "work-packages-activities-tab-journals-item-component--header__internal-comment"endendenddef 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"+ if journal.internal?+ classes << "work-packages-activities-tab-journals-item-component--journal-notes-body__internal-comment"endendend@@ -163,10 +163,10 @@ module WorkPackagesquote_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("-is-internal-param") => journal.internal?,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,+ quote_comments_stimulus_controller("-#{internal_comment_stimulus_controller}-outlet") => add_comment_selector,test_selector: "op-wp-journal-#{journal.id}-quote"}enddiff --git a/app/components/work_packages/activities_tab/journals/item_component.sass b/app/components/work_packages/activities_tab/journals/item_component.sassindex 708bd40219d..eb2b07557c2 100644--- a/app/components/work_packages/activities_tab/journals/item_component.sass+++ b/app/components/work_packages/activities_tab/journals/item_component.sass@@ -11,11 +11,11 @@color: var(--bgColor-accent-emphasis)&--header-start-containerflex-grow: 1- &--container__restricted-comment+ &--container__internal-commentborder-color: var(--display-brown-borderColor-emphasis)- &--header__restricted-comment+ &--header__internal-commentborder-color: var(--display-brown-borderColor-emphasis)background-color: var(--display-brown-bgColor-muted)- &--journal-notes-body__restricted-comment+ &--journal-notes-body__internal-commentborder-color: var(--display-brown-borderColor-emphasis)diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.rb b/app/components/work_packages/activities_tab/journals/item_component/details.rbindex c8f3065e277..96e0c60a6ff 100644--- a/app/components/work_packages/activities_tab/journals/item_component/details.rb+++ b/app/components/work_packages/activities_tab/journals/item_component/details.rb@@ -193,7 +193,7 @@ module WorkPackagesrender(Primer::Beta::Octicon.new(:"dot-fill", # color is set via CSS as requested by UI/UX Teamclasses: "work-packages-activities-tab-journals-item-component-details--notification-dot-icon",- size: (OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? ? :small : :medium),+ size: (OpenProject::FeatureDecisions.internal_comments_active? ? :small : :medium),data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }))enddiff --git a/app/components/work_packages/activities_tab/journals/item_component/edit.rb b/app/components/work_packages/activities_tab/journals/item_component/edit.rbindex 628c1cab98e..a0d44199814 100644--- a/app/components/work_packages/activities_tab/journals/item_component/edit.rb+++ b/app/components/work_packages/activities_tab/journals/item_component/edit.rb@@ -53,7 +53,7 @@ module WorkPackagesdef wrapper_data_attributes{- restricted_comment_stimulus_controller("-is-restricted-value") => journal.restricted?+ internal_comment_stimulus_controller("-is-internal-value") => journal.internal?}endenddiff --git a/app/components/work_packages/activities_tab/journals/new_component.html.erb b/app/components/work_packages/activities_tab/journals/new_component.html.erbindex d12c70ad931..a79c1d309cb 100644--- a/app/components/work_packages/activities_tab/journals/new_component.html.erb+++ b/app/components/work_packages/activities_tab/journals/new_component.html.erb@@ -61,16 +61,16 @@render(WorkPackages::ActivitiesTab::Journals::NotesForm.new(f))end- form_container.with_row(flex_layout: true, justify_content: adding_restricted_comment_allowed? ? :space_between : :flex_end) do |form_container_row|- if adding_restricted_comment_allowed?- form_container_row.with_column(flex_layout: true, align_items: :center) do |restricted_comment_container|- restricted_comment_container.with_column(mr: 2, test_selector: "op-work-package-journal-restricted-comment-checkbox") do- render(WorkPackages::ActivitiesTab::Journals::RestrictedNoteForm.new(f))+ form_container.with_row(flex_layout: true, justify_content: adding_internal_comment_allowed? ? :space_between : :flex_end) do |form_container_row|+ if adding_internal_comment_allowed?+ form_container_row.with_column(flex_layout: true, align_items: :center) do |internal_comment_container|+ internal_comment_container.with_column(mr: 2, test_selector: "op-work-package-journal-internal-comment-checkbox") do+ render(WorkPackages::ActivitiesTab::Journals::InternalNoteForm.new(f))end- restricted_comment_container.with_column(+ internal_comment_container.with_column(display: :none,- data: { "work-packages--activities-tab--restricted-comment-target": "learnMoreLink" },+ data: { "work-packages--activities-tab--internal-comment-target": "learnMoreLink" },pb: 1) dorender(Primer::Beta::Link.new(href: learn_more_static_link_url, target: "_blank")) do |link|diff --git a/app/components/work_packages/activities_tab/journals/new_component.rb b/app/components/work_packages/activities_tab/journals/new_component.rbindex c7b746a5521..3ccdf839f9d 100644--- a/app/components/work_packages/activities_tab/journals/new_component.rb+++ b/app/components/work_packages/activities_tab/journals/new_component.rb@@ -58,9 +58,9 @@ module WorkPackagesform_hidden_initially ? :none : :blockend- def adding_restricted_comment_allowed?- OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? &&- work_package.project.enabled_comments_with_restricted_visibility &&+ def adding_internal_comment_allowed?+ OpenProject::FeatureDecisions.internal_comments_active? &&+ work_package.project.enabled_internal_comments &&User.current.allowed_in_project?(:add_internal_comments, work_package.project)enddiff --git a/app/components/work_packages/activities_tab/journals/new_component.sass b/app/components/work_packages/activities_tab/journals/new_component.sassindex 17923c7ee55..939c5318e38 100644--- a/app/components/work_packages/activities_tab/journals/new_component.sass+++ b/app/components/work_packages/activities_tab/journals/new_component.sass@@ -27,6 +27,6 @@max-height: 10vh.ck-editor__previewmax-height: 30vh- &--journal-notes-body__restricted-comment+ &--journal-notes-body__internal-commentbackground-color: var(--display-brown-bgColor-muted) !importantborder-top: var(--borderWidth-thick) solid var(--display-brown-borderColor-emphasis)diff --git a/app/contracts/work_packages/create_note_contract.rb b/app/contracts/work_packages/create_note_contract.rbindex 92b2c4ebea4..9d35f098a86 100644--- a/app/contracts/work_packages/create_note_contract.rb+++ b/app/contracts/work_packages/create_note_contract.rb@@ -37,14 +37,14 @@ module WorkPackageserrors.add(:journal_notes, :blank) if model.journal_notes.blank?end- attribute :journal_restricted do- next unless model.journal_restricted+ attribute :journal_internal do+ next unless model.journal_internal- unless OpenProject::FeatureDecisions.comments_with_restricted_visibility_active?- errors.add(:journal_restricted, :feature_disabled)+ unless OpenProject::FeatureDecisions.internal_comments_active?+ errors.add(:journal_internal, :feature_disabled)endunless allowed_in_project?(:add_internal_comments)- errors.add(:journal_restricted, :error_unauthorized)+ errors.add(:journal_internal, :error_unauthorized)endenddiff --git a/app/controllers/projects/settings/work_packages/activities_controller.rb b/app/controllers/projects/settings/work_packages/activities_controller.rbindex 18a756f1174..942b99baa97 100644--- a/app/controllers/projects/settings/work_packages/activities_controller.rb+++ b/app/controllers/projects/settings/work_packages/activities_controller.rb@@ -32,10 +32,10 @@ class Projects::Settings::WorkPackages::ActivitiesController < Projects::Settingmenu_item :settings_work_packagesdef update- enabled = ActiveRecord::Type::Boolean.new.cast(expected_params[:enabled_comments_with_restricted_visibility])+ enabled = ActiveRecord::Type::Boolean.new.cast(expected_params[:enabled_internal_comments])result = Projects::UpdateService.new(user: current_user, model: @project, contract_class: Projects::SettingsContract)- .call(enabled_comments_with_restricted_visibility: enabled)+ .call(enabled_internal_comments: enabled)if result.success?flash[:notice] = t("notice_successful_update")@@ -49,6 +49,6 @@ class Projects::Settings::WorkPackages::ActivitiesController < Projects::Settingprivatedef expected_params- params.expect(project: [:enabled_comments_with_restricted_visibility])+ params.expect(project: [:enabled_internal_comments])endenddiff --git a/app/controllers/work_packages/activities_tab_controller.rb b/app/controllers/work_packages/activities_tab_controller.rbindex 619bf8074ab..179e90b7eaa 100644--- a/app/controllers/work_packages/activities_tab_controller.rb+++ b/app/controllers/work_packages/activities_tab_controller.rb@@ -141,7 +141,7 @@ class WorkPackages::ActivitiesTabController < ApplicationControllerrespond_with_turbo_streamsend- def sanitize_restricted_mentions+ def sanitize_internal_mentionsrender plain: sanitized_journal_notesrescue StandardError => ehandle_internal_server_error(e)@@ -231,11 +231,11 @@ class WorkPackages::ActivitiesTabController < ApplicationControllerenddef sanitized_journal_notes- WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer.sanitize(@work_package, journal_params[:notes])+ WorkPackages::ActivitiesTab::InternalMentionsSanitizer.sanitize(@work_package, journal_params[:notes])enddef journal_params- params.expect(journal: %i[notes restricted])+ params.expect(journal: %i[notes internal])enddef handle_successful_create_call(call)@@ -308,15 +308,15 @@ class WorkPackages::ActivitiesTabController < ApplicationControllerenddef create_journal_service_call- restricted = to_boolean(journal_params[:restricted], false)- notes = restricted ? sanitized_journal_notes : journal_params[:notes]+ internal = to_boolean(journal_params[:internal], false)+ notes = internal ? sanitized_journal_notes : journal_params[:notes]AddWorkPackageNoteService.new(user: User.current,work_package: @work_package).call(notes,send_notifications: to_boolean(params[:notify], true),- restricted:)+ internal:)enddef to_boolean(value, default)@@ -324,7 +324,7 @@ class WorkPackages::ActivitiesTabController < ApplicationControllerenddef update_journal_service_call- notes = @journal.restricted? ? sanitized_journal_notes : journal_params[:notes]+ notes = @journal.internal? ? sanitized_journal_notes : journal_params[:notes]Journals::UpdateService.new(model: @journal, user: User.current).call(notes:)end@@ -337,7 +337,7 @@ class WorkPackages::ActivitiesTabController < ApplicationControllerdef generate_time_based_update_streams(last_update_timestamp)journals = @work_package.journals- .restricted_visible+ .internal_visible.with_sequence_versionif @filter == :only_commentsdiff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rbindex 72ba79a9dc7..878503ec8a4 100644--- a/app/controllers/work_packages_controller.rb+++ b/app/controllers/work_packages_controller.rb@@ -226,7 +226,7 @@ class WorkPackagesController < ApplicationControllerwork_package.journals- .restricted_visible+ .internal_visible.changing.includes(:user).order(order).to_adiff --git a/app/forms/projects/settings/work_packages/activities/form.rb b/app/forms/projects/settings/work_packages/activities/form.rbindex 3dd3a1f37ff..d00433eaa58 100644--- a/app/forms/projects/settings/work_packages/activities/form.rb+++ b/app/forms/projects/settings/work_packages/activities/form.rb@@ -31,10 +31,10 @@ module Projects::Settings::WorkPackages::Activitiesclass Form < ApplicationFormform do |f|f.check_box(- name: :enabled_comments_with_restricted_visibility,- label: I18n.t("settings.work_packages.activities.enable_comments_with_restricted_visibility"),+ name: :enabled_internal_comments,+ label: I18n.t("settings.work_packages.activities.enable_internal_comments"),caption: caption_text,- checked: model.project.enabled_comments_with_restricted_visibility+ checked: model.project.enabled_internal_comments)f.submit(diff --git a/app/forms/work_packages/activities_tab/journals/restricted_note_form.rb b/app/forms/work_packages/activities_tab/journals/internal_note_form.rbsimilarity index 85%rename from app/forms/work_packages/activities_tab/journals/restricted_note_form.rbrename to app/forms/work_packages/activities_tab/journals/internal_note_form.rbindex 30e8b5dd9ba..d6e98c60c9a 100644--- a/app/forms/work_packages/activities_tab/journals/restricted_note_form.rb+++ b/app/forms/work_packages/activities_tab/journals/internal_note_form.rb@@ -28,15 +28,15 @@# See COPYRIGHT and LICENSE files for more details.#++module WorkPackages::ActivitiesTab::Journals- class RestrictedNoteForm < ApplicationForm+ class InternalNoteForm < ApplicationFormform do |notes_form|notes_form.check_box(- name: :restricted,+ name: :internal,label: I18n.t("activities.work_packages.activity_tab.restrict_visibility"),checked: false,data: {- "work-packages--activities-tab--restricted-comment-target": "restrictedCheckbox",- action: "input->work-packages--activities-tab--restricted-comment#toggleRestriction"+ "work-packages--activities-tab--internal-comment-target": "internalCheckbox",+ action: "input->work-packages--activities-tab--internal-comment#toggleInternal"})enddiff --git a/app/models/activities/base_activity_provider.rb b/app/models/activities/base_activity_provider.rbindex 3f34c66d9ba..1e5f644dc94 100644--- a/app/models/activities/base_activity_provider.rb+++ b/app/models/activities/base_activity_provider.rb@@ -163,14 +163,14 @@ class Activities::BaseActivityProviderenddef filter_for_visibility(query, user)- unless OpenProject::FeatureDecisions.comments_with_restricted_visibility_active?- return query.where(journals_table[:restricted].eq(false))+ unless OpenProject::FeatureDecisions.internal_comments_active?+ return query.where(journals_table[:internal].eq(false))endquery.where(projects_table[:id].in(Project.allowed_to(user, :view_internal_comments).select(:id).arel)- .or(journals_table[:restricted].eq(false))+ .or(journals_table[:internal].eq(false)))enddiff --git a/app/models/journal.rb b/app/models/journal.rbindex a1e036c7ceb..b10edc728a7 100644--- a/app/models/journal.rb+++ b/app/models/journal.rb@@ -123,6 +123,8 @@ class Journal < ApplicationRecordscope :for_work_package, -> { where(journable_type: "WorkPackage") }scope :for_meeting, -> { where(journable_type: "Meeting") }+ alias_attribute :internal, :restricted+# In conjunction with the included Comparable module, allows comparison of journal records# based on their corresponding version numbers, creation timestamps and IDs.def <=>(other)@@ -151,7 +153,7 @@ class Journal < ApplicationRecordenddef attachments_visible?(user = User.current)- if restricted?+ if internal?super && user.allowed_in_project?(:view_internal_comments, project)elsesuper@@ -159,7 +161,7 @@ class Journal < ApplicationRecordenddef visible?(user = User.current)- if restricted?+ if internal?user.allowed_in_project?(:view_internal_comments, project)elsejournable.visible?(user)diff --git a/app/models/project.rb b/app/models/project.rbindex fa0ae2cdf3f..e47928838a9 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -99,7 +99,7 @@ class Project < ApplicationRecordvalidates_associated :available_phases, on: :saving_phasesstore_attribute :settings, :deactivate_work_package_attachments, :boolean- store_attribute :settings, :enabled_comments_with_restricted_visibility, :boolean+ store_attribute :settings, :enabled_internal_comments, :booleanacts_as_favorablediff --git a/app/models/queries/principals.rb b/app/models/queries/principals.rbindex 8197f099cac..377d3d275d0 100644--- a/app/models/queries/principals.rb+++ b/app/models/queries/principals.rb@@ -32,7 +32,7 @@ module Queries::Principalsfilter Filters::TypeFilterfilter Filters::MemberFilterfilter Filters::MentionableOnWorkPackageFilter- filter Filters::RestrictedMentionableOnWorkPackageFilter+ filter Filters::InternalMentionableOnWorkPackageFilterfilter Filters::StatusFilterfilter Filters::NameFilterfilter Filters::AnyNameAttributeFilterdiff --git a/app/models/queries/principals/filters/restricted_mentionable_on_work_package_filter.rb b/app/models/queries/principals/filters/internal_mentionable_on_work_package_filter.rbsimilarity index 92%rename from app/models/queries/principals/filters/restricted_mentionable_on_work_package_filter.rbrename to app/models/queries/principals/filters/internal_mentionable_on_work_package_filter.rbindex 33b2020f63c..e6df3a2e57c 100644--- a/app/models/queries/principals/filters/restricted_mentionable_on_work_package_filter.rb+++ b/app/models/queries/principals/filters/internal_mentionable_on_work_package_filter.rb@@ -28,7 +28,7 @@# See COPYRIGHT and LICENSE files for more details.# ++-class Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFilter <+class Queries::Principals::Filters::InternalMentionableOnWorkPackageFilter <Queries::Principals::Filters::PrincipalFiltervalidate :values_are_a_single_work_package_id@@ -45,11 +45,11 @@ class Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFilter <enddef key- :restricted_mentionable_on_work_package+ :internal_mentionable_on_work_packageenddef human_name- "restricted mentionable" # Only for Internal use, not visible in the UI+ "internal mentionable" # Only for Internal use, not visible in the UIenddef apply_to(query_scope)diff --git a/app/models/work_package.rb b/app/models/work_package.rbindex 0ab6a5a6155..96eae27f208 100644--- a/app/models/work_package.rb+++ b/app/models/work_package.rb@@ -382,7 +382,7 @@ class WorkPackage < ApplicationRecord# check if user is allowed to edit WorkPackage Journals.# see Acts::Journalized::Permissions#journal_editable_bydef journal_editable_by?(journal, user)- if journal.restricted?+ if journal.internal?user.allowed_in_project?(:edit_others_internal_comments, project) ||(user.allowed_in_project?(:edit_own_internal_comments, project) && journal.user_id == user.id)elsediff --git a/app/models/work_package/journalized.rb b/app/models/work_package/journalized.rbindex 0c480fbbc3c..0901cefd0b8 100644--- a/app/models/work_package/journalized.rb+++ b/app/models/work_package/journalized.rb@@ -33,13 +33,13 @@ module WorkPackage::Journalizedincluded doacts_as_journalized journals_association_extension: proc {- def restricted_visible- if OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? &&- proxy_association.owner.project.enabled_comments_with_restricted_visibility &&+ def internal_visible+ if OpenProject::FeatureDecisions.internal_comments_active? &&+ proxy_association.owner.project.enabled_internal_comments &&User.current.allowed_in_project?(:view_internal_comments, proxy_association.owner.project)allelse- where(restricted: false)+ where(internal: false)endend}diff --git a/app/services/add_work_package_note_service.rb b/app/services/add_work_package_note_service.rbindex d3342335452..929c3b2aa09 100644--- a/app/services/add_work_package_note_service.rb+++ b/app/services/add_work_package_note_service.rb@@ -44,9 +44,9 @@ class AddWorkPackageNoteServiceself.contract_class = WorkPackages::CreateNoteContractend- def call(notes, send_notifications: nil, restricted: false)+ def call(notes, send_notifications: nil, internal: false)in_context(work_package, send_notifications:) do- work_package.add_journal(user:, notes:, restricted:)+ work_package.add_journal(user:, notes:, internal:)success, errors = validate_and_yield(work_package, user) dowork_package.save_journalsdiff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex a6ca9dac667..3b94cd10ec0 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -51,9 +51,9 @@ module Journals@associations = Association.for(journable)end- def call(notes: "", restricted: false, cause: CauseOfChange::NoCause.new)+ def call(notes: "", internal: false, cause: CauseOfChange::NoCause.new)Journal.transaction do- journal = create_journal(notes, restricted, cause)+ journal = create_journal(notes, internal, cause)if journalreload_journals@@ -75,18 +75,18 @@ module Journals## Instead of removing the predecessor, return it here so that it can be stripped in the journal creating# SQL to than be refilled. That way, references to the journal, including ones users have, are kept intact.- def aggregatable_predecessor(notes, restricted, cause)+ def aggregatable_predecessor(notes, internal, cause)predecessor = journable.last_journal- predecessor if aggregatable?(predecessor, notes, restricted, cause)+ predecessor if aggregatable?(predecessor, notes, internal, cause)end- def create_journal(notes, restricted, cause)- predecessor = aggregatable_predecessor(notes, restricted, cause)+ def create_journal(notes, internal, cause)+ predecessor = aggregatable_predecessor(notes, internal, cause)log_journal_creation(predecessor)- create_sql = create_journal_sql(predecessor, notes, restricted, cause)+ create_sql = create_journal_sql(predecessor, notes, internal, cause)# We need to ensure that the result is genuine. Otherwise,# calling the service repeatedly for the same journable@@ -194,8 +194,8 @@ module Journals# (`insert_attachable`, `insert_customizable` and `insert_storable`) should actually insert data. It is additionally# used as the values returned by the overall SQL statement so that an AR instance can be instantiated with it.#- def create_journal_sql(predecessor, notes, restricted, cause)- journal_modifications = journal_modification_sql(predecessor, notes, restricted, cause)+ def create_journal_sql(predecessor, notes, internal, cause)+ journal_modifications = journal_modification_sql(predecessor, notes, internal, cause)relation_modifications = relation_modifications_sql(predecessor)journal_cte_clauses = [journal_modifications]@@ -207,7 +207,7 @@ module JournalsSQLend- def journal_modification_sql(predecessor, notes, restricted, cause)+ def journal_modification_sql(predecessor, notes, internal, cause)<<~SQLcleanup_predecessor_data AS (#{cleanup_predecessor_data(predecessor)}@@ -224,7 +224,7 @@ module Journals), update_predecessor AS (#{update_predecessor_sql(predecessor, notes, cause)}), inserted_journal AS (- #{update_or_insert_journal_sql(predecessor, notes, restricted, cause)}+ #{update_or_insert_journal_sql(predecessor, notes, internal, cause)})SQLend@@ -252,11 +252,11 @@ module Journals:data_id)end- def update_or_insert_journal_sql(predecessor, notes, restricted, cause)+ def update_or_insert_journal_sql(predecessor, notes, internal, cause)if predecessorupdate_journal_sql(predecessor, notes, cause)else- insert_journal_sql(notes, restricted, cause)+ insert_journal_sql(notes, internal, cause)endend@@ -288,7 +288,7 @@ module Journalscause: cause_sql(cause))end- def insert_journal_sql(notes, restricted, cause)+ def insert_journal_sql(notes, internal, cause)sql = <<~SQLINSERT INTOjournals (@@ -324,7 +324,7 @@ module Journalssanitize(sql,notes:,- restricted:,+ restricted: internal,cause: cause_sql(cause),journable_id:,journable_type:,@@ -572,14 +572,14 @@ module Journalsjournable.journals.reload if journable.journals.loaded?end- def aggregatable?(predecessor, notes, restricted, cause)+ def aggregatable?(predecessor, notes, internal, cause)predecessor.present? &&aggregation_active? &&within_aggregation_time?(predecessor) &&same_user?(predecessor) &&same_cause?(predecessor, cause) &&only_one_note(predecessor, notes) &&- same_restriction(predecessor, restricted)+ same_restriction(predecessor, internal)enddef aggregation_active?@@ -594,8 +594,8 @@ module Journalspredecessor.notes.empty? || notes.empty?end- def same_restriction(predecessor, restricted)- predecessor.restricted == restricted+ def same_restriction(predecessor, internal)+ predecessor.internal == internalenddef same_user?(predecessor)diff --git a/app/services/notifications/create_from_model_service/work_package_strategy.rb b/app/services/notifications/create_from_model_service/work_package_strategy.rbindex f31be8a1994..f098a641fc2 100644--- a/app/services/notifications/create_from_model_service/work_package_strategy.rb+++ b/app/services/notifications/create_from_model_service/work_package_strategy.rb@@ -32,9 +32,9 @@ module Notifications::CreateFromModelService::WorkPackageStrategyenddef self.permission(journal, _reason)- if journal&.restricted?- # we assume that if a journal is restricted it is a comment and respects the- # view comments with restricted visibility permissions+ if journal&.internal?+ # we assume that if a journal is internal it is a comment and respects the+ # view internal comments permissions:view_internal_commentselse:view_work_packagesdiff --git a/app/services/work_packages/activities_tab/restricted_mentions_sanitizer.rb b/app/services/work_packages/activities_tab/internal_mentions_sanitizer.rbsimilarity index 94%rename from app/services/work_packages/activities_tab/restricted_mentions_sanitizer.rbrename to app/services/work_packages/activities_tab/internal_mentions_sanitizer.rbindex 7e02e3dab6a..527fca77337 100644--- a/app/services/work_packages/activities_tab/restricted_mentions_sanitizer.rb+++ b/app/services/work_packages/activities_tab/internal_mentions_sanitizer.rb@@ -28,7 +28,7 @@# See COPYRIGHT and LICENSE files for more details.#++-class WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer+class WorkPackages::ActivitiesTab::InternalMentionsSanitizerdef self.sanitize(work_package, notes)new(work_package, notes).callend@@ -65,7 +65,7 @@ class WorkPackages::ActivitiesTab::RestrictedMentionsSanitizerdef mentionable_principals@mentionable_principals ||= Queries::Principals::PrincipalQuery.new(user: User.current)- .where(:restricted_mentionable_on_work_package, "=", [work_package.id])+ .where(:internal_mentionable_on_work_package, "=", [work_package.id]).where(:status, "!", [Principal.statuses[:locked]]).where(:type, "=", %w[User Group]).resultsdiff --git a/app/views/projects/settings/work_packages/activities/show.html.erb b/app/views/projects/settings/work_packages/activities/show.html.erbindex 9b09e15ee2b..1dca8163665 100644--- a/app/views/projects/settings/work_packages/activities/show.html.erb+++ b/app/views/projects/settings/work_packages/activities/show.html.erb@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Settings::ProjectWorkPackages::HeaderComponent.new(@project, selected: :activities)) %>-<% if EnterpriseToken.allows_to?(:comments_with_restricted_visibility) %>+<% if EnterpriseToken.allows_to?(:internal_comments) %><%=primer_form_with(model: @project,@@ -40,5 +40,5 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Projects::Settings::WorkPackages::Activities::Form.new(f)) %><% end %><% else %>- <%= render(EnterpriseEdition::UpsalePageComponent.new(:comments_with_restricted_visibility)) %>+ <%= render(EnterpriseEdition::UpsalePageComponent.new(:internal_comments)) %><% end %>diff --git a/config/initializers/feature_decisions.rb b/config/initializers/feature_decisions.rbindex a7e99a59c2e..1a07fb7748c 100644--- a/config/initializers/feature_decisions.rb+++ b/config/initializers/feature_decisions.rb@@ -61,6 +61,6 @@ OpenProject::FeatureDecisions.add :work_package_comment_id_url,"`#comment-<journal-id>` replacing the old " \"`#activity-<journal-sequence_number>`."-OpenProject::FeatureDecisions.add :comments_with_restricted_visibility,- description: "Enables submitting comments that are restricted " \+OpenProject::FeatureDecisions.add :internal_comments,+ description: "Enables submitting comments that are internal" \"and only a subset of users can see"diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex e78d9c2846c..d17ad838f6d 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -292,7 +292,7 @@ Rails.application.reloader.to_prepare do# FIXME: Although the endpoint is removed, the code checking whether a user# is eligible to add work packages through the API still seems to rely on this.journals: [:new],- "work_packages/activities_tab": %i[create toggle_reaction sanitize_restricted_mentions]+ "work_packages/activities_tab": %i[create toggle_reaction sanitize_internal_mentions]},permissible_on: %i[work_package project],dependencies: :view_work_packages@@ -318,28 +318,28 @@ Rails.application.reloader.to_prepare dopermissible_on: %i[project],require: :loggedin,dependencies: :view_work_packages,- visible: -> { OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? }+ visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }wpt.permission :add_internal_comments,{},permissible_on: %i[project],require: :loggedin,dependencies: %i[view_project view_internal_comments],- visible: -> { OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? }+ visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }wpt.permission :edit_own_internal_comments,{},permissible_on: %i[project],require: :loggedin,dependencies: %i[view_project view_internal_comments],- visible: -> { OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? }+ visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }wpt.permission :edit_others_internal_comments,{},permissible_on: %i[project],require: :loggedin,dependencies: %i[view_project view_internal_comments],- visible: -> { OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? }+ visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }# WP attachments can be added with :edit_work_packages, this permission allows it without Edit WP as well.wpt.permission :add_work_package_attachments,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 143abe87d2d..01d5a8ac8e6 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -50,7 +50,7 @@ en:created: "created"commented: "commented"restrict_visibility: Restrict visibility- restricted_journal: Restricted comments are visible to a limited group of members.+ internal_journal: Internal comments are visible to a limited group of members.unsaved_changes_confirmation_message: You have unsaved changes. Are you sure you want to close the editor?admin:@@ -1159,7 +1159,7 @@ en:title: "Working days"false: "working days only"true: "include non-working days"- journal_restricted: Restricted Journal+ journal_internal: Internal Journalnotify: "Notify" # used in custom actionsparent: "Parent"parent_issue: "Parent"@@ -1381,7 +1381,7 @@ en:values:inclusion: "filter has invalid values."format: "%{message}"- queries/principals/filters/restricted_mentionable_on_work_package_filter:+ queries/principals/filters/internal_mentionable_on_work_package_filter:attributes:values:single_value_requirement: "must be a single work package"@@ -2048,7 +2048,7 @@ en:baseline_comparison: Baseline Comparisonsboard_view: Advanced Boardsconditional_highlighting: Conditional Highlighting- comments_with_restricted_visibility: Comments With Restricted Visibility+ internal_comments: Internal Commentscustom_actions: Custom Actionscustom_field_hierarchies: Custom fields of type hierarchycustomize_life_cycle: Customize Life Cycle@@ -2114,9 +2114,9 @@ en:Placeholder users are a way to assign work packages to users who are not part of your project.They can be useful in a range of scenarios; for example, if you need to track tasks for a resource that is not yet named or available,or if you don’t want to give that person access to OpenProject but still want to track tasks assigned to them.- comments_with_restricted_visibility:+ internal_comments:title: "For your eyes only"- description: "Restricted-visibilty comments allow an internal team to communicate amongst themselves privately. These are only visible to certain project roles and will never be visible publicly."+ description: "Internal comments allow an internal team to communicate amongst themselves privately. These are only visible to certain project roles and will never be visible publicly."enumeration_activities: "Time tracking activities"enumeration_work_package_priorities: "Work package priorities"enumeration_reported_project_statuses: "Reported project status"@@ -4065,8 +4065,8 @@ en:work_packages:not_allowed_text: "You do not have the necessary permissions to view this page."activities:- enable_comments_with_restricted_visibility: "Enable restricted visibility comments"- helper_text: "Restricted comments allow an internal team to communicate amongst themselves privately. These are only visible to selected roles that have the necessary permissions and will not be visible publicly. %{link}"+ enable_internal_comments: "Enable internal comments"+ helper_text: "Internal comments allow an internal team to communicate amongst themselves privately. These are only visible to selected roles that have the necessary permissions and will not be visible publicly. %{link}"text_formatting:markdown: "Markdown"diff --git a/config/routes.rb b/config/routes.rbindex 88005a270f4..2b5de4c5e9d 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -661,7 +661,7 @@ Rails.application.routes.draw doget :update_streamsget :update_filter # filter not persistedput :update_sorting # sorting is persisted- post :sanitize_restricted_mentions+ post :sanitize_internal_mentionsendenddiff --git a/config/static_links.yml b/config/static_links.ymlindex 609e1c077bc..47b722d38f1 100644--- a/config/static_links.yml+++ b/config/static_links.yml@@ -153,7 +153,7 @@ enterprise_features:href: https://www.openproject.org/docs/user-guide/agile-boards/#action-boards-enterprise-add-oncustom_field_hierarchies:href: https://www.openproject.org/docs/system-admin-guide/custom-fields/#hierarchy-custom-field-enterprise-add-on- comments_with_restricted_visibility:+ internal_comments:href: https://www.openproject.org/docs/user-guide/activity/#work-package-activitysysadmin_docs:saml:diff --git a/frontend/src/app/core/path-helper/apiv3-paths.ts b/frontend/src/app/core/path-helper/apiv3-paths.tsindex 4a656267cae..139ba6ce349 100644--- a/frontend/src/app/core/path-helper/apiv3-paths.ts+++ b/frontend/src/app/core/path-helper/apiv3-paths.ts@@ -48,7 +48,7 @@ export class ApiV3Paths {} else {// that are mentionable on the work packagefilters.add(- (this.isRestrictedMentionable() ? 'restricted_mentionable_on_work_package' : 'mentionable_on_work_package'),+ (this.isInternalMentionable() ? 'internal_mentionable_on_work_package' : 'mentionable_on_work_package'),'=',[workPackage.id.toString()],);@@ -65,16 +65,16 @@ export class ApiV3Paths {}/**- * Check if either adding or editing a comment is restricted, and thus- * the mentionable principals are to be restricted+ * Check if either adding or editing a comment is internal, and thus+ * the mentionable principals are to be internal** @returns {boolean}*/- private isRestrictedMentionable():boolean {- const isRestrictedAttributeValue = 'data-work-packages--activities-tab--restricted-comment-is-restricted-value';- const addingCommentIsRestricted = document.getElementById('work-packages-activities-tab-add-comment-component')?.getAttribute(isRestrictedAttributeValue) === 'true';- const editingCommentIsRestricted = document.querySelector('.work-packages-activities-tab-journals-item-component-edit')?.getAttribute(isRestrictedAttributeValue) === 'true';+ private isInternalMentionable():boolean {+ const isInternalAttributeValue = 'data-work-packages--activities-tab--internal-comment-is-internal-value';+ const addingCommentIsInternal = document.getElementById('work-packages-activities-tab-add-comment-component')?.getAttribute(isInternalAttributeValue) === 'true';+ const editingCommentIsInternal = document.querySelector('.work-packages-activities-tab-journals-item-component-edit')?.getAttribute(isInternalAttributeValue) === 'true';- return addingCommentIsRestricted || editingCommentIsRestricted;+ return addingCommentIsInternal || editingCommentIsInternal;}}diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.tssimilarity index 81%rename from frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.tsrename to frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.tsindex e52a34b903a..6ef3b6e1ce3 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/internal-comment.controller.ts@@ -32,37 +32,37 @@ import { Controller } from '@hotwired/stimulus';import { renderStreamMessage } from '@hotwired/turbo';import type IndexController from './index.controller';-export default class RestrictedCommentController extends Controller {- static targets = ['restrictedCheckbox', 'formContainer', 'learnMoreLink'];+export default class InternalCommentController extends Controller {+ static targets = ['internalCheckbox', 'formContainer', 'learnMoreLink'];static outlets = ['work-packages--activities-tab--index'];static classes = ['highlight', 'hidden'];static values = {- isRestricted: { type: Boolean, default: false },+ isInternal: { type: Boolean, default: false },};- declare readonly restrictedCheckboxTarget:HTMLInputElement;+ declare readonly internalCheckboxTarget:HTMLInputElement;declare readonly formContainerTarget:HTMLElement;declare readonly learnMoreLinkTarget:HTMLAnchorElement;declare readonly workPackagesActivitiesTabIndexOutlet:IndexController;declare readonly highlightClass:string;declare readonly hiddenClass:string;- declare isRestrictedValue:boolean;+ declare isInternalValue:boolean;onSubmitEnd(_event:CustomEvent):void {- this.toggleRestriction();+ this.toggleInternal();}- toggleRestriction():void {- const isChecked = this.restrictedCheckboxTarget.checked;+ toggleInternal():void {+ const isChecked = this.internalCheckboxTarget.checked;this.formContainerTarget.classList.toggle(this.highlightClass, isChecked);this.toggleLearnMoreLink(isChecked);- this.isRestrictedValue = isChecked;+ this.isInternalValue = isChecked;if (isChecked) {- void this.sanitizeRestrictedMentions();+ void this.sanitizeInternalMentions();}}@@ -72,12 +72,12 @@ export default class RestrictedCommentController extends Controller {this.learnMoreLinkTarget.classList.toggle(this.hiddenClass, !isChecked);}- private async sanitizeRestrictedMentions():Promise<void> {+ private async sanitizeInternalMentions():Promise<void> {if (this.ckEditorInstance) {const editorData = this.ckEditorInstance.getData({ trim: false });if (editorData.length === 0) return;- const sanitizePath = `/work_packages/${this.workPackagesActivitiesTabIndexOutlet.workPackageIdValue}/activities/sanitize_restricted_mentions`;+ const sanitizePath = `/work_packages/${this.workPackagesActivitiesTabIndexOutlet.workPackageIdValue}/activities/sanitize_internal_mentions`;const csrfToken = (document.querySelector('meta[name="csrf-token"]') as HTMLMetaElement).content;try {@@ -96,7 +96,7 @@ export default class RestrictedCommentController extends Controller {this.ckEditorInstance.setData(sanitizedNotesResponse);} else {renderStreamMessage(sanitizedNotesResponse);- throw new Error(`Failed to sanitize restricted mentions. Response status: ${response.status}`);+ throw new Error(`Failed to sanitize internal mentions. Response status: ${response.status}`);}} catch (error) {console.error(error);diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/quote-comment.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/quote-comment.controller.tsindex b6febbd3039..5ab07e806f8 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/quote-comment.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/quote-comment.controller.ts@@ -31,23 +31,23 @@import { Controller } from '@hotwired/stimulus';import type IndexController from './index.controller';-import type RestrictedCommentController from './restricted-comment.controller';+import type InternalCommentController from './internal-comment.controller';type QuoteParams = {userId:string;userName:string;textWrote:string;content:string;- isRestricted:boolean;+ isInternal:boolean;};export default class QuoteCommentController extends Controller {- static outlets = ['work-packages--activities-tab--index', 'work-packages--activities-tab--restricted-comment'];+ static outlets = ['work-packages--activities-tab--index', 'work-packages--activities-tab--internal-comment'];declare readonly workPackagesActivitiesTabIndexOutlet:IndexController;- declare readonly workPackagesActivitiesTabRestrictedCommentOutlet:RestrictedCommentController;+ declare readonly workPackagesActivitiesTabInternalCommentOutlet:InternalCommentController;- quote({ params: { userId, userName, textWrote, content, isRestricted } }:{ params:QuoteParams }) {+ quote({ params: { userId, userName, textWrote, content, isInternal } }:{ params:QuoteParams }) {const quotedText = this.quotedText(content, userId, userName, textWrote);if (this.isFormVisible) {@@ -56,7 +56,7 @@ export default class QuoteCommentController extends Controller {this.openEditorWithInitialData(quotedText);}- this.setCommentRestriction(isRestricted);+ this.setCommentRestriction(isInternal);}private quotedText(rawComment:string, userId:string, userName:string, textWrote:string) {@@ -80,10 +80,10 @@ export default class QuoteCommentController extends Controller {}}- private setCommentRestriction(isRestricted:boolean) {- if (isRestricted && !this.workPackagesActivitiesTabRestrictedCommentOutlet.restrictedCheckboxTarget.checked) {- this.workPackagesActivitiesTabRestrictedCommentOutlet.restrictedCheckboxTarget.checked = isRestricted;- this.workPackagesActivitiesTabRestrictedCommentOutlet.toggleRestriction();+ private setCommentRestriction(isInternal:boolean) {+ if (isInternal && !this.workPackagesActivitiesTabInternalCommentOutlet.internalCheckboxTarget.checked) {+ this.workPackagesActivitiesTabInternalCommentOutlet.internalCheckboxTarget.checked = isInternal;+ this.workPackagesActivitiesTabInternalCommentOutlet.toggleInternal();}}diff --git a/lib/api/v3/activities/activities_by_work_package_api.rb b/lib/api/v3/activities/activities_by_work_package_api.rbindex d19c152a464..e7adcf4eeb4 100644--- a/lib/api/v3/activities/activities_by_work_package_api.rb+++ b/lib/api/v3/activities/activities_by_work_package_api.rb@@ -38,7 +38,7 @@ module APIjournals = @work_package.journals- .restricted_visible+ .internal_visible.includes(:data,:customizable_journals,:attachable_journals,diff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rbindex 0f4e545ed84..17b1492dde5 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb@@ -53,7 +53,7 @@ module Acts::Journalizedbase.class_eval doafter_save :save_journals- attr_accessor :journal_notes, :journal_user, :journal_restricted, :journal_cause+ attr_accessor :journal_notes, :journal_user, :journal_internal, :journal_causeendend@@ -61,7 +61,7 @@ module Acts::Journalizedwith_ensured_journal_attributes docreate_call = Journals::CreateService.new(self, @journal_user)- .call(notes: @journal_notes, restricted: @journal_restricted, cause: @journal_cause)+ .call(notes: @journal_notes, internal: @journal_internal, cause: @journal_cause)if create_call.success? && create_call.resultOpenProject::Notifications.send(OpenProject::Events::JOURNAL_CREATED,@@ -78,11 +78,11 @@ module Acts::Journalizedsave_journalsend- def add_journal(user: User.current, notes: "", restricted: false, cause: CauseOfChange::NoCause.new)+ def add_journal(user: User.current, notes: "", internal: false, cause: CauseOfChange::NoCause.new)self.journal_user ||= userself.journal_notes ||= notesself.journal_cause ||= cause- self.journal_restricted ||= restricted+ self.journal_internal ||= internalendprivate@@ -91,14 +91,14 @@ module Acts::Journalizedself.journal_user ||= User.currentself.journal_notes ||= ""self.journal_cause ||= CauseOfChange::NoCause.new- self.journal_restricted ||= false+ self.journal_internal ||= falseyieldensureself.journal_user = nilself.journal_notes = nilself.journal_cause = nil- self.journal_restricted = nil+ self.journal_internal = nilendendenddiff --git a/spec/contracts/work_packages/create_note_contract_spec.rb b/spec/contracts/work_packages/create_note_contract_spec.rbindex 45f188773e6..6fe7b9c5cc9 100644--- a/spec/contracts/work_packages/create_note_contract_spec.rb+++ b/spec/contracts/work_packages/create_note_contract_spec.rb@@ -82,56 +82,56 @@ RSpec.describe WorkPackages::CreateNoteContract doendend- describe "journal_restricted" do+ describe "journal_internal" dobefore do# Setting the journal_notes to not trigger a :blank errorwork_package.journal_notes = "blubs"end- context "and journal_restricted is true, and comments_with_restricted_visibility_active? is disabled",- with_flag: { comments_with_restricted_visibility_active: false } do+ context "and journal_internal is true, and internal_comments_active? is disabled",+ with_flag: { internal_comments_active: false } dobefore do- work_package.journal_restricted = true+ work_package.journal_internal = trueend- it_behaves_like "contract is invalid", journal_restricted: :feature_disabled+ it_behaves_like "contract is invalid", journal_internal: :feature_disabledend- context "and journal_restricted is true, and comments_with_restricted_visibility_active? is enabled",- with_flag: { comments_with_restricted_visibility_active: true } do+ context "and journal_internal is true, and internal_comments_active? is enabled",+ with_flag: { internal_comments_active: true } dobefore do- work_package.journal_restricted = true+ work_package.journal_internal = trueendit_behaves_like "contract is valid"end- context "and journal_restricted is false, and comments_with_restricted_visibility_active? is disabled",- with_flag: { comments_with_restricted_visibility_active: false } do+ context "and journal_internal is false, and internal_comments_active? is disabled",+ with_flag: { internal_comments_active: false } dobefore do- work_package.journal_restricted = false+ work_package.journal_internal = falseendit_behaves_like "contract is valid"end- context "with journal_restricted is true, comments_with_restricted_visibility_active? is active but lacking permissions",- with_flag: { comments_with_restricted_visibility_active: true } do+ context "with journal_internal is true, internal_comments_active? is active but lacking permissions",+ with_flag: { internal_comments_active: true } dolet(:permissions) { super() - [:add_internal_comments] }before do- work_package.journal_restricted = true+ work_package.journal_internal = trueend- it_behaves_like "contract is invalid", journal_restricted: :error_unauthorized+ it_behaves_like "contract is invalid", journal_internal: :error_unauthorizedend- context "with journal_restricted is false, comments_with_restricted_visibility_active? is active and lacking permissions",- with_flag: { comments_with_restricted_visibility_active: true } do+ context "with journal_internal is false, internal_comments_active? is active and lacking permissions",+ with_flag: { internal_comments_active: true } dolet(:permissions) { super() - [:add_internal_comments] }before do- work_package.journal_restricted = false+ work_package.journal_internal = falseendit_behaves_like "contract is valid"diff --git a/spec/controllers/work_packages_controller_spec.rb b/spec/controllers/work_packages_controller_spec.rbindex 5032ca9e077..b1b5fdf1ec0 100644--- a/spec/controllers/work_packages_controller_spec.rb+++ b/spec/controllers/work_packages_controller_spec.rb@@ -313,12 +313,12 @@ RSpec.describe WorkPackagesController doendend- context "when there are internal comments", with_flag: { comments_with_restricted_visibility: true } do+ context "when there are internal comments", with_flag: { internal_comments: true } dorender_viewslet(:admin) { create(:admin) }let(:project) do- create(:project, identifier: "test_project", public: false, enabled_comments_with_restricted_visibility: true)+ create(:project, identifier: "test_project", public: false, enabled_internal_comments: true)endbefore do@@ -327,7 +327,7 @@ RSpec.describe WorkPackagesController dojournable: work_package,user: admin,notes: "internal comment",- restricted: true,+ internal: true,version: 2)enddiff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rbindex 4f6b314b6a3..71246c0434b 100644--- a/spec/features/activities/work_package/activities_spec.rb+++ b/spec/features/activities/work_package/activities_spec.rb@@ -34,7 +34,7 @@ require "support/flash/expectations"RSpec.describe "Work package activity", :js, :with_cuprite doinclude Flash::Expectations- let(:project) { create(:project, enabled_comments_with_restricted_visibility: true) }+ let(:project) { create(:project, enabled_internal_comments: true) }let(:admin) { create(:admin) }let(:member_role) docreate(:project_role,@@ -236,8 +236,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite doendend- context "when a user cannot see comments with restricted visibility",- with_flag: { comments_with_restricted_visibility: true } do+ context "when a user cannot see internal comments",+ with_flag: { internal_comments: true } docurrent_user { member }before do@@ -245,7 +245,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite douser: admin,notes: "First comment by admin",journable: work_package,- restricted: true,+ internal: true,version: 2)end@@ -257,8 +257,8 @@ RSpec.describe "Work package activity", :js, :with_cuprite doendend- context "when a user can see comments with restricted visibility",- with_flag: { comments_with_restricted_visibility: true } do+ context "when a user can see internal comments",+ with_flag: { internal_comments: true } docurrent_user { admin }before do@@ -266,7 +266,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite douser: admin,notes: "First comment by admin",journable: work_package,- restricted: true,+ internal: true,version: 2)end@@ -420,7 +420,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite doendcontext "when multiple users are commenting on a workpackage" do- context "when the user has permissions to see restricted comments" do+ context "when the user has permissions to see internal comments" docurrent_user { admin }let(:work_package) { create(:work_package, project:, author: admin) }@@ -475,7 +475,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite doendend- context "when the user does not have permissions to see restricted comments" do+ context "when the user does not have permissions to see internal comments" docurrent_user { member }let(:work_package) { create(:work_package, project:, author: admin) }@@ -512,13 +512,13 @@ RSpec.describe "Work package activity", :js, :with_cuprite docreate(:work_package_journal,user: admin,notes: "Second comment by admin",- restricted: true,+ internal: true,journable: work_package,version: 3)create(:work_package_journal,user: admin,notes: "Third comment by admin",- restricted: true,+ internal: true,journable: work_package,version: 4)diff --git a/spec/features/activities/work_package/activity_tab_comment_editor_spec.rb b/spec/features/activities/work_package/activity_tab_comment_editor_spec.rbindex 2a71eff083c..b0ad47a134d 100644--- a/spec/features/activities/work_package/activity_tab_comment_editor_spec.rb+++ b/spec/features/activities/work_package/activity_tab_comment_editor_spec.rb@@ -33,7 +33,7 @@ require "spec_helper"RSpec.describe "Work package activity tab comment editor",:js,:with_cuprite,- with_flag: { comments_with_restricted_visibility: true } do+ with_flag: { internal_comments: true } dolet(:project) { create(:project) }let(:admin) { create(:admin) }let(:work_package) { create(:work_package, project:, author: admin) }diff --git a/spec/features/activities/work_package/restricted_visibility_comments_spec.rb b/spec/features/activities/work_package/internal_comments_spec.rbsimilarity index 67%rename from spec/features/activities/work_package/restricted_visibility_comments_spec.rbrename to spec/features/activities/work_package/internal_comments_spec.rbindex b5ed478bace..ca2cf83fc94 100644--- a/spec/features/activities/work_package/restricted_visibility_comments_spec.rb+++ b/spec/features/activities/work_package/internal_comments_spec.rb@@ -30,21 +30,21 @@require "spec_helper"-RSpec.describe "Work package comments with restricted visibility",+RSpec.describe "Work package internal comments",:js,- with_flag: { comments_with_restricted_visibility: true } do- include RestrictedVisibilityCommentsHelpers+ with_flag: { internal_comments: true } do+ include InternalCommentsHelpers- shared_let(:project) { create(:project, enabled_comments_with_restricted_visibility: true) }+ shared_let(:project) { create(:project, enabled_internal_comments: true) }shared_let(:admin) { create(:admin) }- shared_let(:viewer) { create_user_with_restricted_comments_view_permissions }- shared_let(:viewer_with_commenting_permission) { create_user_with_restricted_comments_view_and_write_permissions }+ shared_let(:viewer) { create_user_with_internal_comments_view_permissions }+ shared_let(:viewer_with_commenting_permission) { create_user_with_internal_comments_view_and_write_permissions }shared_let(:project_admin) { create_user_as_project_admin }shared_let(:work_package) { create(:work_package, project:, author: admin) }shared_let(:first_comment) do- create(:work_package_journal, user: admin, notes: "A (restricted) comment by admin",- journable: work_package, version: 2, restricted: true)+ create(:work_package_journal, user: admin, notes: "A (internal) comment by admin",+ journable: work_package, version: 2, internal: true)endlet(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }@@ -59,35 +59,35 @@ RSpec.describe "Work package comments with restricted visibility",wp_page.wait_for_activity_tabend- it "allows adding a comment with restricted visibility" do+ it "allows adding a comment with internal visibility" doactivity_tab.expect_input_field- activity_tab.add_comment(text: "First (restricted) comment by admin", restricted: true)+ activity_tab.add_comment(text: "First (internal) comment by admin", internal: true)- activity_tab.expect_journal_notes(text: "First (restricted) comment by admin")+ activity_tab.expect_journal_notes(text: "First (internal) comment by admin")endendcontext "when the feature is not enabled for the project" dobefore do- project.enabled_comments_with_restricted_visibility = false+ project.enabled_internal_comments = falseproject.save!wp_page.visit!wp_page.wait_for_activity_tabend- it "allows adding a comment with restricted visibility" do+ it "allows adding a internal comment" doactivity_tab.expect_input_field- activity_tab.type_comment("This comment cannot be restricted")+ activity_tab.type_comment("This comment cannot be internal")- expect(page).not_to have_test_selector("op-work-package-journal-restricted-comment-checkbox")+ expect(page).not_to have_test_selector("op-work-package-journal-internal-comment-checkbox")endendend- context "with a user that is only allowed to view comments with restricted visibility" do+ context "with a user that is only allowed to view comments with internal visibility" docurrent_user { viewer }before do@@ -97,8 +97,8 @@ RSpec.describe "Work package comments with restricted visibility",wp_page.wait_for_activity_tabend- it "does show restricted comments but does NOT enable editing or quoting comments" do- activity_tab.expect_journal_notes(text: "A (restricted) comment by admin")+ it "does show internal comments but does NOT enable editing or quoting comments" do+ activity_tab.expect_journal_notes(text: "A (internal) comment by admin")activity_tab.within_journal_entry(first_comment) dopage.find_test_selector("op-wp-journal-#{first_comment.id}-action-menu").click@@ -119,12 +119,12 @@ RSpec.describe "Work package comments with restricted visibility",wp_page.wait_for_activity_tabend- it "allows adding a comment with restricted visibility" do+ it "allows adding a internal comment" doactivity_tab.expect_input_field- activity_tab.add_comment(text: "First (restricted) comment by member", restricted: true)+ activity_tab.add_comment(text: "First (internal) comment by member", internal: true)- activity_tab.expect_journal_notes(text: "First (restricted) comment by member")+ activity_tab.expect_journal_notes(text: "First (internal) comment by member")created_comment = work_package.journals.reload.last@@ -133,7 +133,7 @@ RSpec.describe "Work package comments with restricted visibility",page.find_test_selector("op-wp-journal-#{created_comment.id}-edit").clickpage.within_test_selector("op-work-package-journal-form-element") do- expect(page).not_to have_test_selector("op-work-package-journal-restricted-comment-checkbox")+ expect(page).not_to have_test_selector("op-work-package-journal-internal-comment-checkbox")activity_tab.get_editor_form_field_element.set_value("Edited comment by member")page.find_test_selector("op-submit-work-package-journal-form").clickend@@ -142,13 +142,13 @@ RSpec.describe "Work package comments with restricted visibility",endend- it "does show restricted comments but does NOT enable editing other users comments" do- activity_tab.expect_journal_notes(text: "A (restricted) comment by admin")+ it "does show internal comments but does NOT enable editing other users comments" do+ activity_tab.expect_journal_notes(text: "A (internal) comment by admin")activity_tab.within_journal_entry(first_comment) dopage.find_test_selector("op-wp-journal-#{first_comment.id}-action-menu").click- # not allowed to edit other user's restricted comments+ # not allowed to edit other user's internal commentsexpect(page).not_to have_test_selector("op-wp-journal-#{first_comment.id}-edit")# allowed to quote other user's commentsexpect(page).to have_test_selector("op-wp-journal-#{first_comment.id}-quote")@@ -159,27 +159,27 @@ RSpec.describe "Work package comments with restricted visibility",context "with a user that is allowed to view, create and edit all comments" docurrent_user { project_admin }- let(:unrestricted_comment) do+ let(:external_comment) docreate(:work_package_journal,- user: project_admin, notes: "An unrestricted comment by member",- journable: work_package, version: (work_package.journals.reload.last.version + 1), restricted: false)+ user: project_admin, notes: "An external comment by member",+ journable: work_package, version: (work_package.journals.reload.last.version + 1), internal: false)endbefore dofirst_comment- unrestricted_comment+ external_commentwp_page.visit!wp_page.wait_for_activity_tabend- it "allows editing and quoting restricted comments" do- activity_tab.expect_journal_notes(text: "A (restricted) comment by admin")+ it "allows editing and quoting internal comments" do+ activity_tab.expect_journal_notes(text: "A (internal) comment by admin")- activity_tab.edit_comment(first_comment, text: "A (restricted) comment by admin - EDITED")+ activity_tab.edit_comment(first_comment, text: "A (internal) comment by admin - EDITED")activity_tab.within_journal_entry(first_comment) do- activity_tab.expect_journal_notes(text: "A (restricted) comment by admin - EDITED")+ activity_tab.expect_journal_notes(text: "A (internal) comment by admin - EDITED")endactivity_tab.quote_comment(first_comment)@@ -187,7 +187,7 @@ RSpec.describe "Work package comments with restricted visibility",expect(page).to have_checked_field("Restrict visibility")end- activity_tab.quote_comment(unrestricted_comment)+ activity_tab.quote_comment(external_comment)page.within_test_selector("op-work-package-journal-form-element") doexpect(page).to have_checked_field("Restrict visibility")end@@ -197,8 +197,8 @@ RSpec.describe "Work package comments with restricted visibility",describe "mentioning users in comments" docurrent_user { project_admin }- shared_let(:user_without_restricted_comments_view_permissions) do- create_user_without_restricted_comments_view_permissions+ shared_let(:user_without_internal_comments_view_permissions) do+ create_user_without_internal_comments_view_permissionsendshared_let(:group) { create(:group, firstname: "A", lastname: "Group") }@@ -217,45 +217,45 @@ RSpec.describe "Work package comments with restricted visibility",wp_page.wait_for_activity_tabend- context "with restricted comments initially enabled" do- it "restricts mentions to project members with view comments with restricted visibility permission" do+ context "with internal comments initially enabled" do+ it "restricts mentions to project members with view comments with internal visibility permission" doactivity_tab.open_new_comment_editorexpect(page).to have_test_selector("op-work-package-journal-form-element")- activity_tab.check_restricted_visibility_comment_checkbox+ activity_tab.check_internal_comment_checkboxactivity_tab.refocus_editoractivity_tab.type_comment("@")expect(page.all(".mention-list-item").map(&:text))- .to contain_exactly("Project Admin", "Restricted Viewer", "Restricted ViewerCommenter")+ .to contain_exactly("Project Admin", "Internal Viewer", "Internal ViewerCommenter")endend- context "with restricted comments initially disabled" do+ context "with internal comments initially disabled" doit "allows mentioning project members but they are sanitized when the checkbox is checked" doactivity_tab.type_comment("@")expect(page.all(".mention-list-item").map(&:text))- .to contain_exactly("A Viewer", "Group", "Project Admin", "Restricted Viewer", "Restricted ViewerCommenter")+ .to contain_exactly("A Viewer", "Group", "Project Admin", "Internal Viewer", "Internal ViewerCommenter")page.find(".mention-list-item", text: "A Viewer").click- activity_tab.type_comment("@Restricted")- page.first(".mention-list-item", text: "Restricted Viewer").click+ activity_tab.type_comment("@Internal")+ page.first(".mention-list-item", text: "Internal Viewer").clickactivity_tab.type_comment("@Group")page.find(".mention-list-item", text: "Group").click- activity_tab.check_restricted_visibility_comment_checkbox+ activity_tab.check_internal_comment_checkboxpage.within_test_selector("op-work-package-journal-form-element") doexpect(page.all("a.mention").map(&:text))- .to contain_exactly("@Restricted Viewer")+ .to contain_exactly("@Internal Viewer")expect(page).to have_text("@A Viewer") & have_text("@Group")endendend- context "when editing a restricted comment" do+ context "when editing a internal comment" doit "honors mentionable principals" doactivity_tab.within_journal_entry(first_comment) dopage.find_test_selector("op-wp-journal-#{first_comment.id}-action-menu").click@@ -265,21 +265,21 @@ RSpec.describe "Work package comments with restricted visibility",endexpect(page.all(".mention-list-item").map(&:text))- .to contain_exactly("Project Admin", "Restricted Viewer", "Restricted ViewerCommenter")+ .to contain_exactly("Project Admin", "Internal Viewer", "Internal ViewerCommenter")endendcontext "with a server error" dobefore do- allow(WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer).to receive(:sanitize)+ allow(WorkPackages::ActivitiesTab::InternalMentionsSanitizer).to receive(:sanitize).and_raise(RuntimeError, "Something went wrong!!!")endit "shows an error message" do- activity_tab.type_comment("@Restricted")- page.first(".mention-list-item", text: "Restricted Viewer").click+ activity_tab.type_comment("@Internal")+ page.first(".mention-list-item", text: "Internal Viewer").click- activity_tab.check_restricted_visibility_comment_checkbox+ activity_tab.check_internal_comment_checkboxpage.within_test_selector("op-primer-flash-message") doexpect(page).to have_text("Something went wrong!!!")diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rbindex 35df18c31de..f0d5f7c142c 100644--- a/spec/features/projects/edit_settings_spec.rb+++ b/spec/features/projects/edit_settings_spec.rb@@ -102,7 +102,7 @@ RSpec.describe "Projects", "editing settings", :js doendend- context "with a length restricted custom field" do+ context "with a length internal custom field" dolet!(:required_custom_field) docreate(:string_project_custom_field,name: "Foo",diff --git a/spec/features/projects/settings/activities_settings_spec.rb b/spec/features/projects/settings/activities_settings_spec.rbindex 965cb437f49..e925f08e3e7 100644--- a/spec/features/projects/settings/activities_settings_spec.rb+++ b/spec/features/projects/settings/activities_settings_spec.rb@@ -36,22 +36,22 @@ RSpec.describe "WorkPackages-Settings-Activities", :js docurrent_user { create(:admin) }- it "enables and disables the settings for the project", with_ee: %i[comments_with_restricted_visibility] do+ it "enables and disables the settings for the project", with_ee: %i[internal_comments] doactivities_settings_page.visit!expect(page).to have_css("#activities-form")- expect(page).to have_field(:project_enabled_comments_with_restricted_visibility, checked: false)+ expect(page).to have_field(:project_enabled_internal_comments, checked: false)- check("Enable restricted visibility comments")+ check("Enable internal comments")click_link_or_button "Save"expect_and_dismiss_flash(message: "Successful update.")- expect(page).to have_field(:project_enabled_comments_with_restricted_visibility, checked: true)+ expect(page).to have_field(:project_enabled_internal_comments, checked: true)- uncheck("Enable restricted visibility comments")+ uncheck("Enable internal comments")click_link_or_button "Save"expect_and_dismiss_flash(message: "Successful update.")- expect(page).to have_field(:project_enabled_comments_with_restricted_visibility, checked: false)+ expect(page).to have_field(:project_enabled_internal_comments, checked: false)endenddiff --git a/spec/features/projects/settings/work_packages_settings_spec.rb b/spec/features/projects/settings/work_packages_settings_spec.rbindex f5cc6ba8bd1..623815f881f 100644--- a/spec/features/projects/settings/work_packages_settings_spec.rb+++ b/spec/features/projects/settings/work_packages_settings_spec.rb@@ -72,7 +72,7 @@ RSpec.describe "Projects", "work packages settings menu", :js doendend- context "when the user has access to the activities tab", with_ee: %i[comments_with_restricted_visibility] do+ context "when the user has access to the activities tab", with_ee: %i[internal_comments] dolet(:permissions) { %i(edit_project view_work_packages) }current_user { create(:user, member_with_permissions: { project => permissions }) }diff --git a/spec/models/activities/fetcher_integration_spec.rb b/spec/models/activities/fetcher_integration_spec.rbindex e7d5fbb803d..1368ff5aa75 100644--- a/spec/models/activities/fetcher_integration_spec.rb+++ b/spec/models/activities/fetcher_integration_spec.rb@@ -50,7 +50,7 @@ RSpec.describe Activities::Fetcher, "integration" do.not_to include("budgets")end- describe "#events", with_flag: { comments_with_restricted_visibility: true } do+ describe "#events", with_flag: { internal_comments: true } dolet(:event_user) { user }let(:work_package) { create(:work_package, project:, author: event_user) }let(:forum) { create(:forum, project:) }@@ -61,12 +61,12 @@ RSpec.describe Activities::Fetcher, "integration" dolet(:changeset) { create(:changeset, committer: event_user.login, repository:) }let(:wiki) { create(:wiki, project:) }let(:wiki_page) { create(:wiki_page, wiki:, author: event_user, text: "some text") }- let(:restricted_note) do+ let(:internal_note) docreate(:work_package_journal,journable: work_package,user: admin,- notes: "Restricted comment",- restricted: true,+ notes: "Internal comment",+ internal: true,version: 2,data: build(:journal_work_package_journal,subject: work_package.subject,@@ -133,7 +133,7 @@ RSpec.describe Activities::Fetcher, "integration" docontext "for global activities" dolet!(:activities) { [project, work_package, message, news, time_entry, changeset, wiki_page] }- include_examples "specifying scope"+ it_behaves_like "specifying scope"context "if lacking permissions" dobefore do@@ -158,7 +158,7 @@ RSpec.describe Activities::Fetcher, "integration" doendend- context "if user cannot see restricted journals" do+ context "if user cannot see internal journals" dobefore dorole.role_permissions.find_by(permission: "view_internal_comments")@@ -167,23 +167,23 @@ RSpec.describe Activities::Fetcher, "integration" do# reload otherwise permissions don't updateevent_user.reload- # make sure restricted_note is created- restricted_note+ # make sure internal_note is created+ internal_noteend- it "does not find events with restricted journals" do- expect(instance.events.map(&:journal).select(&:restricted)).to be_empty+ it "does not find events with internal journals" do+ expect(instance.events.map(&:journal).select(&:internal)).to be_emptyendend- context "if user can see restricted journals" do+ context "if user can see internal journals" dobefore do- # make sure restricted_note is created- restricted_note+ # make sure internal_note is created+ internal_noteend- it "finds events with restricted journals" do- expect(instance.events.map(&:journal).select(&:restricted)).to include(restricted_note)+ it "finds events with internal journals" do+ expect(instance.events.map(&:journal).select(&:internal)).to include(internal_note)endendend@@ -192,7 +192,7 @@ RSpec.describe Activities::Fetcher, "integration" dolet(:options) { { project: } }let!(:activities) { [project, work_package, message, news, time_entry, changeset, wiki_page] }- include_examples "specifying scope"+ it_behaves_like "specifying scope"context "if lacking permissions" dobefore do@@ -222,7 +222,7 @@ RSpec.describe Activities::Fetcher, "integration" doendend- context "if user cannot see restricted journals" do+ context "if user cannot see internal journals" dobefore dorole.role_permissions.find_by(permission: "view_internal_comments")@@ -231,23 +231,23 @@ RSpec.describe Activities::Fetcher, "integration" do# reload otherwise permissions don't updateevent_user.reload- # make sure restricted_note is created- restricted_note+ # make sure internal_note is created+ internal_noteend- it "does not find events with restricted journals" do- expect(instance.events.map(&:journal).select(&:restricted)).to be_empty+ it "does not find events with internal journals" do+ expect(instance.events.map(&:journal).select(&:internal)).to be_emptyendend- context "if user can see restricted journals" do+ context "if user can see internal journals" dobefore do- # make sure restricted_note is created- restricted_note+ # make sure internal_note is created+ internal_noteend- it "finds events with restricted journals" do- expect(instance.events.map(&:journal).select(&:restricted)).to include(restricted_note)+ it "finds events with internal journals" do+ expect(instance.events.map(&:journal).select(&:internal)).to include(internal_note)endendend@@ -272,7 +272,7 @@ RSpec.describe Activities::Fetcher, "integration" doendlet!(:activities) { [project, subproject, news, subproject_news, work_package, subproject_work_package] }- include_examples "specifying scope"+ it_behaves_like "specifying scope"context "if the subproject has activity disabled" dobefore do@@ -323,7 +323,7 @@ RSpec.describe Activities::Fetcher, "integration" do[project, work_package, message, news, time_entry, changeset, wiki_page]end- include_examples "specifying scope"+ it_behaves_like "specifying scope"context "for a different user" dolet(:other_user) { create(:user) }diff --git a/spec/models/journal_spec.rb b/spec/models/journal_spec.rbindex 22bf52d3191..df68cb34bcf 100644--- a/spec/models/journal_spec.rb+++ b/spec/models/journal_spec.rb@@ -36,28 +36,28 @@ RSpec.describe Journal dolet(:model_instance) { create(:work_package_journal, journable: work_package, version: 2) }describe "#attachments_visible?" do- context "with a restricted journal" do- let(:restricted_journal) { build_stubbed(:work_package_journal, journable: work_package, restricted: true) }+ context "with a internal journal" do+ let(:internal_journal) { build_stubbed(:work_package_journal, journable: work_package, internal: true) }- context "with the user having the restricted permission" do- let(:user_with_restricted_permission) do+ context "with the user having the internal permission" do+ let(:user_with_internal_permission) docreate(:user, member_with_permissions: { project => %i[view_work_packages view_internal_comments] })end- let(:current_user) { user_with_restricted_permission }+ let(:current_user) { user_with_internal_permission }before dologin_as(current_user)endit "is visible" do- expect(restricted_journal).to be_attachments_visible+ expect(internal_journal).to be_attachments_visibleendend- context "with the user not having the restricted permission" do+ context "with the user not having the internal permission" doit "returns false" do- expect(restricted_journal).not_to be_attachments_visible+ expect(internal_journal).not_to be_attachments_visibleendendend@@ -68,7 +68,7 @@ RSpec.describe Journal dolet(:work_package) { create(:work_package) }let(:journal) { create(:work_package_journal, journable: work_package, version: 2) }- let(:user_with_restricted_permission) do+ let(:user_with_internal_permission) docreate(:user,member_with_permissions: { work_package.project => %i[view_work_packagesview_internal_comments] })@@ -79,14 +79,14 @@ RSpec.describe Journal domember_with_permissions: { work_package.project => %i[view_work_packages] })end- context "with a restricted journal" do+ context "with a internal journal" dobefore do- journal.update!(restricted: true)+ journal.update!(internal: true)end- context "with the user having view permission for restricted journals" do+ context "with the user having view permission for internal journals" dobefore do- login_as(user_with_restricted_permission)+ login_as(user_with_internal_permission)endit "is visible" do@@ -94,7 +94,7 @@ RSpec.describe Journal doendend- context "with the user not having view permission for restricted journals" do+ context "with the user not having view permission for internal journals" dobefore dologin_as(user_with_view_work_packages_permission)end@@ -105,13 +105,13 @@ RSpec.describe Journal doendend- context "with a journal that is not restricted" do+ context "with a journal that is not internal" dobefore do- journal.update!(restricted: false)+ journal.update!(internal: false)login_as(user_with_view_work_packages_permission)end- context "and the user has permission to view unrestricted journals" do+ context "and the user has permission to view public journals" doit "is visible" doexpect(journal).to be_visibleenddiff --git a/spec/models/queries/principals/filters/restricted_mentionable_on_work_package_filter_spec.rb b/spec/models/queries/principals/filters/internal_mentionable_on_work_package_filter_spec.rbsimilarity index 77%rename from spec/models/queries/principals/filters/restricted_mentionable_on_work_package_filter_spec.rbrename to spec/models/queries/principals/filters/internal_mentionable_on_work_package_filter_spec.rbindex 73dc3426f68..d3f1010a348 100644--- a/spec/models/queries/principals/filters/restricted_mentionable_on_work_package_filter_spec.rb+++ b/spec/models/queries/principals/filters/internal_mentionable_on_work_package_filter_spec.rb@@ -30,25 +30,25 @@require "spec_helper"-RSpec.describe Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFilter do+RSpec.describe Queries::Principals::Filters::InternalMentionableOnWorkPackageFilter doit_behaves_like "basic query filter" do- include RestrictedVisibilityCommentsHelpers+ include InternalCommentsHelpers- let(:class_key) { :restricted_mentionable_on_work_package }+ let(:class_key) { :internal_mentionable_on_work_package }let(:type) { :list_optional }- let(:human_name) { "restricted mentionable" }+ let(:human_name) { "internal mentionable" }shared_let(:project) { create(:project) }shared_let(:work_package) { create(:work_package, project:) }shared_let(:other_work_package) { create(:work_package, project:) }- shared_let(:user_without_restricted_comments_view_permissions) { create_user_without_restricted_comments_view_permissions }- shared_let(:user_with_restricted_comments_view_permissions) { create_user_with_restricted_comments_view_permissions }- shared_let(:user_with_restricted_comments_view_and_write_permissions) do- create_user_with_restricted_comments_view_and_write_permissions+ shared_let(:user_without_internal_comments_view_permissions) { create_user_without_internal_comments_view_permissions }+ shared_let(:user_with_internal_comments_view_permissions) { create_user_with_internal_comments_view_permissions }+ shared_let(:user_with_internal_comments_view_and_write_permissions) do+ create_user_with_internal_comments_view_and_write_permissionsend- let(:user) { user_with_restricted_comments_view_permissions }+ let(:user) { user_with_internal_comments_view_permissions }before { allow(User).to receive(:current).and_return(user) }@@ -88,8 +88,8 @@ RSpec.describe Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFit "returns all mentionable principals on the work package and its project" doexpect(subject)- .to contain_exactly(user_with_restricted_comments_view_permissions,- user_with_restricted_comments_view_and_write_permissions)+ .to contain_exactly(user_with_internal_comments_view_permissions,+ user_with_internal_comments_view_and_write_permissions)endcontext "with users and groups" do@@ -106,8 +106,8 @@ RSpec.describe Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFit "returns all mentionable principals including group and group members" doexpect(subject)- .to contain_exactly(user_with_restricted_comments_view_permissions,- user_with_restricted_comments_view_and_write_permissions,+ .to contain_exactly(user_with_internal_comments_view_permissions,+ user_with_internal_comments_view_and_write_permissions,group,group_member1,group_member2)@@ -120,7 +120,7 @@ RSpec.describe Queries::Principals::Filters::RestrictedMentionableOnWorkPackageFit "returns all non-mentionable users on the work package and its project" doexpect(subject)- .to contain_exactly(user_without_restricted_comments_view_permissions)+ .to contain_exactly(user_without_internal_comments_view_permissions)endendenddiff --git a/spec/models/work_package/work_package_acts_as_journalized_spec.rb b/spec/models/work_package/work_package_acts_as_journalized_spec.rbindex a8cfca56e1c..90218b4b044 100644--- a/spec/models/work_package/work_package_acts_as_journalized_spec.rb+++ b/spec/models/work_package/work_package_acts_as_journalized_spec.rb@@ -873,56 +873,56 @@ RSpec.describe WorkPackage doendend- describe "#journals.restricted_visible" do+ describe "#journals.internal_visible" dolet(:work_package) { create(:work_package) }let(:admin) { create(:admin) }let(:user) { create(:user) }- let!(:restricted_note) do+ let!(:internal_note) docreate(:work_package_journal,user: admin,notes: "First comment by admin",journable: work_package,- restricted: true,+ internal: true,version: 2)end- let!(:unrestricted_note) do+ let!(:public_note) docreate(:work_package_journal,user:,notes: "First comment by user",journable: work_package,- restricted: false,+ internal: false,version: 3)end- subject(:journals) { work_package.journals.restricted_visible }+ subject(:journals) { work_package.journals.internal_visible }before dologin_as userend- context "when comments_with_restricted_visibility is enabled", with_flag: { comments_with_restricted_visibility: true } do+ context "when internal_comments is enabled", with_flag: { internal_comments: true } docontext "and setting is enabled for the project" dobefore do- work_package.project.enabled_comments_with_restricted_visibility = true+ work_package.project.enabled_internal_comments = truework_package.project.save!end- context "when the user cannot see restricted journals" do+ context "when the user cannot see internal journals" dobefore domock_permissions_for(user) do |mock|mock.allow_in_work_package :view_work_packages, work_package:endend- it "does not return the restricted journal" do- expect(journals.map(&:id)).not_to include(restricted_note.id)- expect(journals.map(&:id)).to include(unrestricted_note.id)+ it "does not return the internal journal" do+ expect(journals.map(&:id)).not_to include(internal_note.id)+ expect(journals.map(&:id)).to include(public_note.id)endend- context "when the user can see restricted journals" do+ context "when the user can see internal journals" dobefore domock_permissions_for(user) do |mock|mock.allow_in_project(:view_internal_comments, project: work_package.project)@@ -930,14 +930,14 @@ RSpec.describe WorkPackage doendit "returns all journals" do- expect(journals.map(&:id)).to include(restricted_note.id, unrestricted_note.id)+ expect(journals.map(&:id)).to include(internal_note.id, public_note.id)endendendcontext "and setting is disabled for the project" dobefore do- work_package.project.enabled_comments_with_restricted_visibility = false+ work_package.project.enabled_internal_comments = falsework_package.project.save!mock_permissions_for(user) do |mock|@@ -945,23 +945,23 @@ RSpec.describe WorkPackage doendend- it "does not return the restricted journal" do- expect(journals.map(&:id)).not_to include(restricted_note.id)- expect(journals.map(&:id)).to include(unrestricted_note.id)+ it "does not return the internal journal" do+ expect(journals.map(&:id)).not_to include(internal_note.id)+ expect(journals.map(&:id)).to include(public_note.id)endendend- context "when comments_with_restricted_visibility is disabled", with_flag: { comments_with_restricted_visibility: false } do+ context "when internal_comments is disabled", with_flag: { internal_comments: false } dobefore domock_permissions_for(user) do |mock|mock.allow_in_project(:view_internal_comments, project: work_package.project)endend- it "does not return the restricted journal regardless of permissions" do- expect(journals.map(&:id)).not_to include(restricted_note.id)- expect(journals.map(&:id)).to include(unrestricted_note.id)+ it "does not return the internal journal regardless of permissions" do+ expect(journals.map(&:id)).not_to include(internal_note.id)+ expect(journals.map(&:id)).to include(public_note.id)endendenddiff --git a/spec/requests/api/v3/activities_api_spec.rb b/spec/requests/api/v3/activities_api_spec.rbindex 1c3ba56144f..6c082f94af1 100644--- a/spec/requests/api/v3/activities_api_spec.rb+++ b/spec/requests/api/v3/activities_api_spec.rb@@ -135,15 +135,15 @@ RSpec.describe API::V3::Activities::ActivitiesAPI, content_type: :json doit_behaves_like "not found"end- context "for a restricted journal" do+ context "for a internal journal" dolet(:activity) do- work_package.add_journal(user: current_user, notes: "need to know basis", restricted: true)+ work_package.add_journal(user: current_user, notes: "need to know basis", internal: true)work_package.save(validate: false)work_package.journals.lastendcontext "when editing OWN journals" do- context "and the user has permission to edit own restricted journals" do+ context "and the user has permission to edit own internal journals" dolet(:permissions) do%i[view_work_packages view_internal_comments edit_own_internal_comments]end@@ -153,17 +153,17 @@ RSpec.describe API::V3::Activities::ActivitiesAPI, content_type: :json doit_behaves_like "valid activity patch request"end- context "and the user does not have permission to edit own restricted journals" do+ context "and the user does not have permission to edit own internal journals" dolet(:permissions) { %i[view_work_packages view_internal_comments] }it_behaves_like "unauthorized access"endend- context "when editing OTHERs restricted journals" do+ context "when editing OTHERs internal journals" dolet(:other_user) { create(:user, member_with_permissions: { project => permissions }) }- context "and the user has permission to edit others restricted journals" do+ context "and the user has permission to edit others internal journals" dolet(:permissions) do%i[view_work_packages view_internal_comments edit_others_internal_comments]end@@ -177,7 +177,7 @@ RSpec.describe API::V3::Activities::ActivitiesAPI, content_type: :json doit_behaves_like "valid activity patch request"end- context "and the user does not have permission to edit others restricted journals" do+ context "and the user does not have permission to edit others internal journals" dolet(:permissions) { %i[view_work_packages view_internal_comments] }before do@@ -216,20 +216,20 @@ RSpec.describe API::V3::Activities::ActivitiesAPI, content_type: :json doit_behaves_like "valid activity request", "Activity::Comment"end- context "for a restricted journal" do+ context "for a internal journal" dolet(:activity) do- work_package.add_journal(user: current_user, notes: "need to know basis", restricted: true)+ work_package.add_journal(user: current_user, notes: "need to know basis", internal: true)work_package.save(validate: false)work_package.journals.lastend- context "and the user has permission to view restricted journals" do+ context "and the user has permission to view internal journals" dolet(:permissions) { %i[view_work_packages view_internal_comments] }it_behaves_like "valid activity request", "Activity::Comment"end- context "and the user does not have permission to view restricted journals" do+ context "and the user does not have permission to view internal journals" dolet(:permissions) { [:view_work_packages] }it_behaves_like "not found"diff --git a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb b/spec/requests/api/v3/activities_by_work_package_resource_spec.rbindex b5ab7838971..594dd3b3120 100644--- a/spec/requests/api/v3/activities_by_work_package_resource_spec.rb+++ b/spec/requests/api/v3/activities_by_work_package_resource_spec.rb@@ -51,8 +51,8 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI do # rubocop:disaallow(User).to receive(:current).and_return(current_user)end- describe "GET /api/v3/work_packages/:id/activities", with_flag: { comments_with_restricted_visibility: true } do- context "when activities do not include restricted journals" do+ describe "GET /api/v3/work_packages/:id/activities", with_flag: { internal_comments: true } do+ context "when activities do not include internal journals" dobefore doget api_v3_paths.work_package_activities work_package.idend@@ -70,25 +70,25 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI do # rubocop:disaendend- context "when activities include restricted journals" do- let!(:restricted_note) do+ context "when activities include internal journals" do+ let!(:internal_note) docreate(:work_package_journal,journable: work_package,user: admin,- notes: "Restricted comment",- restricted: true,+ notes: "Internal comment",+ internal: true,version: 2)endbefore do- project.enabled_comments_with_restricted_visibility = true+ project.enabled_internal_comments = trueproject.save!endcontext "and user has the permission to see it" do- it "includes restricted activities" do+ it "includes internal activities" doget api_v3_paths.work_package_activities work_package.id- expect(last_response.body).to include("Restricted comment")+ expect(last_response.body).to include("Internal comment")endend@@ -99,9 +99,9 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI do # rubocop:disa.destroyend- it "does not include restricted activities" do+ it "does not include internal activities" doget api_v3_paths.work_package_activities work_package.id- expect(last_response.body).not_to include("Restricted comment")+ expect(last_response.body).not_to include("Internal comment")endendenddiff --git a/spec/requests/api/v3/attachments/activity_comment_spec.rb b/spec/requests/api/v3/attachments/activity_comment_spec.rbindex 6418ce3ab01..bb94695c0f9 100644--- a/spec/requests/api/v3/attachments/activity_comment_spec.rb+++ b/spec/requests/api/v3/attachments/activity_comment_spec.rb@@ -50,14 +50,14 @@ RSpec.describe "Activity comment attachments" dolet(:update_permission) { :edit_own_work_package_comments }end- context "with a restricted journal" do+ context "with a internal journal" doit_behaves_like "an APIv3 attachment resource" dolet(:work_package) docreate(:work_package, author: current_user, project:)endlet(:activity) do- work_package.add_journal(user: current_user, notes: "Need to know!", restricted: true)+ work_package.add_journal(user: current_user, notes: "Need to know!", internal: true)work_package.save(validate: false)work_package.journals.lastenddiff --git a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_resource_spec.rbindex 20542d94058..a26abec6814 100644--- a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb+++ b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb@@ -138,7 +138,7 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_gooendend- describe "with restricted copying" do+ describe "with internal copying" dolet(:params) do{ name: "My copied project",identifier: "my-copied-project",diff --git a/spec/services/add_work_package_note_service_spec.rb b/spec/services/add_work_package_note_service_spec.rbindex dd98c03e5d7..5132e82b441 100644--- a/spec/services/add_work_package_note_service_spec.rb+++ b/spec/services/add_work_package_note_service_spec.rb@@ -71,17 +71,17 @@ RSpec.describe AddWorkPackageNoteService, type: :model doit "persists the value" doexpect(subject).to be_successexpect(work_package).to have_received(:add_journal)- .with(user: user, notes: "blubs", restricted: false)+ .with(user: user, notes: "blubs", internal: false)expect(work_package).to have_received(:save_journals)end- context "with restricted note" do- subject { instance.call("blubs", send_notifications:, restricted: true) }+ context "with internal note" do+ subject { instance.call("blubs", send_notifications:, internal: true) }it "persists the value" doexpect(subject).to be_successexpect(work_package).to have_received(:add_journal)- .with(user: user, notes: "blubs", restricted: true)+ .with(user: user, notes: "blubs", internal: true)expect(work_package).to have_received(:save_journals)endenddiff --git a/spec/services/notifications/create_from_model_service_work_package_spec.rb b/spec/services/notifications/create_from_model_service_work_package_spec.rbindex 2abbfe8f9f5..2ab82359f3d 100644--- a/spec/services/notifications/create_from_model_service_work_package_spec.rb+++ b/spec/services/notifications/create_from_model_service_work_package_spec.rb@@ -102,7 +102,7 @@ RSpec.describe Notifications::CreateFromModelService,work_package.journals.lastendlet(:journal_2_with_internal_comment) do- work_package.add_journal(user: admin, notes: "need to know basis", restricted: true)+ work_package.add_journal(user: admin, notes: "need to know basis", internal: true)work_package.save(validate: false)work_package.journals.lastend@@ -204,14 +204,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when assignee does not have access to restricted journal" do+ context "when assignee does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when assignee has access to restricted journal" do+ context "when assignee has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }@@ -281,14 +281,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when responsible does not have access to restricted journal" do+ context "when responsible does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when responsible has access to restricted journal" do+ context "when responsible has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }@@ -371,14 +371,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when watcher does not have access to restricted journal" do+ context "when watcher does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when watcher has access to restricted journal" do+ context "when watcher has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }@@ -493,14 +493,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when recipient does not have access to restricted journal" do+ context "when recipient does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when recipient has access to restricted journal" do+ context "when recipient has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }@@ -564,14 +564,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when the shared user does not have access to restricted journal" do+ context "when the shared user does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when the shared user has access to restricted journal" do+ context "when the shared user has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }@@ -672,14 +672,14 @@ RSpec.describe Notifications::CreateFromModelService,it_behaves_like "creates no notification"end- context "when the user does not have access to restricted journal" do+ context "when the user does not have access to internal journal" dolet(:author) { admin }let(:journal) { journal_2_with_internal_comment }it_behaves_like "creates no notification"end- context "when the user has access to restricted journal" do+ context "when the user has access to internal journal" dolet(:author) { admin }let(:permissions) { %i[view_work_packages view_internal_comments] }let(:journal) { journal_2_with_internal_comment }diff --git a/spec/services/work_packages/activities_tab/restricted_mentions_sanitizer_spec.rb b/spec/services/work_packages/activities_tab/internal_mentions_sanitizer_spec.rbsimilarity index 75%rename from spec/services/work_packages/activities_tab/restricted_mentions_sanitizer_spec.rbrename to spec/services/work_packages/activities_tab/internal_mentions_sanitizer_spec.rbindex cbf6473d41d..f7545941054 100644--- a/spec/services/work_packages/activities_tab/restricted_mentions_sanitizer_spec.rb+++ b/spec/services/work_packages/activities_tab/internal_mentions_sanitizer_spec.rb@@ -30,14 +30,14 @@require "spec_helper"-RSpec.describe WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer do- include RestrictedVisibilityCommentsHelpers+RSpec.describe WorkPackages::ActivitiesTab::InternalMentionsSanitizer do+ include InternalCommentsHelpersshared_let(:project) { create(:project) }shared_let(:admin_but_non_member) { create(:admin) }- shared_let(:viewer) { create_user_without_restricted_comments_view_permissions }- shared_let(:user_with_restricted_comments_view_and_write_permissions) do- create_user_with_restricted_comments_view_and_write_permissions+ shared_let(:viewer) { create_user_without_internal_comments_view_permissions }+ shared_let(:user_with_internal_comments_view_and_write_permissions) do+ create_user_with_internal_comments_view_and_write_permissionsendshared_let(:project_admin) { create_user_as_project_admin }shared_let(:work_package) { create(:work_package, project:) }@@ -50,7 +50,7 @@ RSpec.describe WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer do<mention class="mention" data-id="#{viewer.id}" data-type="user" data-text="@#{viewer.firstname}">@#{viewer.firstname}</mention> wrote:- > <mention class="mention" data-id="#{user_with_restricted_comments_view_and_write_permissions.id}" data-type="user" data-text="@#{user_with_restricted_comments_view_and_write_permissions.firstname}">@#{user_with_restricted_comments_view_and_write_permissions.firstname}</mention> wrote:+ > <mention class="mention" data-id="#{user_with_internal_comments_view_and_write_permissions.id}" data-type="user" data-text="@#{user_with_internal_comments_view_and_write_permissions.firstname}">@#{user_with_internal_comments_view_and_write_permissions.firstname}</mention> wrote:>> > <mention class="mention" data-id="#{project_admin.id}" data-type="user" data-text="@#{project_admin.firstname}">@#{project_admin.firstname}</mention> wrote:> >@@ -70,7 +70,7 @@ RSpec.describe WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer do@#{viewer.firstname} wrote:- > <mention class="mention" data-id="#{user_with_restricted_comments_view_and_write_permissions.id}" data-type="user" data-text="@#{user_with_restricted_comments_view_and_write_permissions.firstname}">@#{user_with_restricted_comments_view_and_write_permissions.firstname}</mention> wrote:+ > <mention class="mention" data-id="#{user_with_internal_comments_view_and_write_permissions.id}" data-type="user" data-text="@#{user_with_internal_comments_view_and_write_permissions.firstname}">@#{user_with_internal_comments_view_and_write_permissions.firstname}</mention> wrote:>> > <mention class="mention" data-id="#{project_admin.id}" data-type="user" data-text="@#{project_admin.firstname}">@#{project_admin.firstname}</mention> wrote:> >@@ -84,7 +84,7 @@ RSpec.describe WorkPackages::ActivitiesTab::RestrictedMentionsSanitizer dosubject { described_class.new(work_package, input).call }- before { allow(User).to receive(:current).and_return(user_with_restricted_comments_view_and_write_permissions) }+ before { allow(User).to receive(:current).and_return(user_with_internal_comments_view_and_write_permissions) }it "sanitizes the notes" doexpect(subject).to eq(expected_output)diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rbindex 7c050740762..c709ac9c43d 100644--- a/spec/support/components/work_packages/activities.rb+++ b/spec/support/components/work_packages/activities.rb@@ -241,7 +241,7 @@ module Componentspage.find_test_selector("op-submit-work-package-journal-form").clickend- def add_comment(text: nil, save: true, restricted: false)+ def add_comment(text: nil, save: true, internal: false)if page.find_test_selector("op-open-work-package-journal-form-trigger")open_new_comment_editorelse@@ -251,7 +251,7 @@ module Componentspage.within_test_selector("op-work-package-journal-form-element") doget_editor_form_field_element.set_value(text)- check_restricted_visibility_comment_checkbox if restricted+ check_internal_comment_checkbox if internalpage.find_test_selector("op-submit-work-package-journal-form").click if saveend@@ -306,8 +306,8 @@ module Componentsexpect(page).to have_test_selector("op-work-package-journal-form-element")end- def check_restricted_visibility_comment_checkbox- expect(page).to have_test_selector("op-work-package-journal-restricted-comment-checkbox")+ def check_internal_comment_checkbox+ expect(page).to have_test_selector("op-work-package-journal-internal-comment-checkbox")page.check("Restrict visibility")enddiff --git a/spec/support/work_packages/activities_tab/restricted_visibility_comments_helpers.rb b/spec/support/work_packages/activities_tab/internal_comments_helpers.rbsimilarity index 90%rename from spec/support/work_packages/activities_tab/restricted_visibility_comments_helpers.rbrename to spec/support/work_packages/activities_tab/internal_comments_helpers.rbindex fdaef15d530..7cbeecb9299 100644--- a/spec/support/work_packages/activities_tab/restricted_visibility_comments_helpers.rb+++ b/spec/support/work_packages/activities_tab/internal_comments_helpers.rb@@ -29,8 +29,8 @@#++require "spec_helper"-module RestrictedVisibilityCommentsHelpers- def create_user_without_restricted_comments_view_permissions+module InternalCommentsHelpers+ def create_user_without_internal_comments_view_permissionsviewer_role = create(:project_role, permissions: %i[view_work_packages])create(:user,firstname: "A",@@ -50,15 +50,15 @@ module RestrictedVisibilityCommentsHelpersmember_with_roles: { project => member_role })end- def create_user_with_restricted_comments_view_permissions+ def create_user_with_internal_comments_view_permissionsviewer_role = create(:project_role, permissions: %i[view_work_packages view_internal_comments])create(:user,- firstname: "Restricted",+ firstname: "Internal",lastname: "Viewer",member_with_roles: { project => viewer_role })end- def create_user_with_restricted_comments_view_and_write_permissions+ def create_user_with_internal_comments_view_and_write_permissionsviewer_role_with_commenting_permission = create(:project_role,permissions: %i[view_work_packages add_work_package_commentsedit_own_work_package_comments@@ -66,7 +66,7 @@ module RestrictedVisibilityCommentsHelpersadd_internal_commentsedit_own_internal_comments])create(:user,- firstname: "Restricted",+ firstname: "Internal",lastname: "ViewerCommenter",member_with_roles: { project => viewer_role_with_commenting_permission })end