{requestData.status === MediaRequestStatus.FAILED &&
hasPermission(Permission.MANAGE_REQUESTS) && (
@@ -537,8 +571,8 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
buttonType="danger"
buttonSize="sm"
className="hidden sm:block"
- onClick={() => modifyRequest('decline')}
disabled={updatingType !== null}
+ onClick={() => setShowDeclineRequestModal(true)}
>
{updatingType === 'decline' ?
:
}
{intl.formatMessage(globalMessages.decline)}
@@ -550,8 +584,8 @@ const RequestCard = ({ request, onTitleData }: RequestCardProps) => {
buttonType="danger"
buttonSize="sm"
className="sm:hidden"
- onClick={() => modifyRequest('decline')}
disabled={updatingType !== null}
+ onClick={() => setShowDeclineRequestModal(true)}
>
{updatingType === 'decline' ? (
diff --git a/src/components/RequestList/RequestItem/index.tsx b/src/components/RequestList/RequestItem/index.tsx
index 9a7d2de52c..f6f52eeca7 100644
--- a/src/components/RequestList/RequestItem/index.tsx
+++ b/src/components/RequestList/RequestItem/index.tsx
@@ -3,7 +3,9 @@ import Badge from '@app/components/Common/Badge';
import Button from '@app/components/Common/Button';
import CachedImage from '@app/components/Common/CachedImage';
import ConfirmButton from '@app/components/Common/ConfirmButton';
+import Tooltip from '@app/components/Common/Tooltip';
import RequestModal from '@app/components/RequestModal';
+import DeclineRequestModal from '@app/components/RequestModal/DeclineRequestModal';
import StatusBadge from '@app/components/StatusBadge';
import useDeepLinks from '@app/hooks/useDeepLinks';
import useToasts from '@app/hooks/useToasts';
@@ -48,6 +50,7 @@ const messages = defineMessages('components.RequestList.RequestItem', {
unknowntitle: 'Unknown Title',
removearr: 'Remove from {arr}',
profileName: 'Profile',
+ declineReason: 'Reason',
});
const isMovie = (movie: MovieDetails | TvDetails): movie is MovieDetails => {
@@ -327,6 +330,7 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
const [updatingType, setUpdatingType] = useState<
'approve' | 'decline' | null
>(null);
+ const [showDeclineRequestModal, setShowDeclineRequestModal] = useState(false);
const modifyRequest = async (type: 'approve' | 'decline') => {
setUpdatingType(type);
@@ -416,6 +420,23 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
setShowEditModal(false);
}}
/>
+
setShowDeclineRequestModal(false)}
+ onError={() => {
+ addToast(intl.formatMessage(messages.failedmodify), {
+ autoDismiss: true,
+ appearance: 'error',
+ });
+ }}
+ onComplete={() => {
+ revalidate();
+ mutate('/api/v1/request/count');
+ setShowDeclineRequestModal(false);
+ }}
+ />
{title.backdropPath && (
@@ -669,6 +690,22 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {
)}
+ {requestData.declineReason && (
+
+
+
+ {intl.formatMessage(messages.declineReason)}
+
+
+ {requestData.declineReason}
+
+
+
+ )}
@@ -736,8 +773,8 @@ const RequestItem = ({ request, revalidateList }: RequestItemProps) => {