This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 6a18426b8fa433dea1de16ede43766512e4eaae0
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Mar 31 12:24:02 2021 +0200

    fix type test bugs
---
 server/plugins/auditlog.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/plugins/auditlog.py b/server/plugins/auditlog.py
index 0d54ff9..fb5eeae 100644
--- a/server/plugins/auditlog.py
+++ b/server/plugins/auditlog.py
@@ -45,8 +45,9 @@ class AuditLogEntry:
 
 async def view(
     session: plugins.session.SessionObject, page: int = 0, num_entries: int = 
50, raw: bool = False
-) -> typing.List[dict]:
+) -> typing.AsyncGenerator:
     """ Returns N entries from the audit log, paginated """
+    assert session.database, "No database connection could be found!"
     res = await session.database.search(
         index=session.database.dbs.auditlog, size=num_entries, from_=page * 
num_entries, sort="date:desc",
     )
@@ -66,7 +67,8 @@ async def add_entry(session: plugins.session.SessionObject, 
action: str, target:
         log = f"Removed email {target} from {lid} archives"
     if not log and action == "edit":
         log = f"Modified email {target} from {lid} archives"
-
+    assert session.credentials, "No session credentials could be found!"
+    assert session.database, "Session not connected to database!"
     await session.database.index(
         index=session.database.dbs.auditlog,
         body={

Reply via email to