[bookmarks] Compilation inherit author and access rules from parent category. MAPSME-15206

This commit is contained in:
Anatoliy Tomilov 2020-11-03 15:40:02 +05:00 committed by Arsentiy Milchakov
parent 81feae83b4
commit e5dd159372

View file

@ -2992,12 +2992,6 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
group->SetFileName(fileName);
group->SetServerId(fileData.m_serverId);
for (auto const & [compilationId, compilation] : compilations)
{
UNUSED_VALUE(compilationId);
compilation->SetParentId(groupId);
}
// Restore sensitive info from the cache.
auto const cacheIt = m_restoringCache.find(fileName);
if (cacheIt != m_restoringCache.end() &&
@ -3009,6 +3003,15 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
group->EnableAutoSave(autoSave);
}
for (auto const & [compilationId, compilation] : compilations)
{
UNUSED_VALUE(compilationId);
compilation->SetParentId(groupId);
auto const & categoryData = group->GetCategoryData();
compilation->SetAccessRules(categoryData.m_accessRules);
compilation->SetAuthor(categoryData.m_authorName, categoryData.m_authorId);
}
for (auto & bmData : fileData.m_bookmarksData)
{
auto const compilationIds = bmData.m_compilations;
@ -3018,7 +3021,7 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
for (auto const c : compilationIds)
{
auto const it = compilations.find(c);
if (it == compilations.cend())
if (it == compilations.end())
{
LOG(LERROR, ("Incorrect compilation id", c, "into", fileName));
continue;