mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* MM-15302: Migrate `Preference.Delete` to Sync by default #10715 * MM-15302: Migrate `Preference.Delete` to Sync by default #10715 * regenerate store mocks * fix shadow var
This commit is contained in:
committed by
Jesús Espino
parent
c2d7fba39a
commit
599dcb0f77
@@ -236,18 +236,21 @@ func (s SqlPreferenceStore) IsFeatureEnabled(feature, userId string) (bool, *mod
|
||||
return value == "true", nil
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) Delete(userId, category, name string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
if _, err := s.GetMaster().Exec(
|
||||
`DELETE FROM
|
||||
Preferences
|
||||
WHERE
|
||||
UserId = :UserId
|
||||
AND Category = :Category
|
||||
AND Name = :Name`, map[string]interface{}{"UserId": userId, "Category": category, "Name": name}); err != nil {
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.Delete", "store.sql_preference.delete.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
})
|
||||
func (s SqlPreferenceStore) Delete(userId, category, name string) *model.AppError {
|
||||
query :=
|
||||
`DELETE FROM Preferences
|
||||
WHERE
|
||||
UserId = :UserId
|
||||
AND Category = :Category
|
||||
AND Name = :Name`
|
||||
|
||||
_, err := s.GetMaster().Exec(query, map[string]interface{}{"UserId": userId, "Category": category, "Name": name})
|
||||
|
||||
if err != nil {
|
||||
return model.NewAppError("SqlPreferenceStore.Delete", "store.sql_preference.delete.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) DeleteCategory(userId string, category string) *model.AppError {
|
||||
|
||||
Reference in New Issue
Block a user