mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add channel name updates when loading.
This commit is contained in:
parent
1157d5dfaa
commit
82ac80df97
1 changed files with 18 additions and 3 deletions
|
@ -223,15 +223,30 @@ public class ResponseHelper {
|
|||
|
||||
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()) {
|
||||
|
||||
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());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!channel.getUploaderAvatar().equals(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();
|
||||
s.update(channel);
|
||||
tr.commit();
|
||||
|
|
Loading…
Reference in a new issue