diff --git a/changelog/unreleased/fileupdated-activity.md b/changelog/unreleased/fileupdated-activity.md new file mode 100644 index 0000000000..484922af5f --- /dev/null +++ b/changelog/unreleased/fileupdated-activity.md @@ -0,0 +1,5 @@ +Enhancement: Add an Activity for FileUpdated + +Previously FileUpdated has also triggered a FileAdded Activity + +https://github.com/owncloud/ocis/pull/10072 diff --git a/services/activitylog/pkg/service/http.go b/services/activitylog/pkg/service/http.go index 2c3139e18a..a1cfc18faf 100644 --- a/services/activitylog/pkg/service/http.go +++ b/services/activitylog/pkg/service/http.go @@ -121,6 +121,9 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h continue case events.UploadReady: message = MessageResourceCreated + if ev.IsVersion { + message = MessageResourceUpdated + } ts = utils.TSToTime(ev.Timestamp) vars, err = s.GetVars(ctx, WithResource(ev.FileRef, true), WithUser(ev.ExecutingUser.GetId(), ev.ExecutingUser.GetDisplayName()), WithSpace(toSpace(ev.FileRef))) case events.FileTouched: diff --git a/services/activitylog/pkg/service/response.go b/services/activitylog/pkg/service/response.go index c03dc9f169..e8c80f8af2 100644 --- a/services/activitylog/pkg/service/response.go +++ b/services/activitylog/pkg/service/response.go @@ -21,6 +21,7 @@ import ( // Translations var ( MessageResourceCreated = l10n.Template("{user} added {resource} to {space}") + MessageResourceUpdated = l10n.Template("{user} updated {resource} in {folder}") MessageResourceTrashed = l10n.Template("{user} deleted {resource} from {space}") MessageResourceMoved = l10n.Template("{user} moved {resource} to {space}") MessageResourceRenamed = l10n.Template("{user} renamed {oldResource} to {resource}") diff --git a/tests/acceptance/features/apiActivities/shareActivities.feature b/tests/acceptance/features/apiActivities/shareActivities.feature index 4994330b0e..7d039e5b32 100644 --- a/tests/acceptance/features/apiActivities/shareActivities.feature +++ b/tests/acceptance/features/apiActivities/shareActivities.feature @@ -540,6 +540,47 @@ Feature: check share activity "properties": { "message": { "const": "{user} added {resource} to {space}" + }, + "variables": { + "type": "object", + "required": ["resource","space","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "space": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%!%user_id_pattern%$" + }, + "name": { + "const": "Alice Hansen" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } + } + } + } } } } @@ -598,7 +639,7 @@ Feature: check share activity "properties": { "id": { "type": "string", - "pattern": "^%user_id_pattern%!%user_id_pattern%$" + "pattern": "^%file_id_pattern%$" }, "name": { "const": "Alice Hansen" @@ -637,7 +678,7 @@ Feature: check share activity "required": ["message","variables"], "properties": { "message": { - "const": "{user} added {resource} to {space}" + "const": "{user} updated {resource} in {folder}" }, "variables": { "type": "object", @@ -658,7 +699,7 @@ Feature: check share activity "properties": { "id": { "type": "string", - "pattern": "^%user_id_pattern%!%user_id_pattern%$" + "pattern": "^%file_id_pattern%$" }, "name": { "const": "Alice Hansen"