mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-20 12:42:50 +02:00
Remove unsupported actions from monoforum menu.
This commit is contained in:
parent
3278de9ba1
commit
0d43f16db2
4 changed files with 27 additions and 6 deletions
|
@ -591,6 +591,7 @@ void SafeSubmitOnEnter(not_null<Ui::GenericBox*> box) {
|
|||
void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
const auto container = box->verticalLayout();
|
||||
|
||||
const auto userpicPeer = peer->userpicPaintingPeer();
|
||||
const auto maybeUser = peer->asUser();
|
||||
const auto isBot = maybeUser && maybeUser->isBot();
|
||||
|
||||
|
@ -601,8 +602,9 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
|||
|
||||
const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
|
||||
container,
|
||||
peer,
|
||||
st::mainMenuUserpic);
|
||||
userpicPeer,
|
||||
st::mainMenuUserpic,
|
||||
peer->userpicForceForumShape());
|
||||
userpic->showSavedMessagesOnSelf(true);
|
||||
Ui::IconWithTitle(
|
||||
container,
|
||||
|
@ -614,7 +616,7 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
|||
: maybeUser
|
||||
? tr::lng_profile_delete_conversation() | Ui::Text::ToBold()
|
||||
: rpl::single(
|
||||
peer->name()
|
||||
userpicPeer->name()
|
||||
) | Ui::Text::ToBold() | rpl::type_erased(),
|
||||
box->getDelegate()->style().title));
|
||||
|
||||
|
|
|
@ -652,6 +652,9 @@ bool ChannelData::canPostStories() const {
|
|||
}
|
||||
|
||||
bool ChannelData::canEditStories() const {
|
||||
if (isMonoforum()) {
|
||||
return false;
|
||||
}
|
||||
return amCreator()
|
||||
|| (adminRights() & AdminRight::EditStories);
|
||||
}
|
||||
|
@ -678,7 +681,9 @@ bool ChannelData::hiddenPreHistory() const {
|
|||
}
|
||||
|
||||
bool ChannelData::canAddMembers() const {
|
||||
return isMegagroup()
|
||||
return isMonoforum()
|
||||
? false
|
||||
: isMegagroup()
|
||||
? !amRestricted(ChatRestriction::AddParticipants)
|
||||
: ((adminRights() & AdminRight::InviteByLinkOrAdd) || amCreator());
|
||||
}
|
||||
|
|
|
@ -1206,6 +1206,8 @@ int PeerData::nameVersion() const {
|
|||
const QString &PeerData::name() const {
|
||||
if (const auto to = migrateTo()) {
|
||||
return to->name();
|
||||
} else if (const auto broadcast = monoforumBroadcast()) {
|
||||
return broadcast->name();
|
||||
}
|
||||
return _name;
|
||||
}
|
||||
|
@ -1213,6 +1215,10 @@ const QString &PeerData::name() const {
|
|||
const QString &PeerData::shortName() const {
|
||||
if (const auto user = asUser()) {
|
||||
return user->firstName.isEmpty() ? user->lastName : user->firstName;
|
||||
} else if (const auto to = migrateTo()) {
|
||||
return to->shortName();
|
||||
} else if (const auto broadcast = monoforumBroadcast()) {
|
||||
return broadcast->shortName();
|
||||
}
|
||||
return _name;
|
||||
}
|
||||
|
@ -1554,7 +1560,8 @@ bool PeerData::canRevokeFullHistory() const {
|
|||
} else if (const auto megagroup = asMegagroup()) {
|
||||
return megagroup->amCreator()
|
||||
&& megagroup->membersCountKnown()
|
||||
&& megagroup->canDelete();
|
||||
&& megagroup->canDelete()
|
||||
&& !megagroup->isMonoforum();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1087,6 +1087,9 @@ void Filler::addManageChat() {
|
|||
|
||||
void Filler::addBoostChat() {
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
if (channel->isMonoforum()) {
|
||||
return;
|
||||
}
|
||||
const auto text = channel->isMegagroup()
|
||||
? tr::lng_boost_group_button(tr::now)
|
||||
: tr::lng_boost_channel_button(tr::now);
|
||||
|
@ -1101,6 +1104,9 @@ void Filler::addBoostChat() {
|
|||
|
||||
void Filler::addViewStatistics() {
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
if (channel->isMonoforum()) {
|
||||
return;
|
||||
}
|
||||
const auto controller = _controller;
|
||||
const auto weak = base::make_weak(_thread);
|
||||
const auto peer = _peer;
|
||||
|
@ -1219,7 +1225,7 @@ void Filler::addThemeEdit() {
|
|||
}
|
||||
|
||||
void Filler::addTTLSubmenu(bool addSeparator) {
|
||||
if (_thread->asTopic()) {
|
||||
if (_thread->asTopic() || !_peer || _peer->isMonoforum()) {
|
||||
return; // #TODO later forum
|
||||
}
|
||||
const auto validator = TTLMenu::TTLValidator(
|
||||
|
@ -1346,6 +1352,7 @@ void Filler::addViewAsMessages() {
|
|||
void Filler::addViewAsTopics() {
|
||||
if (!_peer
|
||||
|| !_peer->isForum()
|
||||
|| (_peer->asChannel()->flags() & ChannelDataFlag::ForumTabs)
|
||||
|| !_controller->adaptive().isOneColumn()) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue