(20241203) Label-work almost done for GMail.

This commit is contained in:
2024-12-03 17:10:03 +05:30
parent e749a27a92
commit b6274ca7a4
2 changed files with 13 additions and 9 deletions
+3 -3
View File
@@ -158,17 +158,17 @@ async def handle_gmail_callback() -> render_template:
{
"name": "TCAOFF",
"textColor": "#434343",
"backgroundColor": "#cccccc"
"backgroundColor": "#e7e7e7"
},
{
"name": "CA-Doc",
"textColor": "#434343",
"backgroundColor": "#cccccc"
"backgroundColor": "#e7e7e7"
},
{
"name": "CA-AI",
"textColor": "#434343",
"backgroundColor": "#cccccc"
"backgroundColor": "#e7e7e7"
}
]
tasks = [
+10 -6
View File
@@ -455,12 +455,16 @@ class MailSyncModel(BaseModel):
)
# 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)
try:
client_response = await mail_client.modify_messages(
tokens = tokens,
message_ids = [v["id"] for v in messages_list.values()],
add_label_ids = [tokens.labels.get("TCAOFF", {}).get("id")]
)
print(client_response)
print([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"