From 65109a204a87c0cfccca15be73370dcd9099a233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Fri, 20 Jan 2023 11:19:38 +0100 Subject: [PATCH 1/3] Add event code for group changes. This MR adds the boilerplate to support emiting group change events. --- pkg/events/groups.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/events/groups.go b/pkg/events/groups.go index 495eb90352..b639a99923 100644 --- a/pkg/events/groups.go +++ b/pkg/events/groups.go @@ -77,3 +77,23 @@ func (GroupMemberRemoved) Unmarshal(v []byte) (interface{}, error) { err := json.Unmarshal(v, &e) return e, err } + +// GroupFeature represents a group feature +type GroupFeature struct { + Name string + Value string +} + +// UserFeatureChanged is emitted when a group feature was changed +type GroupFeatureChanged struct { + Executant *user.UserId + UserID string + Features []GroupFeature +} + +// Unmarshal to fulfill unmarshaller interface +func (GroupFeatureChanged) Unmarshal(v []byte) (interface{}, error) { + e := GroupFeatureChanged{} + err := json.Unmarshal(v, &e) + return e, err +} From 9861969480420c876bb2fcd4fe1e6e06f5507618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Fri, 20 Jan 2023 11:25:56 +0100 Subject: [PATCH 2/3] Add changelog and fix comment. --- changelog/unreleased/group-changed-event.md | 5 +++++ pkg/events/groups.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/group-changed-event.md diff --git a/changelog/unreleased/group-changed-event.md b/changelog/unreleased/group-changed-event.md new file mode 100644 index 0000000000..8722a87fc7 --- /dev/null +++ b/changelog/unreleased/group-changed-event.md @@ -0,0 +1,5 @@ +Enhancement: Group feature changed event added + +We added a group feature changed event. + +https://github.com/cs3org/reva/pull/3612 diff --git a/pkg/events/groups.go b/pkg/events/groups.go index b639a99923..4d50c00499 100644 --- a/pkg/events/groups.go +++ b/pkg/events/groups.go @@ -84,7 +84,7 @@ type GroupFeature struct { Value string } -// UserFeatureChanged is emitted when a group feature was changed +// GroupFeatureChanged is emitted when a group feature was changed type GroupFeatureChanged struct { Executant *user.UserId UserID string From a6526edd7be1ee980a4d4302f986a8df4688d0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Franke?= Date: Fri, 20 Jan 2023 11:39:24 +0100 Subject: [PATCH 3/3] Change UserID to GroupID. --- pkg/events/groups.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/events/groups.go b/pkg/events/groups.go index 4d50c00499..c6bff4a9b0 100644 --- a/pkg/events/groups.go +++ b/pkg/events/groups.go @@ -87,7 +87,7 @@ type GroupFeature struct { // GroupFeatureChanged is emitted when a group feature was changed type GroupFeatureChanged struct { Executant *user.UserId - UserID string + GroupID string Features []GroupFeature }