Skip to content

Commit

Permalink
Fix webhook avatar, simplify message title
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Jul 8, 2024
1 parent cf4b92d commit 1a78c0b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package io.papermc.hangar.components.webhook.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;
import java.util.List;

public record DiscordWebhook(
String username,
String avatarUrl,
@JsonProperty("avatar_url") String avatarUrl,
@JsonRawValue String embeds,
AllowedMentions allowedMentions
@JsonProperty("allowed_mentions") AllowedMentions allowedMentions
) {

public DiscordWebhook(final String embeds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class WebhookService {
[
{
"id": {{id}},
"title": "{{author}} / {{name}} is now available on Hangar!",
"title": "{{author}}/{{name}}",
"description": "{{description}}",
"color": 2326507,
"fields": [],
Expand All @@ -50,7 +50,7 @@ public class WebhookService {
[
{
"id": {{id}},
"title": "Version {{version}} for {{author}} / {{name}} has been released!",
"title": "Version {{version}} - {{author}}/{{name}}",
"description": "{{description}}",
"color": 2326507,
"fields": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public List<JobTable> getErroredJobs() {
@Transactional
public void schedule(final Job... jobs) {
for (final Job job : jobs) {
logger.info("Scheduling job: {}", job);
this.logger.info("Scheduling job: {}", job);
this.jobsDAO.save(job.toTable());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private void verifyPendingPlatforms(final PendingVersion pendingVersion, final S
final Platform platform = entry.getKey();
final Set<String> versionsForPlatform = new HashSet<>(this.platformService.getFullVersionsForPlatform(platform));
if (!versionsForPlatform.containsAll(entry.getValue())) {
throw new HangarApiException(HttpStatus.BAD_REQUEST, "version.new.error.invalidPlatformVersion", entry.getValue());
throw new HangarApiException(HttpStatus.BAD_REQUEST, "version.new.error.invalidPlatformVersionList", entry.getValue());
}
}
}
Expand Down

0 comments on commit 1a78c0b

Please sign in to comment.