Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
message send: Introduce dataclass to wrap user-notifications variables.
We will in later commits, extend this class to contain methods to determine if a message is notifiable or not, but for now we only turn it into a dict and pass it on.
- Loading branch information
1 parent
2179275
commit 951b49c
Showing
2 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
|
||
@dataclass | ||
class UserMessageNotificationsData: | ||
id: int | ||
flags: List[str] | ||
mentioned: bool | ||
online_push_enabled: bool | ||
stream_push_notify: bool | ||
stream_email_notify: bool | ||
wildcard_mention_notify: bool | ||
sender_is_muted: bool | ||
|
||
def __post_init__(self) -> None: | ||
if self.mentioned: | ||
assert "mentioned" in self.flags | ||
if self.wildcard_mention_notify: | ||
assert "wildcard_mentioned" in self.flags |