Removed dcId from passport FileKey.

This commit is contained in:
23rd 2021-08-24 18:36:26 +03:00
parent 559d488b0b
commit b3f8d0e81a
3 changed files with 6 additions and 7 deletions

View file

@ -1745,7 +1745,7 @@ void FormController::loadFile(File &file) {
return;
}
const auto key = FileKey{ file.id, file.dcId };
const auto key = FileKey{ file.id };
const auto i = _fileLoaders.find(key);
if (i != _fileLoaders.end()) {
return;
@ -2466,14 +2466,14 @@ EditFile *FormController::findEditFile(const FullMsgId &fullId) {
EditFile *FormController::findEditFile(const FileKey &key) {
return findEditFileByCondition([&](const EditFile &file) {
return (file.fields.dcId == key.dcId && file.fields.id == key.id);
return (file.fields.id == key.id);
});
}
auto FormController::findFile(const FileKey &key)
-> std::pair<Value*, File*> {
const auto found = [&](const File &file) {
return (file.dcId == key.dcId) && (file.id == key.id);
return (file.id == key.id);
};
for (auto &pair : _form.values) {
auto &value = pair.second;

View file

@ -336,16 +336,15 @@ struct PasswordSettings {
struct FileKey {
uint64 id = 0;
int32 dcId = 0;
inline bool operator==(const FileKey &other) const {
return (id == other.id) && (dcId == other.dcId);
return (id == other.id);
}
inline bool operator!=(const FileKey &other) const {
return !(*this == other);
}
inline bool operator<(const FileKey &other) const {
return (id < other.id) || ((id == other.id) && (dcId < other.dcId));
return (id < other.id);
}
inline bool operator>(const FileKey &other) const {
return (other < *this);

View file

@ -75,7 +75,7 @@ ScanInfo CollectScanInfo(const EditFile &file) {
}();
return {
file.type,
FileKey{ file.fields.id, file.fields.dcId },
FileKey{ file.fields.id },
!file.fields.error.isEmpty() ? file.fields.error : status,
file.fields.image,
file.deleted,