Fix for channels with too large name length.

This commit is contained in:
Kavin 2023-06-05 07:56:53 +01:00
parent c3863c22b8
commit 0dd97c67ca
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 5 additions and 2 deletions

View File

@ -76,7 +76,9 @@ public class ChannelHandlers {
Multithreading.runAsync(() -> {
try {
MatrixHelper.sendEvent("video.piped.channel.info", new FederatedChannelInfo(info.getId(), info.getName(), info.getAvatarUrl(), info.isVerified()));
MatrixHelper.sendEvent("video.piped.channel.info", new FederatedChannelInfo(
info.getId(), StringUtils.abbreviate(info.getName(), 100), info.getAvatarUrl(), info.isVerified())
);
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -6,6 +6,7 @@ import jakarta.persistence.criteria.JoinType;
import jakarta.persistence.criteria.Root;
import me.kavin.piped.consts.Constants;
import me.kavin.piped.utils.obj.db.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.hibernate.SharedSessionContract;
import org.hibernate.StatelessSession;
@ -191,7 +192,7 @@ public class DatabaseHelper {
return null;
}
var channel = new Channel(channelId, info.getName(),
var channel = new Channel(channelId, StringUtils.abbreviate(info.getName(), 100),
info.getAvatarUrl(), info.isVerified());
try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) {