[Expansion] Content Filtering Adjustments (#1910)

* Change default expansion values for ALL to -1 from 0

* Adjust content_filter_criteria

* Refactor content filtering logic

* Allow flag strings to also just be empty instead of null

* Formatting

* Editor oops
This commit is contained in:
Chris Miles
2022-01-02 20:52:29 -06:00
committed by GitHub
parent c0f57bed1f
commit 9815f50efa
23 changed files with 365 additions and 121 deletions
-38
View File
@@ -160,41 +160,3 @@ ZoneRepository::Zone ZoneStore::GetZone(const char *in_zone_name)
return ZoneRepository::Zone();
}
/**
* @return
*/
void ZoneStore::LoadContentFlags()
{
content_service.ReloadContentFlags(database);
}
/**
* Sets the value in the database and proceeds to load content flags into the server context again
*
* @param content_flag_name
* @param enabled
*/
void ZoneStore::SetContentFlag(const std::string &content_flag_name, bool enabled)
{
auto content_flags = ContentFlagsRepository::GetWhere(database,
fmt::format("flag_name = '{}'", content_flag_name)
);
auto content_flag = ContentFlagsRepository::NewEntity();
if (!content_flags.empty()) {
content_flag = content_flags.front();
}
content_flag.enabled = enabled ? 1 : 0;
content_flag.flag_name = content_flag_name;
if (!content_flags.empty()) {
ContentFlagsRepository::UpdateOne(database, content_flag);
}
else {
ContentFlagsRepository::InsertOne(database, content_flag);
}
LoadContentFlags();
}