mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Merge pull request #403 from TeamPiped/channel-name-updates
Add channel name updates when loading channels
This commit is contained in:
commit
b62da8a8d0
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