From b898b9dd00289a32af4be07e5e76475504934138 Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Mon, 13 Jan 2025 17:13:44 -0800 Subject: [PATCH 1/5] property value should be a URI, re #11727 --- arches/app/utils/activity_stream_jsonld.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arches/app/utils/activity_stream_jsonld.py b/arches/app/utils/activity_stream_jsonld.py index b9feb19771e..6fe8daaaa77 100644 --- a/arches/app/utils/activity_stream_jsonld.py +++ b/arches/app/utils/activity_stream_jsonld.py @@ -155,7 +155,8 @@ def add_resource(editlog_object, perm_level=perm_level): # Tombstone instead. obj["formerType"] = obj["type"] obj["type"] = "Tombstone" - obj["id"] = editlog_object.resourceinstanceid + + obj["id"] = self.base_uri_for_arches + reverse("resources", args=(editlog_object.resourceinstanceid,)) return obj From ed68dea0f9294bcdad821c63f80241e9a5c412b9 Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Mon, 13 Jan 2025 17:20:59 -0800 Subject: [PATCH 2/5] add readme, re #11727 --- releases/7.6.5.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 releases/7.6.5.md diff --git a/releases/7.6.5.md b/releases/7.6.5.md new file mode 100644 index 00000000000..5ab1ea4dbc9 --- /dev/null +++ b/releases/7.6.5.md @@ -0,0 +1,31 @@ +## Arches 7.6.5 Release Notes + +### Bug Fixes and Enhancements + +- Fix Activity Stream id value #[11727](https://github.com/archesproject/arches/issues/11727) + +### Dependency changes: + +``` +Python: + Upgraded: + Django == 4.2.17 (or <5.0.0) +JavaScript: + Upgraded: + none +``` + +### Upgrading Arches + +1. Upgrade to version 7.6.0 before proceeding by following the upgrade process in the [Version 7.6.0 release notes](https://github.com/archesproject/arches/blob/dev/7.6.x/releases/7.6.0.md) + +2. Upgrade to Arches 7.6.5 + + ``` + pip install --upgrade arches==7.6.5 + ``` + +3. If you are running Arches on Apache, restart your server: + ``` + sudo service apache2 reload + ``` From b4695975692cf7c80ff8af3b3d6f666c139c90c3 Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Mon, 13 Jan 2025 17:40:43 -0800 Subject: [PATCH 3/5] fix formatting, re #11727 --- arches/app/utils/activity_stream_jsonld.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arches/app/utils/activity_stream_jsonld.py b/arches/app/utils/activity_stream_jsonld.py index 6fe8daaaa77..e9c5393b800 100644 --- a/arches/app/utils/activity_stream_jsonld.py +++ b/arches/app/utils/activity_stream_jsonld.py @@ -156,7 +156,9 @@ def add_resource(editlog_object, perm_level=perm_level): obj["formerType"] = obj["type"] obj["type"] = "Tombstone" - obj["id"] = self.base_uri_for_arches + reverse("resources", args=(editlog_object.resourceinstanceid,)) + obj["id"] = self.base_uri_for_arches + reverse( + "resources", args=(editlog_object.resourceinstanceid,) + ) return obj From 6c4868102f222dc24cbc017c91893618a9356cf6 Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Tue, 14 Jan 2025 13:22:25 -0800 Subject: [PATCH 4/5] add test, re #11727 --- tests/utils/activitystream.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/utils/activitystream.py b/tests/utils/activitystream.py index 212d718234f..c57413b9853 100644 --- a/tests/utils/activitystream.py +++ b/tests/utils/activitystream.py @@ -17,23 +17,27 @@ """ import os +import json from unittest.mock import Mock from tests.base_test import ArchesTestCase from rdflib import Namespace -from arches.app.utils.activity_stream_jsonld import ActivityStreamCollection +from uuid import uuid4 +from itertools import cycle +from datetime import datetime + +from django.core.validators import URLValidator +from arches.app.utils.activity_stream_jsonld import ActivityStreamCollection from arches.app.utils.betterJSONSerializer import JSONDeserializer from arches.app.utils.data_management.resource_graphs.importer import ( import_graph as ResourceGraphImporter, ) -from arches.app.models.models import ResourceInstance from arches.app.utils.skos import SKOSReader -from uuid import uuid4 -from itertools import cycle -from datetime import datetime -import json from arches.app.models.models import ResourceInstance, GraphModel +# these tests can be run from the command line via +# python manage.py test tests.utils.activitystream --settings="tests.test_settings" + ARCHES_NS = Namespace("https://arches.getty.edu/") CIDOC_NS = Namespace("http://www.cidoc-crm.org/cidoc-crm/") COL_NS = Namespace(ARCHES_NS["history/"]) @@ -164,3 +168,5 @@ def test_generate_page(self): ) obj = collection_page.to_obj() self.assertIn("id", obj["orderedItems"][0]["object"]) + self.assertIsNone(URLValidator()(obj["orderedItems"][0]["object"]["id"])) + From 3ae9cd9a2c6f423f93383f8c50f8c69cac0d83ac Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Tue, 14 Jan 2025 15:12:43 -0800 Subject: [PATCH 5/5] format, re #11727 --- tests/utils/activitystream.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/utils/activitystream.py b/tests/utils/activitystream.py index c57413b9853..9cc1ff8868a 100644 --- a/tests/utils/activitystream.py +++ b/tests/utils/activitystream.py @@ -169,4 +169,3 @@ def test_generate_page(self): obj = collection_page.to_obj() self.assertIn("id", obj["orderedItems"][0]["object"]) self.assertIsNone(URLValidator()(obj["orderedItems"][0]["object"]["id"])) -