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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3ab0da1648
Коммит
ca9fd45408
@@ -7403,6 +7403,22 @@ func (s *TimerLayerPropertyValueStore) DeleteForField(id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPropertyValueStore) DeleteForTarget(groupID string, targetType string, targetID string) error {
|
||||
start := time.Now()
|
||||
|
||||
err := s.PropertyValueStore.DeleteForTarget(groupID, targetType, targetID)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if err == nil {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("PropertyValueStore.DeleteForTarget", success, elapsed)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPropertyValueStore) Get(groupID string, id string) (*model.PropertyValue, error) {
|
||||
start := time.Now()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user