diff --git a/api/logics.py b/api/logics.py index 12421be5..02a5e5de 100644 --- a/api/logics.py +++ b/api/logics.py @@ -458,6 +458,7 @@ class Logics: profile.orders_disputes_started).append(str(order.id)) profile.save() + send_message.delay(order.id,'dispute_opened') return True, None def dispute_statement(order, user, statement): @@ -790,6 +791,7 @@ class Logics: cls.return_escrow(order) order.status = Order.Status.CCA order.save() + send_message.delay(order.id,'collaborative_cancelled') return @classmethod diff --git a/api/messages.py b/api/messages.py index 84076409..919f41c2 100644 --- a/api/messages.py +++ b/api/messages.py @@ -177,6 +177,34 @@ class Telegram(): self.send_message(user, text) return + def collaborative_cancelled(self, order): + user = order.maker + if not user.profile.telegram_enabled: + return + + lang = user.profile.telegram_lang_code + if lang == 'es': + text = f'La orden con ID {str(order.id)} fue cancelada colaborativamente.' + else: + text = f'Your order with ID {str(order.id)} has been collaboratively cancelled.' + + self.send_message(user, text) + return + + def dispute_opened(self, order): + user = order.maker + if not user.profile.telegram_enabled: + return + + lang = user.profile.telegram_lang_code + if lang == 'es': + text = f'La orden con ID {str(order.id)} ha entrado en disputa.' + else: + text = f'A dispute has been opened on your order with ID {str(order.id)}.' + + self.send_message(user, text) + return + def order_published(self, order): time.sleep(1) # Just so this message always arrives after the previous two diff --git a/api/tasks.py b/api/tasks.py index b6bf8081..85baff34 100644 --- a/api/tasks.py +++ b/api/tasks.py @@ -276,4 +276,10 @@ def send_message(order_id, message): elif message == 'fiat_exchange_starts': telegram.fiat_exchange_starts(order) + elif message == 'dispute_opened': + telegram.dispute_opened(order) + + elif message == 'collaborative_cancelled': + telegram.collaborative_cancelled(order) + return \ No newline at end of file diff --git a/dev_utils/reinitiate_db.sh b/dev_utils/reinitiate_db.sh deleted file mode 100644 index 32d63e95..00000000 --- a/dev_utils/reinitiate_db.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -rm db.sqlite3 - -rm -R api/migrations -rm -R frontend/migrations -rm -R frontend/static/assets/avatars - -python3 manage.py makemigrations -python3 manage.py makemigrations api - -python3 manage.py migrate - -python3 manage.py createsuperuser - -python3 manage.py runserver \ No newline at end of file diff --git a/docs/_pages/docs/03-understand/07-wallets.md b/docs/_pages/docs/03-understand/07-wallets.md index 8ba6f1c2..bcbfbd52 100644 --- a/docs/_pages/docs/03-understand/07-wallets.md +++ b/docs/_pages/docs/03-understand/07-wallets.md @@ -72,5 +72,5 @@ The hodl invoice shows as a grey icon while waiting. Need to tap the back obviou ## Help keep this page updated -There are many wallets and all of them keep improving at lightning speed. You can contribute to the RoboSats Open Source Project by testing wallets, editing [the content of this page](https://github.com/Reckless-Satoshi/robosats/tree/main/docs/{page.src}}) and opening a [Pull Request](https://github.com/Reckless-Satoshi/robosats/pulls) +There are many wallets and all of them keep improving at lightning speed. You can contribute to the RoboSats Open Source Project by testing wallets, editing [the content of this page](https://github.com/Reckless-Satoshi/robosats/tree/main/docs/{{page.src}}) and opening a [Pull Request](https://github.com/Reckless-Satoshi/robosats/pulls) diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js index c6cb8388..08f17e2e 100644 --- a/frontend/src/components/BottomBar.js +++ b/frontend/src/components/BottomBar.js @@ -61,7 +61,7 @@ class BottomBar extends Component { this.setState(null) fetch('/api/info/') .then((response) => response.json()) - .then((data) => this.setState(data) & console.log(data) + .then((data) => this.setState(data) & this.setState({active_order_id: data.active_order_id ? data.active_order_id : null, last_order_id: data.last_order_id ? data.last_order_id : null}) & this.props.setAppState({nickname:data.nickname, loading:false})); @@ -105,7 +105,7 @@ class BottomBar extends Component { }; fetch('/api/reward/', requestOptions) .then((response) => response.json()) - .then((data) => console.log(data) & this.setState({ + .then((data) => this.setState({ badInvoice:data.bad_invoice, openClaimRewards: data.successful_withdrawal ? false : true, earned_rewards: data.successful_withdrawal ? 0 : this.state.earned_rewards,