fix: pr suggestions

feature/watchlist-sync
Ryan Cohen 3 years ago
parent 11991c4131
commit 8e66516650

1
.gitignore vendored

@ -16,7 +16,6 @@
# misc
.DS_Store
*.pem
.eslintcache
# debug
npm-debug.log*

@ -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 {

@ -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';

@ -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.',

@ -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 <PlexWatchlistSupportLink>Plex Watchlist</PlexWatchlistSupportLink>',
plexwatchlistsyncseries: 'Auto-Request Series',
plexwatchlistsyncseriestip:
'Automatically request series on your Plex watchlist',
'Automatically request series on your <PlexWatchlistSupportLink>Plex Watchlist</PlexWatchlistSupportLink>',
});
const UserGeneralSettings = () => {
@ -432,7 +432,18 @@ const UserGeneralSettings = () => {
{intl.formatMessage(messages.plexwatchlistsyncmovies)}
</span>
<span className="label-tip">
{intl.formatMessage(messages.plexwatchlistsyncmoviestip)}
{intl.formatMessage(messages.plexwatchlistsyncmoviestip, {
PlexWatchlistSupportLink: (msg: React.ReactNode) => (
<a
href="https://support.plex.tv/articles/universal-watchlist/"
className="text-white transition duration-300 hover:underline"
target="_blank"
rel="noreferrer"
>
{msg}
</a>
),
})}
</span>
</label>
<div className="form-input-area">
@ -453,31 +464,48 @@ const UserGeneralSettings = () => {
{hasPermission(
[Permission.AUTO_REQUEST, Permission.AUTO_REQUEST_TV],
{ type: 'or' }
) && (
<div className="form-row">
<label htmlFor="watchlistSyncTv" className="checkbox-label">
<span>
{intl.formatMessage(messages.plexwatchlistsyncseries)}
</span>
<span className="label-tip">
{intl.formatMessage(messages.plexwatchlistsyncseriestip)}
</span>
</label>
<div className="form-input-area">
<Field
type="checkbox"
id="watchlistSyncTv"
name="watchlistSyncTv"
onChange={() => {
setFieldValue(
'watchlistSyncTv',
!values.watchlistSyncTv
);
}}
/>
) &&
user?.userType === UserType.PLEX && (
<div className="form-row">
<label htmlFor="watchlistSyncTv" className="checkbox-label">
<span>
{intl.formatMessage(messages.plexwatchlistsyncseries)}
</span>
<span className="label-tip">
{intl.formatMessage(
messages.plexwatchlistsyncseriestip,
{
PlexWatchlistSupportLink: (
msg: React.ReactNode
) => (
<a
href="https://support.plex.tv/articles/universal-watchlist/"
className="text-white transition duration-300 hover:underline"
target="_blank"
rel="noreferrer"
>
{msg}
</a>
),
}
)}
</span>
</label>
<div className="form-input-area">
<Field
type="checkbox"
id="watchlistSyncTv"
name="watchlistSyncTv"
onChange={() => {
setFieldValue(
'watchlistSyncTv',
!values.watchlistSyncTv
);
}}
/>
</div>
</div>
</div>
)}
)}
<div className="actions">
<div className="flex justify-end">
<span className="ml-3 inline-flex rounded-md shadow-sm">

@ -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",

Loading…
Cancel
Save