mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-04 15:35:43 +00:00
[AB-xxx] adding ability to add additional channels to a post target
adding auto complete to post target command
This commit is contained in:
@@ -118,7 +118,7 @@ public class StarboardServiceBean implements StarboardService {
|
||||
public CompletionStage<Void> sendStarboardPostAndStore(CachedMessage message, Long starredUserId, List<Long> userExceptAuthorIds, StarboardPostModel starboardPostModel, Long userReactingId) {
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(STARBOARD_POST_TEMPLATE, starboardPostModel, message.getServerId());
|
||||
PostTarget starboard = postTargetManagement.getPostTarget(StarboardPostTarget.STARBOARD.getKey(), message.getServerId());
|
||||
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, StarboardPostTarget.STARBOARD, message.getServerId());
|
||||
List<CompletableFuture<Message>> completableFutures = postTargetService.sendEmbedInPostTarget(messageToSend, StarboardPostTarget.STARBOARD, message.getServerId()).get(0);
|
||||
Long starboardChannelId = starboard.getChannelReference().getId();
|
||||
return CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).thenAccept(aVoid ->
|
||||
self.persistPost(message, userExceptAuthorIds, completableFutures, starboardChannelId, starredUserId, userReactingId)
|
||||
|
||||
@@ -185,7 +185,7 @@ public class StarboardServiceBeanTest {
|
||||
when(postTarget.getChannelReference()).thenReturn(starboardChannel);
|
||||
when(starboardChannel.getId()).thenReturn(STARBOARD_CHANNEL_ID);
|
||||
when(postTargetManagement.getPostTarget(StarboardPostTarget.STARBOARD.getKey(), SERVER_ID)).thenReturn(postTarget);
|
||||
when(postTargetService.sendEmbedInPostTarget(messageToSend, StarboardPostTarget.STARBOARD, SERVER_ID)).thenReturn(Arrays.asList(CompletableFuture.completedFuture(null)));
|
||||
when(postTargetService.sendEmbedInPostTarget(messageToSend, StarboardPostTarget.STARBOARD, SERVER_ID)).thenReturn(List.of(List.of(CompletableFuture.completedFuture(null))));
|
||||
ArrayList<Long> userExceptAuthorIds = new ArrayList<>();
|
||||
testUnit.sendStarboardPostAndStore(message, STARRED_USER_ID, userExceptAuthorIds, model, STARRING_USER_ID);
|
||||
verify(self, times(1)).persistPost(eq(message), eq(userExceptAuthorIds), any(), eq(STARBOARD_CHANNEL_ID), eq(STARRED_USER_ID), eq(STARRING_USER_ID));
|
||||
|
||||
Reference in New Issue
Block a user