Merge pull request #18756 from opf/impl/63635-remove-internal-comments-feature-flag

Remove internal comments feature flag
This commit is contained in:
Bruno Pagno
2025-04-29 12:41:07 +02:00
committed by GitHub
17 changed files with 21 additions and 56 deletions
-1
View File
@@ -35,7 +35,6 @@ jobs:
echo "OPENPROJECT_HSTS=false" >> .env.pullpreview
echo "OPENPROJECT_NOTIFICATIONS_POLLING_INTERVAL=10000" >> .env.pullpreview
echo "OPENPROJECT_FEATURE_WORK_PACKAGE_COMMENT_ID_URL_ACTIVE=true" >> .env.pullpreview
echo "OPENPROJECT_FEATURE_COMMENTS_WITH_RESTRICTED_VISIBILITY_ACTIVE=true" >> .env.pullpreview
- name: Boot as BIM edition
if: contains(github.ref, 'bim/') || contains(github.head_ref, 'bim/')
run: |
@@ -73,7 +73,7 @@
Primer::Beta::Octicon.new(
:"dot-fill", # color is set via CSS as requested by UI/UX Team
classes: "work-packages-activities-tab-journals-item-component--notification-dot-icon",
size: (OpenProject::FeatureDecisions.internal_comments_active? ? :small : :medium),
size: :small,
data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }
)
)
@@ -193,7 +193,7 @@ module WorkPackages
render(Primer::Beta::Octicon.new(
:"dot-fill", # color is set via CSS as requested by UI/UX Team
classes: "work-packages-activities-tab-journals-item-component-details--notification-dot-icon",
size: (OpenProject::FeatureDecisions.internal_comments_active? ? :small : :medium),
size: :small,
data: { test_selector: "op-journal-unread-notification", "op-ian-center-update-immediate": true }
))
end
@@ -60,8 +60,7 @@ module WorkPackages
end
def adding_internal_comment_allowed?
OpenProject::FeatureDecisions.internal_comments_active? &&
work_package.project.enabled_internal_comments &&
work_package.project.enabled_internal_comments &&
User.current.allowed_in_project?(:add_internal_comments, work_package.project)
end
@@ -40,9 +40,6 @@ module WorkPackages
attribute :journal_internal do
next unless model.journal_internal
unless OpenProject::FeatureDecisions.internal_comments_active?
errors.add(:journal_internal, :feature_disabled)
end
unless allowed_in_project?(:add_internal_comments)
errors.add(:journal_internal, :error_unauthorized)
end
@@ -163,10 +163,6 @@ class Activities::BaseActivityProvider
end
def filter_for_visibility(query, user)
unless OpenProject::FeatureDecisions.internal_comments_active?
return query.where(journals_table[:internal].eq(false))
end
query.where(
projects_table[:id]
.in(Project.allowed_to(user, :view_internal_comments).select(:id).arel)
+1 -2
View File
@@ -34,8 +34,7 @@ module WorkPackage::Journalized
included do
acts_as_journalized journals_association_extension: proc {
def internal_visible
if OpenProject::FeatureDecisions.internal_comments_active? &&
proxy_association.owner.project.enabled_internal_comments &&
if proxy_association.owner.project.enabled_internal_comments &&
User.current.allowed_in_project?(:view_internal_comments, proxy_association.owner.project)
all
else
-4
View File
@@ -60,7 +60,3 @@ OpenProject::FeatureDecisions.add :work_package_comment_id_url,
description: "Introduced a new WP comment URL identifier structure " \
"`#comment-<journal-id>` replacing the old " \
"`#activity-<journal-sequence_number>`."
OpenProject::FeatureDecisions.add :internal_comments,
description: "Enables submitting comments that are internal" \
"and only a subset of users can see"
+4 -8
View File
@@ -317,29 +317,25 @@ Rails.application.reloader.to_prepare do
{},
permissible_on: %i[project],
require: :loggedin,
dependencies: :view_work_packages,
visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }
dependencies: :view_work_packages
wpt.permission :add_internal_comments,
{},
permissible_on: %i[project],
require: :loggedin,
dependencies: %i[view_project view_internal_comments],
visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }
dependencies: %i[view_project view_internal_comments]
wpt.permission :edit_own_internal_comments,
{},
permissible_on: %i[project],
require: :loggedin,
dependencies: %i[view_project view_internal_comments],
visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }
dependencies: %i[view_project view_internal_comments]
wpt.permission :edit_others_internal_comments,
{},
permissible_on: %i[project],
require: :loggedin,
dependencies: %i[view_project view_internal_comments],
visible: -> { OpenProject::FeatureDecisions.internal_comments_active? }
dependencies: %i[view_project view_internal_comments]
# WP attachments can be added with :edit_work_packages, this permission allows it without Edit WP as well.
wpt.permission :add_work_package_attachments,
@@ -88,17 +88,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
work_package.journal_notes = "blubs"
end
context "and journal_internal is true, and internal_comments_active? is disabled",
with_flag: { internal_comments_active: false } do
before do
work_package.journal_internal = true
end
it_behaves_like "contract is invalid", journal_internal: :feature_disabled
end
context "and journal_internal is true, and internal_comments_active? is enabled",
with_flag: { internal_comments_active: true } do
context "and journal_internal is true" do
before do
work_package.journal_internal = true
end
@@ -106,8 +96,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
it_behaves_like "contract is valid"
end
context "and journal_internal is false, and internal_comments_active? is disabled",
with_flag: { internal_comments_active: false } do
context "and journal_internal is false" do
before do
work_package.journal_internal = false
end
@@ -115,8 +104,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
it_behaves_like "contract is valid"
end
context "with journal_internal is true, internal_comments_active? is active but lacking permissions",
with_flag: { internal_comments_active: true } do
context "with journal_internal is true, but lacking permissions" do
let(:permissions) { super() - [:add_internal_comments] }
before do
@@ -126,8 +114,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
it_behaves_like "contract is invalid", journal_internal: :error_unauthorized
end
context "with journal_internal is false, internal_comments_active? is active and lacking permissions",
with_flag: { internal_comments_active: true } do
context "with journal_internal is false and lacking permissions" do
let(:permissions) { super() - [:add_internal_comments] }
before do
@@ -313,7 +313,7 @@ RSpec.describe WorkPackagesController do
end
end
context "when there are internal comments", with_flag: { internal_comments: true } do
context "when there are internal comments" do
render_views
let(:admin) { create(:admin) }
@@ -236,8 +236,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite do
end
end
context "when a user cannot see internal comments",
with_flag: { internal_comments: true } do
context "when a user cannot see internal comments" do
current_user { member }
before do
@@ -257,8 +256,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite do
end
end
context "when a user can see internal comments",
with_flag: { internal_comments: true } do
context "when a user can see internal comments" do
current_user { admin }
before do
@@ -32,8 +32,7 @@ require "spec_helper"
RSpec.describe "Work package activity tab comment editor",
:js,
:with_cuprite,
with_flag: { internal_comments: true } do
:with_cuprite do
let(:project) { create(:project) }
let(:admin) { create(:admin) }
let(:work_package) { create(:work_package, project:, author: admin) }
@@ -31,8 +31,7 @@
require "spec_helper"
RSpec.describe "Work package internal comments",
:js,
with_flag: { internal_comments: true } do
:js do
include InternalCommentsHelpers
shared_let(:project) { create(:project, enabled_internal_comments: true) }
@@ -50,7 +50,7 @@ RSpec.describe Activities::Fetcher, "integration" do
.not_to include("budgets")
end
describe "#events", with_flag: { internal_comments: true } do
describe "#events" do
let(:event_user) { user }
let(:work_package) { create(:work_package, project:, author: event_user) }
let(:forum) { create(:forum, project:) }
@@ -902,7 +902,7 @@ RSpec.describe WorkPackage do
login_as user
end
context "when internal_comments is enabled", with_flag: { internal_comments: true } do
context "when internal_comments is enabled" do
context "and setting is enabled for the project" do
before do
work_package.project.enabled_internal_comments = true
@@ -952,7 +952,7 @@ RSpec.describe WorkPackage do
end
end
context "when internal_comments is disabled", with_flag: { internal_comments: false } do
context "when internal_comments is disabled" do
before do
mock_permissions_for(user) do |mock|
mock.allow_in_project(:view_internal_comments, project: work_package.project)
@@ -51,7 +51,7 @@ RSpec.describe API::V3::Activities::ActivitiesByWorkPackageAPI do # rubocop:disa
allow(User).to receive(:current).and_return(current_user)
end
describe "GET /api/v3/work_packages/:id/activities", with_flag: { internal_comments: true } do
describe "GET /api/v3/work_packages/:id/activities" do
context "when activities do not include internal journals" do
before do
get api_v3_paths.work_package_activities work_package.id