mirror of https://github.com/procxx/kepka.git
Removed "Export history" from context menu for empty chats.
This commit is contained in:
parent
5d04842a80
commit
2aecd1035e
|
@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
|
||||||
#include <rpl/filter.h>
|
|
||||||
#include <rpl/map.h>
|
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
@ -26,6 +24,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/image/image.h"
|
#include "ui/image/image.h"
|
||||||
#include "ui/empty_userpic.h"
|
#include "ui/empty_userpic.h"
|
||||||
#include "ui/text_options.h"
|
#include "ui/text_options.h"
|
||||||
|
#include "history/history.h"
|
||||||
|
#include "history/view/history_view_element.h"
|
||||||
|
#include "history/history_item.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -376,6 +377,17 @@ void PeerData::setPinnedMessageId(MsgId messageId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PeerData::canExportChatHistory() const {
|
||||||
|
for (const auto &block : _owner->history(id)->blocks) {
|
||||||
|
for (const auto &message : block->messages) {
|
||||||
|
if (!message->data()->serviceMsg()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool PeerData::setAbout(const QString &newAbout) {
|
bool PeerData::setAbout(const QString &newAbout) {
|
||||||
if (_about == newAbout) {
|
if (_about == newAbout) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -274,6 +274,8 @@ public:
|
||||||
setPinnedMessageId(0);
|
setPinnedMessageId(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool canExportChatHistory() const;
|
||||||
|
|
||||||
// Returns true if about text was changed.
|
// Returns true if about text was changed.
|
||||||
bool setAbout(const QString &newAbout);
|
bool setAbout(const QString &newAbout);
|
||||||
const QString &about() const {
|
const QString &about() const {
|
||||||
|
|
|
@ -336,9 +336,11 @@ void Filler::addUserActions(not_null<UserData*> user) {
|
||||||
lang(lng_profile_invite_to_group),
|
lang(lng_profile_invite_to_group),
|
||||||
[user] { AddBotToGroupBoxController::Start(user); });
|
[user] { AddBotToGroupBoxController::Start(user); });
|
||||||
}
|
}
|
||||||
_addAction(
|
if (user->canExportChatHistory()) {
|
||||||
lang(lng_profile_export_chat),
|
_addAction(
|
||||||
[=] { PeerMenuExportChat(user); });
|
lang(lng_profile_export_chat),
|
||||||
|
[=] { PeerMenuExportChat(user); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_addAction(
|
_addAction(
|
||||||
lang(lng_profile_delete_conversation),
|
lang(lng_profile_delete_conversation),
|
||||||
|
@ -369,9 +371,11 @@ void Filler::addChatActions(not_null<ChatData*> chat) {
|
||||||
lang(lng_polls_create),
|
lang(lng_polls_create),
|
||||||
[=] { PeerMenuCreatePoll(chat); });
|
[=] { PeerMenuCreatePoll(chat); });
|
||||||
}
|
}
|
||||||
_addAction(
|
if (chat->canExportChatHistory()) {
|
||||||
lang(lng_profile_export_chat),
|
_addAction(
|
||||||
[=] { PeerMenuExportChat(chat); });
|
lang(lng_profile_export_chat),
|
||||||
|
[=] { PeerMenuExportChat(chat); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_addAction(
|
_addAction(
|
||||||
lang(lng_profile_clear_and_exit),
|
lang(lng_profile_clear_and_exit),
|
||||||
|
@ -411,11 +415,13 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||||
lang(lng_polls_create),
|
lang(lng_polls_create),
|
||||||
[=] { PeerMenuCreatePoll(channel); });
|
[=] { PeerMenuCreatePoll(channel); });
|
||||||
}
|
}
|
||||||
_addAction(
|
if (channel->canExportChatHistory()) {
|
||||||
lang(isGroup
|
_addAction(
|
||||||
? lng_profile_export_chat
|
lang(isGroup
|
||||||
: lng_profile_export_channel),
|
? lng_profile_export_chat
|
||||||
[=] { PeerMenuExportChat(channel); });
|
: lng_profile_export_channel),
|
||||||
|
[=] { PeerMenuExportChat(channel); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (channel->amIn()) {
|
if (channel->amIn()) {
|
||||||
if (isGroup && !channel->isPublic()) {
|
if (isGroup && !channel->isPublic()) {
|
||||||
|
|
Loading…
Reference in New Issue