mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fix reliability telegram notifications
This commit is contained in:
parent
afb7566e50
commit
0c7e1ae021
@ -58,23 +58,6 @@ class Telegram:
|
||||
user.profile.save()
|
||||
return
|
||||
|
||||
# def welcome(self, user):
|
||||
# lang = user.profile.telegram_lang_code
|
||||
|
||||
# # In weird cases the order cannot be found (e.g. it is cancelled)
|
||||
# queryset = Order.objects.filter(maker=user)
|
||||
# order = queryset.last()
|
||||
|
||||
# print(str(order.id))
|
||||
# if lang == 'es':
|
||||
# text = f'Hola {user.username}, te enviaré un mensaje cuando tu orden con ID {str(order.id)} haya sido tomada.'
|
||||
# else:
|
||||
# text = f"Hey {user.username}, I will send you a message when someone takes your order with ID {str(order.id)}."
|
||||
# self.send_message(user, text)
|
||||
# user.profile.telegram_welcomed = True
|
||||
# user.profile.save()
|
||||
# return
|
||||
|
||||
def order_taken_confirmed(self, order):
|
||||
if order.maker.profile.telegram_enabled:
|
||||
lang = order.maker.profile.telegram_lang_code
|
||||
|
@ -299,7 +299,10 @@ def send_message(order_id, message):
|
||||
from api.models import Order
|
||||
|
||||
order = Order.objects.get(id=order_id)
|
||||
if not order.maker.profile.telegram_enabled:
|
||||
taker_enabled = (
|
||||
False if order.taker is None else order.taker.profile.telegram_enabled
|
||||
)
|
||||
if not (order.maker.profile.telegram_enabled or taker_enabled):
|
||||
return
|
||||
|
||||
from api.messages import Telegram
|
||||
|
@ -751,6 +751,7 @@ class UserView(APIView):
|
||||
|
||||
user.profile.save()
|
||||
|
||||
context = {**context, **Telegram.get_context(user)}
|
||||
context["public_key"] = user.profile.public_key
|
||||
context["encrypted_private_key"] = user.profile.encrypted_private_key
|
||||
context["wants_stealth"] = user.profile.wants_stealth
|
||||
|
Loading…
Reference in New Issue
Block a user