Skip to content

Commit

Permalink
Merge pull request #1456 from maykinmedia/issue/2832-also-show-archiv…
Browse files Browse the repository at this point in the history
…ed-documents

[#2832] Rx.mission/Venray: Also show documents with the status archived
  • Loading branch information
alextreme authored Oct 29, 2024
2 parents cf2b17c + f6fb6a0 commit c173dcb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
45 changes: 45 additions & 0 deletions src/open_inwoner/openzaak/tests/test_case_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,19 @@ def setUp(self):
bestandsnaam="geheim-document.txt",
bestandsomvang=123,
)
self.informatie_object_archived = generate_oas_component_cached(
"drc",
"schemas/EnkelvoudigInformatieObject",
uuid="7e4c4bbb-982e-4dfb-86b6-23ef41f97282",
url=f"{DOCUMENTEN_ROOT}enkelvoudiginformatieobjecten/7e4c4bbb-982e-4dfb-86b6-23ef41f97282",
inhoud=f"{DOCUMENTEN_ROOT}enkelvoudiginformatieobjecten/014c38fe-b010-4412-881c-3000032fb812/download",
informatieobjecttype=self.informatie_object_type["url"],
status="gearchiveerd",
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
bestandsnaam="uploaded_document.txt",
titel="uploaded_document_title.txt",
bestandsomvang=123,
)

#
# Zaken API (ZRC)
Expand Down Expand Up @@ -501,6 +514,17 @@ def setUp(self):
beschrijving="",
registratiedatum="2021-01-12",
)
self.zaak_informatie_object_archived = generate_oas_component_cached(
"zrc",
"schemas/ZaakInformatieObject",
url=f"{ZAKEN_ROOT}zaakinformatieobjecten/fa5153aa-ad2c-4a07-ae75-15add57ee",
informatieobject=self.informatie_object_archived["url"],
zaak=self.zaak_invisible["url"],
aardRelatieWeergave="some invisible content",
titel="",
beschrijving="",
registratiedatum="2021-01-12",
)

#
# Contactmomenten API (CMC)
Expand Down Expand Up @@ -623,6 +647,21 @@ def setUp(self):
},
),
)
self.informatie_object_file_archived = SimpleFile(
name="document_archived.txt",
size=123,
url=reverse(
"cases:document_download",
kwargs={
"object_id": self.zaak["uuid"],
"info_id": self.informatie_object_archived["uuid"],
"api_group_id": self.api_group.id,
},
),
created=dateutil.parser.parse(
self.zaak_informatie_object_new["registratiedatum"]
),
)

def _setUpMocks(self, m, use_eindstatus=True):
if use_eindstatus:
Expand Down Expand Up @@ -1280,6 +1319,9 @@ def test_document_ordering_by_date(self, m):
# install mocks with additional case documents
m.get(self.informatie_object["url"], json=self.informatie_object)
m.get(self.informatie_object_2["url"], json=self.informatie_object_2)
m.get(
self.informatie_object_archived["url"], json=self.informatie_object_archived
)

m.post(
f"{ZAKEN_ROOT}zaakinformatieobjecten",
Expand All @@ -1294,6 +1336,7 @@ def test_document_ordering_by_date(self, m):
json=[
self.zaak_informatie_object_old,
self.zaak_informatie_object_new,
self.zaak_informatie_object_archived,
],
)

Expand All @@ -1306,10 +1349,12 @@ def test_document_ordering_by_date(self, m):
response = self.app.get(self.case_detail_url, user=self.user)

documents = response.context.get("case")["documents"]
self.assertEqual(len(documents), 3)

# order should be reverse of list order from response
self.assertEqual(documents[0].name, self.informatie_object_2["titel"])
self.assertEqual(documents[1].name, self.informatie_object["titel"])
self.assertEqual(documents[1].name, self.informatie_object_archived["titel"])

def test_document_ordering_by_name(self, m):
"""
Expand Down
6 changes: 3 additions & 3 deletions src/open_inwoner/openzaak/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def is_info_object_visible(
"""
Test if a InformatieObject (case info object) should be visible to the user.
We check on its definitive status, and a maximum confidentiality level (compared the
ordering from the VertrouwelijkheidsAanduidingen.choices)
We check on its definitive or archived status, and a maximum confidentiality
level (compared the ordering from the VertrouwelijkheidsAanduidingen.choices)
"""
if info_object.status != "definitief":
if info_object.status not in ["definitief", "gearchiveerd"]:
return False

return is_object_visible(info_object, max_confidentiality_level)
Expand Down

0 comments on commit c173dcb

Please sign in to comment.