Implement executing tasks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from asgiref.sync import sync_to_async
|
||||
from django.conf import settings
|
||||
import uuid
|
||||
|
||||
from core.messaging.utils import messages_to_string
|
||||
from core.models import ChatSession, Message, QueuedMessage
|
||||
@@ -316,9 +317,21 @@ async def apply_reaction(
|
||||
target = None
|
||||
target_uuid = str(target_message_id or "").strip()
|
||||
if target_uuid:
|
||||
target = await sync_to_async(
|
||||
lambda: queryset.filter(id=target_uuid).order_by("-ts").first()
|
||||
)()
|
||||
is_uuid = True
|
||||
try:
|
||||
uuid.UUID(str(target_uuid))
|
||||
except Exception:
|
||||
is_uuid = False
|
||||
if is_uuid:
|
||||
target = await sync_to_async(
|
||||
lambda: queryset.filter(id=target_uuid).order_by("-ts").first()
|
||||
)()
|
||||
if target is None:
|
||||
target = await sync_to_async(
|
||||
lambda: queryset.filter(source_message_id=target_uuid)
|
||||
.order_by("-ts")
|
||||
.first()
|
||||
)()
|
||||
|
||||
if target is None:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user