Do not store photo.id in file_unique_id.

GitOrigin-RevId: 51a888c863b90f220964444255c46c9ac5e91c2e
This commit is contained in:
levlam 2019-12-23 04:32:02 +03:00
parent 70926d1882
commit 03066d10c9
2 changed files with 10 additions and 7 deletions

View File

@ -92,12 +92,13 @@ struct PhotoRemoteFileLocation {
struct AsKey {
const PhotoRemoteFileLocation &key;
bool is_unique;
template <class StorerT>
void store(StorerT &storer) const;
};
AsKey as_key() const {
return AsKey{*this};
AsKey as_key(bool is_unique) const {
return AsKey{*this, is_unique};
}
bool operator<(const PhotoRemoteFileLocation &other) const {
@ -128,7 +129,7 @@ struct WebRemoteFileLocation {
template <class StorerT>
void store(StorerT &storer) const;
};
AsKey as_key() const {
AsKey as_key(bool /*is_unique*/) const {
return AsKey{*this};
}
@ -159,7 +160,7 @@ struct CommonRemoteFileLocation {
template <class StorerT>
void store(StorerT &storer) const;
};
AsKey as_key() const {
AsKey as_key(bool /*is_unique*/) const {
return AsKey{*this};
}

View File

@ -68,7 +68,9 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) {
template <class StorerT>
void PhotoRemoteFileLocation::AsKey::store(StorerT &storer) const {
using td::store;
store(key.id_, storer);
if (!is_unique) {
store(key.id_, storer);
}
store(key.volume_id_, storer);
store(key.local_id_, storer);
}
@ -207,7 +209,7 @@ void FullRemoteFileLocation::AsKey::store(StorerT &storer) const {
store(key.key_type(), storer);
key.variant_.visit([&](auto &&value) {
using td::store;
store(value.as_key(), storer);
store(value.as_key(false), storer);
});
}
@ -252,7 +254,7 @@ void FullRemoteFileLocation::AsUnique::store(StorerT &storer) const {
store(type, storer);
key.variant_.visit([&](auto &&value) {
using td::store;
store(value.as_key(), storer);
store(value.as_key(true), storer);
});
}