in apps-rendering/src/client/article.ts [137:187]
function conditionallyRenderFollowTagComponent(
topic: Topic,
followTagStatus: Element | null,
followTag: Element | null,
): void {
const checkBridgetCompatibilty = (
bridgetVersion: Optional<string>,
): boolean =>
bridgetVersion
.map((versionString) => compare(versionString, '2.5.0', '>='))
.withDefault(false);
const isBridgetCompatible = getBridgetVersion().then((version) => {
return checkBridgetCompatibilty(version);
});
const isMyGuardianEnabled = environmentClient.isMyGuardianEnabled();
const tagIsFollowingState = tagClient.isFollowing(topic);
void Promise.all([
isBridgetCompatible,
isMyGuardianEnabled,
tagIsFollowingState,
])
.then(
([
isBridgetCompatible,
isMyGuardianEnabled,
tagIsFollowingState,
]) => {
isBridgetCompatible &&
isMyGuardianEnabled &&
followTagStatus &&
ReactDOM.render(
h(FollowTagStatus, {
isFollowing: tagIsFollowingState,
contributorName: topic.displayName,
}),
followTagStatus,
);
followTag?.addEventListener('click', followTagClick);
followTag?.setAttribute('aria-hidden', 'false');
followTag?.toggleAttribute('disabled', false);
},
)
.catch((error) => {
logger.error(error);
});
}