Skip to content

Commit

Permalink
fix: discussion notifications (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler authored Oct 4, 2024
1 parent c375254 commit e0c29be
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/services/webhook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class WebhookService {
}

if ('discussion' in dto && (action === 'created' || action === 'deleted' || action === 'answered')) {
const embed = this.getEmbed(action, dto.repository.full_name, 'Issue', dto.discussion);
const embed = this.getEmbed(action, dto.repository.full_name, 'Discussion', dto.discussion);
embed.setColor(this.getDiscussionEmbedColor({ action }));

await this.discord.sendMessage(DiscordChannel.IssuesAndDiscussions, { embeds: [embed] });
Expand All @@ -84,14 +84,24 @@ export class WebhookService {

if ('release' in dto && action === 'released') {
const content = `${_.sample(ReleaseMessages)} ${dto.release.html_url}`;
await Promise.all([
this.zulip.sendMessage({
stream: Constants.Zulip.Streams.Immich,
topic: Constants.Zulip.Topics.ImmichRelease,
content,
const messages = [
this.discord.sendMessage(DiscordChannel.Releases, {
content: `[${dto.repository.full_name}] ${content}`,
flags: [MessageFlags.SuppressEmbeds],
}),
this.discord.sendMessage(DiscordChannel.Releases, { content, flags: [MessageFlags.SuppressEmbeds] }),
]);
];

if (dto.repository.full_name === 'immich-app/immich') {
messages.push(
this.zulip.sendMessage({
stream: Constants.Zulip.Streams.Immich,
topic: Constants.Zulip.Topics.ImmichRelease,
content,
}),
);
}

await Promise.all(messages);
}
}

Expand Down

0 comments on commit e0c29be

Please sign in to comment.