Skip to content

Commit

Permalink
commit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MHHukiewitz authored and odesenfans committed Sep 5, 2023
1 parent ec34326 commit 39b600d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/aleph/db/accessors/messages.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/aleph/web/controllers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,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."
Expand Down

0 comments on commit 39b600d

Please sign in to comment.