2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support channel stories archive.

This commit is contained in:
John Preston
2023-09-05 11:07:32 +04:00
parent b2c9a92c3e
commit 29c5f6b706
13 changed files with 314 additions and 156 deletions

View File

@@ -66,6 +66,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/info_memento.h"
#include "info/info_controller.h"
#include "info/profile/info_profile_values.h"
#include "info/stories/info_stories_widget.h"
#include "data/notify/data_notify_settings.h"
#include "data/data_changes.h"
#include "data/data_session.h"
@@ -249,6 +250,7 @@ private:
void addToggleMuteSubmenu(bool addSeparator);
void addSupportInfo();
void addInfo();
void addStoryArchive();
void addNewWindow();
void addToggleFolder();
void addToggleUnreadMark();
@@ -548,6 +550,22 @@ void Filler::addInfo() {
}, _peer->isUser() ? &st::menuIconProfile : &st::menuIconInfo);
}
void Filler::addStoryArchive() {
const auto channel = _peer ? _peer->asChannel() : nullptr;
if (!channel || !channel->canEditStories()) {
return;
}
const auto controller = _controller;
const auto weak = base::make_weak(_thread);
_addAction(tr::lng_stories_archive_button(tr::now), [=] {
if (const auto strong = weak.get()) {
controller->showSection(Info::Stories::Make(
channel,
Info::Stories::Tab::Archive));
}
}, &st::menuIconStoriesArchiveSection);
}
void Filler::addToggleFolder() {
const auto controller = _controller;
const auto history = _request.key.history();
@@ -1196,6 +1214,7 @@ void Filler::fillContextMenuActions() {
void Filler::fillHistoryActions() {
addToggleMuteSubmenu(true);
addInfo();
addStoryArchive();
addSupportInfo();
addManageChat();
addCreatePoll();