mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Remove unused null option in SendReport().
This commit is contained in:
parent
4001899bdf
commit
363ffc1c04
3 changed files with 17 additions and 33 deletions
|
@ -40,29 +40,20 @@ MTPreportReason ReasonToTL(const Ui::ReportReason &reason) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void SendReport(
|
void SendPhotoReport(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
const QString &comment,
|
const QString &comment,
|
||||||
std::variant<v::null_t, not_null<PhotoData*>> data) {
|
not_null<PhotoData*> photo) {
|
||||||
auto done = [=] {
|
peer->session().api().request(MTPaccount_ReportProfilePhoto(
|
||||||
|
peer->input,
|
||||||
|
photo->mtpInput(),
|
||||||
|
ReasonToTL(reason),
|
||||||
|
MTP_string(comment)
|
||||||
|
)).done([=] {
|
||||||
show->showToast(tr::lng_report_thanks(tr::now));
|
show->showToast(tr::lng_report_thanks(tr::now));
|
||||||
};
|
}).send();
|
||||||
v::match(data, [&](v::null_t) {
|
|
||||||
peer->session().api().request(MTPaccount_ReportPeer(
|
|
||||||
peer->input,
|
|
||||||
ReasonToTL(reason),
|
|
||||||
MTP_string(comment)
|
|
||||||
)).done(std::move(done)).send();
|
|
||||||
}, [&](not_null<PhotoData*> photo) {
|
|
||||||
peer->session().api().request(MTPaccount_ReportProfilePhoto(
|
|
||||||
peer->input,
|
|
||||||
photo->mtpInput(),
|
|
||||||
ReasonToTL(reason),
|
|
||||||
MTP_string(comment)
|
|
||||||
)).done(std::move(done)).send();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto CreateReportMessagesOrStoriesCallback(
|
auto CreateReportMessagesOrStoriesCallback(
|
||||||
|
|
|
@ -41,12 +41,12 @@ struct ReportResult final {
|
||||||
bool successful = false;
|
bool successful = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void SendReport(
|
void SendPhotoReport(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
const QString &comment,
|
const QString &comment,
|
||||||
std::variant<v::null_t, not_null<PhotoData*>> data);
|
not_null<PhotoData*> photo);
|
||||||
|
|
||||||
[[nodiscard]] auto CreateReportMessagesOrStoriesCallback(
|
[[nodiscard]] auto CreateReportMessagesOrStoriesCallback(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
|
|
|
@ -27,13 +27,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[nodiscard]] object_ptr<Ui::BoxContent> Report(
|
[[nodiscard]] object_ptr<Ui::BoxContent> ReportPhoto(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
std::variant<v::null_t, not_null<PhotoData*>> data,
|
not_null<PhotoData*> photo,
|
||||||
const style::ReportBox *stOverride) {
|
const style::ReportBox *stOverride) {
|
||||||
const auto source = v::match(data, [](const MessageIdsList &ids) {
|
const auto source = [&] {
|
||||||
return Ui::ReportSource::Message;
|
|
||||||
}, [&](not_null<PhotoData*> photo) {
|
|
||||||
return peer->isUser()
|
return peer->isUser()
|
||||||
? (photo->hasVideo()
|
? (photo->hasVideo()
|
||||||
? Ui::ReportSource::ProfileVideo
|
? Ui::ReportSource::ProfileVideo
|
||||||
|
@ -45,19 +43,14 @@ namespace {
|
||||||
: (photo->hasVideo()
|
: (photo->hasVideo()
|
||||||
? Ui::ReportSource::ChannelVideo
|
? Ui::ReportSource::ChannelVideo
|
||||||
: Ui::ReportSource::ChannelPhoto);
|
: Ui::ReportSource::ChannelPhoto);
|
||||||
}, [&](StoryId id) {
|
}();
|
||||||
return Ui::ReportSource::Story;
|
|
||||||
}, [](v::null_t) {
|
|
||||||
Unexpected("Bad source report.");
|
|
||||||
return Ui::ReportSource::Bot;
|
|
||||||
});
|
|
||||||
const auto st = stOverride ? stOverride : &st::defaultReportBox;
|
const auto st = stOverride ? stOverride : &st::defaultReportBox;
|
||||||
return Box([=](not_null<Ui::GenericBox*> box) {
|
return Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
const auto show = box->uiShow();
|
const auto show = box->uiShow();
|
||||||
Ui::ReportReasonBox(box, *st, source, [=](Ui::ReportReason reason) {
|
Ui::ReportReasonBox(box, *st, source, [=](Ui::ReportReason reason) {
|
||||||
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
Ui::ReportDetailsBox(box, *st, [=](const QString &text) {
|
Ui::ReportDetailsBox(box, *st, [=](const QString &text) {
|
||||||
Api::SendReport(show, peer, reason, text, data);
|
Api::SendPhotoReport(show, peer, reason, text, photo);
|
||||||
show->hideLayer();
|
show->hideLayer();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -70,7 +63,7 @@ namespace {
|
||||||
object_ptr<Ui::BoxContent> ReportProfilePhotoBox(
|
object_ptr<Ui::BoxContent> ReportProfilePhotoBox(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<PhotoData*> photo) {
|
not_null<PhotoData*> photo) {
|
||||||
return Report(peer, photo, nullptr);
|
return ReportPhoto(peer, photo, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowReportMessageBox(
|
void ShowReportMessageBox(
|
||||||
|
|
Loading…
Add table
Reference in a new issue