Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Use document owner for matching if set

shamoon5ae48c80125a
diff --git a/src/documents/matching.py b/src/documents/matching.py
index 39a3d52b5..521d49284 100644
--- a/src/documents/matching.py
+++ b/src/documents/matching.py
@@ -22,6 +22,9 @@ def log_reason(matching_model, document, reason):
def match_correspondents(document, classifier, user=None):
pred_id = classifier.predict_correspondent(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
correspondents = get_objects_for_user_owner_aware(
user,
@@ -39,6 +42,9 @@ def match_correspondents(document, classifier, user=None):
def match_document_types(document, classifier, user=None):
pred_id = classifier.predict_document_type(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
document_types = get_objects_for_user_owner_aware(
user,
@@ -56,6 +62,9 @@ def match_document_types(document, classifier, user=None):
def match_tags(document, classifier, user=None):
predicted_tag_ids = classifier.predict_tags(document.content) if classifier else []
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
tags = get_objects_for_user_owner_aware(user, "documents.view_tag", Tag)
else:
@@ -69,6 +78,9 @@ def match_tags(document, classifier, user=None):
def match_storage_paths(document, classifier, user=None):
pred_id = classifier.predict_storage_path(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
storage_paths = get_objects_for_user_owner_aware(
user,