SL-16063 FIXED The favorite landmark does not change after editing from another machine

master
Mnikolenko Productengine 2021-09-24 15:28:25 +03:00
parent 1c3d2876ac
commit f3a43c74f9
2 changed files with 32 additions and 6 deletions

View File

@ -763,6 +763,14 @@ void LLFavoritesBarCtrl::updateButtons()
}
LLFavoritesOrderStorage::instance().mPrevFavorites = mItems;
mGetPrevItems = false;
if (LLFavoritesOrderStorage::instance().isStorageUpdateNeeded())
{
if (!mItemsChangedTimer.getStarted())
{
mItemsChangedTimer.start();
}
}
}
const LLButton::Params& button_params = getButtonParams();
@ -1640,7 +1648,6 @@ void LLFavoritesOrderStorage::load()
llifstream in_file;
in_file.open(filename.c_str());
LLSD fav_llsd;
LLSD user_llsd;
if (in_file.is_open())
{
LLSDSerialize::fromXML(fav_llsd, in_file);
@ -1650,12 +1657,12 @@ void LLFavoritesOrderStorage::load()
in_file.close();
if (fav_llsd.isMap() && fav_llsd.has(gAgentUsername))
{
user_llsd = fav_llsd[gAgentUsername];
mStorageFavorites = fav_llsd[gAgentUsername];
S32 index = 0;
bool needs_validation = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
for (LLSD::array_iterator iter = user_llsd.beginArray();
iter != user_llsd.endArray(); ++iter)
for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
iter != mStorageFavorites.endArray(); ++iter)
{
// Validation
LLUUID fv_id = iter->get("id").asUUID();
@ -2040,6 +2047,23 @@ void LLFavoritesOrderStorage::showFavoritesOnLoginChanged(BOOL show)
}
}
bool LLFavoritesOrderStorage::isStorageUpdateNeeded()
{
if (!mRecreateFavoriteStorage)
{
for (LLSD::array_iterator iter = mStorageFavorites.beginArray();
iter != mStorageFavorites.endArray(); ++iter)
{
if (mFavoriteNames[iter->get("id").asUUID()] != iter->get("name").asString())
{
mRecreateFavoriteStorage = true;
return true;
}
}
}
return false;
}
void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id)
{
if (mTargetLandmarkId.isNull()) return;

View File

@ -226,8 +226,11 @@ public:
BOOL saveFavoritesRecord(bool pref_changed = false);
void showFavoritesOnLoginChanged(BOOL show);
LLInventoryModel::item_array_t mPrevFavorites;
bool isStorageUpdateNeeded();
LLInventoryModel::item_array_t mPrevFavorites;
LLSD mStorageFavorites;
bool mRecreateFavoriteStorage;
const static S32 NO_INDEX;
static bool mSaveOnExit;
@ -254,7 +257,6 @@ private:
slurls_map_t mSLURLs;
std::set<LLUUID> mMissingSLURLs;
bool mIsDirty;
bool mRecreateFavoriteStorage;
struct IsNotInFavorites
{