diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-07-14 10:08:36 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-07-14 10:08:36 -0400 |
commit | caabfbcdd56bdced7c5c1d38e00f488adffe7c60 (patch) | |
tree | 4d52326767246f331da352f0427e34bf714e3130 /store/sql_preference_store.go | |
parent | 8e810bc2ebb743717b5b0fc4541fcd3b2565966c (diff) | |
download | chat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.tar.gz chat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.tar.bz2 chat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.zip |
PLT-2992 Added the ability to use different themes for each team (#3411)
* Cleaned up user_settings_theme.jsx and import_theme_modal.jsx
* Made ImportThemeModal use a callback to return the theme to the user settings modal instead of saving it directly
* Moved user theme from model to preferences
* Added serverside API to delete preferences TODO update package with client stuff
* Changed constants.jsx so that Preferences and ActionTypes can be imported on their own
* Updated ThemeProps migration code to properly rename solarized code themes
* Fixed warnings thrown by AppDispatcher
* Added clientside UI to support team-specific themes
* Removed debugging code from test
* Fixed setting a user's theme when they haven't set their theme before
Diffstat (limited to 'store/sql_preference_store.go')
-rw-r--r-- | store/sql_preference_store.go | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go index 83bf92ead..a701c3cb8 100644 --- a/store/sql_preference_store.go +++ b/store/sql_preference_store.go @@ -26,7 +26,7 @@ func NewSqlPreferenceStore(sqlStore *SqlStore) PreferenceStore { table.ColMap("UserId").SetMaxSize(26) table.ColMap("Category").SetMaxSize(32) table.ColMap("Name").SetMaxSize(32) - table.ColMap("Value").SetMaxSize(128) + table.ColMap("Value").SetMaxSize(2000) } return s @@ -100,6 +100,8 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel { func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *model.Preference) StoreResult { result := StoreResult{} + preference.PreUpdate() + if result.Err = preference.IsValid(); result.Err != nil { return result } @@ -304,3 +306,26 @@ func (s SqlPreferenceStore) IsFeatureEnabled(feature, userId string) StoreChanne return storeChannel } + +func (s SqlPreferenceStore) Delete(userId, category, name string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := 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.NewLocAppError("SqlPreferenceStore.Delete", "store.sql_preference.delete.app_error", nil, err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |