From 8e6651665056c9a2db58003d6ab3871915fd8520 Mon Sep 17 00:00:00 2001 From: Ryan Cohen Date: Fri, 19 Aug 2022 13:57:02 +0900 Subject: [PATCH] fix: pr suggestions --- .gitignore | 1 - server/routes/discover.ts | 2 +- server/scripts/prepareTestDb.ts | 8 +- src/components/PermissionEdit/index.tsx | 6 +- .../UserGeneralSettings/index.tsx | 82 +++++++++++++------ src/i18n/locale/en.json | 2 - 6 files changed, 65 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index f72b67cc9..4f7c3ce6c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ # misc .DS_Store *.pem -.eslintcache # debug npm-debug.log* diff --git a/server/routes/discover.ts b/server/routes/discover.ts index a0546cb32..d12a9e971 100644 --- a/server/routes/discover.ts +++ b/server/routes/discover.ts @@ -1,9 +1,9 @@ import { Router } from 'express'; import { sortBy } from 'lodash'; -import { getRepository } from 'typeorm'; import PlexTvAPI from '../api/plextv'; import TheMovieDb from '../api/themoviedb'; import { MediaType } from '../constants/media'; +import { getRepository } from '../datasource'; import Media from '../entity/Media'; import { User } from '../entity/User'; import type { diff --git a/server/scripts/prepareTestDb.ts b/server/scripts/prepareTestDb.ts index 371805130..41cfc46ad 100644 --- a/server/scripts/prepareTestDb.ts +++ b/server/scripts/prepareTestDb.ts @@ -14,7 +14,9 @@ const prepareDb = async () => { // Connect to DB and seed test data const dbConnection = await dataSource.initialize(); - await dbConnection.dropDatabase(); + if (process.env.PRESERVE_DB !== 'true') { + await dbConnection.dropDatabase(); + } // Run migrations in production if (process.env.WITH_MIGRATIONS === 'true') { @@ -41,9 +43,11 @@ const prepareDb = async () => { // Create the other user const otherUser = new User(); otherUser.plexId = 1; + otherUser.plexToken = '1234'; + otherUser.plexUsername = 'friend'; otherUser.username = 'friend'; otherUser.email = 'friend@seerr.dev'; - otherUser.userType = UserType.LOCAL; + otherUser.userType = UserType.PLEX; await otherUser.setPassword('test1234'); otherUser.permissions = 32; otherUser.avatar = 'https://plex.tv/assets/images/avatar/default.png'; diff --git a/src/components/PermissionEdit/index.tsx b/src/components/PermissionEdit/index.tsx index 3f70771a7..4e77a13f8 100644 --- a/src/components/PermissionEdit/index.tsx +++ b/src/components/PermissionEdit/index.tsx @@ -52,13 +52,13 @@ export const messages = defineMessages({ 'Grant permission to modify advanced media request options.', autorequest: 'Auto-Request', autorequestDescription: - 'Grant permission to use Plex Watchlist Sync to automatically request media.', + 'Grant permission to automatically submit requests for non-4K media via Plex Watchlist.', autorequestMovies: 'Auto-Request Movies', autorequestMoviesDescription: - 'Grant permission to use Plex Watchlist Sync to automatically request movies.', + 'Grant permission to automatically submit requests for non-4K movies via Plex Watchlist.', autorequestSeries: 'Auto-Request Series', autorequestSeriesDescription: - 'Grant permission to use Plex Watchlist Sync to automatically request series.', + 'Grant permission to automatically submit requests for non-4K series via Plex Watchlist.', viewrequests: 'View Requests', viewrequestsDescription: 'Grant permission to view media requests submitted by other users.', diff --git a/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx b/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx index cccff3541..db963c8ec 100644 --- a/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx +++ b/src/components/UserProfile/UserSettings/UserGeneralSettings/index.tsx @@ -51,10 +51,10 @@ const messages = defineMessages({ validationDiscordId: 'You must provide a valid Discord user ID', plexwatchlistsyncmovies: 'Auto-Request Movies', plexwatchlistsyncmoviestip: - 'Automatically request movies on your Plex watchlist', + 'Automatically request movies on your Plex Watchlist', plexwatchlistsyncseries: 'Auto-Request Series', plexwatchlistsyncseriestip: - 'Automatically request series on your Plex watchlist', + 'Automatically request series on your Plex Watchlist', }); const UserGeneralSettings = () => { @@ -432,7 +432,18 @@ const UserGeneralSettings = () => { {intl.formatMessage(messages.plexwatchlistsyncmovies)} - {intl.formatMessage(messages.plexwatchlistsyncmoviestip)} + {intl.formatMessage(messages.plexwatchlistsyncmoviestip, { + PlexWatchlistSupportLink: (msg: React.ReactNode) => ( + + {msg} + + ), + })}
@@ -453,31 +464,48 @@ const UserGeneralSettings = () => { {hasPermission( [Permission.AUTO_REQUEST, Permission.AUTO_REQUEST_TV], { type: 'or' } - ) && ( -
- -
- { - setFieldValue( - 'watchlistSyncTv', - !values.watchlistSyncTv - ); - }} - /> + ) && + user?.userType === UserType.PLEX && ( +
+ +
+ { + setFieldValue( + 'watchlistSyncTv', + !values.watchlistSyncTv + ); + }} + /> +
-
- )} + )}
diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index 973e60329..88bbca2e9 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -930,9 +930,7 @@ "components.UserProfile.UserSettings.UserGeneralSettings.owner": "Owner", "components.UserProfile.UserSettings.UserGeneralSettings.plexuser": "Plex User", "components.UserProfile.UserSettings.UserGeneralSettings.plexwatchlistsyncmovies": "Auto-Request Movies", - "components.UserProfile.UserSettings.UserGeneralSettings.plexwatchlistsyncmoviestip": "Automatically request movies on your Plex watchlist", "components.UserProfile.UserSettings.UserGeneralSettings.plexwatchlistsyncseries": "Auto-Request Series", - "components.UserProfile.UserSettings.UserGeneralSettings.plexwatchlistsyncseriestip": "Automatically request series on your Plex watchlist", "components.UserProfile.UserSettings.UserGeneralSettings.region": "Discover Region", "components.UserProfile.UserSettings.UserGeneralSettings.regionTip": "Filter content by regional availability", "components.UserProfile.UserSettings.UserGeneralSettings.role": "Role",