Files
outline/server/migrations/20260603000000-commenting-access-preference.js
T
Tom MoorandClaude Opus 4.8 4383324b30 feat: Add setting to enable guest commenting (#12591)
* Treat legacy boolean commenting preference as disabled

Teams not yet migrated to the CommentingAccess enum may still have a
boolean `false` stored for the commenting preference. Guard the
enabled checks so `false` reads as disabled rather than enabled.

* Move commenting setting from Details to Security settings

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 11:26:05 -04:00

33 lines
1.1 KiB
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
// Convert the legacy boolean "commenting" team preference into the
// CommentingAccess enum: false -> "none", true -> "members".
await queryInterface.sequelize.query(`
UPDATE teams
SET preferences = jsonb_set(preferences, '{commenting}', '"none"')
WHERE preferences -> 'commenting' = 'false'::jsonb
`);
await queryInterface.sequelize.query(`
UPDATE teams
SET preferences = jsonb_set(preferences, '{commenting}', '"members"')
WHERE preferences -> 'commenting' = 'true'::jsonb
`);
},
async down(queryInterface) {
await queryInterface.sequelize.query(`
UPDATE teams
SET preferences = jsonb_set(preferences, '{commenting}', 'false')
WHERE preferences -> 'commenting' = '"none"'::jsonb
`);
await queryInterface.sequelize.query(`
UPDATE teams
SET preferences = jsonb_set(preferences, '{commenting}', 'true')
WHERE preferences -> 'commenting' IN ('"members"'::jsonb, '"everyone"'::jsonb)
`);
},
};