From 5b64557d745cab2d657c84013dad6c0f49a59b41 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 2 May 2023 18:09:16 +0000 Subject: [PATCH] Remove manual transaction reporting, no one looks anyway --- apiserver/apiserver/api/views.py | 11 ------ webclient/src/Transactions.js | 66 +++----------------------------- 2 files changed, 5 insertions(+), 72 deletions(-) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 5736887..ef63249 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -544,17 +544,6 @@ class TransactionViewSet(Base, List, Create, Retrieve, Update): raise exceptions.PermissionDenied() return super().list(request) - @action(detail=True, methods=['post']) - def report(self, request, pk=None): - report_memo = request.data.get('report_memo', '').strip() - if not report_memo: - raise exceptions.ValidationError(dict(report_memo='This field may not be blank.')) - transaction = self.get_object() - transaction.report_type = 'User Flagged' - transaction.report_memo = report_memo - transaction.save() - return Response(200) - @action(detail=False, methods=['get']) def summary(self, request): txs = models.Transaction.objects diff --git a/webclient/src/Transactions.js b/webclient/src/Transactions.js index 1c1226b..be03b14 100644 --- a/webclient/src/Transactions.js +++ b/webclient/src/Transactions.js @@ -211,66 +211,6 @@ function EditTransaction(props) { ); }; -function ReportTransaction(props) { - const { transaction, token, refreshUser } = props; - const [input, setInput] = useState(transaction); - const [error, setError] = useState(false); - const [loading, setLoading] = useState(false); - const [success, setSuccess] = useState(false); - const { id } = useParams(); - - const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value }); - const handleChange = (e) => handleValues(e, e.currentTarget); - - const handleSubmit = (e) => { - if (loading) return; - setLoading(true); - setSuccess(false); - requester('/transactions/'+id+'/report/', 'POST', token, input) - .then(res => { - setLoading(false); - setSuccess(true); - setError(false); - if (refreshUser) { - refreshUser(); - } - }) - .catch(err => { - setLoading(false); - console.log(err); - setError(err.data); - }); - }; - - const makeProps = (name) => ({ - name: name, - onChange: handleChange, - value: input[name] || '', - error: error[name], - }); - - return ( -
-
Report Transaction
- -

If this transaction was made in error or there is anything incorrect about it, please report it using this form.

-

A staff member will review the report as soon as possible.

-

Follow up with directors@protospace.ca.

- -
- - - - Submit Report - - {success &&
Success!
} - -
- ); -}; export function TransactionList(props) { const { transactions, noMember, noCategory } = props; @@ -474,7 +414,11 @@ export function TransactionDetail(props) { : - +
Report Transaction
+ +

If there's anything wrong with this transaction or it was made in error please email the Protospace Directors:

+

directors@protospace.ca

+

Please include a link to this transaction and any relevant details.

}