Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileUpdated Activity #10072

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fileupdated-activity.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions services/activitylog/pkg/service/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,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:
Expand Down
1 change: 1 addition & 0 deletions services/activitylog/pkg/service/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
47 changes: 44 additions & 3 deletions tests/acceptance/features/apiActivities/shareActivities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
}
}
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down