Skip to content

Commit 12c021a

Browse files
committed
feat: rebase
1 parent 428fc4f commit 12c021a

24 files changed

Lines changed: 368 additions & 297 deletions

File tree

docs/using-seerr/notifications/discord.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,3 @@ If you would like to override the name you configured for your bot in Discord, y
2929
### Bot Avatar URL (optional)
3030

3131
Similar to the bot username, you can override the avatar for your bot.
32-
33-
### Use Notification Recipient Locale
34-
35-
When enabled, notifications will be sent in the language of the user who triggered the notification (e.g., the user who made the request or reported the issue) based on their display language setting. When disabled, the **Notification Language** setting below is used instead.
36-
37-
### Notification Language
38-
39-
Sets the language for all notifications sent to this Discord channel. This option is only available when **Use Notification Recipient Locale** is disabled.

docs/using-seerr/notifications/webhook.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ Customize the JSON payload to suit your needs. Seerr provides several [template
5353

5454
These variables are for the target recipient of the notification.
5555

56-
| Variable | Value |
57-
| ---------------------------------------- | ------------------------------------------------------------- |
58-
| `{{notifyuser_username}}` | The target notification recipient's username |
59-
| `{{notifyuser_email}}` | The target notification recipient's email address |
60-
| `{{notifyuser_avatar}}` | The target notification recipient's avatar URL |
61-
| `{{notifyuser_settings_discordId}}` | The target notification recipient's Discord ID (if set) |
62-
| `{{notifyuser_settings_telegramChatId}}` | The target notification recipient's Telegram Chat ID (if set) |
56+
| Variable | Value |
57+
| ---------------------------------------- | -------------------------------------------------------------------------------------------- |
58+
| `{{notifyuser_username}}` | The target notification recipient's username |
59+
| `{{notifyuser_email}}` | The target notification recipient's email address |
60+
| `{{notifyuser_avatar}}` | The target notification recipient's avatar URL |
61+
| `{{notifyuser_settings_discordIds}}` | The target notification recipient's Discord ID(s) as a JSON array (if set) |
62+
| `{{notifyuser_settings_telegramChatId}}` | The target notification recipient's Telegram Chat ID (if set) |
6363

6464
:::info
6565
The `notifyuser` variables are not defined for the following request notification types, as they are intended for application administrators rather than end users:
@@ -111,42 +111,42 @@ The `{{request}}` will be `null` if there is no relevant media object for the no
111111

112112
The following special variables are only included in request-related notifications.
113113

114-
| Variable | Value |
115-
| ----------------------------------------- | ----------------------------------------------- |
116-
| `{{request_id}}` | The request ID |
117-
| `{{requestedBy_username}}` | The requesting user's username |
118-
| `{{requestedBy_email}}` | The requesting user's email address |
119-
| `{{requestedBy_avatar}}` | The requesting user's avatar URL |
120-
| `{{requestedBy_jellyfinUserId}}` | The requesting user's Jellyfin User ID |
121-
| `{{requestedBy_settings_discordId}}` | The requesting user's Discord ID (if set) |
122-
| `{{requestedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
114+
| Variable | Value |
115+
| ----------------------------------------- | ------------------------------------------------------------------------------ |
116+
| `{{request_id}}` | The request ID |
117+
| `{{requestedBy_username}}` | The requesting user's username |
118+
| `{{requestedBy_email}}` | The requesting user's email address |
119+
| `{{requestedBy_avatar}}` | The requesting user's avatar URL |
120+
| `{{requestedBy_jellyfinUserId}}` | The requesting user's Jellyfin User ID |
121+
| `{{requestedBy_settings_discordIds}}` | The requesting user's Discord ID(s) as a JSON array (if set) |
122+
| `{{requestedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
123123

124124
#### Issue
125125

126126
The `{{issue}}` will be `null` if there is no relevant media object for the notification.
127127

128128
The following special variables are only included in issue-related notifications.
129129

130-
| Variable | Value |
131-
| ---------------------------------------- | ----------------------------------------------- |
132-
| `{{issue_id}}` | The issue ID |
133-
| `{{reportedBy_username}}` | The requesting user's username |
134-
| `{{reportedBy_email}}` | The requesting user's email address |
135-
| `{{reportedBy_avatar}}` | The requesting user's avatar URL |
136-
| `{{reportedBy_settings_discordId}}` | The requesting user's Discord ID (if set) |
137-
| `{{reportedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
130+
| Variable | Value |
131+
| ---------------------------------------- | ------------------------------------------------------------------------------ |
132+
| `{{issue_id}}` | The issue ID |
133+
| `{{reportedBy_username}}` | The requesting user's username |
134+
| `{{reportedBy_email}}` | The requesting user's email address |
135+
| `{{reportedBy_avatar}}` | The requesting user's avatar URL |
136+
| `{{reportedBy_settings_discordIds}}` | The reporting user's Discord ID(s) as a JSON array (if set) |
137+
| `{{reportedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
138138

139139
#### Comment
140140

141141
The `{{comment}}` will be `null` if there is no relevant media object for the notification.
142142

143143
The following special variables are only included in issue comment-related notifications.
144144

145-
| Variable | Value |
146-
| ----------------------------------------- | ----------------------------------------------- |
147-
| `{{comment_message}}` | The comment message |
148-
| `{{commentedBy_username}}` | The commenting user's username |
149-
| `{{commentedBy_email}}` | The commenting user's email address |
150-
| `{{commentedBy_avatar}}` | The commenting user's avatar URL |
151-
| `{{commentedBy_settings_discordId}}` | The commenting user's Discord ID (if set) |
152-
| `{{commentedBy_settings_telegramChatId}}` | The commenting user's Telegram Chat ID (if set) |
145+
| Variable | Value |
146+
| ----------------------------------------- | ------------------------------------------------------------------------------ |
147+
| `{{comment_message}}` | The comment message |
148+
| `{{commentedBy_username}}` | The commenting user's username |
149+
| `{{commentedBy_email}}` | The commenting user's email address |
150+
| `{{commentedBy_avatar}}` | The commenting user's avatar URL |
151+
| `{{commentedBy_settings_discordIds}}` | The commenting user's Discord ID(s) as a JSON array (if set) |
152+
| `{{commentedBy_settings_telegramChatId}}` | The commenting user's Telegram Chat ID (if set) |

seerr-api.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ components:
148148
email:
149149
type: string
150150
example: 'user@example.com'
151-
discordId:
152-
type: string
153-
nullable: true
154-
example: '123456789'
155151
locale:
156152
type: string
157153
nullable: true
@@ -706,18 +702,10 @@ components:
706702
example: A Label
707703
PublicSettings:
708704
type: object
709-
required:
710-
- initialized
711-
- plexClientIdentifier
712705
properties:
713706
initialized:
714707
type: boolean
715708
example: false
716-
plexClientIdentifier:
717-
type: string
718-
format: uuid
719-
description: Instance Plex OAuth client identifier
720-
example: 6919275e-142a-48d8-be6b-93594cbd4626
721709
MovieResult:
722710
type: object
723711
required:
@@ -1952,8 +1940,10 @@ components:
19521940
discordEnabledTypes:
19531941
type: number
19541942
nullable: true
1955-
discordId:
1956-
type: string
1943+
discordIds:
1944+
type: array
1945+
items:
1946+
type: string
19571947
nullable: true
19581948
pushbulletAccessToken:
19591949
type: string

server/constants/discord.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const DISCORD_SNOWFLAKE_REGEX = /^\d{17,20}$/;
2+
3+
export enum EmbedColors {
4+
DEFAULT = 0,
5+
AQUA = 1752220,
6+
GREEN = 3066993,
7+
BLUE = 3447003,
8+
PURPLE = 10181046,
9+
GOLD = 15844367,
10+
ORANGE = 15105570,
11+
RED = 15158332,
12+
GREY = 9807270,
13+
DARKER_GREY = 8359053,
14+
NAVY = 3426654,
15+
DARK_AQUA = 1146986,
16+
DARK_GREEN = 2067276,
17+
DARK_BLUE = 2123412,
18+
DARK_PURPLE = 7419530,
19+
DARK_GOLD = 12745742,
20+
DARK_ORANGE = 11027200,
21+
DARK_RED = 10038562,
22+
DARK_GREY = 9936031,
23+
LIGHT_GREY = 12370112,
24+
DARK_NAVY = 2899536,
25+
LUMINOUS_VIVID_PINK = 16580705,
26+
DARK_VIVID_PINK = 12320855,
27+
}

server/entity/UserSettings.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ export const ALL_NOTIFICATIONS = Object.values(Notification)
1414
.filter((v) => !isNaN(Number(v)))
1515
.reduce((a, v) => a + Number(v), 0);
1616

17+
// convert between DB representation (JSON string) into typescript array
18+
const jsonArrayTransformer = {
19+
from: (v: string | null): string[] => {
20+
try {
21+
return v ? JSON.parse(v) : [];
22+
} catch {
23+
return [];
24+
}
25+
},
26+
to: (v: string[] | null): string | null =>
27+
v?.length ? JSON.stringify(v) : null,
28+
};
29+
1730
@Entity()
1831
export class UserSettings {
1932
constructor(init?: Partial<UserSettings>) {
@@ -45,6 +58,9 @@ export class UserSettings {
4558
@Column({ nullable: true })
4659
public discordId?: string;
4760

61+
@Column({ type: 'text', nullable: true, transformer: jsonArrayTransformer })
62+
public discordIds: string[];
63+
4864
@Column({ nullable: true })
4965
public pushbulletAccessToken?: string;
5066

server/i18n/locale/en.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,5 @@
5151
"notifications.common.resolved": "Resolved",
5252
"notifications.common.series": "series",
5353
"notifications.common.viewIssue": "View Issue in {applicationTitle}",
54-
"notifications.common.viewMedia": "View Media in {applicationTitle}",
55-
"notifications.test.message": "Check check, 1, 2, 3. Are we coming in clear?",
56-
"notifications.test.subject": "Test Notification"
54+
"notifications.common.viewMedia": "View Media in {applicationTitle}"
5755
}

server/interfaces/api/userSettingsInterfaces.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { NotificationAgentKey } from '@server/lib/settings';
33
export interface UserSettingsGeneralResponse {
44
username?: string;
55
email?: string;
6-
discordId?: string;
76
locale?: string;
87
discoverRegion?: string;
98
streamingRegion?: string;
@@ -26,7 +25,7 @@ export interface UserSettingsNotificationsResponse {
2625
pgpKey?: string;
2726
discordEnabled?: boolean;
2827
discordEnabledTypes?: number;
29-
discordId?: string;
28+
discordIds?: string[];
3029
pushbulletAccessToken?: string;
3130
pushoverApplicationToken?: string;
3231
pushoverUserKey?: string;

0 commit comments

Comments
 (0)