Apply peer restrictions.

This commit is contained in:
John Preston 2019-08-27 21:24:48 +03:00
parent 97a239a8b4
commit 149c69809d

View File

@ -97,28 +97,29 @@ void CheckForSwitchInlineButton(not_null<HistoryItem*> item) {
// We should get a full restriction in "{full}: {reason}" format and we // We should get a full restriction in "{full}: {reason}" format and we
// need to find an "-all" tag in {full}, otherwise ignore this restriction. // need to find an "-all" tag in {full}, otherwise ignore this restriction.
QString ExtractUnavailableReason( QString ExtractUnavailableReason(
const QVector<MTPRestrictionReason> &restriction) { const QVector<MTPRestrictionReason> &restrictions) {
// const auto fullEnd = restriction.indexOf(':'); auto &&texts = ranges::view::all(
// if (fullEnd <= 0) { restrictions
// return QString(); ) | ranges::view::transform([](const MTPRestrictionReason &restriction) {
// } return restriction.match([&](const MTPDrestrictionReason &data) {
// const auto platform = qs(data.vplatform());
// // {full} is in "{type}-{tag}-{tag}-{tag}" format return (false
// // if we find "all" tag we return the restriction string #ifdef OS_MAC_STORE
// const auto typeTags = restriction.mid(0, fullEnd).split('-').mid(1); || (platform == qstr("ios"))
//#ifdef OS_MAC_STORE #elif defined OS_WIN_STORE // OS_MAC_STORE
// const auto restrictionApplies = typeTags.contains(qsl("all")) || (platform == qstr("ms"))
// || typeTags.contains(qsl("ios")); #endif // OS_MAC_STORE || OS_WIN_STORE
//#elif defined OS_WIN_STORE // OS_MAC_STORE || (platform == qstr("all")))
// const auto restrictionApplies = typeTags.contains(qsl("all")) ? std::make_optional(qs(data.vtext()))
// || typeTags.contains(qsl("ms")); : std::nullopt;
//#else });
// const auto restrictionApplies = typeTags.contains(qsl("all")); }) | ranges::view::filter([](const std::optional<QString> &value) {
//#endif // OS_MAC_STORE || OS_WIN_STORE return value.has_value();
// if (restrictionApplies) { }) | ranges::view::transform([](const std::optional<QString> &value) {
// return restriction.midRef(fullEnd + 1).trimmed().toString(); return *value;
// } });
return QString(); const auto begin = texts.begin();
return (begin != texts.end()) ? *begin : nullptr;
} }
MTPPhotoSize FindDocumentInlineThumbnail(const MTPDdocument &data) { MTPPhotoSize FindDocumentInlineThumbnail(const MTPDdocument &data) {