feat: TOC position for publicly shared docs (#7057)

* feat: TOC position for publicly shared docs

* remove preferences object

* comment

* fix: Allow sidebar position preference without public branding switch

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Hemachandar
2024-06-17 02:56:29 +05:30
committed by GitHub
parent 1290aecbc9
commit 3edaf4f8ea
5 changed files with 42 additions and 15 deletions

View File

@@ -1,10 +1,20 @@
import { TeamPreference } from "@shared/types";
import { TOCPosition, TeamPreference } from "@shared/types";
import { Team } from "@server/models";
export default function presentPublicTeam(team: Team) {
export default function presentPublicTeam(
/** The team to present */
team: Team,
/** Whether the branding is public */
isBrandingPublic: boolean
) {
return {
name: team.name,
avatarUrl: team.avatarUrl,
customTheme: team.getPreference(TeamPreference.CustomTheme),
...(isBrandingPublic
? {
name: team.name,
avatarUrl: team.avatarUrl,
customTheme: team.getPreference(TeamPreference.CustomTheme),
}
: {}),
tocPosition: team.getPreference(TeamPreference.TocPosition) as TOCPosition,
};
}