diff --git a/backend/src/middleware/notifications/notificationsMiddleware.spec.js b/backend/src/middleware/notifications/notificationsMiddleware.spec.js index 2122d009b..502ddaa8e 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.spec.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.spec.js @@ -371,7 +371,7 @@ describe('notifications', () => { expect(readAfter).toEqual(false) }) - it('does not update the `createdAt` attribute', async () => { + it('updates the `createdAt` attribute', async () => { await createPostAction() await markAsReadAction() const { diff --git a/neo4j/change_disabled_relationship_to_claim_node.sh b/neo4j/change_disabled_relationship_to_claim_node.sh deleted file mode 100755 index 9d587d906..000000000 --- a/neo4j/change_disabled_relationship_to_claim_node.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -ENV_FILE=$(dirname "$0")/.env -[[ -f "$ENV_FILE" ]] && source "$ENV_FILE" - -if [ -z "$NEO4J_USERNAME" ] || [ -z "$NEO4J_PASSWORD" ]; then - echo "Please set NEO4J_USERNAME and NEO4J_PASSWORD environment variables." - echo "Database manipulation is not possible without connecting to the database." - echo "E.g. you could \`cp .env.template .env\` unless you run the script in a docker container" -fi - -until echo 'RETURN "Connection successful" as info;' | cypher-shell -do - echo "Connecting to neo4j failed, trying again..." - sleep 1 -done - -echo " -// convert old DISABLED to new REVIEWED-Report-BELONGS_TO structure -MATCH (moderator:User)-[disabled:DISABLED]->(disabledResource) -WHERE disabledResource:User OR disabledResource:Comment OR disabledResource:Post -DELETE disabled -CREATE (moderator)-[review:REVIEWED]->(report:Report)-[:BELONGS_TO]->(disabledResource) -SET review.createdAt = toString(datetime()), review.updatedAt = review.createdAt, review.disable = true -SET report.id = randomUUID(), report.createdAt = toString(datetime()), report.updatedAt = report.createdAt, report.rule = 'latestReviewUpdatedAtRules', report.disable = true, report.closed = false - -// if disabledResource has no report, then create a moderators default report -WITH moderator, disabledResource, report -OPTIONAL MATCH (disabledResourceReporter:User)-[existingReport:FILED]->(disabledResource) -FOREACH(disabledResource IN CASE WHEN existingReport IS NULL THEN [1] ELSE [] END | - CREATE (moderator)-[addModeratorReport:FILED]->(report) - SET addModeratorReport.createdAt = toString(datetime()), addModeratorReport.reasonCategory = 'other', addModeratorReport.reasonDescription = 'Old DISABLED relation had no now mandatory report !!! Created automatically to ensure database consistency! Creation date is when the database manipulation happened.' -) -FOREACH(disabledResource IN CASE WHEN existingReport IS NOT NULL THEN [1] ELSE [] END | - CREATE (disabledResourceReporter)-[moveModeratorReport:FILED]->(report) - SET moveModeratorReport = existingReport - DELETE existingReport -) - -RETURN disabledResource {.id}; -" | cypher-shell - -echo " -// for FILED resources without DISABLED relation which are handled above, create new FILED-Report-BELONGS_TO structure -MATCH (reporter:User)-[oldReport:FILED]->(notDisabledResource) -WHERE notDisabledResource:User OR notDisabledResource:Comment OR notDisabledResource:Post -MERGE (report:Report)-[:BELONGS_TO]->(notDisabledResource) -ON CREATE SET report.id = randomUUID(), report.createdAt = toString(datetime()), report.updatedAt = report.createdAt, report.rule = 'latestReviewUpdatedAtRules', report.disable = false, report.closed = false -CREATE (reporter)-[report:FILED]->(report) -SET report = oldReport -DELETE oldReport - -RETURN notDisabledResource {.id}; -" | cypher-shell - diff --git a/neo4j/storeOldScriptsAsTemplates/change_report_node_to_relationship.sh b/neo4j/storeOldScriptsAsTemplates/change_report_node_to_relationship.sh deleted file mode 100644 index da3a1dad9..000000000 --- a/neo4j/storeOldScriptsAsTemplates/change_report_node_to_relationship.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -ENV_FILE=$(dirname "$0")/.env -[[ -f "$ENV_FILE" ]] && source "$ENV_FILE" - -if [ -z "$NEO4J_USERNAME" ] || [ -z "$NEO4J_PASSWORD" ]; then - echo "Please set NEO4J_USERNAME and NEO4J_PASSWORD environment variables." - echo "Database manipulation is not possible without connecting to the database." - echo "E.g. you could \`cp .env.template .env\` unless you run the script in a docker container" -fi - -until echo 'RETURN "Connection successful" as info;' | cypher-shell -do - echo "Connecting to neo4j failed, trying again..." - sleep 1 -done - -echo " -MATCH (submitter:User)-[:FILED]->(report:Report)-[:FILED]->(resource) -DETACH DELETE report -CREATE (submitter)-[reported:FILED]->(resource) -SET reported.createdAt = toString(datetime()) -SET reported.reasonCategory = 'other' -SET reported.reasonDescription = '!!! Created automatically to ensure database consistency! Creation date is when the database manipulation happened.' -RETURN reported; -" | cypher-shell \ No newline at end of file