mirror of https://github.com/procxx/kepka.git
Rename restrictionReason to unavailableReason.
This commit is contained in:
parent
d2d6b319b6
commit
0ce4d66601
|
@ -474,10 +474,16 @@ bool UserData::setAbout(const QString &newAbout) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserData::setRestrictionReason(const QString &text) {
|
QString UserData::unavailableReason() const {
|
||||||
if (_restrictionReason != text) {
|
return _unavailableReason;
|
||||||
_restrictionReason = text;
|
}
|
||||||
Notify::peerUpdatedDelayed(this, Notify::PeerUpdate::Flag::RestrictionReasonChanged);
|
|
||||||
|
void UserData::setUnavailableReason(const QString &text) {
|
||||||
|
if (_unavailableReason != text) {
|
||||||
|
_unavailableReason = text;
|
||||||
|
Notify::peerUpdatedDelayed(
|
||||||
|
this,
|
||||||
|
Notify::PeerUpdate::Flag::UnavailableReasonChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,10 +930,16 @@ bool ChannelData::isGroupAdmin(not_null<UserData*> user) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelData::setRestrictionReason(const QString &text) {
|
QString ChannelData::unavailableReason() const {
|
||||||
if (_restrictionReason != text) {
|
return _unavailableReason;
|
||||||
_restrictionReason = text;
|
}
|
||||||
Notify::peerUpdatedDelayed(this, Notify::PeerUpdate::Flag::RestrictionReasonChanged);
|
|
||||||
|
void ChannelData::setUnavailableReason(const QString &text) {
|
||||||
|
if (_unavailableReason != text) {
|
||||||
|
_unavailableReason = text;
|
||||||
|
Notify::peerUpdatedDelayed(
|
||||||
|
this,
|
||||||
|
Notify::PeerUpdate::Flag::UnavailableReasonChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,9 +199,9 @@ public:
|
||||||
|
|
||||||
int nameVersion = 1;
|
int nameVersion = 1;
|
||||||
|
|
||||||
// if this string is not empty we must not allow to open the
|
// If this string is not empty we must not allow to open the
|
||||||
// conversation and we must show this string instead
|
// conversation and we must show this string instead.
|
||||||
virtual QString restrictionReason() const {
|
virtual QString unavailableReason() const {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,10 +467,8 @@ public:
|
||||||
|
|
||||||
std::unique_ptr<BotInfo> botInfo;
|
std::unique_ptr<BotInfo> botInfo;
|
||||||
|
|
||||||
QString restrictionReason() const override {
|
QString unavailableReason() const override;
|
||||||
return _restrictionReason;
|
void setUnavailableReason(const QString &reason);
|
||||||
}
|
|
||||||
void setRestrictionReason(const QString &reason);
|
|
||||||
|
|
||||||
int commonChatsCount() const {
|
int commonChatsCount() const {
|
||||||
return _commonChatsCount;
|
return _commonChatsCount;
|
||||||
|
@ -481,7 +479,7 @@ private:
|
||||||
Flags _flags;
|
Flags _flags;
|
||||||
FullFlags _fullFlags;
|
FullFlags _fullFlags;
|
||||||
|
|
||||||
QString _restrictionReason;
|
QString _unavailableReason;
|
||||||
QString _about;
|
QString _about;
|
||||||
QString _phone;
|
QString _phone;
|
||||||
ContactStatus _contactStatus = ContactStatus::PhoneUnknown;
|
ContactStatus _contactStatus = ContactStatus::PhoneUnknown;
|
||||||
|
@ -991,10 +989,8 @@ public:
|
||||||
return _ptsWaiter.waitingForShortPoll();
|
return _ptsWaiter.waitingForShortPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString restrictionReason() const override {
|
QString unavailableReason() const override;
|
||||||
return _restrictionReason;
|
void setUnavailableReason(const QString &reason);
|
||||||
}
|
|
||||||
void setRestrictionReason(const QString &reason);
|
|
||||||
|
|
||||||
MsgId availableMinId() const {
|
MsgId availableMinId() const {
|
||||||
return _availableMinId;
|
return _availableMinId;
|
||||||
|
@ -1030,7 +1026,7 @@ private:
|
||||||
RestrictionFlags _restrictions;
|
RestrictionFlags _restrictions;
|
||||||
TimeId _restrictedUntill;
|
TimeId _restrictedUntill;
|
||||||
|
|
||||||
QString _restrictionReason;
|
QString _unavailableReason;
|
||||||
QString _about;
|
QString _about;
|
||||||
|
|
||||||
QString _inviteLink;
|
QString _inviteLink;
|
||||||
|
|
|
@ -96,7 +96,7 @@ 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 ExtractRestrictionReason(const QString &restriction) {
|
QString ExtractUnavailableReason(const QString &restriction) {
|
||||||
const auto fullEnd = restriction.indexOf(':');
|
const auto fullEnd = restriction.indexOf(':');
|
||||||
if (fullEnd <= 0) {
|
if (fullEnd <= 0) {
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -278,12 +278,9 @@ not_null<UserData*> Session::user(const MTPUser &data) {
|
||||||
result->input = MTP_inputPeerUser(data.vid, data.vaccess_hash);
|
result->input = MTP_inputPeerUser(data.vid, data.vaccess_hash);
|
||||||
result->inputUser = MTP_inputUser(data.vid, data.vaccess_hash);
|
result->inputUser = MTP_inputUser(data.vid, data.vaccess_hash);
|
||||||
}
|
}
|
||||||
if (data.is_restricted()) {
|
result->setUnavailableReason(data.is_restricted()
|
||||||
result->setRestrictionReason(
|
? ExtractUnavailableReason(qs(data.vrestriction_reason))
|
||||||
ExtractRestrictionReason(qs(data.vrestriction_reason)));
|
: QString());
|
||||||
} else {
|
|
||||||
result->setRestrictionReason(QString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (data.is_deleted()) {
|
if (data.is_deleted()) {
|
||||||
if (!result->phone().isEmpty()) {
|
if (!result->phone().isEmpty()) {
|
||||||
|
@ -554,12 +551,9 @@ not_null<PeerData*> Session::chat(const MTPChat &data) {
|
||||||
if (channel->version < data.vversion.v) {
|
if (channel->version < data.vversion.v) {
|
||||||
channel->version = data.vversion.v;
|
channel->version = data.vversion.v;
|
||||||
}
|
}
|
||||||
if (data.is_restricted()) {
|
channel->setUnavailableReason(data.is_restricted()
|
||||||
channel->setRestrictionReason(
|
? ExtractUnavailableReason(qs(data.vrestriction_reason))
|
||||||
ExtractRestrictionReason(qs(data.vrestriction_reason)));
|
: QString());
|
||||||
} else {
|
|
||||||
channel->setRestrictionReason(QString());
|
|
||||||
}
|
|
||||||
channel->setFlags(data.vflags.v);
|
channel->setFlags(data.vflags.v);
|
||||||
//if (data.has_feed_id()) { // #feed
|
//if (data.has_feed_id()) { // #feed
|
||||||
// channel->setFeed(feed(data.vfeed_id.v));
|
// channel->setFeed(feed(data.vfeed_id.v));
|
||||||
|
|
|
@ -406,7 +406,7 @@ HistoryWidget::HistoryWidget(
|
||||||
| UpdateFlag::UnreadMentionsChanged
|
| UpdateFlag::UnreadMentionsChanged
|
||||||
| UpdateFlag::UnreadViewChanged
|
| UpdateFlag::UnreadViewChanged
|
||||||
| UpdateFlag::MigrationChanged
|
| UpdateFlag::MigrationChanged
|
||||||
| UpdateFlag::RestrictionReasonChanged
|
| UpdateFlag::UnavailableReasonChanged
|
||||||
| UpdateFlag::PinnedMessageChanged
|
| UpdateFlag::PinnedMessageChanged
|
||||||
| UpdateFlag::UserIsBlocked
|
| UpdateFlag::UserIsBlocked
|
||||||
| UpdateFlag::AdminsChanged
|
| UpdateFlag::AdminsChanged
|
||||||
|
@ -436,11 +436,11 @@ HistoryWidget::HistoryWidget(
|
||||||
if (update.flags & UpdateFlag::NotificationsEnabled) {
|
if (update.flags & UpdateFlag::NotificationsEnabled) {
|
||||||
updateNotifyControls();
|
updateNotifyControls();
|
||||||
}
|
}
|
||||||
if (update.flags & UpdateFlag::RestrictionReasonChanged) {
|
if (update.flags & UpdateFlag::UnavailableReasonChanged) {
|
||||||
auto restriction = _peer->restrictionReason();
|
const auto unavailable = _peer->unavailableReason();
|
||||||
if (!restriction.isEmpty()) {
|
if (!unavailable.isEmpty()) {
|
||||||
this->controller()->showBackFromStack();
|
this->controller()->showBackFromStack();
|
||||||
Ui::show(Box<InformBox>(restriction));
|
Ui::show(Box<InformBox>(unavailable));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1593,10 +1593,10 @@ void MainWidget::ui_showPeerHistory(
|
||||||
peerId = peer->id;
|
peerId = peer->id;
|
||||||
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
||||||
}
|
}
|
||||||
auto restriction = peer->restrictionReason();
|
const auto unavailable = peer->unavailableReason();
|
||||||
if (!restriction.isEmpty()) {
|
if (!unavailable.isEmpty()) {
|
||||||
if (params.activation != anim::activation::background) {
|
if (params.activation != anim::activation::background) {
|
||||||
Ui::show(Box<InformBox>(restriction));
|
Ui::show(Box<InformBox>(unavailable));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct PeerUpdate {
|
||||||
NotificationsEnabled = (1 << 4),
|
NotificationsEnabled = (1 << 4),
|
||||||
MigrationChanged = (1 << 6),
|
MigrationChanged = (1 << 6),
|
||||||
ChatPinnedChanged = (1 << 7),
|
ChatPinnedChanged = (1 << 7),
|
||||||
RestrictionReasonChanged = (1 << 8),
|
UnavailableReasonChanged = (1 << 8),
|
||||||
UnreadViewChanged = (1 << 9),
|
UnreadViewChanged = (1 << 9),
|
||||||
PinnedMessageChanged = (1 << 10),
|
PinnedMessageChanged = (1 << 10),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue