(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", "name": "TCAOFF",
"textColor": "#434343", "textColor": "#434343",
"backgroundColor": "#cccccc" "backgroundColor": "#e7e7e7"
}, },
{ {
"name": "CA-Doc", "name": "CA-Doc",
"textColor": "#434343", "textColor": "#434343",
"backgroundColor": "#cccccc" "backgroundColor": "#e7e7e7"
}, },
{ {
"name": "CA-AI", "name": "CA-AI",
"textColor": "#434343", "textColor": "#434343",
"backgroundColor": "#cccccc" "backgroundColor": "#e7e7e7"
} }
] ]
tasks = [ tasks = [
+10 -6
View File
@@ -455,12 +455,16 @@ class MailSyncModel(BaseModel):
) )
# Apply the labels to the read messages: # Apply the labels to the read messages:
try: client_response = await mail_client.modify_messages( try:
tokens = tokens, client_response = await mail_client.modify_messages(
message_ids = [v["id"] for v in messages_list], tokens = tokens,
add_label_ids = [tokens.labels.get("TCAOFF")] message_ids = [v["id"] for v in messages_list.values()],
) add_label_ids = [tokens.labels.get("TCAOFF", {}).get("id")]
except Exception as exception: self._printer(exception) )
print(client_response)
print([tokens.labels.get("TCAOFF")])
except Exception as exception:
self._printer(exception)
# Done here: # Done here:
sync_results.message = f"{sync_results.successCount}/{sync_results.totalCount} mail(s) sync'd from gmail" sync_results.message = f"{sync_results.successCount}/{sync_results.totalCount} mail(s) sync'd from gmail"