mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Remove blocknote editor feature flag (#21273)
https://community.openproject.org/wp/68232
This commit is contained in:
@@ -57,9 +57,6 @@ OpenProject::FeatureDecisions.add :scim_api,
|
|||||||
description: "Enables SCIM API.",
|
description: "Enables SCIM API.",
|
||||||
force_active: true
|
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,
|
OpenProject::FeatureDecisions.add :beta_widgets,
|
||||||
description: "Enables BETA versions of widgets."
|
description: "Enables BETA versions of widgets."
|
||||||
|
|
||||||
|
|||||||
@@ -51,18 +51,6 @@ class AddCollaborationToDocuments < ActiveRecord::Migration[8.0]
|
|||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET kind = 'classic'
|
SET kind = 'classic'
|
||||||
SQL
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ module API
|
|||||||
end
|
end
|
||||||
|
|
||||||
patch do
|
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
|
doc = document
|
||||||
request_body = JSON.parse(request.body.read)
|
request_body = JSON.parse(request.body.read)
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ RSpec.describe "Upload attachment to documents",
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "for collaborative documents", with_flag: { block_note_editor: true } do
|
context "for collaborative documents" do
|
||||||
let(:document) { create(:document, project:) }
|
let(:document) { create(:document, project:) }
|
||||||
let(:editor) { FormFields::Primerized::BlockNoteEditorInput.new }
|
let(:editor) { FormFields::Primerized::BlockNoteEditorInput.new }
|
||||||
let(:attachments_list) { Components::AttachmentsList.new }
|
let(:attachments_list) { Components::AttachmentsList.new }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
require "rails_helper"
|
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(:admin) { create(:admin) }
|
||||||
let(:type) { create(:document_type, :experimental) }
|
let(:type) { create(:document_type, :experimental) }
|
||||||
let(:document) { create(:document, type:) }
|
let(:document) { create(:document, type:) }
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ require_module_spec_helper
|
|||||||
|
|
||||||
RSpec.describe "Show/Edit Document View",
|
RSpec.describe "Show/Edit Document View",
|
||||||
:js,
|
:js,
|
||||||
:selenium,
|
:selenium do
|
||||||
with_flag: { block_note_editor: true } do
|
|
||||||
shared_let(:project) { create(:project) }
|
shared_let(:project) { create(:project) }
|
||||||
shared_let(:member_role) { create(:existing_project_role, permissions: %i[view_documents manage_documents]) }
|
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 }) }
|
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(doc3.reload.kind).to eq("classic")
|
||||||
expect(doc4.reload.kind).to eq("classic")
|
expect(doc4.reload.kind).to eq("classic")
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -145,11 +145,11 @@ RSpec.describe "API v3 documents resource" do
|
|||||||
patch path, request_body.to_json, "CONTENT_TYPE" => "application/json"
|
patch path, request_body.to_json, "CONTENT_TYPE" => "application/json"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns 200 OK", with_flag: { block_note_editor: true } do
|
it "returns 200 OK" do
|
||||||
expect(subject.status).to be(200)
|
expect(subject.status).to be(200)
|
||||||
end
|
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)
|
expect(subject.body)
|
||||||
.to be_json_eql("Document".to_json)
|
.to be_json_eql("Document".to_json)
|
||||||
.at_path("_type")
|
.at_path("_type")
|
||||||
@@ -163,7 +163,7 @@ RSpec.describe "API v3 documents resource" do
|
|||||||
.at_path("contentBinary")
|
.at_path("contentBinary")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when lacking edit permissions", with_flag: { block_note_editor: true } do
|
context "when lacking edit permissions" do
|
||||||
let(:permissions) { %i(view_documents) }
|
let(:permissions) { %i(view_documents) }
|
||||||
|
|
||||||
it "returns 403 FORBIDDEN" do
|
it "returns 403 FORBIDDEN" do
|
||||||
@@ -172,7 +172,7 @@ RSpec.describe "API v3 documents resource" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when lacking view permissions", with_flag: { block_note_editor: true } do
|
context "when lacking view permissions" do
|
||||||
let(:permissions) { [] }
|
let(:permissions) { [] }
|
||||||
|
|
||||||
it "returns 404 NOT FOUND" do
|
it "returns 404 NOT FOUND" do
|
||||||
@@ -180,16 +180,5 @@ RSpec.describe "API v3 documents resource" do
|
|||||||
.to be(404)
|
.to be(404)
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user