(20241203) Working with labels.
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
|
||||
# To make sibling directories accessible for imports:
|
||||
import sys
|
||||
from logging import exception
|
||||
|
||||
sys.path.append(".")
|
||||
sys.path.append("..")
|
||||
|
||||
@@ -134,7 +136,6 @@ class MailSyncModel(BaseModel):
|
||||
|
||||
@staticmethod
|
||||
async def __save_one_attachment(
|
||||
self,
|
||||
session_token: str,
|
||||
attachment: Dict[str, Any],
|
||||
attachment_tags: List[str],
|
||||
@@ -453,6 +454,14 @@ class MailSyncModel(BaseModel):
|
||||
requests = mongo_operations
|
||||
)
|
||||
|
||||
# Apply the labels to the read messages:
|
||||
try: client_response = await mail_client.modify_messages(
|
||||
tokens = tokens,
|
||||
message_ids = [v["id"] for v in messages_list],
|
||||
add_label_ids = [tokens.labels.get("TCAOFF")]
|
||||
)
|
||||
except Exception as exception: self._printer(exception)
|
||||
|
||||
# Done here:
|
||||
sync_results.message = f"{sync_results.successCount}/{sync_results.totalCount} mail(s) sync'd from gmail"
|
||||
return sync_results
|
||||
|
||||
Reference in New Issue
Block a user