mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Update API scheme on layer 160, show correct warnings.
This commit is contained in:
@@ -1775,6 +1775,14 @@ ServiceAction ParseServiceAction(
|
||||
.rejected = data.is_rejected(),
|
||||
.balanceTooLow = data.is_balance_too_low(),
|
||||
};
|
||||
}, [&](const MTPDmessageActionSuggestedPostSuccess &data) {
|
||||
result.content = ActionSuggestedPostSuccess{
|
||||
.price = CreditsAmountFromTL(data.vprice()),
|
||||
};
|
||||
}, [&](const MTPDmessageActionSuggestedPostRefund &data) {
|
||||
result.content = ActionSuggestedPostRefund{
|
||||
.payerInitiated = data.is_payer_initiated(),
|
||||
};
|
||||
}, [&](const MTPDmessageActionConferenceCall &data) {
|
||||
auto content = ActionPhoneCall();
|
||||
using State = ActionPhoneCall::State;
|
||||
|
@@ -707,6 +707,14 @@ struct ActionSuggestedPostApproval {
|
||||
bool balanceTooLow = false;
|
||||
};
|
||||
|
||||
struct ActionSuggestedPostSuccess {
|
||||
CreditsAmount price;
|
||||
};
|
||||
|
||||
struct ActionSuggestedPostRefund {
|
||||
bool payerInitiated = false;
|
||||
};
|
||||
|
||||
struct ServiceAction {
|
||||
std::variant<
|
||||
v::null_t,
|
||||
@@ -757,7 +765,9 @@ struct ServiceAction {
|
||||
ActionPaidMessagesPrice,
|
||||
ActionTodoCompletions,
|
||||
ActionTodoAppendTasks,
|
||||
ActionSuggestedPostApproval> content;
|
||||
ActionSuggestedPostApproval,
|
||||
ActionSuggestedPostSuccess,
|
||||
ActionSuggestedPostRefund> content;
|
||||
};
|
||||
|
||||
ServiceAction ParseServiceAction(
|
||||
|
@@ -1466,6 +1466,15 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||
: (", with comment: ""
|
||||
+ SerializeString(data.rejectComment)
|
||||
+ """));
|
||||
}, [&](const ActionSuggestedPostSuccess &data) {
|
||||
return "The paid post was shown for 24 hours and "
|
||||
+ QString::number(data.price.value()).toUtf8()
|
||||
+ (data.price.ton() ? " TON" : " stars")
|
||||
+ " were transferred to the channel.";
|
||||
}, [&](const ActionSuggestedPostRefund &data) {
|
||||
return QByteArray() + (data.payerInitiated
|
||||
? "The user refunded the payment, post was deleted."
|
||||
: "The admin deleted the post early, the payment was refunded.");
|
||||
}, [](v::null_t) { return QByteArray(); });
|
||||
|
||||
if (!serviceText.isEmpty()) {
|
||||
|
@@ -725,6 +725,16 @@ QByteArray SerializeMessage(
|
||||
push("price_currency", data.price.ton() ? "TON" : "Stars");
|
||||
push("scheduled_date", data.scheduleDate);
|
||||
}
|
||||
}, [&](const ActionSuggestedPostSuccess &data) {
|
||||
pushActor();
|
||||
pushAction("suggested_post_success");
|
||||
push("price_amount_whole", NumberToString(data.price.whole()));
|
||||
push("price_amount_nano", NumberToString(data.price.nano()));
|
||||
push("price_currency", data.price.ton() ? "TON" : "Stars");
|
||||
}, [&](const ActionSuggestedPostRefund &data) {
|
||||
pushActor();
|
||||
pushAction("suggested_post_refund");
|
||||
push("user_initiated", data.payerInitiated);
|
||||
}, [](v::null_t) {});
|
||||
|
||||
if (v::is_null(message.action.content)) {
|
||||
|
Reference in New Issue
Block a user