Added check for code theme (#3367)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
2fc4b37828
Коммит
0485c5f64e
@@ -50,6 +50,27 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
|||||||
func (us SqlUserStore) UpgradeSchemaIfNeeded() {
|
func (us SqlUserStore) UpgradeSchemaIfNeeded() {
|
||||||
// ADDED for 2.0 REMOVE for 2.4
|
// ADDED for 2.0 REMOVE for 2.4
|
||||||
us.CreateColumnIfNotExists("Users", "Locale", "varchar(5)", "character varying(5)", model.DEFAULT_LOCALE)
|
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() {
|
func (us SqlUserStore) CreateIndexesIfNotExists() {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user