mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Better entry point for Direct Messages.
This commit is contained in:
parent
cd05586d51
commit
6c80d443b9
4 changed files with 22 additions and 37 deletions
|
@ -1491,6 +1491,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_profile_hide_participants_about" = "Switch this on to hide the list of members in this group. Admins will remain visible.";
|
||||
"lng_profile_view_channel" = "View Channel";
|
||||
"lng_profile_view_discussion" = "View discussion";
|
||||
"lng_profile_direct_messages" = "Direct messages";
|
||||
"lng_profile_join_channel" = "Join Channel";
|
||||
"lng_profile_join_group" = "Join Group";
|
||||
"lng_profile_apply_to_join_group" = "Apply to Join Group";
|
||||
|
|
|
@ -445,7 +445,6 @@ void SavedSublist::setInboxReadTill(
|
|||
&& _inboxReadTillId >= _list.front()) {
|
||||
unreadCount = 0;
|
||||
}
|
||||
const auto wasUnreadCount = _unreadCount;
|
||||
if (_unreadCount.current() != unreadCount
|
||||
&& (changed || unreadCount.has_value())) {
|
||||
setUnreadCount(unreadCount);
|
||||
|
@ -593,24 +592,7 @@ std::optional<int> SavedSublist::computeUnreadCountLocally(
|
|||
}
|
||||
|
||||
void SavedSublist::requestUnreadCount() {
|
||||
if (_reloadUnreadCountRequestId) {
|
||||
return;
|
||||
}
|
||||
//const auto weak = base::make_weak(this); // #TODO monoforum
|
||||
//const auto session = &_parent->session();
|
||||
//const auto apply = [weak](MsgId readTill, int unreadCount) {
|
||||
// if (const auto strong = weak.get()) {
|
||||
// strong->setInboxReadTill(readTill, unreadCount);
|
||||
// }
|
||||
//};
|
||||
//_reloadUnreadCountRequestId = session->api().request(
|
||||
// ...
|
||||
//).done([=](const ... &result) {
|
||||
// if (weak) {
|
||||
// _reloadUnreadCountRequestId = 0;
|
||||
// }
|
||||
// ...
|
||||
//}).send();
|
||||
parent()->requestSublist(sublistPeer());
|
||||
}
|
||||
|
||||
void SavedSublist::readTill(not_null<HistoryItem*> item) {
|
||||
|
|
|
@ -2188,24 +2188,6 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons(
|
|||
std::move(viewChannel),
|
||||
tracker);
|
||||
|
||||
auto viewDirectVisible = channel->flagsValue() | rpl::map([=] {
|
||||
return channel->monoforumLink() != nullptr;
|
||||
}) | rpl::distinct_until_changed();
|
||||
auto viewDirect = [=] {
|
||||
if (const auto linked = channel->monoforumLink()) {
|
||||
window->showPeerHistory(linked);
|
||||
//if (const auto monoforum = linked->monoforum()) {
|
||||
// window->showMonoforum(monoforum);
|
||||
//}
|
||||
}
|
||||
};
|
||||
AddMainButton( // #TODO monoforum
|
||||
_wrap,
|
||||
rpl::single(u"View Direct Messages"_q),
|
||||
std::move(viewDirectVisible),
|
||||
std::move(viewDirect),
|
||||
tracker);
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
|
|
|
@ -293,6 +293,7 @@ private:
|
|||
void addThemeEdit();
|
||||
void addBlockUser();
|
||||
void addViewDiscussion();
|
||||
void addDirectMessages();
|
||||
void addToggleTopicClosed();
|
||||
void addExportChat();
|
||||
void addTranslate();
|
||||
|
@ -872,6 +873,23 @@ void Filler::addViewDiscussion() {
|
|||
}, &st::menuIconDiscussion);
|
||||
}
|
||||
|
||||
void Filler::addDirectMessages() {
|
||||
const auto channel = _peer->asBroadcast();
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
const auto monoforum = channel->broadcastMonoforum();
|
||||
if (!monoforum || !monoforum->amMonoforumAdmin()) {
|
||||
return;
|
||||
}
|
||||
const auto navigation = _controller;
|
||||
_addAction(tr::lng_profile_direct_messages(tr::now), [=] {
|
||||
navigation->showPeerHistory(
|
||||
monoforum,
|
||||
Window::SectionShow::Way::Forward);
|
||||
}, &st::menuIconChatDiscuss);
|
||||
}
|
||||
|
||||
void Filler::addExportChat() {
|
||||
if (_thread->asTopic() || !_peer->canExportChatHistory()) {
|
||||
return;
|
||||
|
@ -1461,6 +1479,7 @@ void Filler::fillHistoryActions() {
|
|||
addCreatePoll();
|
||||
addThemeEdit();
|
||||
addViewDiscussion();
|
||||
addDirectMessages();
|
||||
addExportChat();
|
||||
addTranslate();
|
||||
addReport();
|
||||
|
@ -1485,6 +1504,7 @@ void Filler::fillProfileActions() {
|
|||
addManageTopic();
|
||||
addToggleTopicClosed();
|
||||
addViewDiscussion();
|
||||
addDirectMessages();
|
||||
addExportChat();
|
||||
addToggleFolder();
|
||||
addBlockUser();
|
||||
|
|
Loading…
Add table
Reference in a new issue