aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/user-notifications.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/users/user-notifications.ts')
-rw-r--r--shared/extra-utils/users/user-notifications.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/shared/extra-utils/users/user-notifications.ts b/shared/extra-utils/users/user-notifications.ts
index 98d222e1d..467a3d959 100644
--- a/shared/extra-utils/users/user-notifications.ts
+++ b/shared/extra-utils/users/user-notifications.ts
@@ -11,8 +11,14 @@ import { flushAndRunMultipleServers, ServerInfo } from '../server/servers'
11import { getUserNotificationSocket } from '../socket/socket-io' 11import { getUserNotificationSocket } from '../socket/socket-io'
12import { setAccessTokensToServers, userLogin } from './login' 12import { setAccessTokensToServers, userLogin } from './login'
13import { createUser, getMyUserInformation } from './users' 13import { createUser, getMyUserInformation } from './users'
14import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
14 15
15function updateMyNotificationSettings (url: string, token: string, settings: UserNotificationSetting, statusCodeExpected = 204) { 16function updateMyNotificationSettings (
17 url: string,
18 token: string,
19 settings: UserNotificationSetting,
20 statusCodeExpected = HttpStatusCode.NO_CONTENT_204
21) {
16 const path = '/api/v1/users/me/notification-settings' 22 const path = '/api/v1/users/me/notification-settings'
17 23
18 return makePutBodyRequest({ 24 return makePutBodyRequest({
@@ -31,7 +37,7 @@ async function getUserNotifications (
31 count: number, 37 count: number,
32 unread?: boolean, 38 unread?: boolean,
33 sort = '-createdAt', 39 sort = '-createdAt',
34 statusCodeExpected = 200 40 statusCodeExpected = HttpStatusCode.OK_200
35) { 41) {
36 const path = '/api/v1/users/me/notifications' 42 const path = '/api/v1/users/me/notifications'
37 43
@@ -49,7 +55,7 @@ async function getUserNotifications (
49 }) 55 })
50} 56}
51 57
52function markAsReadNotifications (url: string, token: string, ids: number[], statusCodeExpected = 204) { 58function markAsReadNotifications (url: string, token: string, ids: number[], statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
53 const path = '/api/v1/users/me/notifications/read' 59 const path = '/api/v1/users/me/notifications/read'
54 60
55 return makePostBodyRequest({ 61 return makePostBodyRequest({
@@ -61,7 +67,7 @@ function markAsReadNotifications (url: string, token: string, ids: number[], sta
61 }) 67 })
62} 68}
63 69
64function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = 204) { 70function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
65 const path = '/api/v1/users/me/notifications/read-all' 71 const path = '/api/v1/users/me/notifications/read-all'
66 72
67 return makePostBodyRequest({ 73 return makePostBodyRequest({