Postgres fix
Этот коммит содержится в:
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/mattermost/gorp"
|
"github.com/mattermost/gorp"
|
||||||
"github.com/mattermost/platform/model"
|
"github.com/mattermost/platform/model"
|
||||||
|
"github.com/mattermost/platform/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SqlOAuthStore struct {
|
type SqlOAuthStore struct {
|
||||||
@@ -527,7 +528,14 @@ func (as SqlOAuthStore) deleteApp(transaction *gorp.Transaction, clientId string
|
|||||||
func (as SqlOAuthStore) deleteOAuthAppSessions(transaction *gorp.Transaction, clientId string) StoreResult {
|
func (as SqlOAuthStore) deleteOAuthAppSessions(transaction *gorp.Transaction, clientId string) StoreResult {
|
||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
|
|
||||||
if _, err := transaction.Exec("DELETE s.* FROM Sessions s INNER JOIN OAuthAccessData o ON o.Token = s.Token WHERE o.ClientId = :Id", map[string]interface{}{"Id": clientId}); err != nil {
|
query := ""
|
||||||
|
if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
|
||||||
|
query = "DELETE FROM Sessions s USING OAuthAccessData o WHERE o.Token = s.Token AND o.ClientId = :Id"
|
||||||
|
} else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_MYSQL {
|
||||||
|
query = "DELETE s.* FROM Sessions s INNER JOIN OAuthAccessData o ON o.Token = s.Token WHERE o.ClientId = :Id"
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := transaction.Exec(query, map[string]interface{}{"Id": clientId}); err != nil {
|
||||||
result.Err = model.NewLocAppError("SqlOAuthStore.DeleteApp", "store.sql_oauth.delete_app.app_error", nil, "id="+clientId+", err="+err.Error())
|
result.Err = model.NewLocAppError("SqlOAuthStore.DeleteApp", "store.sql_oauth.delete_app.app_error", nil, "id="+clientId+", err="+err.Error())
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user