server: fix thread mutes not working

Because of differing string names for the `update` notification in
the application and the database, there were some errors.

Changelog: Fixed
This commit is contained in:
Johann150 2023-07-10 18:20:40 +02:00
parent 415e84daf0
commit 46660abb6a
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 44 additions and 1 deletions

View file

@ -1304,7 +1304,7 @@ _notification:
reaction: "Reactions"
pollVote: "Votes on polls"
pollEnded: "Polls ending"
updated: "Watched Note was updated"
update: "Watched Note was updated"
receiveFollowRequest: "Received follow requests"
followRequestAccepted: "Accepted follow requests"
groupInvited: "Group invitations"

View file

@ -0,0 +1,43 @@
export class syncDatabase1689005520053 {
name = 'syncDatabase1689005520053';
async up(queryRunner) {
await queryRunner.query(`COMMENT ON COLUMN "user"."isDeleted" IS 'How many delivery jobs are outstanding before the deletion is completed.'`);
await queryRunner.query(`ALTER TYPE "public"."note_thread_muting_mutingnotificationtypes_enum" RENAME TO "note_thread_muting_mutingnotificationtypes_enum_old"`);
await queryRunner.query(`CREATE TYPE "public"."note_thread_muting_mutingnotificationtypes_enum" AS ENUM('mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'update')`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."note_thread_muting_mutingnotificationtypes_enum"[] USING "mutingNotificationTypes"::"text"::"public"."note_thread_muting_mutingnotificationtypes_enum"[]`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`);
await queryRunner.query(`DROP TYPE "public"."note_thread_muting_mutingnotificationtypes_enum_old"`);
await queryRunner.query(`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`);
await queryRunner.query(`CREATE TYPE "public"."notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'update', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'move', 'app')`);
await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum" USING "type"::"text"::"public"."notification_type_enum"`);
await queryRunner.query(`DROP TYPE "public"."notification_type_enum_old"`);
await queryRunner.query(`ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" RENAME TO "user_profile_mutingnotificationtypes_enum_old"`);
await queryRunner.query(`CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'update', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'move', 'app')`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum"[]`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`);
await queryRunner.query(`DROP TYPE "public"."user_profile_mutingnotificationtypes_enum_old"`);
}
async down(queryRunner) {
await queryRunner.query(`CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'move', 'app', 'updated')`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum_old"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum_old"[]`);
await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`);
await queryRunner.query(`DROP TYPE "public"."user_profile_mutingnotificationtypes_enum"`);
await queryRunner.query(`ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum_old" RENAME TO "user_profile_mutingnotificationtypes_enum"`);
await queryRunner.query(`CREATE TYPE "public"."notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'move', 'app', 'updated')`);
await queryRunner.query(`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum_old" USING "type"::"text"::"public"."notification_type_enum_old"`);
await queryRunner.query(`DROP TYPE "public"."notification_type_enum"`);
await queryRunner.query(`ALTER TYPE "public"."notification_type_enum_old" RENAME TO "notification_type_enum"`);
await queryRunner.query(`CREATE TYPE "public"."note_thread_muting_mutingnotificationtypes_enum_old" AS ENUM('mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded')`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."note_thread_muting_mutingnotificationtypes_enum_old"[] USING "mutingNotificationTypes"::"text"::"public"."note_thread_muting_mutingnotificationtypes_enum_old"[]`);
await queryRunner.query(`ALTER TABLE "note_thread_muting" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}'`);
await queryRunner.query(`DROP TYPE "public"."note_thread_muting_mutingnotificationtypes_enum"`);
await queryRunner.query(`ALTER TYPE "public"."note_thread_muting_mutingnotificationtypes_enum_old" RENAME TO "note_thread_muting_mutingnotificationtypes_enum"`);
await queryRunner.query(`COMMENT ON COLUMN "user"."isDeleted" IS NULL`);
}
}