mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-14 06:10:29 +05:30
Add channel name updates when loading.
This commit is contained in:
parent
1157d5dfaa
commit
82ac80df97
@ -223,15 +223,30 @@ public class ResponseHelper {
|
|||||||
|
|
||||||
Multithreading.runAsync(() -> {
|
Multithreading.runAsync(() -> {
|
||||||
|
|
||||||
me.kavin.piped.utils.obj.db.Channel channel = DatabaseHelper.getChannelFromId(info.getId());
|
var channel = DatabaseHelper.getChannelFromId(info.getId());
|
||||||
|
|
||||||
try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) {
|
try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) {
|
||||||
|
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
if (channel.isVerified() != info.isVerified()
|
|
||||||
|| !channel.getUploaderAvatar().equals(info.getAvatarUrl())) {
|
boolean modified = false;
|
||||||
|
|
||||||
|
if (channel.isVerified() != info.isVerified()) {
|
||||||
channel.setVerified(info.isVerified());
|
channel.setVerified(info.isVerified());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!channel.getUploaderAvatar().equals(info.getAvatarUrl())) {
|
||||||
channel.setUploaderAvatar(info.getAvatarUrl());
|
channel.setUploaderAvatar(info.getAvatarUrl());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!channel.getUploader().equals(info.getName())) {
|
||||||
|
channel.setUploader(info.getName());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modified) {
|
||||||
var tr = s.beginTransaction();
|
var tr = s.beginTransaction();
|
||||||
s.update(channel);
|
s.update(channel);
|
||||||
tr.commit();
|
tr.commit();
|
||||||
|
Loading…
Reference in New Issue
Block a user