Merge pull request #613 from TeamPiped/channel-length-fix

Fix for channels with too large name length.
This commit is contained in:
Kavin 2023-06-05 07:58:41 +01:00 committed by GitHub
commit 8e112d2058
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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()) {