[SIS-xxx] changing ban message

modifying meetup to add the location on the meetup message itself
updating abstracto version
This commit is contained in:
Sheldan
2026-04-24 20:03:10 +02:00
parent 796c66ff33
commit d5d6bbbcb5
9 changed files with 26 additions and 25 deletions

View File

@@ -35,6 +35,8 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;
@@ -76,7 +78,7 @@ public class CreateMeetup extends AbstractConditionableCommand {
private static final String DESCRIPTION_PARAMETER = "description";
private static final String LOCATION_PARAMETER = "location";
private static final String CONFIRMATION_TEMPLATE = "createMeetup_confirmation";
private static final String DEFAULT_LOCATION_STRING = "\"\"";
private static final String DEFAULT_LOCATION_STRING = "";
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
@@ -94,13 +96,14 @@ public class CreateMeetup extends AbstractConditionableCommand {
Meetup meetup = meetupManagementServiceBean.createMeetup(meetupTime, meetupTopic, description, organizer, meetupChannel, DEFAULT_LOCATION_STRING);
String confirmationId = componentService.generateComponentId();
String cancelId = componentService.generateComponentId();
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
MeetupConfirmationModel model = MeetupConfirmationModel
.builder()
.meetupTime(meetupTime)
.guildId(commandContext.getGuild().getIdLong())
.description(description)
.topic(meetupTopic)
.location(meetup.getLocation())
.location(locationEncoded)
.confirmationId(confirmationId)
.cancelId(cancelId)
.meetupId(meetup.getId().getId())
@@ -136,13 +139,14 @@ public class CreateMeetup extends AbstractConditionableCommand {
Meetup meetup = meetupManagementServiceBean.createMeetup(meetupTime, topic, description, organizer, meetupChannel, location);
String confirmationId = componentService.generateComponentId();
String cancelId = componentService.generateComponentId();
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
MeetupConfirmationModel model = MeetupConfirmationModel
.builder()
.meetupTime(meetupTime)
.guildId(event.getGuild().getIdLong())
.description(description)
.topic(topic)
.location(meetup.getLocation())
.location(locationEncoded)
.confirmationId(confirmationId)
.cancelId(cancelId)
.meetupId(meetup.getId().getId())

View File

@@ -16,7 +16,7 @@ public class MeetupMessageModel {
private String description;
private Instant meetupTime;
private String location;
private String decodedLocation;
private String locationEncoded;
private MemberDisplay organizer;
private Long meetupId;
private String yesId;

View File

@@ -195,17 +195,17 @@ public class MeetupServiceBean {
.filter(meetupParticipator -> meetupParticipator.getDecision().equals(MeetupDecision.NO_TIME))
.map(mapToUserId)
.toList();
String rawLocation = java.net.URLDecoder.decode(meetup.getLocation(), StandardCharsets.UTF_8);
List<Long> participantIds = allParticipants
.stream()
.map(mapToUserId)
.collect(Collectors.toList());
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
MeetupMessageModel.MeetupMessageModelBuilder builder = MeetupMessageModel
.builder()
.description(meetup.getDescription())
.topic(meetup.getTopic())
.location(meetup.getLocation())
.decodedLocation(rawLocation)
.locationEncoded(locationEncoded)
.noTimeId(meetup.getNoTimeButtonId())
.yesId(meetup.getYesButtonId())
.maybeId(meetup.getMaybeButtonId())
@@ -525,11 +525,7 @@ public class MeetupServiceBean {
}
public CompletableFuture<Void> changeMeetupLocation(Meetup meetup, String newLocation) {
try {
meetup.setLocation(URLEncoder.encode(newLocation, StandardCharsets.UTF_8.toString()));
} catch (UnsupportedEncodingException e) {
throw new AbstractoRunTimeException(e);
}
meetup.setLocation(newLocation);
return updateMeetupMessage(meetup);
}

View File

@@ -35,23 +35,18 @@ public class MeetupManagementServiceBean {
throw new MeetupPastTimeException();
}
Long meetupId = counterService.getNextCounterValue(organizer.getServerReference(), MEETUP_COUNTER_KEY);
Meetup meetup = null;
try {
meetup = Meetup
Meetup meetup = Meetup
.builder()
.meetupTime(timeStamp)
.description(description)
.topic(topic)
.location(URLEncoder.encode(location, StandardCharsets.UTF_8.toString()))
.location(location)
.organizer(organizer)
.server(organizer.getServerReference())
.meetupChannel(meetupChannel)
.state(MeetupState.NEW)
.id(new ServerSpecificId(organizer.getServerReference().getId(), meetupId))
.build();
} catch (UnsupportedEncodingException e) {
throw new AbstractoRunTimeException(e);
}
return meetupRepository.save(meetup);
}