From 86154a1a295ef3eba2daf737ee5e64ce05a779c5 Mon Sep 17 00:00:00 2001 From: FireMaskterK <20838718+FireMasterK@users.noreply.github.com> Date: Sun, 31 Oct 2021 17:48:34 +0000 Subject: [PATCH] Allow Avatar URL to change in channel. --- .../java/me/kavin/piped/utils/CustomServletDecorator.java | 2 +- src/main/java/me/kavin/piped/utils/ResponseHelper.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java b/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java index 6a8550a..39c5c9b 100644 --- a/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java +++ b/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java @@ -24,7 +24,7 @@ public class CustomServletDecorator implements AsyncServlet { } @Override - public @NotNull Promisable serve(@NotNull HttpRequest request) { + public @NotNull Promisable serve(@NotNull HttpRequest request) throws Exception { long before = System.nanoTime(); return servlet.serve(request).promise().map(response -> { diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index b4b6752..3ef1267 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -218,8 +218,10 @@ public class ResponseHelper { me.kavin.piped.utils.obj.db.Channel channel = DatabaseHelper.getChannelFromId(s, info.getId()); if (channel != null) { - if (channel.isVerified() != info.isVerified()) { + if (channel.isVerified() != info.isVerified() + || !channel.getUploaderAvatar().equals(info.getAvatarUrl())) { channel.setVerified(info.isVerified()); + channel.setUploaderAvatar(info.getAvatarUrl()); if (!s.getTransaction().isActive()) s.getTransaction().begin(); s.update(channel);