From cd175229e7a089c72a10eafa56c56e47ff2951dc Mon Sep 17 00:00:00 2001 From: Mike Hukiewitz Date: Tue, 6 Jun 2023 15:56:14 +0200 Subject: [PATCH] commit suggestions --- src/aleph/db/accessors/messages.py | 10 ++-------- src/aleph/web/controllers/messages.py | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/aleph/db/accessors/messages.py b/src/aleph/db/accessors/messages.py index 887f81bfd..cbccee4af 100644 --- a/src/aleph/db/accessors/messages.py +++ b/src/aleph/db/accessors/messages.py @@ -1,6 +1,5 @@ import datetime as dt import traceback -import warnings from typing import Optional, Sequence, Union, Iterable, Any, Mapping, overload, Tuple from aleph_message.models import ItemHash, Chain, MessageType @@ -90,14 +89,8 @@ def make_matching_messages_query( if chains: select_stmt = select_stmt.where(MessageDb.chain.in_(chains)) if message_types: - if len(message_types) == 1: - select_stmt = select_stmt.where(MessageDb.type == message_types[0]) - else: - select_stmt = select_stmt.where(MessageDb.type.in_(message_types)) + select_stmt = select_stmt.where(MessageDb.type.in_(message_types)) if message_type: - warnings.warn( - "Warning: `msgType`/`message_type` query parameter is deprecated in favor of `msgTypes`\`message_types` and will be removed in future versions." - ) select_stmt = select_stmt.where(MessageDb.type == message_type) if start_datetime: select_stmt = select_stmt.where(MessageDb.time >= start_datetime) @@ -244,6 +237,7 @@ def refresh_address_stats_mat_view(session: DbSession) -> None: def get_unconfirmed_messages( session: DbSession, limit: int = 100, chain: Optional[Chain] = None ) -> Iterable[MessageDb]: + if chain is None: select_message_confirmations = select(message_confirmations.c.item_hash).where( message_confirmations.c.item_hash == MessageDb.item_hash diff --git a/src/aleph/web/controllers/messages.py b/src/aleph/web/controllers/messages.py index 61b4d3c9e..25cec1d2e 100644 --- a/src/aleph/web/controllers/messages.py +++ b/src/aleph/web/controllers/messages.py @@ -65,10 +65,10 @@ class BaseMessageQueryParams(BaseModel): "-1 means most recent messages first, 1 means older messages first.", ) message_type: Optional[MessageType] = Field( - default=None, alias="msgType", description="[DEPRECATED] Message type." + default=None, alias="msgType", description="Message type. Deprecated: use msgTypes instead" ) message_types: Optional[List[MessageType]] = Field( - default=None, alias="msgTypes", description="Accepted types of messages." + default=None, alias="msgTypes", description="Accepted message types." ) addresses: Optional[List[str]] = Field( default=None, description="Accepted values for the 'sender' field."