mute notifications in muted threads #119

Merged
norm merged 7 commits from mute-notifications into main 2022-09-22 19:52:33 +00:00
Owner

This allows to mute notifications in threads which are muted. Users can select which notifications they want to mute for each thread.

This aims to fix #12.

Changelog: Changed
This allows to mute notifications in threads which are muted. Users can select which notifications they want to mute for each thread. This aims to fix #12. ``` Changelog: Changed ```
Johann150 added this to the (deleted) project 2022-09-07 12:22:54 +00:00
Johann150 removed this from the (deleted) project 2022-09-07 12:23:19 +00:00
Owner

I'll probably be able to test this friday or saturday.

I'll probably be able to test this friday or saturday.
Author
Owner

Just so you know I've not started testing yet so maybe wait a bit. It is still work in progress, I think I'll refactor a bit since some of these commits were originally quite old, for example refactor noteNotificationTypes to be in foundkey-js.

Just so you know I've not started testing yet so maybe wait a bit. It is still work in progress, I think I'll refactor a bit since some of these commits were originally quite old, for example refactor `noteNotificationTypes` to be in foundkey-js.
Johann150 force-pushed mute-notifications from 322f2d7978 to 5bebe543bb 2022-09-08 22:02:07 +00:00 Compare
Author
Owner

Testing this I get an error when trying to run migrations:

$ yarn migrate
Error during migration run:
Error: Unable to open file: "/home/misskey/misskey/packages/backend/ormconfig.js". Cannot find module '/home/misskey/misskey/packages/foundkey-js/built/streaming' imported from /home/misskey/misskey/packages/foundkey-js/built/index.js
    at CommandUtils.loadDataSource (/home/misskey/misskey/node_modules/typeorm/commands/CommandUtils.js:22:19)
    at async Object.handler (/home/misskey/misskey/node_modules/typeorm/commands/MigrationRunCommand.js:34:26)

It seems the problem is because the foundkey-js module does not have file extensions in the import statements. I made the following change and got a different error message (similar about not being able to find consts):

diff --git a/packages/foundkey-js/src/index.ts b/packages/foundkey-js/src/index.ts
index 0b6edd4c7..214747896 100644
--- a/packages/foundkey-js/src/index.ts
+++ b/packages/foundkey-js/src/index.ts
@@ -1,5 +1,5 @@
 import { Endpoints } from './api.types';
-import Stream, { Connection } from './streaming';
+import Stream, { Connection } from './streaming.js';
 import { Channels } from './streaming.types';
 import { Acct } from './acct';
 import * as consts from './consts';

I'm not sure if this should be fixed in the backend module by some setting or if we should add all the filename extensions in foundkey-js since others might experience this as well.

Testing this I get an error when trying to run migrations: ```shellsession $ yarn migrate Error during migration run: Error: Unable to open file: "/home/misskey/misskey/packages/backend/ormconfig.js". Cannot find module '/home/misskey/misskey/packages/foundkey-js/built/streaming' imported from /home/misskey/misskey/packages/foundkey-js/built/index.js at CommandUtils.loadDataSource (/home/misskey/misskey/node_modules/typeorm/commands/CommandUtils.js:22:19) at async Object.handler (/home/misskey/misskey/node_modules/typeorm/commands/MigrationRunCommand.js:34:26) ``` It seems the problem is because the `foundkey-js` module does not have file extensions in the import statements. I made the following change and got a different error message (similar about not being able to find `consts`): ```diff diff --git a/packages/foundkey-js/src/index.ts b/packages/foundkey-js/src/index.ts index 0b6edd4c7..214747896 100644 --- a/packages/foundkey-js/src/index.ts +++ b/packages/foundkey-js/src/index.ts @@ -1,5 +1,5 @@ import { Endpoints } from './api.types'; -import Stream, { Connection } from './streaming'; +import Stream, { Connection } from './streaming.js'; import { Channels } from './streaming.types'; import { Acct } from './acct'; import * as consts from './consts'; ``` I'm not sure if this should be fixed in the backend module by some setting or if we should add all the filename extensions in `foundkey-js` since others might experience this as well.
Owner

I think it should be addressed in foundkey-js itself as it is supposed to use file extensions in imports anyways as an ESM module, we really only got away without those so far since the client stuff didn't seem to need that.

Should be fixed now in 106c643f85.

I think it should be addressed in foundkey-js itself as it is supposed to use file extensions in imports anyways as an ESM module, we really only got away without those so far since the client stuff didn't seem to need that. Should be fixed now in https://akkoma.dev/FoundKeyGang/FoundKey/commit/106c643f8501221d6e8f801adc06a5dcd5e9eac4.
Owner

Probably also worth adding in 674f91109f for completeness.

Probably also worth adding in https://akkoma.dev/FoundKeyGang/FoundKey/commit/674f91109f536b527cf3324914105911e6b29af3 for completeness.
Johann150 force-pushed mute-notifications from cbf752d9b4 to 8ca5048981 2022-09-09 13:20:29 +00:00 Compare
Johann150 force-pushed mute-notifications from 8ca5048981 to 95b51a4283 2022-09-10 17:20:52 +00:00 Compare
Johann150 force-pushed mute-notifications from 95b51a4283 to d682695816 2022-09-21 13:53:00 +00:00 Compare
Johann150 changed title from WIP: mute notifications in muted threads to mute notifications in muted threads 2022-09-21 17:35:14 +00:00
Author
Owner

Tested it a bit and it seems to be working.

Tested it a bit and it seems to be working.
norm requested changes 2022-09-21 19:09:39 +00:00
@ -71,0 +78,4 @@
const { includingTypes: value } = res;
let mutingNotificationTypes: string[] | undefined;
if (value != null) {
mutingNotificationTypes = misskey.noteNotificationTypes.filter(x => !value.includes(x))
Owner

These should be updated to foundkey instead of misskey, otherwise this error happens when I try to mute a thread:

runtime-core.esm-bundler.js:218 Uncaught ReferenceError: misskey is not defined
    at h (get-note-menu.ts:70:26)
    at action (get-note-menu.ts:282:19)
    at m (menu.vue:106:2)
    at onClick (menu.vue:120:1)
    at ke (runtime-core.esm-bundler.js:155:22)
    at Te (runtime-core.esm-bundler.js:164:21)
    at HTMLButtonElement.n (runtime-dom.esm-bundler.js:370:13)
These should be updated to `foundkey` instead of `misskey`, otherwise this error happens when I try to mute a thread: ``` runtime-core.esm-bundler.js:218 Uncaught ReferenceError: misskey is not defined at h (get-note-menu.ts:70:26) at action (get-note-menu.ts:282:19) at m (menu.vue:106:2) at onClick (menu.vue:120:1) at ke (runtime-core.esm-bundler.js:155:22) at Te (runtime-core.esm-bundler.js:164:21) at HTMLButtonElement.n (runtime-dom.esm-bundler.js:370:13) ```
Author
Owner

Yeah did that but apparently forgot to push after testing... 😅

Yeah did that but apparently forgot to push after testing... 😅
Johann150 marked this conversation as resolved
Johann150 force-pushed mute-notifications from d682695816 to 48fda127ca 2022-09-22 15:48:47 +00:00 Compare
norm approved these changes 2022-09-22 16:22:13 +00:00
norm left a comment
Owner

Seems to be working for me now.

Seems to be working for me now.
norm merged commit dba63e4000 into main 2022-09-22 19:52:33 +00:00
norm deleted branch mute-notifications 2022-09-22 19:52:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#119
No description provided.