mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added check for code theme (#3367)
This commit is contained in:
committed by
Christopher Speller
parent
2fc4b37828
commit
0485c5f64e
@@ -50,6 +50,27 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
||||
func (us SqlUserStore) UpgradeSchemaIfNeeded() {
|
||||
// ADDED for 2.0 REMOVE for 2.4
|
||||
us.CreateColumnIfNotExists("Users", "Locale", "varchar(5)", "character varying(5)", model.DEFAULT_LOCALE)
|
||||
|
||||
// ADDED for 3.2 REMOVE for 3.6
|
||||
var data []*model.User
|
||||
if _, err := us.GetReplica().Select(&data, "SELECT * FROM Users WHERE ThemeProps LIKE '%solarized%'"); err == nil {
|
||||
for _, user := range data {
|
||||
shouldUpdate := false
|
||||
if user.ThemeProps["codeTheme"] == "solarized_dark" {
|
||||
user.ThemeProps["codeTheme"] = "solarized-dark"
|
||||
shouldUpdate = true
|
||||
} else if user.ThemeProps["codeTheme"] == "solarized_light" {
|
||||
user.ThemeProps["codeTheme"] = "solarized-light"
|
||||
shouldUpdate = true
|
||||
}
|
||||
|
||||
if shouldUpdate {
|
||||
if result := <-us.Update(user, true); result.Err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (us SqlUserStore) CreateIndexesIfNotExists() {
|
||||
|
||||
Reference in New Issue
Block a user