Explorar o código

[web] Enable PDF Detach and Dictionary editor in SP (#8959)

GitOrigin-RevId: a02d35d5bc30b25e8be02943f6c1fdee3f6ddaad
Miguel Serrano %!s(int64=4) %!d(string=hai) anos
pai
achega
b7a28f10fe

+ 12 - 8
services/web/app/src/Features/Project/ProjectController.js

@@ -1086,10 +1086,12 @@ const ProjectController = {
               }
               }
             }
             }
 
 
-            const showPdfDetach = shouldDisplayFeature(
-              'pdf_detach',
-              pdfDetachAssignment.variant === 'enabled'
-            )
+            const showPdfDetach =
+              !Features.hasFeature('saas') ||
+              shouldDisplayFeature(
+                'pdf_detach',
+                pdfDetachAssignment.variant === 'enabled'
+              )
 
 
             const debugPdfDetach = shouldDisplayFeature('debug_pdf_detach')
             const debugPdfDetach = shouldDisplayFeature('debug_pdf_detach')
 
 
@@ -1109,10 +1111,12 @@ const ProjectController = {
               !Features.hasFeature('saas') ||
               !Features.hasFeature('saas') ||
               (user.features && user.features.symbolPalette)
               (user.features && user.features.symbolPalette)
 
 
-            const dictionaryEditorEnabled = shouldDisplayFeature(
-              'dictionary-editor',
-              dictionaryEditorAssignment.variant === 'enabled'
-            )
+            const dictionaryEditorEnabled =
+              !Features.hasFeature('saas') ||
+              shouldDisplayFeature(
+                'dictionary-editor',
+                dictionaryEditorAssignment.variant === 'enabled'
+              )
 
 
             // Persistent upgrade prompts
             // Persistent upgrade prompts
             // in header & in share project modal
             // in header & in share project modal

+ 14 - 1
services/web/test/unit/src/Project/ProjectControllerTests.js

@@ -1367,7 +1367,11 @@ describe('ProjectController', function () {
     describe('feature flags', function () {
     describe('feature flags', function () {
       describe('showPdfDetach', function () {
       describe('showPdfDetach', function () {
         describe('showPdfDetach=false', function () {
         describe('showPdfDetach=false', function () {
-          it('should be false by default', function (done) {
+          beforeEach(function () {
+            this.Features.hasFeature.withArgs('saas').returns(true)
+          })
+
+          it('should be false by default in SaaS', function (done) {
             this.res.render = (pageName, opts) => {
             this.res.render = (pageName, opts) => {
               expect(opts.showPdfDetach).to.be.false
               expect(opts.showPdfDetach).to.be.false
               done()
               done()
@@ -1375,6 +1379,15 @@ describe('ProjectController', function () {
             this.ProjectController.loadEditor(this.req, this.res)
             this.ProjectController.loadEditor(this.req, this.res)
           })
           })
 
 
+          it('should be true by default in Server Pro', function (done) {
+            this.Features.hasFeature.withArgs('saas').returns(false)
+            this.res.render = (pageName, opts) => {
+              expect(opts.showPdfDetach).to.be.true
+              done()
+            }
+            this.ProjectController.loadEditor(this.req, this.res)
+          })
+
           it('should be false when the split test is enabled and ?pdf_detach=false', function (done) {
           it('should be false when the split test is enabled and ?pdf_detach=false', function (done) {
             this.res.render = (pageName, opts) => {
             this.res.render = (pageName, opts) => {
               expect(opts.showPdfDetach).to.be.false
               expect(opts.showPdfDetach).to.be.false