Adds a mechanism to delete CPA values for a given user (#30330)

* Adds a mechanism to delete CPA values for a given user

This requires improving the Property Value service to enable delete
all values for a given target, so a new method was created that allows
to delete filtering by targetType and targetID (required) and
optionally for a specific groupID in case the caller wants to affect
all values for a target (useful in case you remove a post for example
and want to delete all values pointing to that post regardless of the
feature they belong to) or only those that belong to a specific
feature.

* Fix property value tests

* Fix after merge and update method name

* Fix linter

---------

Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Miguel de la Cruz
2025-04-10 19:22:05 +02:00
коммит произвёл GitHub
родитель 3ab0da1648
Коммит ca9fd45408
10 изменённых файлов: 307 добавлений и 0 удалений

Просмотреть файл

@@ -80,6 +80,24 @@ func (_m *PropertyValueStore) DeleteForField(id string) error {
return r0
}
// DeleteForTarget provides a mock function with given fields: groupID, targetType, targetID
func (_m *PropertyValueStore) DeleteForTarget(groupID string, targetType string, targetID string) error {
ret := _m.Called(groupID, targetType, targetID)
if len(ret) == 0 {
panic("no return value specified for DeleteForTarget")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(groupID, targetType, targetID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: groupID, id
func (_m *PropertyValueStore) Get(groupID string, id string) (*model.PropertyValue, error) {
ret := _m.Called(groupID, id)