mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Rename Story::pinned to Story::inProfile.
This commit is contained in:
@@ -340,7 +340,7 @@ void Stories::clearArchive(not_null<PeerData*> peer) {
|
||||
_archive.erase(i);
|
||||
for (const auto &id : archive.ids.list) {
|
||||
if (const auto story = lookup({ peerId, id })) {
|
||||
if ((*story)->expired() && !(*story)->pinned()) {
|
||||
if ((*story)->expired() && !(*story)->inProfile()) {
|
||||
applyDeleted(peer, id);
|
||||
}
|
||||
}
|
||||
@@ -558,8 +558,8 @@ void Stories::unregisterDependentMessage(
|
||||
void Stories::savedStateChanged(not_null<Story*> story) {
|
||||
const auto id = story->id();
|
||||
const auto peer = story->peer()->id;
|
||||
const auto pinned = story->pinned();
|
||||
if (pinned) {
|
||||
const auto inProfile = story->inProfile();
|
||||
if (inProfile) {
|
||||
auto &saved = _saved[peer];
|
||||
const auto added = saved.ids.list.emplace(id).second;
|
||||
if (added) {
|
||||
@@ -794,7 +794,7 @@ void Stories::applyDeleted(not_null<PeerData*> peer, StoryId id) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (story->pinned()) {
|
||||
if (story->inProfile()) {
|
||||
if (const auto k = _saved.find(peerId); k != end(_saved)) {
|
||||
const auto saved = &k->second;
|
||||
if (saved->ids.list.remove(id)) {
|
||||
@@ -832,7 +832,7 @@ void Stories::applyDeleted(not_null<PeerData*> peer, StoryId id) {
|
||||
void Stories::applyExpired(FullStoryId id) {
|
||||
if (const auto maybeStory = lookup(id)) {
|
||||
const auto story = *maybeStory;
|
||||
if (!hasArchive(story->peer()) && !story->pinned()) {
|
||||
if (!hasArchive(story->peer()) && !story->inProfile()) {
|
||||
applyDeleted(story->peer(), id.story);
|
||||
return;
|
||||
}
|
||||
@@ -1099,7 +1099,7 @@ void Stories::markAsRead(FullStoryId id, bool viewed) {
|
||||
return;
|
||||
}
|
||||
const auto story = *maybeStory;
|
||||
if (story->expired() && story->pinned()) {
|
||||
if (story->expired() && story->inProfile()) {
|
||||
_incrementViewsPending[id.peer].emplace(id.story);
|
||||
if (!_incrementViewsTimer.isActive()) {
|
||||
_incrementViewsTimer.callOnce(kIncrementViewsDelay);
|
||||
@@ -1724,9 +1724,9 @@ void Stories::deleteList(const std::vector<FullStoryId> &ids) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
void Stories::togglePinnedList(
|
||||
void Stories::toggleInProfileList(
|
||||
const std::vector<FullStoryId> &ids,
|
||||
bool pinned) {
|
||||
bool inProfile) {
|
||||
if (ids.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1745,7 +1745,7 @@ void Stories::togglePinnedList(
|
||||
api->request(MTPstories_TogglePinned(
|
||||
peer->input,
|
||||
MTP_vector<MTPint>(list),
|
||||
MTP_bool(pinned)
|
||||
MTP_bool(inProfile)
|
||||
)).done([=](const MTPVector<MTPint> &result) {
|
||||
const auto peerId = peer->id;
|
||||
auto &saved = _saved[peerId];
|
||||
@@ -1759,8 +1759,8 @@ void Stories::togglePinnedList(
|
||||
for (const auto &id : result.v) {
|
||||
if (const auto maybeStory = lookup({ peerId, id.v })) {
|
||||
const auto story = *maybeStory;
|
||||
story->setPinned(pinned);
|
||||
if (pinned) {
|
||||
story->setInProfile(inProfile);
|
||||
if (inProfile) {
|
||||
const auto add = loaded || (id.v >= lastId);
|
||||
if (!add) {
|
||||
dirty = true;
|
||||
|
@@ -131,7 +131,7 @@ public:
|
||||
explicit Stories(not_null<Session*> owner);
|
||||
~Stories();
|
||||
|
||||
static constexpr auto kPinnedToastDuration = 4 * crl::time(1000);
|
||||
static constexpr auto kInProfileToastDuration = 4 * crl::time(1000);
|
||||
|
||||
[[nodiscard]] Session &owner() const;
|
||||
[[nodiscard]] Main::Session &session() const;
|
||||
@@ -205,7 +205,9 @@ public:
|
||||
void savedLoadMore(PeerId peerId);
|
||||
|
||||
void deleteList(const std::vector<FullStoryId> &ids);
|
||||
void togglePinnedList(const std::vector<FullStoryId> &ids, bool pinned);
|
||||
void toggleInProfileList(
|
||||
const std::vector<FullStoryId> &ids,
|
||||
bool inProfile);
|
||||
void report(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
FullStoryId id,
|
||||
|
@@ -389,12 +389,12 @@ TextWithEntities Story::inReplyText() const {
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
|
||||
void Story::setPinned(bool pinned) {
|
||||
_pinned = pinned;
|
||||
void Story::setInProfile(bool value) {
|
||||
_inProfile = value;
|
||||
}
|
||||
|
||||
bool Story::pinned() const {
|
||||
return _pinned;
|
||||
bool Story::inProfile() const {
|
||||
return _inProfile;
|
||||
}
|
||||
|
||||
StoryPrivacy Story::privacy() const {
|
||||
@@ -431,7 +431,9 @@ bool Story::canDownloadChecked() const {
|
||||
}
|
||||
|
||||
bool Story::canShare() const {
|
||||
return _privacyPublic && !forbidsForward() && (pinned() || !expired());
|
||||
return _privacyPublic
|
||||
&& !forbidsForward()
|
||||
&& (inProfile() || !expired());
|
||||
}
|
||||
|
||||
bool Story::canDelete() const {
|
||||
@@ -447,7 +449,7 @@ bool Story::canReport() const {
|
||||
}
|
||||
|
||||
bool Story::hasDirectLink() const {
|
||||
if (!_privacyPublic || (!_pinned && expired())) {
|
||||
if (!_privacyPublic || (!_inProfile && expired())) {
|
||||
return false;
|
||||
}
|
||||
return !_peer->username().isEmpty();
|
||||
@@ -707,7 +709,7 @@ void Story::applyFields(
|
||||
: data.vsent_reaction()
|
||||
? Data::ReactionFromMTP(*data.vsent_reaction())
|
||||
: Data::ReactionId();
|
||||
const auto pinned = data.is_pinned();
|
||||
const auto inProfile = data.is_pinned();
|
||||
const auto edited = data.is_edited();
|
||||
const auto privacy = data.is_public()
|
||||
? StoryPrivacy::Public
|
||||
@@ -767,7 +769,7 @@ void Story::applyFields(
|
||||
}
|
||||
}
|
||||
|
||||
const auto pinnedChanged = (_pinned != pinned);
|
||||
const auto inProfileChanged = (_inProfile != inProfile);
|
||||
const auto editedChanged = (_edited != edited);
|
||||
const auto mediaChanged = (_media != media);
|
||||
const auto captionChanged = (_caption != caption);
|
||||
@@ -783,7 +785,7 @@ void Story::applyFields(
|
||||
_privacyContacts = (privacy == StoryPrivacy::Contacts);
|
||||
_privacySelectedContacts = (privacy == StoryPrivacy::SelectedContacts);
|
||||
_edited = edited;
|
||||
_pinned = pinned;
|
||||
_inProfile = inProfile;
|
||||
_noForwards = noForwards;
|
||||
if (mediaChanged) {
|
||||
_media = std::move(media);
|
||||
@@ -823,7 +825,7 @@ void Story::applyFields(
|
||||
}
|
||||
_peer->owner().refreshStoryItemViews(fullId());
|
||||
}
|
||||
if (pinnedChanged) {
|
||||
if (inProfileChanged) {
|
||||
_peer->owner().stories().savedStateChanged(this);
|
||||
}
|
||||
}
|
||||
|
@@ -153,8 +153,8 @@ public:
|
||||
[[nodiscard]] Image *replyPreview() const;
|
||||
[[nodiscard]] TextWithEntities inReplyText() const;
|
||||
|
||||
void setPinned(bool pinned);
|
||||
[[nodiscard]] bool pinned() const;
|
||||
void setInProfile(bool value);
|
||||
[[nodiscard]] bool inProfile() const;
|
||||
[[nodiscard]] StoryPrivacy privacy() const;
|
||||
[[nodiscard]] bool forbidsForward() const;
|
||||
[[nodiscard]] bool edited() const;
|
||||
@@ -250,7 +250,7 @@ private:
|
||||
const TimeId _expires = 0;
|
||||
TimeId _lastUpdateTime = 0;
|
||||
bool _out : 1 = false;
|
||||
bool _pinned : 1 = false;
|
||||
bool _inProfile : 1 = false;
|
||||
bool _privacyPublic : 1 = false;
|
||||
bool _privacyCloseFriends : 1 = false;
|
||||
bool _privacyContacts : 1 = false;
|
||||
|
Reference in New Issue
Block a user