[AB-290] fixing showing wrong active warning count in warn decay notification

fixing un mute log failing to render in case the mute did not come from a message
fixing notification failing with exception in case there were no warnings to decay
This commit is contained in:
Sheldan
2021-06-09 12:18:36 +02:00
parent ba4d8f1da6
commit 2c3b5fb651
5 changed files with 15 additions and 2 deletions

View File

@@ -62,6 +62,9 @@ public class UnMuteLog extends ServerContext {
* @return A string containing an URL leading to the message where the mute was triggered
*/
public String getMessageUrl() {
return MessageUtils.buildMessageUrl(this.mute.getServer().getId() ,this.getMute().getMutingChannel().getId(), this.mute.getMessageId());
if(this.mute.getMessageId() != null && this.mute.getMutingChannel() != null) {
return MessageUtils.buildMessageUrl(this.mute.getServer().getId(), this.mute.getMutingChannel().getId(), this.mute.getMessageId());
}
return null;
}
}

View File

@@ -12,6 +12,7 @@ public interface WarnManagementService {
Warning createWarning(AUserInAServer warnedAUser, AUserInAServer warningAUser, String reason, Long warnId);
List<Warning> getActiveWarningsInServerOlderThan(AServer server, Instant date);
List<Warning> getActiveWarningsInServerYoungerThan(AServer server, Instant date);
List<Warning> getActiveWarningsFromUserYoungerThan(AUserInAServer user, Instant date);
Long getTotalWarnsForUser(AUserInAServer aUserInAServer);
List<Warning> getAllWarnsForUser(AUserInAServer aUserInAServer);
List<Warning> getAllWarningsOfServer(AServer server);