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