Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hideTags option in user settings #3620

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/entity/UserSettings.ts
Original file line number Diff line number Diff line change
@@ -63,6 +63,9 @@ export class UserSettings {
@Column({ nullable: true })
public watchlistSyncTv?: boolean;

@Column({ nullable: true })
public hideTags?: boolean;

@Column({
type: 'text',
nullable: true,
1 change: 1 addition & 0 deletions server/interfaces/api/userSettingsInterfaces.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ export interface UserSettingsGeneralResponse {
globalTvQuotaDays?: number;
watchlistSyncMovies?: boolean;
watchlistSyncTv?: boolean;
hideTags?: boolean;
}

export type NotificationAgentTypes = Record<NotificationAgentKey, number>;
2 changes: 2 additions & 0 deletions server/lib/settings.ts
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ export interface MainSettings {
tv: Quota;
};
hideAvailable: boolean;
hideTags: boolean;
localLogin: boolean;
newPlexLogin: boolean;
region: string;
@@ -292,6 +293,7 @@ class Settings {
tv: {},
},
hideAvailable: false,
hideTags: false,
localLogin: true,
newPlexLogin: true,
region: '',
4 changes: 4 additions & 0 deletions server/routes/user/usersettings.ts
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ userSettingsRoutes.get<{ id: string }, UserSettingsGeneralResponse>(
globalTvQuotaLimit: defaultQuotas.tv.quotaLimit,
watchlistSyncMovies: user.settings?.watchlistSyncMovies,
watchlistSyncTv: user.settings?.watchlistSyncTv,
hideTags: user.settings?.hideTags,
});
} catch (e) {
next({ status: 500, message: e.message });
@@ -118,6 +119,7 @@ userSettingsRoutes.post<
originalLanguage: req.body.originalLanguage,
watchlistSyncMovies: req.body.watchlistSyncMovies,
watchlistSyncTv: req.body.watchlistSyncTv,
hideTags: req.body.hideTags,
});
} else {
user.settings.discordId = req.body.discordId;
@@ -126,6 +128,7 @@ userSettingsRoutes.post<
user.settings.originalLanguage = req.body.originalLanguage;
user.settings.watchlistSyncMovies = req.body.watchlistSyncMovies;
user.settings.watchlistSyncTv = req.body.watchlistSyncTv;
user.settings.hideTags = req.body.hideTags;
}

await userRepository.save(user);
@@ -138,6 +141,7 @@ userSettingsRoutes.post<
originalLanguage: user.settings.originalLanguage,
watchlistSyncMovies: user.settings.watchlistSyncMovies,
watchlistSyncTv: user.settings.watchlistSyncTv,
hideTags: user.settings.hideTags,
});
} catch (e) {
next({ status: 500, message: e.message });
2 changes: 1 addition & 1 deletion src/components/MovieDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -464,7 +464,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
</div>
</>
)}
{data.keywords.length > 0 && (
{!user?.settings?.hideTags && data.keywords.length > 0 && (
<div className="mt-6">
{data.keywords.map((keyword) => (
<Link
2 changes: 1 addition & 1 deletion src/components/TvDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -503,7 +503,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div>
</>
)}
{data.keywords.length > 0 && (
{!user?.settings?.hideTags && data.keywords.length > 0 && (
<div className="mt-6">
{data.keywords.map((keyword) => (
<Link
Original file line number Diff line number Diff line change
@@ -55,6 +55,8 @@ const messages = defineMessages({
plexwatchlistsyncseries: 'Auto-Request Series',
plexwatchlistsyncseriestip:
'Automatically request series on your <PlexWatchlistSupportLink>Plex Watchlist</PlexWatchlistSupportLink>',
hideTags: 'Hide Tags',
hideTagsTip: 'Hide the tags in a listing detail page',
});

const UserGeneralSettings = () => {
@@ -130,6 +132,7 @@ const UserGeneralSettings = () => {
tvQuotaDays: data?.tvQuotaDays,
watchlistSyncMovies: data?.watchlistSyncMovies,
watchlistSyncTv: data?.watchlistSyncTv,
hideTags: data?.hideTags,
}}
validationSchema={UserGeneralSettingsSchema}
enableReinitialize
@@ -149,6 +152,7 @@ const UserGeneralSettings = () => {
tvQuotaDays: tvQuotaEnabled ? values.tvQuotaDays : null,
watchlistSyncMovies: values.watchlistSyncMovies,
watchlistSyncTv: values.watchlistSyncTv,
hideTags: values.hideTags,
});

if (currentUser?.id === user?.id && setLocale) {
@@ -334,6 +338,24 @@ const UserGeneralSettings = () => {
</div>
</div>
</div>
<div className="form-row">
<label htmlFor="hideTags" className="checkbox-label">
<span>{intl.formatMessage(messages.hideTags)}</span>
<span className="label-tip">
{intl.formatMessage(messages.hideTagsTip)}
</span>
</label>
<div className="form-input-area">
<Field
type="checkbox"
id="hideTags"
name="hideTags"
onChange={() => {
setFieldValue('hideTags', !values.hideTags);
}}
/>
</div>
</div>
{currentHasPermission(Permission.MANAGE_USERS) &&
!hasPermission(Permission.MANAGE_USERS) && (
<>
2 changes: 2 additions & 0 deletions src/i18n/locale/en.json
Original file line number Diff line number Diff line change
@@ -1085,6 +1085,8 @@
"components.UserProfile.UserSettings.UserGeneralSettings.enableOverride": "Override Global Limit",
"components.UserProfile.UserSettings.UserGeneralSettings.general": "General",
"components.UserProfile.UserSettings.UserGeneralSettings.generalsettings": "General Settings",
"components.UserProfile.UserSettings.UserGeneralSettings.hideTags": "Hide Tags",
"components.UserProfile.UserSettings.UserGeneralSettings.hideTagsTip": "Hide the tags in a listing detail page",
"components.UserProfile.UserSettings.UserGeneralSettings.languageDefault": "Default ({language})",
"components.UserProfile.UserSettings.UserGeneralSettings.localuser": "Local User",
"components.UserProfile.UserSettings.UserGeneralSettings.movierequestlimit": "Movie Request Limit",