Support custom channel backgrounds display.

This commit is contained in:
John Preston 2023-12-16 23:23:24 +00:00
parent ac744b957a
commit b6c679449e
2 changed files with 12 additions and 1 deletions

View file

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_histories.h"
#include "data/data_group_call.h"
#include "data/data_message_reactions.h"
#include "data/data_wall_paper.h"
#include "data/notify/data_notify_settings.h"
#include "main/main_session.h"
#include "main/session/send_as_peers.h"
@ -1142,6 +1143,13 @@ void ApplyChannelUpdate(
session->sendAsPeers().setChosen(channel, PeerId());
}
if (const auto paper = update.vwallpaper()) {
channel->setWallPaper(
Data::WallPaper::Create(&channel->session(), *paper));
} else {
channel->setWallPaper({});
}
// For clearUpTill() call.
channel->owner().sendHistoryChangeNotifications();
}

View file

@ -509,8 +509,11 @@ rpl::producer<QString> ThemeDocumentBox::button() {
}
ClickHandlerPtr ThemeDocumentBox::createViewLink() {
const auto out = _parent->data()->out();
const auto to = _parent->history()->peer;
if (to->isChannel()) {
return nullptr;
}
const auto out = _parent->data()->out();
const auto media = _parent->data()->media();
const auto weak = base::make_weak(_parent);
const auto paper = media ? media->paper() : nullptr;