Skip to content

Commit

Permalink
fix: Fixed empty alert string placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed May 12, 2023
1 parent b85f55e commit 41b3715
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private void sendSingleTitle(String title, TagResolver resolver, IFormatter form
sendTitlePart(TitlePart.SUBTITLE, formatter.parse(title, resolver));
}

private void sendAlertMessage(final InfractionType type, final CheckResult result) {
private void sendAlertMessage(final InfractionType type, final CheckResult result, final String original) {
final Messages.Alert messages = requireNonNull(messagesContainer.get().getAlert(type));

final TagResolver.Builder builder = TagResolver.builder();
Expand All @@ -179,7 +179,7 @@ private void sendAlertMessage(final InfractionType type, final CheckResult resul
if (result instanceof CheckResult.ReplaceCheckResult replaceResult) {
builder.resolver(Placeholder.unparsed("string", replaceResult.replaced()));
} else {
builder.resolver(Placeholder.unparsed("string", ""));
builder.resolver(Placeholder.unparsed("string", original));
}

final Component message = formatter.parse(messages.getAlertMessage(), builder.build());
Expand Down Expand Up @@ -235,7 +235,7 @@ public void debug(String string, InfractionType detection) {

public void onDenied(CheckResult.DeniedCheckresult result, String string) {
this.sendWarningMessage(result, result.infractionType());
this.sendAlertMessage(result.infractionType(), result);
this.sendAlertMessage(result.infractionType(), result, string);
this.getInfractions().addViolation(result.infractionType());
this.executeCommands(result.infractionType());
this.debug(string, result.infractionType());
Expand Down

0 comments on commit 41b3715

Please sign in to comment.