New: Renamed Blacklist to Blocklist

(cherry picked from commit ead1371846b1f19cd49928052be0128bf7ccd41f)
pull/1268/head
Robin Dadswell 3 years ago committed by Qstick
parent 07829a19b8
commit 89319f9833

@ -19,9 +19,9 @@ import getSelectedIds from 'Utilities/Table/getSelectedIds';
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
import selectAll from 'Utilities/Table/selectAll';
import toggleSelected from 'Utilities/Table/toggleSelected';
import BlacklistRowConnector from './BlacklistRowConnector';
import BlocklistRowConnector from './BlocklistRowConnector';
class Blacklist extends Component {
class Blocklist extends Component {
//
// Lifecycle
@ -103,8 +103,8 @@ class Blacklist extends Component {
columns,
totalRecords,
isRemoving,
isClearingBlacklistExecuting,
onClearBlacklistPress,
isClearingBlocklistExecuting,
onClearBlocklistPress,
...otherProps
} = this.props;
@ -121,7 +121,7 @@ class Blacklist extends Component {
const selectedIds = this.getSelectedIds();
return (
<PageContent title={translate('Blacklist')}>
<PageContent title={translate('Blocklist')}>
<PageToolbar>
<PageToolbarSection>
<PageToolbarButton
@ -135,8 +135,8 @@ class Blacklist extends Component {
<PageToolbarButton
label={translate('Clear')}
iconName={icons.CLEAR}
isSpinning={isClearingBlacklistExecuting}
onPress={onClearBlacklistPress}
isSpinning={isClearingBlocklistExecuting}
onPress={onClearBlocklistPress}
/>
</PageToolbarSection>
@ -162,14 +162,14 @@ class Blacklist extends Component {
{
!isAnyFetching && !!error &&
<div>
{translate('UnableToLoadBlacklist')}
{translate('UnableToLoadBlocklist')}
</div>
}
{
isAllPopulated && !error && !items.length &&
<div>
No history blacklist
{translate('NoHistoryBlocklist')}
</div>
}
@ -188,7 +188,7 @@ class Blacklist extends Component {
{
items.map((item) => {
return (
<BlacklistRowConnector
<BlocklistRowConnector
key={item.id}
isSelected={selectedState[item.id] || false}
columns={columns}
@ -224,7 +224,7 @@ class Blacklist extends Component {
}
}
Blacklist.propTypes = {
Blocklist.propTypes = {
isAuthorFetching: PropTypes.bool.isRequired,
isAuthorPopulated: PropTypes.bool.isRequired,
isFetching: PropTypes.bool.isRequired,
@ -234,9 +234,9 @@ Blacklist.propTypes = {
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
totalRecords: PropTypes.number,
isRemoving: PropTypes.bool.isRequired,
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
onRemoveSelected: PropTypes.func.isRequired,
onClearBlacklistPress: PropTypes.func.isRequired
onClearBlocklistPress: PropTypes.func.isRequired
};
export default Blacklist;
export default Blocklist;

@ -4,34 +4,34 @@ import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import * as commandNames from 'Commands/commandNames';
import withCurrentPage from 'Components/withCurrentPage';
import * as blacklistActions from 'Store/Actions/blacklistActions';
import * as blocklistActions from 'Store/Actions/blocklistActions';
import { executeCommand } from 'Store/Actions/commandActions';
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
import Blacklist from './Blacklist';
import Blocklist from './Blocklist';
function createMapStateToProps() {
return createSelector(
(state) => state.blacklist,
(state) => state.blocklist,
(state) => state.authors,
createCommandExecutingSelector(commandNames.CLEAR_BLACKLIST),
(blacklist, authors, isClearingBlacklistExecuting) => {
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST),
(blocklist, authors, isClearingBlocklistExecuting) => {
return {
isAuthorFetching: authors.isFetching,
isAuthorPopulated: authors.isPopulated,
isClearingBlacklistExecuting,
...blacklist
isClearingBlocklistExecuting,
...blocklist
};
}
);
}
const mapDispatchToProps = {
...blacklistActions,
...blocklistActions,
executeCommand
};
class BlacklistConnector extends Component {
class BlocklistConnector extends Component {
//
// Lifecycle
@ -39,27 +39,27 @@ class BlacklistConnector extends Component {
componentDidMount() {
const {
useCurrentPage,
fetchBlacklist,
gotoBlacklistFirstPage
fetchBlocklist,
gotoBlocklistFirstPage
} = this.props;
registerPagePopulator(this.repopulate);
if (useCurrentPage) {
fetchBlacklist();
fetchBlocklist();
} else {
gotoBlacklistFirstPage();
gotoBlocklistFirstPage();
}
}
componentDidUpdate(prevProps) {
if (prevProps.isClearingBlacklistExecuting && !this.props.isClearingBlacklistExecuting) {
this.props.gotoBlacklistFirstPage();
if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) {
this.props.gotoBlocklistFirstPage();
}
}
componentWillUnmount() {
this.props.clearBlacklist();
this.props.clearBlocklist();
unregisterPagePopulator(this.repopulate);
}
@ -67,49 +67,49 @@ class BlacklistConnector extends Component {
// Control
repopulate = () => {
this.props.fetchBlacklist();
this.props.fetchBlocklist();
}
//
// Listeners
onFirstPagePress = () => {
this.props.gotoBlacklistFirstPage();
this.props.gotoBlocklistFirstPage();
}
onPreviousPagePress = () => {
this.props.gotoBlacklistPreviousPage();
this.props.gotoBlocklistPreviousPage();
}
onNextPagePress = () => {
this.props.gotoBlacklistNextPage();
this.props.gotoBlocklistNextPage();
}
onLastPagePress = () => {
this.props.gotoBlacklistLastPage();
this.props.gotoBlocklistLastPage();
}
onPageSelect = (page) => {
this.props.gotoBlacklistPage({ page });
this.props.gotoBlocklistPage({ page });
}
onRemoveSelected = (ids) => {
this.props.removeBlacklistItems({ ids });
this.props.removeBlocklistItems({ ids });
}
onSortPress = (sortKey) => {
this.props.setBlacklistSort({ sortKey });
this.props.setBlocklistSort({ sortKey });
}
onTableOptionChange = (payload) => {
this.props.setBlacklistTableOption(payload);
this.props.setBlocklistTableOption(payload);
if (payload.pageSize) {
this.props.gotoBlacklistFirstPage();
this.props.gotoBlocklistFirstPage();
}
}
onClearBlacklistPress = () => {
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
onClearBlocklistPress = () => {
this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST });
}
//
@ -117,7 +117,7 @@ class BlacklistConnector extends Component {
render() {
return (
<Blacklist
<Blocklist
onFirstPagePress={this.onFirstPagePress}
onPreviousPagePress={this.onPreviousPagePress}
onNextPagePress={this.onNextPagePress}
@ -126,30 +126,30 @@ class BlacklistConnector extends Component {
onRemoveSelected={this.onRemoveSelected}
onSortPress={this.onSortPress}
onTableOptionChange={this.onTableOptionChange}
onClearBlacklistPress={this.onClearBlacklistPress}
onClearBlocklistPress={this.onClearBlocklistPress}
{...this.props}
/>
);
}
}
BlacklistConnector.propTypes = {
BlocklistConnector.propTypes = {
useCurrentPage: PropTypes.bool.isRequired,
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
fetchBlacklist: PropTypes.func.isRequired,
gotoBlacklistFirstPage: PropTypes.func.isRequired,
gotoBlacklistPreviousPage: PropTypes.func.isRequired,
gotoBlacklistNextPage: PropTypes.func.isRequired,
gotoBlacklistLastPage: PropTypes.func.isRequired,
gotoBlacklistPage: PropTypes.func.isRequired,
removeBlacklistItems: PropTypes.func.isRequired,
setBlacklistSort: PropTypes.func.isRequired,
setBlacklistTableOption: PropTypes.func.isRequired,
clearBlacklist: PropTypes.func.isRequired,
fetchBlocklist: PropTypes.func.isRequired,
gotoBlocklistFirstPage: PropTypes.func.isRequired,
gotoBlocklistPreviousPage: PropTypes.func.isRequired,
gotoBlocklistNextPage: PropTypes.func.isRequired,
gotoBlocklistLastPage: PropTypes.func.isRequired,
gotoBlocklistPage: PropTypes.func.isRequired,
removeBlocklistItems: PropTypes.func.isRequired,
setBlocklistSort: PropTypes.func.isRequired,
setBlocklistTableOption: PropTypes.func.isRequired,
clearBlocklist: PropTypes.func.isRequired,
executeCommand: PropTypes.func.isRequired
};
export default withCurrentPage(
connect(createMapStateToProps, mapDispatchToProps)(BlacklistConnector)
connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector)
);

@ -10,7 +10,7 @@ import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import translate from 'Utilities/String/translate';
class BlacklistDetailsModal extends Component {
class BlocklistDetailsModal extends Component {
//
// Render
@ -78,7 +78,7 @@ class BlacklistDetailsModal extends Component {
}
}
BlacklistDetailsModal.propTypes = {
BlocklistDetailsModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
sourceTitle: PropTypes.string.isRequired,
protocol: PropTypes.string.isRequired,
@ -87,4 +87,4 @@ BlacklistDetailsModal.propTypes = {
onModalClose: PropTypes.func.isRequired
};
export default BlacklistDetailsModal;
export default BlocklistDetailsModal;

@ -9,10 +9,10 @@ import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
import TableRow from 'Components/Table/TableRow';
import { icons, kinds } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import BlacklistDetailsModal from './BlacklistDetailsModal';
import styles from './BlacklistRow.css';
import BlocklistDetailsModal from './BlocklistDetailsModal';
import styles from './BlocklistRow.css';
class BlacklistRow extends Component {
class BlocklistRow extends Component {
//
// Lifecycle
@ -142,7 +142,7 @@ class BlacklistRow extends Component {
/>
<IconButton
title={translate('RemoveFromBlacklist')}
title={translate('RemoveFromBlocklist')}
name={icons.REMOVE}
kind={kinds.DANGER}
onPress={onRemovePress}
@ -155,7 +155,7 @@ class BlacklistRow extends Component {
})
}
<BlacklistDetailsModal
<BlocklistDetailsModal
isOpen={this.state.isDetailsModalOpen}
sourceTitle={sourceTitle}
protocol={protocol}
@ -169,7 +169,7 @@ class BlacklistRow extends Component {
}
BlacklistRow.propTypes = {
BlocklistRow.propTypes = {
id: PropTypes.number.isRequired,
author: PropTypes.object.isRequired,
sourceTitle: PropTypes.string.isRequired,
@ -184,4 +184,4 @@ BlacklistRow.propTypes = {
onRemovePress: PropTypes.func.isRequired
};
export default BlacklistRow;
export default BlocklistRow;

@ -1,8 +1,8 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { removeBlacklistItem } from 'Store/Actions/blacklistActions';
import { removeBlocklistItem } from 'Store/Actions/blocklistActions';
import createAuthorSelector from 'Store/Selectors/createAuthorSelector';
import BlacklistRow from './BlacklistRow';
import BlocklistRow from './BlocklistRow';
function createMapStateToProps() {
return createSelector(
@ -18,9 +18,9 @@ function createMapStateToProps() {
function createMapDispatchToProps(dispatch, props) {
return {
onRemovePress() {
dispatch(removeBlacklistItem({ id: props.id }));
dispatch(removeBlocklistItem({ id: props.id }));
}
};
}
export default connect(createMapStateToProps, createMapDispatchToProps)(BlacklistRow);
export default connect(createMapStateToProps, createMapDispatchToProps)(BlocklistRow);

@ -43,14 +43,14 @@ class QueueRow extends Component {
this.setState({ isRemoveQueueItemModalOpen: true });
}
onRemoveQueueItemModalConfirmed = (blacklist, skipredownload) => {
onRemoveQueueItemModalConfirmed = (blocklist, skipredownload) => {
const {
onRemoveQueueItemPress,
onQueueRowModalOpenOrClose
} = this.props;
onQueueRowModalOpenOrClose(false);
onRemoveQueueItemPress(blacklist, skipredownload);
onRemoveQueueItemPress(blocklist, skipredownload);
this.setState({ isRemoveQueueItemModalOpen: false });
}

@ -22,7 +22,7 @@ class RemoveQueueItemModal extends Component {
this.state = {
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
};
}
@ -33,7 +33,7 @@ class RemoveQueueItemModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
});
}
@ -45,8 +45,8 @@ class RemoveQueueItemModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onSkipReDownloadChange = ({ value }) => {
@ -75,7 +75,7 @@ class RemoveQueueItemModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist, skipredownload } = this.state;
const { remove, blocklist, skipredownload } = this.state;
return (
<Modal
@ -112,20 +112,20 @@ class RemoveQueueItemModal extends Component {
<FormGroup>
<FormLabel>
{translate('BlacklistRelease')}
{translate('BlocklistRelease')}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
helpText={translate('BlacklistHelpText')}
onChange={this.onBlacklistChange}
name="blocklist"
value={blocklist}
helpText={translate('BlocklistHelpText')}
onChange={this.onBlocklistChange}
/>
</FormGroup>
{
blacklist &&
blocklist &&
<FormGroup>
<FormLabel>
{translate('SkipRedownload')}

@ -23,7 +23,7 @@ class RemoveQueueItemsModal extends Component {
this.state = {
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
};
}
@ -34,7 +34,7 @@ class RemoveQueueItemsModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
});
}
@ -46,8 +46,8 @@ class RemoveQueueItemsModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onSkipReDownloadChange = ({ value }) => {
@ -76,7 +76,7 @@ class RemoveQueueItemsModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist, skipredownload } = this.state;
const { remove, blocklist, skipredownload } = this.state;
return (
<Modal
@ -113,20 +113,20 @@ class RemoveQueueItemsModal extends Component {
<FormGroup>
<FormLabel>
Blacklist Release{selectedCount > 1 ? 's' : ''}
Add Release{selectedCount > 1 ? 's' : ''} To Blocklist
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
helpText={translate('BlacklistHelpText')}
onChange={this.onBlacklistChange}
name="blocklist"
value={blocklist}
helpText={translate('BlocklistHelpText')}
onChange={this.onBlocklistChange}
/>
</FormGroup>
{
blacklist &&
blocklist &&
<FormGroup>
<FormLabel>
{translate('SkipRedownload')}

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import BlacklistConnector from 'Activity/Blacklist/BlacklistConnector';
import BlocklistConnector from 'Activity/Blocklist/BlocklistConnector';
import HistoryConnector from 'Activity/History/HistoryConnector';
import QueueConnector from 'Activity/Queue/QueueConnector';
import AuthorDetailsPageConnector from 'Author/Details/AuthorDetailsPageConnector';
@ -138,8 +138,8 @@ function AppRoutes(props) {
/>
<Route
path="/activity/blacklist"
component={BlacklistConnector}
path="/activity/blocklist"
component={BlocklistConnector}
/>
{/*

@ -1,7 +1,7 @@
export const APPLICATION_UPDATE = 'ApplicationUpdate';
export const BACKUP = 'Backup';
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
export const CLEAR_BLACKLIST = 'ClearBlacklist';
export const CLEAR_BLOCKLIST = 'ClearBlocklist';
export const CLEAR_LOGS = 'ClearLog';
export const CUTOFF_UNMET_BOOK_SEARCH = 'CutoffUnmetBookSearch';
export const DELETE_LOG_FILES = 'DeleteLogFiles';

@ -72,8 +72,8 @@ const links = [
to: '/activity/history'
},
{
title: 'Blacklist',
to: '/activity/blacklist'
title: 'Blocklist',
to: '/activity/blocklist'
}
]
},

@ -10,7 +10,7 @@ import {
import getSectionState from 'Utilities/State/getSectionState';
import updateSectionState from 'Utilities/State/updateSectionState';
const blacklistedProperties = [
const omittedProperties = [
'section',
'id'
];
@ -31,7 +31,7 @@ export default function createHandleActions(handlers, defaultState, section) {
if (section === baseSection) {
const newState = Object.assign(getSectionState(state, payloadSection),
_.omit(payload, blacklistedProperties));
_.omit(payload, omittedProperties));
return updateSectionState(state, payloadSection, newState);
}

@ -14,7 +14,7 @@ import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptio
//
// Variables
export const section = 'blacklist';
export const section = 'blocklist';
//
// State
@ -69,41 +69,41 @@ export const defaultState = {
};
export const persistState = [
'blacklist.pageSize',
'blacklist.sortKey',
'blacklist.sortDirection',
'blacklist.columns'
'blocklist.pageSize',
'blocklist.sortKey',
'blocklist.sortDirection',
'blocklist.columns'
];
//
// Action Types
export const FETCH_BLACKLIST = 'blacklist/fetchBlacklist';
export const GOTO_FIRST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistFirstPage';
export const GOTO_PREVIOUS_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPreviousPage';
export const GOTO_NEXT_BLACKLIST_PAGE = 'blacklist/gotoBlacklistNextPage';
export const GOTO_LAST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistLastPage';
export const GOTO_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPage';
export const SET_BLACKLIST_SORT = 'blacklist/setBlacklistSort';
export const SET_BLACKLIST_TABLE_OPTION = 'blacklist/setBlacklistTableOption';
export const REMOVE_BLACKLIST_ITEM = 'blacklist/removeBlacklistItem';
export const REMOVE_BLACKLIST_ITEMS = 'blacklist/removeBlacklistItems';
export const CLEAR_BLACKLIST = 'blacklist/clearBlacklist';
export const FETCH_BLOCKLIST = 'blocklist/fetchBlocklist';
export const GOTO_FIRST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistFirstPage';
export const GOTO_PREVIOUS_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPreviousPage';
export const GOTO_NEXT_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistNextPage';
export const GOTO_LAST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistLastPage';
export const GOTO_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPage';
export const SET_BLOCKLIST_SORT = 'blocklist/setBlocklistSort';
export const SET_BLOCKLIST_TABLE_OPTION = 'blocklist/setBlocklistTableOption';
export const REMOVE_BLOCKLIST_ITEM = 'blocklist/removeBlocklistItem';
export const REMOVE_BLOCKLIST_ITEMS = 'blocklist/removeBlocklistItems';
export const CLEAR_BLOCKLIST = 'blocklist/clearBlocklist';
//
// Action Creators
export const fetchBlacklist = createThunk(FETCH_BLACKLIST);
export const gotoBlacklistFirstPage = createThunk(GOTO_FIRST_BLACKLIST_PAGE);
export const gotoBlacklistPreviousPage = createThunk(GOTO_PREVIOUS_BLACKLIST_PAGE);
export const gotoBlacklistNextPage = createThunk(GOTO_NEXT_BLACKLIST_PAGE);
export const gotoBlacklistLastPage = createThunk(GOTO_LAST_BLACKLIST_PAGE);
export const gotoBlacklistPage = createThunk(GOTO_BLACKLIST_PAGE);
export const setBlacklistSort = createThunk(SET_BLACKLIST_SORT);
export const setBlacklistTableOption = createAction(SET_BLACKLIST_TABLE_OPTION);
export const removeBlacklistItem = createThunk(REMOVE_BLACKLIST_ITEM);
export const removeBlacklistItems = createThunk(REMOVE_BLACKLIST_ITEMS);
export const clearBlacklist = createAction(CLEAR_BLACKLIST);
export const fetchBlocklist = createThunk(FETCH_BLOCKLIST);
export const gotoBlocklistFirstPage = createThunk(GOTO_FIRST_BLOCKLIST_PAGE);
export const gotoBlocklistPreviousPage = createThunk(GOTO_PREVIOUS_BLOCKLIST_PAGE);
export const gotoBlocklistNextPage = createThunk(GOTO_NEXT_BLOCKLIST_PAGE);
export const gotoBlocklistLastPage = createThunk(GOTO_LAST_BLOCKLIST_PAGE);
export const gotoBlocklistPage = createThunk(GOTO_BLOCKLIST_PAGE);
export const setBlocklistSort = createThunk(SET_BLOCKLIST_SORT);
export const setBlocklistTableOption = createAction(SET_BLOCKLIST_TABLE_OPTION);
export const removeBlocklistItem = createThunk(REMOVE_BLOCKLIST_ITEM);
export const removeBlocklistItems = createThunk(REMOVE_BLOCKLIST_ITEMS);
export const clearBlocklist = createAction(CLEAR_BLOCKLIST);
//
// Action Handlers
@ -111,21 +111,21 @@ export const clearBlacklist = createAction(CLEAR_BLACKLIST);
export const actionHandlers = handleThunks({
...createServerSideCollectionHandlers(
section,
'/blacklist',
fetchBlacklist,
'/blocklist',
fetchBlocklist,
{
[serverSideCollectionHandlers.FETCH]: FETCH_BLACKLIST,
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLACKLIST_PAGE,
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLACKLIST_PAGE,
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLACKLIST_PAGE,
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLACKLIST_PAGE,
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLACKLIST_PAGE,
[serverSideCollectionHandlers.SORT]: SET_BLACKLIST_SORT
[serverSideCollectionHandlers.FETCH]: FETCH_BLOCKLIST,
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.SORT]: SET_BLOCKLIST_SORT
}),
[REMOVE_BLACKLIST_ITEM]: createRemoveItemHandler(section, '/blacklist'),
[REMOVE_BLOCKLIST_ITEM]: createRemoveItemHandler(section, '/blocklist'),
[REMOVE_BLACKLIST_ITEMS]: function(getState, payload, dispatch) {
[REMOVE_BLOCKLIST_ITEMS]: function(getState, payload, dispatch) {
const {
ids
} = payload;
@ -143,7 +143,7 @@ export const actionHandlers = handleThunks({
]));
const promise = createAjaxRequest({
url: '/blacklist/bulk',
url: '/blocklist/bulk',
method: 'DELETE',
dataType: 'json',
contentType: 'application/json',
@ -152,7 +152,7 @@ export const actionHandlers = handleThunks({
promise.done((data) => {
// Don't use batchActions with thunks
dispatch(fetchBlacklist());
dispatch(fetchBlocklist());
dispatch(set({ section, isRemoving: false }));
});
@ -178,9 +178,9 @@ export const actionHandlers = handleThunks({
export const reducers = createHandleActions({
[SET_BLACKLIST_TABLE_OPTION]: createSetTableOptionReducer(section),
[SET_BLOCKLIST_TABLE_OPTION]: createSetTableOptionReducer(section),
[CLEAR_BLACKLIST]: createClearReducer(section, {
[CLEAR_BLOCKLIST]: createClearReducer(section, {
isFetching: false,
isPopulated: false,
error: null,

@ -4,7 +4,7 @@ import * as authorDetails from './authorDetailsActions';
import * as authorEditor from './authorEditorActions';
import * as authorHistory from './authorHistoryActions';
import * as authorIndex from './authorIndexActions';
import * as blacklist from './blacklistActions';
import * as blocklist from './blocklistActions';
import * as books from './bookActions';
import * as bookFiles from './bookFileActions';
import * as bookHistory from './bookHistoryActions';
@ -37,7 +37,7 @@ export default [
authorEditor,
authorHistory,
authorIndex,
blacklist,
blocklist,
bookFiles,
bookHistory,
bookIndex,

@ -353,14 +353,14 @@ export const actionHandlers = handleThunks({
const {
id,
remove,
blacklist,
blocklist,
skipredownload
} = payload;
dispatch(updateItem({ section: paged, id, isRemoving: true }));
const promise = createAjaxRequest({
url: `/queue/${id}?removeFromClient=${remove}&blacklist=${blacklist}&skipredownload=${skipredownload}`,
url: `/queue/${id}?removeFromClient=${remove}&blocklist=${blocklist}&skipredownload=${skipredownload}`,
method: 'DELETE'
}).request;
@ -377,7 +377,7 @@ export const actionHandlers = handleThunks({
const {
ids,
remove,
blacklist,
blocklist,
skipredownload
} = payload;
@ -394,7 +394,7 @@ export const actionHandlers = handleThunks({
]));
const promise = createAjaxRequest({
url: `/queue/bulk?removeFromClient=${remove}&blacklist=${blacklist}&skipredownload=${skipredownload}`,
url: `/queue/bulk?removeFromClient=${remove}&blocklist=${blocklist}&skipredownload=${skipredownload}`,
method: 'DELETE',
dataType: 'json',
data: JSON.stringify({ ids })

@ -1,7 +1,9 @@
import migrateAddAuthorDefaults from './migrateAddAuthorDefaults';
import migrateAuthorSortKey from './migrateAuthorSortKey';
import migrateBlacklistToBlocklist from './migrateBlacklistToBlocklist';
export default function migrate(persistedState) {
migrateAddAuthorDefaults(persistedState);
migrateAuthorSortKey(persistedState);
migrateBlacklistToBlocklist(persistedState);
}

@ -1,6 +1,6 @@
import { get, set } from 'lodash';
const TABLES_TO_MIGRATE = ['blacklist', 'history', 'queue.paged', 'wanted.missing', 'wanted.cutoffUnmet'];
const TABLES_TO_MIGRATE = ['blocklist', 'history', 'queue.paged', 'wanted.missing', 'wanted.cutoffUnmet'];
export default function migrateAuthorSortKey(persistedState) {

@ -0,0 +1,12 @@
import _, { get } from 'lodash';
export default function migrateBlacklistToBlocklist(persistedState) {
const blocklist = get(persistedState, 'blacklist');
if (!blocklist) {
return;
}
persistedState.blocklist = blocklist;
_.remove(persistedState, 'blacklist');
}

@ -0,0 +1,30 @@
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Datastore;
using Sonarr.Http;
namespace NzbDrone.Api.Blocklist
{
public class BlocklistModule : SonarrRestModule<BlocklistResource>
{
private readonly BlocklistService _blocklistService;
public BlocklistModule(BlocklistService blocklistService)
{
_blocklistService = blocklistService;
GetResourcePaged = Blocklist;
DeleteResource = DeleteBlockList;
}
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
{
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, Core.Blocklisting.Blocklist>("id", SortDirection.Ascending);
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
}
private void DeleteBlockList(int id)
{
_blocklistService.Delete(id);
}
}
}

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using Sonarr.Http.REST;
using NzbDrone.Core.Qualities;
using NzbDrone.Api.Series;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Languages;
namespace NzbDrone.Api.Blocklist
{
public class BlocklistResource : RestResource
{
public int SeriesId { get; set; }
public List<int> EpisodeIds { get; set; }
public string SourceTitle { get; set; }
public QualityModel Quality { get; set; }
public DateTime Date { get; set; }
public DownloadProtocol Protocol { get; set; }
public string Indexer { get; set; }
public string Message { get; set; }
public Language Language { get; set; }
public SeriesResource Series { get; set; }
}
public static class BlocklistResourceMapper
{
public static BlocklistResource MapToResource(this Core.Blocklisting.Blocklist model)
{
if (model == null) return null;
return new BlocklistResource
{
Id = model.Id,
SeriesId = model.SeriesId,
EpisodeIds = model.EpisodeIds,
SourceTitle = model.SourceTitle,
Quality = model.Quality,
Date = model.Date,
Protocol = model.Protocol,
Indexer = model.Indexer,
Message = model.Message,
Series = model.Series.ToResource()
};
}
}
}

@ -52,7 +52,7 @@ namespace NzbDrone.Automation.Test
_page.Find(By.LinkText("Queue")).Should().NotBeNull();
_page.Find(By.LinkText("History")).Should().NotBeNull();
_page.Find(By.LinkText("Blacklist")).Should().NotBeNull();
_page.Find(By.LinkText("Blocklist")).Should().NotBeNull();
}
[Test]

@ -3,21 +3,21 @@ using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Blacklisting
namespace NzbDrone.Core.Test.Blocklisting
{
[TestFixture]
public class BlacklistRepositoryFixture : DbTest<BlacklistRepository, Blacklist>
public class BlocklistRepositoryFixture : DbTest<BlocklistRepository, Blocklist>
{
private Blacklist _blacklist;
private Blocklist _blocklist;
[SetUp]
public void Setup()
{
_blacklist = new Blacklist
_blocklist = new Blocklist
{
AuthorId = 12345,
BookIds = new List<int> { 1 },
@ -30,24 +30,24 @@ namespace NzbDrone.Core.Test.Blacklisting
[Test]
public void should_be_able_to_write_to_database()
{
Subject.Insert(_blacklist);
Subject.Insert(_blocklist);
Subject.All().Should().HaveCount(1);
}
[Test]
public void should_should_have_book_ids()
{
Subject.Insert(_blacklist);
Subject.Insert(_blocklist);
Subject.All().First().BookIds.Should().Contain(_blacklist.BookIds);
Subject.All().First().BookIds.Should().Contain(_blocklist.BookIds);
}
[Test]
public void should_check_for_blacklisted_title_case_insensative()
public void should_check_for_blocklisted_title_case_insensative()
{
Subject.Insert(_blacklist);
Subject.Insert(_blocklist);
Subject.BlacklistedByTitle(_blacklist.AuthorId, _blacklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
Subject.BlocklistedByTitle(_blocklist.AuthorId, _blocklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
}
}
}

@ -2,15 +2,15 @@ using System;
using System.Collections.Generic;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Download;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Blacklisting
namespace NzbDrone.Core.Test.Blocklisting
{
[TestFixture]
public class BlacklistServiceFixture : CoreTest<BlacklistService>
public class BlocklistServiceFixture : CoreTest<BlocklistService>
{
private DownloadFailedEvent _event;
@ -39,8 +39,8 @@ namespace NzbDrone.Core.Test.Blacklisting
{
Subject.Handle(_event);
Mocker.GetMock<IBlacklistRepository>()
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.BookIds == _event.BookIds)), Times.Once());
Mocker.GetMock<IBlocklistRepository>()
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.BookIds == _event.BookIds)), Times.Once());
}
[Test]
@ -51,8 +51,8 @@ namespace NzbDrone.Core.Test.Blacklisting
_event.Data.Remove("size");
_event.Data.Remove("protocol");
Mocker.GetMock<IBlacklistRepository>()
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.BookIds == _event.BookIds)), Times.Once());
Mocker.GetMock<IBlocklistRepository>()
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.BookIds == _event.BookIds)), Times.Once());
}
}
}

@ -2,7 +2,7 @@
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Books;
using NzbDrone.Core.Housekeeping.Housekeepers;
using NzbDrone.Core.Qualities;
@ -11,35 +11,35 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
{
[TestFixture]
public class CleanupOrphanedBlacklistFixture : DbTest<CleanupOrphanedBlacklist, Blacklist>
public class CleanupOrphanedBlocklistFixture : DbTest<CleanupOrphanedBlocklist, Blocklist>
{
[Test]
public void should_delete_orphaned_blacklist_items()
public void should_delete_orphaned_blocklist_items()
{
var blacklist = Builder<Blacklist>.CreateNew()
var blocklist = Builder<Blocklist>.CreateNew()
.With(h => h.BookIds = new List<int>())
.With(h => h.Quality = new QualityModel())
.BuildNew();
Db.Insert(blacklist);
Db.Insert(blocklist);
Subject.Clean();
AllStoredModels.Should().BeEmpty();
}
[Test]
public void should_not_delete_unorphaned_blacklist_items()
public void should_not_delete_unorphaned_blocklist_items()
{
var author = Builder<Author>.CreateNew().BuildNew();
Db.Insert(author);
var blacklist = Builder<Blacklist>.CreateNew()
var blocklist = Builder<Blocklist>.CreateNew()
.With(h => h.BookIds = new List<int>())
.With(h => h.Quality = new QualityModel())
.With(b => b.AuthorId = author.Id)
.BuildNew();
Db.Insert(blacklist);
Db.Insert(blocklist);
Subject.Clean();
AllStoredModels.Should().HaveCount(1);

@ -5,9 +5,9 @@ using NzbDrone.Core.Datastore;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public class Blacklist : ModelBase
public class Blocklist : ModelBase
{
public int AuthorId { get; set; }
public Author Author { get; set; }

@ -3,41 +3,41 @@ using NzbDrone.Core.Books;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public interface IBlacklistRepository : IBasicRepository<Blacklist>
public interface IBlocklistRepository : IBasicRepository<Blocklist>
{
List<Blacklist> BlacklistedByTitle(int authorId, string sourceTitle);
List<Blacklist> BlacklistedByTorrentInfoHash(int authorId, string torrentInfoHash);
List<Blacklist> BlacklistedByAuthor(int authorId);
List<Blocklist> BlocklistedByTitle(int authorId, string sourceTitle);
List<Blocklist> BlocklistedByTorrentInfoHash(int authorId, string torrentInfoHash);
List<Blocklist> BlocklistedByAuthor(int authorId);
}
public class BlacklistRepository : BasicRepository<Blacklist>, IBlacklistRepository
public class BlocklistRepository : BasicRepository<Blocklist>, IBlocklistRepository
{
public BlacklistRepository(IMainDatabase database, IEventAggregator eventAggregator)
public BlocklistRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
public List<Blacklist> BlacklistedByTitle(int authorId, string sourceTitle)
public List<Blocklist> BlocklistedByTitle(int authorId, string sourceTitle)
{
return Query(e => e.AuthorId == authorId && e.SourceTitle.Contains(sourceTitle));
}
public List<Blacklist> BlacklistedByTorrentInfoHash(int authorId, string torrentInfoHash)
public List<Blocklist> BlocklistedByTorrentInfoHash(int authorId, string torrentInfoHash)
{
return Query(e => e.AuthorId == authorId && e.TorrentInfoHash.Contains(torrentInfoHash));
}
public List<Blacklist> BlacklistedByAuthor(int authorId)
public List<Blocklist> BlocklistedByAuthor(int authorId)
{
return Query(b => b.AuthorId == authorId);
}
protected override SqlBuilder PagedBuilder() => new SqlBuilder()
.Join<Blacklist, Author>((b, m) => b.AuthorId == m.Id)
.Join<Blocklist, Author>((b, m) => b.AuthorId == m.Id)
.Join<Author, AuthorMetadata>((l, r) => l.AuthorMetadataId == r.Id);
protected override IEnumerable<Blacklist> PagedQuery(SqlBuilder builder) => _database.QueryJoined<Blacklist, Author, AuthorMetadata>(builder,
protected override IEnumerable<Blocklist> PagedQuery(SqlBuilder builder) => _database.QueryJoined<Blocklist, Author, AuthorMetadata>(builder,
(bl, author, metadata) =>
{
author.Metadata = metadata;

@ -10,32 +10,32 @@ using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public interface IBlacklistService
public interface IBlocklistService
{
bool Blacklisted(int authorId, ReleaseInfo release);
PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec);
bool Blocklisted(int authorId, ReleaseInfo release);
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
void Delete(int id);
void Delete(List<int> ids);
}
public class BlacklistService : IBlacklistService,
public class BlocklistService : IBlocklistService,
IExecute<ClearBlacklistCommand>,
IExecute<ClearBlocklistCommand>,
IHandle<DownloadFailedEvent>,
IHandleAsync<AuthorDeletedEvent>
{
private readonly IBlacklistRepository _blacklistRepository;
private readonly IBlocklistRepository _blocklistRepository;
public BlacklistService(IBlacklistRepository blacklistRepository)
public BlocklistService(IBlocklistRepository blocklistRepository)
{
_blacklistRepository = blacklistRepository;
_blocklistRepository = blocklistRepository;
}
public bool Blacklisted(int authorId, ReleaseInfo release)
public bool Blocklisted(int authorId, ReleaseInfo release)
{
var blacklistedByTitle = _blacklistRepository.BlacklistedByTitle(authorId, release.Title);
var blocklistedByTitle = _blocklistRepository.BlocklistedByTitle(authorId, release.Title);
if (release.DownloadProtocol == DownloadProtocol.Torrent)
{
@ -48,35 +48,35 @@ namespace NzbDrone.Core.Blacklisting
if (torrentInfo.InfoHash.IsNullOrWhiteSpace())
{
return blacklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Torrent)
return blocklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Torrent)
.Any(b => SameTorrent(b, torrentInfo));
}
var blacklistedByTorrentInfohash = _blacklistRepository.BlacklistedByTorrentInfoHash(authorId, torrentInfo.InfoHash);
var blocklistedByTorrentInfohash = _blocklistRepository.BlocklistedByTorrentInfoHash(authorId, torrentInfo.InfoHash);
return blacklistedByTorrentInfohash.Any(b => SameTorrent(b, torrentInfo));
return blocklistedByTorrentInfohash.Any(b => SameTorrent(b, torrentInfo));
}
return blacklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Usenet)
return blocklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Usenet)
.Any(b => SameNzb(b, release));
}
public PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec)
public PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec)
{
return _blacklistRepository.GetPaged(pagingSpec);
return _blocklistRepository.GetPaged(pagingSpec);
}
public void Delete(int id)
{
_blacklistRepository.Delete(id);
_blocklistRepository.Delete(id);
}
public void Delete(List<int> ids)
{
_blacklistRepository.DeleteMany(ids);
_blocklistRepository.DeleteMany(ids);
}
private bool SameNzb(Blacklist item, ReleaseInfo release)
private bool SameNzb(Blocklist item, ReleaseInfo release)
{
if (item.PublishedDate == release.PublishDate)
{
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Blacklisting
return false;
}
private bool SameTorrent(Blacklist item, TorrentInfo release)
private bool SameTorrent(Blocklist item, TorrentInfo release)
{
if (release.InfoHash.IsNotNullOrWhiteSpace())
{
@ -103,7 +103,7 @@ namespace NzbDrone.Core.Blacklisting
return item.Indexer.Equals(release.Indexer, StringComparison.InvariantCultureIgnoreCase);
}
private bool HasSameIndexer(Blacklist item, string indexer)
private bool HasSameIndexer(Blocklist item, string indexer)
{
if (item.Indexer.IsNullOrWhiteSpace())
{
@ -113,7 +113,7 @@ namespace NzbDrone.Core.Blacklisting
return item.Indexer.Equals(indexer, StringComparison.InvariantCultureIgnoreCase);
}
private bool HasSamePublishedDate(Blacklist item, DateTime publishedDate)
private bool HasSamePublishedDate(Blocklist item, DateTime publishedDate)
{
if (!item.PublishedDate.HasValue)
{
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Blacklisting
item.PublishedDate.Value.AddMinutes(2) >= publishedDate;
}
private bool HasSameSize(Blacklist item, long size)
private bool HasSameSize(Blocklist item, long size)
{
if (!item.Size.HasValue)
{
@ -136,14 +136,14 @@ namespace NzbDrone.Core.Blacklisting
return difference <= 2.Megabytes();
}
public void Execute(ClearBlacklistCommand message)
public void Execute(ClearBlocklistCommand message)
{
_blacklistRepository.Purge();
_blocklistRepository.Purge();
}
public void Handle(DownloadFailedEvent message)
{
var blacklist = new Blacklist
var blocklist = new Blocklist
{
AuthorId = message.AuthorId,
BookIds = message.BookIds,
@ -158,14 +158,14 @@ namespace NzbDrone.Core.Blacklisting
TorrentInfoHash = message.Data.GetValueOrDefault("torrentInfoHash")
};
_blacklistRepository.Insert(blacklist);
_blocklistRepository.Insert(blocklist);
}
public void HandleAsync(AuthorDeletedEvent message)
{
var blacklisted = _blacklistRepository.BlacklistedByAuthor(message.Author.Id);
var blocklisted = _blocklistRepository.BlocklistedByAuthor(message.Author.Id);
_blacklistRepository.DeleteMany(blacklisted);
_blocklistRepository.DeleteMany(blocklisted);
}
}
}

@ -1,8 +1,8 @@
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public class ClearBlacklistCommand : Command
public class ClearBlocklistCommand : Command
{
public override bool SendUpdatesToClient => true;
}

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(014)]
public class rename_blacklist_to_blocklist : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Rename.Table("Blacklist").To("Blocklist");
}
}
}

@ -4,7 +4,7 @@ using System.Linq;
using Dapper;
using NzbDrone.Common.Reflection;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Books;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFilters;
@ -171,7 +171,7 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity<Log>("Logs").RegisterModel();
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
Mapper.Entity<Blacklist>("Blacklist").RegisterModel();
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
Mapper.Entity<MetadataFile>("MetadataFiles").RegisterModel();
Mapper.Entity<OtherExtraFile>("ExtraFiles").RegisterModel();

@ -1,18 +1,18 @@
using NLog;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
public class BlacklistSpecification : IDecisionEngineSpecification
public class BlocklistSpecification : IDecisionEngineSpecification
{
private readonly IBlacklistService _blacklistService;
private readonly IBlocklistService _blocklistService;
private readonly Logger _logger;
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger)
public BlocklistSpecification(IBlocklistService blocklistService, Logger logger)
{
_blacklistService = blacklistService;
_blocklistService = blocklistService;
_logger = logger;
}
@ -21,10 +21,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public Decision IsSatisfiedBy(RemoteBook subject, SearchCriteriaBase searchCriteria)
{
if (_blacklistService.Blacklisted(subject.Author.Id, subject.Release))
if (_blocklistService.Blocklisted(subject.Author.Id, subject.Release))
{
_logger.Debug("{0} is blacklisted, rejecting.", subject.Release.Title);
return Decision.Reject("Release is blacklisted");
_logger.Debug("{0} is blocklisted, rejecting.", subject.Release.Title);
return Decision.Reject("Release is blocklisted");
}
return Decision.Accept();

@ -3,11 +3,11 @@ using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Housekeeping.Housekeepers
{
public class CleanupOrphanedBlacklist : IHousekeepingTask
public class CleanupOrphanedBlocklist : IHousekeepingTask
{
private readonly IMainDatabase _database;
public CleanupOrphanedBlacklist(IMainDatabase database)
public CleanupOrphanedBlocklist(IMainDatabase database)
{
_database = database;
}
@ -16,11 +16,11 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{
using (var mapper = _database.OpenConnection())
{
mapper.Execute(@"DELETE FROM Blacklist
mapper.Execute(@"DELETE FROM Blocklist
WHERE Id IN (
SELECT Blacklist.Id FROM Blacklist
SELECT Blocklist.Id FROM Blocklist
LEFT OUTER JOIN Authors
ON Blacklist.AuthorId = Authors.Id
ON Blocklist.AuthorId = Authors.Id
WHERE Authors.Id IS NULL)");
}
}

@ -60,9 +60,9 @@
"BindAddress": "Bind Address",
"BindAddressHelpText": "Valid IP4 address or '*' for all interfaces",
"BindAddressHelpTextWarning": "Requires restart to take effect",
"Blacklist": "Blacklist",
"BlacklistHelpText": "Prevents Readarr from automatically grabbing these files again",
"BlacklistRelease": "Blacklist Release",
"Blocklist": "Blocklist",
"BlocklistHelpText": "Prevents Readarr from automatically grabbing these files again",
"BlocklistRelease": "Blocklist Release",
"Book": "Book",
"BookAvailableButMissing": "Book Available, but Missing",
"BookDownloaded": "Book Downloaded",
@ -397,6 +397,7 @@
"New": "New",
"NoBackupsAreAvailable": "No backups are available",
"NoHistory": "No history.",
"NoHistoryBlocklist": "No history blocklist",
"NoLeaveIt": "No, Leave It",
"NoLimitForAnyRuntime": "No limit for any runtime",
"NoLogFiles": "No log files",
@ -499,12 +500,12 @@
"RemovedFromTaskQueue": "Removed from task queue",
"RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history",
"RemoveFilter": "Remove filter",
"RemoveFromBlacklist": "Remove from blacklist",
"RemoveFromBlocklist": "Remove from blocklist",
"RemoveFromDownloadClient": "Remove From Download Client",
"RemoveFromQueue": "Remove from queue",
"RemoveHelpTextWarning": "Removing will remove the download and the file(s) from the download client.",
"RemoveSelected": "Remove Selected",
"RemoveSelectedMessageText": "Are you sure you want to remove the selected items from the blacklist?",
"RemoveSelectedMessageText": "Are you sure you want to remove the selected items from the blocklist?",
"RemoveTagExistingTag": "Existing tag",
"RemoveTagRemovingTag": "Removing tag",
"RenameBooks": "Rename Books",
@ -669,7 +670,7 @@
"UnableToAddANewRemotePathMappingPleaseTryAgain": "Unable to add a new remote path mapping, please try again.",
"UnableToAddANewRootFolderPleaseTryAgain": "Unable to add a new root folder, please try again.",
"UnableToLoadBackups": "Unable to load backups",
"UnableToLoadBlacklist": "Unable to load blacklist",
"UnableToLoadBlocklist": "Unable to load blocklist",
"UnableToLoadDelayProfiles": "Unable to load Delay Profiles",
"UnableToLoadDownloadClientOptions": "Unable to load download client options",
"UnableToLoadDownloadClients": "Unable to load download clients",
@ -736,4 +737,4 @@
"WriteTagsSync": "All files; keep in sync with Goodreads",
"Year": "Year",
"YesCancel": "Yes, Cancel"
}
}

@ -1,22 +1,22 @@
using FluentAssertions;
using NUnit.Framework;
using Readarr.Api.V1.Author;
using Readarr.Api.V1.Blacklist;
using Readarr.Api.V1.Blocklist;
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
public class BlacklistFixture : IntegrationTest
public class BlocklistFixture : IntegrationTest
{
private AuthorResource _author;
[Test]
[Ignore("Adding to blacklist not supported")]
public void should_be_able_to_add_to_blacklist()
[Ignore("Adding to blocklist not supported")]
public void should_be_able_to_add_to_blocklist()
{
_author = EnsureAuthor("14586394", "43765115", "Andrew Hunter Murray");
Blacklist.Post(new BlacklistResource
Blocklist.Post(new BlocklistResource
{
AuthorId = _author.Id,
SourceTitle = "Blacklist - Book 1 [2015 FLAC]"
@ -24,10 +24,10 @@ namespace NzbDrone.Integration.Test.ApiTests
}
[Test]
[Ignore("Adding to blacklist not supported")]
public void should_be_able_to_get_all_blacklisted()
[Ignore("Adding to blocklist not supported")]
public void should_be_able_to_get_all_blocklisted()
{
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
result.Should().NotBeNull();
result.TotalRecords.Should().Be(1);
@ -35,12 +35,12 @@ namespace NzbDrone.Integration.Test.ApiTests
}
[Test]
[Ignore("Adding to blacklist not supported")]
public void should_be_able_to_remove_from_blacklist()
[Ignore("Adding to blocklist not supported")]
public void should_be_able_to_remove_from_blocklist()
{
Blacklist.Delete(1);
Blocklist.Delete(1);
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
result.Should().NotBeNull();
result.TotalRecords.Should().Be(0);

@ -17,7 +17,7 @@ using NzbDrone.SignalR;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.Categories;
using Readarr.Api.V1.Author;
using Readarr.Api.V1.Blacklist;
using Readarr.Api.V1.Blocklist;
using Readarr.Api.V1.Books;
using Readarr.Api.V1.Config;
using Readarr.Api.V1.DownloadClient;
@ -36,7 +36,7 @@ namespace NzbDrone.Integration.Test
{
protected RestClient RestClient { get; private set; }
public ClientBase<BlacklistResource> Blacklist;
public ClientBase<BlocklistResource> Blocklist;
public CommandClient Commands;
public ClientBase<TaskResource> Tasks;
public DownloadClientClient DownloadClients;
@ -101,7 +101,7 @@ namespace NzbDrone.Integration.Test
RestClient.AddDefaultHeader("X-Api-Key", ApiKey);
RestClient.UseSystemTextJson();
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
Blocklist = new ClientBase<BlocklistResource>(RestClient, ApiKey);
Commands = new CommandClient(RestClient, ApiKey);
Tasks = new ClientBase<TaskResource>(RestClient, ApiKey, "system/task");
DownloadClients = new DownloadClientClient(RestClient, ApiKey);

@ -1,43 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Datastore;
using NzbDrone.Http.REST.Attributes;
using Readarr.Http;
using Readarr.Http.Extensions;
namespace Readarr.Api.V1.Blacklist
{
[V1ApiController]
public class BlacklistController : Controller
{
private readonly IBlacklistService _blacklistService;
public BlacklistController(IBlacklistService blacklistService)
{
_blacklistService = blacklistService;
}
[HttpGet]
public PagingResource<BlacklistResource> GetBlacklist()
{
var pagingResource = Request.ReadPagingResourceFromRequest<BlacklistResource>();
var pagingSpec = pagingResource.MapToPagingSpec<BlacklistResource, NzbDrone.Core.Blacklisting.Blacklist>("date", SortDirection.Descending);
return pagingSpec.ApplyToPage(_blacklistService.Paged, BlacklistResourceMapper.MapToResource);
}
[RestDeleteById]
public void DeleteBlacklist(int id)
{
_blacklistService.Delete(id);
}
[HttpDelete("bulk")]
public object Remove([FromBody] BlacklistBulkResource resource)
{
_blacklistService.Delete(resource.Ids);
return new object();
}
}
}

@ -1,8 +1,8 @@
using System.Collections.Generic;
namespace Readarr.Api.V1.Blacklist
namespace Readarr.Api.V1.Blocklist
{
public class BlacklistBulkResource
public class BlocklistBulkResource
{
public List<int> Ids { get; set; }
}

@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Datastore;
using NzbDrone.Http.REST.Attributes;
using Readarr.Http;
using Readarr.Http.Extensions;
namespace Readarr.Api.V1.Blocklist
{
[V1ApiController]
public class BlocklistController : Controller
{
private readonly IBlocklistService _blocklistService;
public BlocklistController(IBlocklistService blocklistService)
{
_blocklistService = blocklistService;
}
[HttpGet]
public PagingResource<BlocklistResource> GetBlocklist()
{
var pagingResource = Request.ReadPagingResourceFromRequest<BlocklistResource>();
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>("date", SortDirection.Descending);
return pagingSpec.ApplyToPage(_blocklistService.Paged, BlocklistResourceMapper.MapToResource);
}
[RestDeleteById]
public void DeleteBlocklist(int id)
{
_blocklistService.Delete(id);
}
[HttpDelete("bulk")]
public object Remove([FromBody] BlocklistBulkResource resource)
{
_blocklistService.Delete(resource.Ids);
return new object();
}
}
}

@ -5,9 +5,9 @@ using NzbDrone.Core.Qualities;
using Readarr.Api.V1.Author;
using Readarr.Http.REST;
namespace Readarr.Api.V1.Blacklist
namespace Readarr.Api.V1.Blocklist
{
public class BlacklistResource : RestResource
public class BlocklistResource : RestResource
{
public int AuthorId { get; set; }
public List<int> BookIds { get; set; }
@ -21,16 +21,16 @@ namespace Readarr.Api.V1.Blacklist
public AuthorResource Author { get; set; }
}
public static class BlacklistResourceMapper
public static class BlocklistResourceMapper
{
public static BlacklistResource MapToResource(this NzbDrone.Core.Blacklisting.Blacklist model)
public static BlocklistResource MapToResource(this NzbDrone.Core.Blocklisting.Blocklist model)
{
if (model == null)
{
return null;
}
return new BlacklistResource
return new BlocklistResource
{
Id = model.Id,

@ -59,9 +59,9 @@ namespace Readarr.Api.V1.Queue
}
[RestDeleteById]
public void RemoveAction(int id, bool removeFromClient = true, bool blacklist = false, bool skipReDownload = false)
public void RemoveAction(int id, bool removeFromClient = true, bool blocklist = false, bool skipReDownload = false)
{
var trackedDownload = Remove(id, removeFromClient, blacklist, skipReDownload);
var trackedDownload = Remove(id, removeFromClient, blocklist, skipReDownload);
if (trackedDownload != null)
{
@ -70,13 +70,13 @@ namespace Readarr.Api.V1.Queue
}
[HttpDelete("bulk")]
public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool removeFromClient = true, [FromQuery] bool blacklist = false, [FromQuery] bool skipReDownload = false)
public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool removeFromClient = true, [FromQuery] bool blocklist = false, [FromQuery] bool skipReDownload = false)
{
var trackedDownloadIds = new List<string>();
foreach (var id in resource.Ids)
{
var trackedDownload = Remove(id, removeFromClient, blacklist, skipReDownload);
var trackedDownload = Remove(id, removeFromClient, blocklist, skipReDownload);
if (trackedDownload != null)
{
@ -193,7 +193,7 @@ namespace Readarr.Api.V1.Queue
}
}
private TrackedDownload Remove(int id, bool removeFromClient, bool blacklist, bool skipReDownload)
private TrackedDownload Remove(int id, bool removeFromClient, bool blocklist, bool skipReDownload)
{
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
@ -223,12 +223,12 @@ namespace Readarr.Api.V1.Queue
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
}
if (blacklist)
if (blocklist)
{
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId, skipReDownload);
}
if (!removeFromClient && !blacklist)
if (!removeFromClient && !blocklist)
{
if (!_ignoredDownloadService.IgnoreDownload(trackedDownload))
{

Loading…
Cancel
Save