]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix registration notification error in client
authorChocobozzz <me@florianbigard.com>
Mon, 19 Jun 2023 08:52:40 +0000 (10:52 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 19 Jun 2023 08:52:40 +0000 (10:52 +0200)
server/initializers/constants.ts
server/initializers/migrations/0780-notification-registration.ts [new file with mode: 0644]
server/middlewares/rate-limiter.ts

index 020ed68daca5cbc9a7c6dc6a9e40c8e91da901a9..a92fd22d6a6ddd088b11249bfe1f2b5368df8939 100644 (file)
@@ -27,7 +27,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 775
+const LAST_MIGRATION_VERSION = 780
 
 // ---------------------------------------------------------------------------
 
diff --git a/server/initializers/migrations/0780-notification-registration.ts b/server/initializers/migrations/0780-notification-registration.ts
new file mode 100644 (file)
index 0000000..5f1e0d2
--- /dev/null
@@ -0,0 +1,30 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
+  sequelize: Sequelize.Sequelize
+}): Promise<void> {
+  const { transaction } = utils
+
+  {
+    await utils.sequelize.query('DELETE FROM "userNotification" WHERE type = 20 AND "userRegistrationId" IS NULL', { transaction })
+  }
+
+  {
+    await utils.sequelize.query(
+      'ALTER TABLE "userNotification" DROP CONSTRAINT "userNotification_userRegistrationId_fkey", ' +
+      'ADD CONSTRAINT "userNotification_userRegistrationId_fkey" ' +
+      'FOREIGN KEY ("userRegistrationId") REFERENCES "userRegistration" ("id") ON DELETE CASCADE ON UPDATE CASCADE',
+      { transaction })
+  }
+}
+
+function down (options) {
+  throw new Error('Not implemented.')
+}
+
+export {
+  up,
+  down
+}
index 1eef8b360d679f7025a001dcff6c9c48f26c08e7..0e936028c2c43f3546d14c3da2201f968317e774 100644 (file)
@@ -45,5 +45,4 @@ export function buildRateLimiter (options: {
 
 function sendRateLimited (res: express.Response, options: RateLimitHandlerOptions) {
   return res.status(options.statusCode).send(options.message)
-
 }