Refused adding ugc for created or deleted objects.

This commit is contained in:
VladiMihaylenko 2017-10-27 17:42:05 +03:00 committed by r.kuznetsov
parent 6b8f14df4d
commit 0a278cbf3c
3 changed files with 16 additions and 1 deletions

View file

@ -831,6 +831,7 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
auto const featureStatus = osm::Editor::Instance().GetFeatureStatus(ft.GetID());
ASSERT_NOT_EQUAL(featureStatus, osm::Editor::FeatureStatus::Deleted,
("Deleted features cannot be selected from UI."));
info.SetFeatureStatus(featureStatus);
ASSERT(m_cityFinder, ());
auto const city =

View file

@ -32,6 +32,13 @@ bool Info::ShouldShowAddPlace() const
return m_canEditOrAdd && !(IsFeature() && isPointOrBuilding);
}
bool Info::ShouldShowUGC() const
{
return ftraits::UGC::IsUGCAvailable(m_sortedTypes) &&
(m_featureStatus == osm::Editor::FeatureStatus::Untouched ||
m_featureStatus == osm::Editor::FeatureStatus::Modified);
}
void Info::SetFromFeatureType(FeatureType const & ft)
{
MapObject::SetFromFeatureType(ft);

View file

@ -13,6 +13,7 @@
#include "indexer/feature_data.hpp"
#include "indexer/feature_meta.hpp"
#include "indexer/map_object.hpp"
#include "indexer/osm_editor.hpp"
#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
@ -78,7 +79,7 @@ public:
bool ShouldShowEditPlace() const;
/// UGC
bool ShouldShowUGC() const { return ftraits::UGC::IsUGCAvailable(m_sortedTypes); }
bool ShouldShowUGC() const;
bool CanBeRated() const { return ftraits::UGC::IsRatingAvailable(m_sortedTypes); }
bool CanBeReviewed() const { return ftraits::UGC::IsReviewsAvailable(m_sortedTypes); }
bool CanHaveExtendedReview() const { return ftraits::UGC::IsDetailsAvailable(m_sortedTypes); }
@ -143,6 +144,9 @@ public:
void SetPreviewIsExtended() { m_isPreviewExtended = true; }
bool IsPreviewExtended() const { return m_isPreviewExtended; }
/// Feature status
void SetFeatureStatus(osm::Editor::FeatureStatus const status) { m_featureStatus = status; }
/// Banner
bool HasBanner() const;
std::vector<ads::Banner> GetBanners() const;
@ -259,6 +263,9 @@ private:
/// Sponsored type or None.
SponsoredType m_sponsoredType = SponsoredType::None;
/// Feature status
osm::Editor::FeatureStatus m_featureStatus = osm::Editor::FeatureStatus::Untouched;
/// Sponsored feature urls.
std::string m_sponsoredUrl;
std::string m_sponsoredDescriptionUrl;