mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 03:42:56 +00:00
Treat community rows like forums in forward boxes.
This commit is contained in:
@@ -62,8 +62,9 @@ namespace {
|
||||
constexpr auto kSortByOnlineThrottle = 3 * crl::time(1000);
|
||||
constexpr auto kSearchPerPage = 50;
|
||||
|
||||
[[nodiscard]] Data::CommunityInfo *JoinedCommunityChats(
|
||||
not_null<PeerData*> peer) {
|
||||
} // namespace
|
||||
|
||||
Data::CommunityInfo *JoinedCommunityChats(not_null<PeerData*> peer) {
|
||||
const auto channel = peer->asChannel();
|
||||
const auto info = (channel && channel->isCommunity())
|
||||
? channel->communityInfo()
|
||||
@@ -71,8 +72,6 @@ constexpr auto kSearchPerPage = 50;
|
||||
return (info && !info->histories().empty()) ? info : nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||
not_null<Window::SessionController*> window) {
|
||||
using Mode = ContactsBoxController::SortMode;
|
||||
|
||||
@@ -455,6 +455,9 @@ private:
|
||||
|
||||
};
|
||||
|
||||
[[nodiscard]] Data::CommunityInfo *JoinedCommunityChats(
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
class ChooseCommunityChatBoxController final
|
||||
: public PeerListController
|
||||
, public base::has_weak_ptr {
|
||||
|
||||
@@ -68,19 +68,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] Data::CommunityInfo *JoinedCommunityChats(
|
||||
not_null<PeerData*> peer) {
|
||||
const auto channel = peer->asChannel();
|
||||
const auto info = (channel && channel->isCommunity())
|
||||
? channel->communityInfo()
|
||||
: nullptr;
|
||||
return (info && !info->histories().empty()) ? info : nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class ShareBox::Inner final : public Ui::RpWidget {
|
||||
public:
|
||||
Inner(
|
||||
|
||||
@@ -2808,9 +2808,11 @@ object_ptr<Ui::BoxContent> PrepareChooseRecipientBox(
|
||||
const auto count = delegate()->peerListSelectedRowsCount();
|
||||
const auto forum = row->peer()->isForum();
|
||||
const auto monoforum = row->peer()->isMonoforum();
|
||||
if (showLockedError(row) || (count && (forum || monoforum))) {
|
||||
const auto community = JoinedCommunityChats(row->peer());
|
||||
if (showLockedError(row)
|
||||
|| (count && (forum || monoforum || community))) {
|
||||
return;
|
||||
} else if (forum || monoforum) {
|
||||
} else if (forum || monoforum || community) {
|
||||
ChooseRecipientBoxController::rowClicked(row);
|
||||
} else {
|
||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||
@@ -2828,7 +2830,8 @@ object_ptr<Ui::BoxContent> PrepareChooseRecipientBox(
|
||||
}
|
||||
if (!row->checked()
|
||||
&& !row->peer()->isForum()
|
||||
&& !row->peer()->isMonoforum()) {
|
||||
&& !row->peer()->isMonoforum()
|
||||
&& !JoinedCommunityChats(row->peer())) {
|
||||
auto menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
parent,
|
||||
st::popupMenuWithIcons);
|
||||
@@ -3125,9 +3128,11 @@ base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
const auto count = delegate()->peerListSelectedRowsCount();
|
||||
const auto forum = row->peer()->isForum();
|
||||
const auto monoforum = row->peer()->isMonoforum();
|
||||
if (showLockedError(row) || (count && (forum || monoforum))) {
|
||||
const auto community = JoinedCommunityChats(row->peer());
|
||||
if (showLockedError(row)
|
||||
|| (count && (forum || monoforum || community))) {
|
||||
return;
|
||||
} else if (!count || forum || monoforum) {
|
||||
} else if (!count || forum || monoforum || community) {
|
||||
ChooseRecipientBoxController::rowClicked(row);
|
||||
} else if (count) {
|
||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||
@@ -3140,7 +3145,8 @@ base::weak_qptr<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
not_null<PeerListRow*> row) override final {
|
||||
if (!row->checked()
|
||||
&& !row->peer()->isForum()
|
||||
&& !row->peer()->isMonoforum()) {
|
||||
&& !row->peer()->isMonoforum()
|
||||
&& !JoinedCommunityChats(row->peer())) {
|
||||
auto menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
parent,
|
||||
st::popupMenuWithIcons);
|
||||
|
||||
Reference in New Issue
Block a user