Avoid restoring of deleted stories.
This commit is contained in:
parent
ede8911f05
commit
dfeeaf8f87
@ -598,6 +598,9 @@ StoryId StoryManager::on_get_story(DialogId owner_dialog_id,
|
||||
LOG(ERROR) << "Receive " << to_string(story_item);
|
||||
return StoryId();
|
||||
}
|
||||
if (deleted_story_full_ids_.count({owner_dialog_id, story_id}) > 0) {
|
||||
return StoryId();
|
||||
}
|
||||
|
||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||
auto story = get_story_editable(story_full_id);
|
||||
@ -1106,6 +1109,8 @@ void StoryManager::delete_story_on_server(DialogId dialog_id, StoryId story_id,
|
||||
auto new_promise = get_erase_log_event_promise(log_event_id, std::move(promise));
|
||||
promise = std::move(new_promise); // to prevent self-move
|
||||
|
||||
deleted_story_full_ids_.insert({dialog_id, story_id});
|
||||
|
||||
td_->create_handler<DeleteStoriesQuery>(std::move(promise))->send({story_id.get()});
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Promise.h"
|
||||
#include "td/utils/WaitFreeHashMap.h"
|
||||
#include "td/utils/WaitFreeHashSet.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
@ -176,6 +177,8 @@ class StoryManager final : public Actor {
|
||||
|
||||
WaitFreeHashMap<StoryFullId, unique_ptr<Story>, StoryFullIdHash> stories_;
|
||||
|
||||
WaitFreeHashSet<StoryFullId, StoryFullIdHash> deleted_story_full_ids_;
|
||||
|
||||
FlatHashMap<StoryFullId, unique_ptr<BeingEditedStory>, StoryFullIdHash> being_edited_stories_;
|
||||
|
||||
uint32 send_story_count_ = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user