mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-24 13:44:33 +00:00
fixed link embedding not properly working with sessions
This commit is contained in:
@@ -14,8 +14,8 @@ import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.Instant;
|
||||
@@ -44,6 +44,11 @@ public class MessageCacheBean implements MessageCache {
|
||||
// needs to be lazy, because of circular dependency
|
||||
private MessageCache self;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
// needs to be lazy, because of circular dependency
|
||||
private MessageCacheBean concreteSelf;
|
||||
|
||||
@Override
|
||||
@CachePut(key = "#message.id")
|
||||
public CompletableFuture<CachedMessage> putMessageInCache(Message message) {
|
||||
@@ -155,9 +160,7 @@ public class MessageCacheBean implements MessageCache {
|
||||
|
||||
List<Long> ausers = new ArrayList<>();
|
||||
users.forEachAsync(user -> {
|
||||
if(reaction.getGuild() != null) {
|
||||
ausers.add(userInServerManagementService.loadUser(reaction.getGuild().getIdLong(), user.getIdLong()).getUserInServerId());
|
||||
}
|
||||
concreteSelf.loadUser(reaction, ausers, user);
|
||||
return false;
|
||||
}).thenAccept(o -> future.complete(builder.build()))
|
||||
.exceptionally(throwable -> {
|
||||
@@ -168,6 +171,13 @@ public class MessageCacheBean implements MessageCache {
|
||||
builder.emote(emoteService.buildAEmoteFromReaction(reaction.getReactionEmote()));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void loadUser(MessageReaction reaction, List<Long> ausers, User user) {
|
||||
if(reaction.getGuild() != null) {
|
||||
ausers.add(userInServerManagementService.loadUser(reaction.getGuild().getIdLong(), user.getIdLong()).getUserInServerId());
|
||||
}
|
||||
}
|
||||
|
||||
private CachedEmbed getCachedEmbedFromEmbed(MessageEmbed embed) {
|
||||
CachedEmbed.CachedEmbedBuilder builder = CachedEmbed
|
||||
.builder();
|
||||
|
||||
Reference in New Issue
Block a user