Extend and cache preprocessed tag information

dev
gravel 2 years ago
parent 26657fc438
commit 9565fd609a
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -86,6 +86,16 @@
"46.101.253.18", "46.101.253.18",
"womanbodybeauty+13f6", "womanbodybeauty+13f6",
"88.212.53.198:4080", "88.212.53.198:4080",
"aiunlimited+fc30",
"AlexMed+e093",
"gore+e5e0",
"internet+70d0",
"k9training+fdcb",
"dogmen+fdcb",
"RU-STEROID+e093",
"thestart+e4b1",
"deutschclub+e4b1",
"cocaine+e4b1",
]; ];
/** /**
@ -96,6 +106,17 @@
"AISFW+fc30", "AISFW+fc30",
]; ];
/**
* These rooms are intended for testing and not for a general userbase.
*/
$TESTING_INCLUDE = [
"fishing+8e2e",
"test+118d",
"test+13f6",
"test+fe93",
"xyz+7908",
];
$SERVER_ICON_MAPPING = [ $SERVER_ICON_MAPPING = [
"open.getsession.org" => "session", "open.getsession.org" => "session",
"sog.caliban.org" => "privacy" "sog.caliban.org" => "privacy"

@ -113,6 +113,7 @@
$details = get_object_vars($this); $details = get_object_vars($this);
unset($details['server']); unset($details['server']);
$details['tags'] = $this->get_raw_tags(); $details['tags'] = $this->get_raw_tags();
$details['tags_custom'] = $this->get_derived_tags();
return $details; return $details;
} }
@ -362,13 +363,10 @@
} }
/** /**
* Return the tags associated with this room. * Return the deroved tags associated with this room.
* @return \CommunityTag[] Tags as string array.
*/ */
function get_room_tags(): array { function get_derived_tags(): array {
global $ROOMS_USED_BY_PROJECT; global $ROOMS_USED_BY_PROJECT, $TESTING_INCLUDE;
$user_tags = CommunityTag::from_user_tags($this->tags, remove_redundant: true);
/** /**
* @var \CommunityTag[] $derived_tags * @var \CommunityTag[] $derived_tags
@ -454,7 +452,25 @@
); );
} }
return [...$derived_tags, ...$user_tags]; if ($this->matched_by_list($TESTING_INCLUDE)) {
$derived_tags[] =
new CommunityTag(
"test",
TagType::RESERVED_TAG,
"This Community is intended for testing only."
);
}
return $derived_tags;
}
/**
* Return the tags associated with this room.
* @return \CommunityTag[] Tags as string array.
*/
function get_room_tags(): array {
$user_tags = CommunityTag::from_user_tags($this->tags, remove_redundant: true);
return [...$this->get_derived_tags(), ...$user_tags];
} }
} }

@ -161,7 +161,8 @@
"not modded", "not modded",
"read-only", "read-only",
"uploads off", "uploads off",
"we're here" "we're here",
"test",
]; ];
private const SHOWCASED_TAGS = ["official", "new", "we're here", "nsfw", "read-only"]; private const SHOWCASED_TAGS = ["official", "new", "we're here", "nsfw", "read-only"];

Loading…
Cancel
Save