mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Use separate phrase for singular Edit Tag.
This commit is contained in:
@@ -6165,6 +6165,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_rights_group_topics" = "Manage topics";
|
||||
"lng_rights_group_add_topics" = "Create topics";
|
||||
"lng_rights_group_edit_rank" = "Edit own tags";
|
||||
"lng_rights_group_edit_rank_single" = "Edit own tag";
|
||||
"lng_rights_group_manage_calls" = "Manage video chats";
|
||||
"lng_rights_group_delete" = "Delete messages";
|
||||
"lng_rights_group_anonymous" = "Remain anonymous";
|
||||
@@ -6481,6 +6482,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_admin_invite_link" = "Invite users via link";
|
||||
"lng_admin_log_admin_pin_messages" = "Pin messages";
|
||||
"lng_admin_log_banned_edit_rank" = "Edit own tags";
|
||||
"lng_admin_log_banned_edit_rank_single" = "Edit own tag";
|
||||
"lng_admin_log_admin_manage_topics" = "Manage topics";
|
||||
"lng_admin_log_admin_create_topics" = "Create topics";
|
||||
"lng_admin_log_admin_manage_calls" = "Manage video chats";
|
||||
|
||||
@@ -835,7 +835,7 @@ void CreateModerateMessagesBox(
|
||||
box,
|
||||
prepareFlags,
|
||||
disabledMessages,
|
||||
{ .isForum = peer->isForum() });
|
||||
{ .isForum = peer->isForum(), .isUserSpecific = true });
|
||||
computeRestrictions = getRestrictions;
|
||||
std::move(changes) | rpl::on_next([=] {
|
||||
ban->setChecked(true);
|
||||
|
||||
@@ -769,7 +769,7 @@ void EditRestrictedBox::prepare() {
|
||||
this,
|
||||
prepareFlags,
|
||||
disabledMessages,
|
||||
{ .isForum = peer()->isForum() });
|
||||
{ .isForum = peer()->isForum(), .isUserSpecific = true });
|
||||
addControl(std::move(checkboxes), QMargins());
|
||||
|
||||
if (canSave() && peer()->canManageRanks()) {
|
||||
|
||||
@@ -96,7 +96,9 @@ constexpr auto kDefaultChargeStars = 10;
|
||||
{ Flag::AddParticipants, tr::lng_rights_chat_add_members(tr::now) },
|
||||
{ Flag::CreateTopics, tr::lng_rights_group_add_topics(tr::now) },
|
||||
{ Flag::PinMessages, tr::lng_rights_group_pin(tr::now) },
|
||||
{ Flag::EditRank, tr::lng_rights_group_edit_rank(tr::now) },
|
||||
{ Flag::EditRank, (options.isUserSpecific
|
||||
? tr::lng_rights_group_edit_rank_single
|
||||
: tr::lng_rights_group_edit_rank)(tr::now) },
|
||||
{ Flag::ChangeInfo, tr::lng_rights_group_info(tr::now) },
|
||||
};
|
||||
if (!options.isForum) {
|
||||
|
||||
@@ -485,9 +485,14 @@ void FormattedDateClickHandler::onClick(ClickContext context) const {
|
||||
},
|
||||
&st::menuIconCopy);
|
||||
|
||||
const auto itemId = my.itemId;
|
||||
const auto &owner = controller->session().data();
|
||||
const auto item = owner.message(itemId);
|
||||
|
||||
const auto messageText = item ? item->originalText().text : QString();
|
||||
menu->addAction(
|
||||
tr::lng_context_add_to_calendar(tr::now),
|
||||
[date] {
|
||||
[date, messageText] {
|
||||
const auto start = QDateTime::fromSecsSinceEpoch(
|
||||
date,
|
||||
Qt::UTC);
|
||||
@@ -505,6 +510,11 @@ void FormattedDateClickHandler::onClick(ClickContext context) const {
|
||||
summary.replace(';', u"\\;"_q);
|
||||
summary.replace(',', u"\\,"_q);
|
||||
summary.replace('\n', u"\\n"_q);
|
||||
auto description = messageText;
|
||||
description.replace('\\', u"\\\\"_q);
|
||||
description.replace(';', u"\\;"_q);
|
||||
description.replace(',', u"\\,"_q);
|
||||
description.replace('\n', u"\\n"_q);
|
||||
const auto uid = base::RandomValue<uint64>();
|
||||
const auto content = u"BEGIN:VCALENDAR\r\n"
|
||||
"VERSION:2.0\r\n"
|
||||
@@ -513,8 +523,9 @@ void FormattedDateClickHandler::onClick(ClickContext context) const {
|
||||
"DTSTART:%1\r\n"
|
||||
"DTEND:%2\r\n"
|
||||
"DTSTAMP:%3\r\n"
|
||||
"UID:telegram-%4-%6@telegram.org\r\n"
|
||||
"UID:telegram-%4-%7@telegram.org\r\n"
|
||||
"SUMMARY:%5\r\n"
|
||||
"DESCRIPTION:%6\r\n"
|
||||
"END:VEVENT\r\n"
|
||||
"END:VCALENDAR\r\n"_q
|
||||
.arg(start.toString(format))
|
||||
@@ -522,6 +533,7 @@ void FormattedDateClickHandler::onClick(ClickContext context) const {
|
||||
.arg(now.toString(format))
|
||||
.arg(date)
|
||||
.arg(summary)
|
||||
.arg(description)
|
||||
.arg(uid, 0, 16);
|
||||
const auto dir = cWorkingDir() + u"tdata/temp"_q;
|
||||
QDir().mkpath(dir);
|
||||
@@ -537,9 +549,6 @@ void FormattedDateClickHandler::onClick(ClickContext context) const {
|
||||
},
|
||||
&st::menuIconSchedule);
|
||||
|
||||
const auto itemId = my.itemId;
|
||||
const auto &owner = controller->session().data();
|
||||
const auto item = owner.message(itemId);
|
||||
const auto canForward = item
|
||||
&& !item->forbidsForward()
|
||||
&& item->history()->peer->allowsForwarding();
|
||||
|
||||
@@ -107,6 +107,7 @@ struct AdminRightsSetOptions {
|
||||
|
||||
struct RestrictionsSetOptions {
|
||||
bool isForum = false;
|
||||
bool isUserSpecific = false;
|
||||
};
|
||||
|
||||
[[nodiscard]] std::vector<ChatRestrictions> ListOfRestrictions(
|
||||
|
||||
@@ -313,11 +313,12 @@ TextWithEntities GenerateAdminChangeText(
|
||||
|
||||
QString GeneratePermissionsChangeText(
|
||||
ChatRestrictionsInfo newRights,
|
||||
ChatRestrictionsInfo prevRights) {
|
||||
ChatRestrictionsInfo prevRights,
|
||||
bool isUserSpecific = false) {
|
||||
using Flag = ChatRestriction;
|
||||
using Flags = ChatRestrictions;
|
||||
|
||||
static auto phraseMap = std::map<Flags, tr::phrase<>>{
|
||||
auto phraseMap = std::map<Flags, tr::phrase<>>{
|
||||
{ Flag::ViewMessages, tr::lng_admin_log_banned_view_messages },
|
||||
{ Flag::SendOther, tr::lng_admin_log_banned_send_messages },
|
||||
{ Flag::SendPhotos, tr::lng_admin_log_banned_send_photos },
|
||||
@@ -340,7 +341,9 @@ QString GeneratePermissionsChangeText(
|
||||
{ Flag::AddParticipants, tr::lng_admin_log_admin_invite_users },
|
||||
{ Flag::CreateTopics, tr::lng_admin_log_admin_create_topics },
|
||||
{ Flag::PinMessages, tr::lng_admin_log_admin_pin_messages },
|
||||
{ Flag::EditRank, tr::lng_admin_log_banned_edit_rank },
|
||||
{ Flag::EditRank, isUserSpecific
|
||||
? tr::lng_admin_log_banned_edit_rank_single
|
||||
: tr::lng_admin_log_banned_edit_rank },
|
||||
};
|
||||
return CollectChanges(phraseMap, prevRights.flags, newRights.flags);
|
||||
}
|
||||
@@ -397,7 +400,10 @@ TextWithEntities GeneratePermissionsChangeText(
|
||||
lt_until,
|
||||
TextWithEntities { untilText },
|
||||
tr::marked);
|
||||
const auto changes = GeneratePermissionsChangeText(newRights, prevRights);
|
||||
const auto changes = GeneratePermissionsChangeText(
|
||||
newRights,
|
||||
prevRights,
|
||||
true);
|
||||
if (!changes.isEmpty()) {
|
||||
result.text.append('\n' + changes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user