diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-20 07:59:56 -0600 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-20 07:59:56 -0600 |
commit | f5eb3c1bcb0c7e367f64bd8e5a0d2d5418f8e2ef (patch) | |
tree | c40d7064cd2045c36b5c95db8faa9997497e459a /store/sql_preference_store.go | |
parent | 1acd38b7b19521d06d274c42c00ce7072cd92196 (diff) | |
download | chat-f5eb3c1bcb0c7e367f64bd8e5a0d2d5418f8e2ef.tar.gz chat-f5eb3c1bcb0c7e367f64bd8e5a0d2d5418f8e2ef.tar.bz2 chat-f5eb3c1bcb0c7e367f64bd8e5a0d2d5418f8e2ef.zip |
PLT-7 adding loc for db calls audits and prefs
Diffstat (limited to 'store/sql_preference_store.go')
-rw-r--r-- | store/sql_preference_store.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go index 6302d2f4f..234396058 100644 --- a/store/sql_preference_store.go +++ b/store/sql_preference_store.go @@ -8,6 +8,7 @@ import ( "github.com/go-gorp/gorp" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" + goi18n "github.com/nicksnyder/go-i18n/i18n" ) type SqlPreferenceStore struct { @@ -41,7 +42,7 @@ func (s SqlPreferenceStore) CreateIndexesIfNotExists() { s.CreateIndexIfNotExists("idx_preferences_name", "Preferences", "Name") } -func (s SqlPreferenceStore) DeleteUnusedFeatures() { +func (s SqlPreferenceStore) DeleteUnusedFeatures(T goi18n.TranslateFunc) { l4g.Debug("Deleting any unused pre-release features") sql := `DELETE @@ -58,7 +59,7 @@ func (s SqlPreferenceStore) DeleteUnusedFeatures() { s.GetMaster().Exec(sql, queryParams) } -func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { +func (s SqlPreferenceStore) Save(T goi18n.TranslateFunc, preferences *model.Preferences) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -70,7 +71,7 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { result.Err = model.NewAppError("SqlPreferenceStore.Save", "Unable to open transaction to save preferences", err.Error()) } else { for _, preference := range *preferences { - if upsertResult := s.save(transaction, &preference); upsertResult.Err != nil { + if upsertResult := s.save(T, transaction, &preference); upsertResult.Err != nil { result = upsertResult break } @@ -97,7 +98,7 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { return storeChannel } -func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *model.Preference) StoreResult { +func (s SqlPreferenceStore) save(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult { result := StoreResult{} if result.Err = preference.IsValid(); result.Err != nil { @@ -139,9 +140,9 @@ func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *mode } if count == 1 { - s.update(transaction, preference) + s.update(T, transaction, preference) } else { - s.insert(transaction, preference) + s.insert(T, transaction, preference) } } else { result.Err = model.NewAppError("SqlPreferenceStore.save", "We encountered an error while updating preferences", @@ -151,7 +152,7 @@ func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *mode return result } -func (s SqlPreferenceStore) insert(transaction *gorp.Transaction, preference *model.Preference) StoreResult { +func (s SqlPreferenceStore) insert(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult { result := StoreResult{} if err := transaction.Insert(preference); err != nil { @@ -167,7 +168,7 @@ func (s SqlPreferenceStore) insert(transaction *gorp.Transaction, preference *mo return result } -func (s SqlPreferenceStore) update(transaction *gorp.Transaction, preference *model.Preference) StoreResult { +func (s SqlPreferenceStore) update(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult { result := StoreResult{} if _, err := transaction.Update(preference); err != nil { @@ -178,7 +179,7 @@ func (s SqlPreferenceStore) update(transaction *gorp.Transaction, preference *mo return result } -func (s SqlPreferenceStore) Get(userId string, category string, name string) StoreChannel { +func (s SqlPreferenceStore) Get(T goi18n.TranslateFunc, userId string, category string, name string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -207,7 +208,7 @@ func (s SqlPreferenceStore) Get(userId string, category string, name string) Sto return storeChannel } -func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreChannel { +func (s SqlPreferenceStore) GetCategory(T goi18n.TranslateFunc, userId string, category string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -235,7 +236,7 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreCha return storeChannel } -func (s SqlPreferenceStore) GetAll(userId string) StoreChannel { +func (s SqlPreferenceStore) GetAll(T goi18n.TranslateFunc, userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -262,7 +263,7 @@ func (s SqlPreferenceStore) GetAll(userId string) StoreChannel { return storeChannel } -func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) StoreChannel { +func (s SqlPreferenceStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -280,7 +281,7 @@ func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) StoreChannel { return storeChannel } -func (s SqlPreferenceStore) IsFeatureEnabled(feature, userId string) StoreChannel { +func (s SqlPreferenceStore) IsFeatureEnabled(T goi18n.TranslateFunc, feature, userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { |