[AB-xxx] adding information whether a modmail thread comes from an appeal to storage and to modmail notification

This commit is contained in:
Sheldan
2024-11-06 21:46:19 +01:00
parent 5b90d429c2
commit 90816649e2
14 changed files with 159 additions and 108 deletions

View File

@@ -59,6 +59,9 @@ public class ModMailThread implements Serializable {
@Column(name = "closed")
private Instant closed;
@Column(name = "appeal", nullable = false)
private Boolean appeal;
/**
* The messages which were officially posted in the context of the mod mail thread. Either via command (from the
* staff side of view) or by messaging the bot (from the member view)

View File

@@ -8,11 +8,14 @@ import lombok.Getter;
@Builder
public class ServerChoicePayload {
private Long serverId;
@Builder.Default
private Boolean appealModmail = false;
public static ServerChoicePayload fromServerChoice(ServerChoice choice) {
return ServerChoicePayload
.builder()
.serverId(choice.getServerId())
.appealModmail(choice.getAppealModmail())
.build();
}
}

View File

@@ -32,4 +32,8 @@ public class ModMailNotificationModel extends ServerContext {
* The {@link GuildMessageChannel} in which the mod mail thread is handled
*/
private GuildMessageChannel channel;
/**
* Whether the modmail is created for the purpose of an appeal
*/
private boolean appeal;
}

View File

@@ -8,4 +8,6 @@ import lombok.Getter;
public class ServerChoice {
private String serverName;
private Long serverId;
@Builder.Default
private Boolean appealModmail = false;
}

View File

@@ -25,11 +25,12 @@ public interface ModMailThreadService {
* @param user The {@link User} to create the mod mail thread for
* @param guild The {@link Guild} in which the mod mail thread should be created in
* @param initialMessage The initial message sparking this mod mail thread, null in case it was created by a command
* @param userInitiated Whether or not the mod mail thread was initiated by a user
* @param userInitiated Whether the mod mail thread was initiated by a user
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @param appeal Whether the modmail thread was created for the purpose of an appeal
* @return A {@link CompletableFuture future} which completes when the modmail thread is set up
*/
CompletableFuture<MessageChannel> createModMailThreadForUser(User user, Guild guild, Message initialMessage, boolean userInitiated, List<UndoActionInstance> undoActions);
CompletableFuture<MessageChannel> createModMailThreadForUser(User user, Guild guild, Message initialMessage, boolean userInitiated, List<UndoActionInstance> undoActions, boolean appeal);
CompletableFuture<Void> sendContactNotification(User user, MessageChannel createdMessageChannel, MessageChannel feedBackChannel);
CompletableFuture<Void> sendContactNotification(User user, MessageChannel createdMessageChannel, InteractionHook interactionHook);

View File

@@ -104,9 +104,10 @@ public interface ModMailThreadManagementService {
* Creates an instance of {@link ModMailThread} with the appropriate parameters and returns the created instance.
* @param userInAServer The {@link AUserInAServer} for which the thread was created for
* @param channel An instance of {@link AChannel} in which the conversation with the member is handled
* @param appeal Whether the modmail thread is for the purpose of an appeal
* @return The created instance of {@link ModMailThread}
*/
ModMailThread createModMailThread(AUserInAServer userInAServer, AChannel channel);
ModMailThread createModMailThread(AUserInAServer userInAServer, AChannel channel, boolean appeal);
/**
* Updates the {@link ModMailThread} with the new state and saves the instance.