-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed default feedback enabled when flag is disabled (#15660)
fixes https://github.com/TryGhost/Team/issues/2114 fixes https://github.com/TryGhost/Team/issues/2115 When a new newsletter is created, the frontend will send feedback_enabled to true. We'll catch this in the backend and don't allow setting feedback_enabled to true when audience_feedback flag is disabled. This is also handled for editing newsletters. To fix this in existing sites, I added a migration that disables feedback for all sites (since this is an alpha feature). Once we'll release the feature later, it will be disabled for existing newsletters, just like expected.
- Loading branch information
1 parent
0f03b5e
commit a650ae2
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...re/core/server/data/migrations/versions/5.21/2022-10-24-07-23-disable-feedback-enabled.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const logging = require('@tryghost/logging'); | ||
const {createTransactionalMigration} = require('../../utils'); | ||
|
||
module.exports = createTransactionalMigration( | ||
async function up(connection) { | ||
const affectedRows = await connection('newsletters') | ||
.update({ | ||
feedback_enabled: false | ||
}) | ||
.where('feedback_enabled', true); | ||
|
||
if (affectedRows > 0) { | ||
// Only log if this site was affected by the issue. | ||
logging.info(`Disabled feedback for ${affectedRows} newsletter(s)`); | ||
} | ||
}, | ||
async function down() { | ||
// no-op: we don't need to change it back | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters