Remove blocknote editor feature flag (#21273)

https://community.openproject.org/wp/68232
This commit is contained in:
Kabiru Mwenja
2025-12-05 11:37:26 +03:00
committed by GitHub
parent 6350aba7e6
commit 84975af7f5
8 changed files with 7 additions and 49 deletions
-3
View File
@@ -57,9 +57,6 @@ OpenProject::FeatureDecisions.add :scim_api,
description: "Enables SCIM API.",
force_active: true
OpenProject::FeatureDecisions.add :block_note_editor,
description: "Enables the block note editor for rich text fields where available."
OpenProject::FeatureDecisions.add :beta_widgets,
description: "Enables BETA versions of widgets."
@@ -51,18 +51,6 @@ class AddCollaborationToDocuments < ActiveRecord::Migration[8.0]
UPDATE documents
SET kind = 'classic'
SQL
# Reset documents with "Experimental" type to collaborative kind
# These were likely created when OPENPROJECT_FEATURE_BLOCK_NOTE_EDITOR was enabled
if OpenProject::FeatureDecisions.block_note_editor_active?
execute <<~SQL.squish
UPDATE documents
SET kind = 'collaborative'
FROM document_types
WHERE documents.type_id = document_types.id
AND LOWER(document_types.name) = LOWER('Experimental')
SQL
end
end
end
@@ -68,10 +68,6 @@ module API
end
patch do
unless OpenProject::FeatureDecisions.block_note_editor_active?
raise ::API::Errors::Unauthorized.new(message: I18n.t("api_v3.errors.code_403"))
end
doc = document
request_body = JSON.parse(request.body.read)
@@ -212,7 +212,7 @@ RSpec.describe "Upload attachment to documents",
end
end
context "for collaborative documents", with_flag: { block_note_editor: true } do
context "for collaborative documents" do
let(:document) { create(:document, project:) }
let(:editor) { FormFields::Primerized::BlockNoteEditorInput.new }
let(:attachments_list) { Components::AttachmentsList.new }
@@ -30,7 +30,7 @@
require "rails_helper"
RSpec.describe "BlockNote editor rendering", :js, with_flag: { block_note_editor: true } do
RSpec.describe "BlockNote editor rendering", :js do
let(:admin) { create(:admin) }
let(:type) { create(:document_type, :experimental) }
let(:document) { create(:document, type:) }
@@ -33,8 +33,7 @@ require_module_spec_helper
RSpec.describe "Show/Edit Document View",
:js,
:selenium,
with_flag: { block_note_editor: true } do
:selenium do
shared_let(:project) { create(:project) }
shared_let(:member_role) { create(:existing_project_role, permissions: %i[view_documents manage_documents]) }
shared_let(:member) { create(:user, member_with_roles: { project => member_role }) }
@@ -66,17 +66,6 @@ RSpec.describe AddCollaborationToDocuments, type: :model do
expect(doc3.reload.kind).to eq("classic")
expect(doc4.reload.kind).to eq("classic")
end
context "when block note feature is active", with_flag: { block_note_editor: true } do
it "sets existing documents to 'classic' kind and 'collaborative' kind for experimental documents" do
ActiveRecord::Migration.suppress_messages { described_class.new.migrate(:up) }
expect(doc1.reload.kind).to eq("classic")
expect(doc2.reload.kind).to eq("classic")
expect(doc3.reload.kind).to eq("classic")
expect(doc4.reload.kind).to eq("collaborative")
end
end
end
end
end
@@ -145,11 +145,11 @@ RSpec.describe "API v3 documents resource" do
patch path, request_body.to_json, "CONTENT_TYPE" => "application/json"
end
it "returns 200 OK", with_flag: { block_note_editor: true } do
it "returns 200 OK" do
expect(subject.status).to be(200)
end
it "updates the document and returns updated document", with_flag: { block_note_editor: true } do
it "updates the document and returns updated document" do
expect(subject.body)
.to be_json_eql("Document".to_json)
.at_path("_type")
@@ -163,7 +163,7 @@ RSpec.describe "API v3 documents resource" do
.at_path("contentBinary")
end
context "when lacking edit permissions", with_flag: { block_note_editor: true } do
context "when lacking edit permissions" do
let(:permissions) { %i(view_documents) }
it "returns 403 FORBIDDEN" do
@@ -172,7 +172,7 @@ RSpec.describe "API v3 documents resource" do
end
end
context "when lacking view permissions", with_flag: { block_note_editor: true } do
context "when lacking view permissions" do
let(:permissions) { [] }
it "returns 404 NOT FOUND" do
@@ -180,16 +180,5 @@ RSpec.describe "API v3 documents resource" do
.to be(404)
end
end
context "when block note editor feature is not active", with_flag: { block_note_editor: false } do
before do
patch path, request_body.to_json, "CONTENT_TYPE" => "application/json"
end
it "returns 403 FORBIDDEN" do
expect(subject.status)
.to be(403)
end
end
end
end