PLT-3547 fixing caching issue with direct profiles (#3567)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
0858c34314
Коммит
294981d4a3
@@ -4,6 +4,7 @@
|
|||||||
package store
|
package store
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/md5"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -480,9 +481,10 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
|
|||||||
go func() {
|
go func() {
|
||||||
result := StoreResult{}
|
result := StoreResult{}
|
||||||
|
|
||||||
updateAt, err := s.GetReplica().SelectInt(`
|
var ids []string
|
||||||
|
_, err := s.GetReplica().Select(ids, `
|
||||||
SELECT
|
SELECT
|
||||||
UpdateAt
|
Id
|
||||||
FROM
|
FROM
|
||||||
Users
|
Users
|
||||||
WHERE
|
WHERE
|
||||||
@@ -508,12 +510,14 @@ func (s SqlUserStore) GetEtagForDirectProfiles(userId string) StoreChannel {
|
|||||||
WHERE
|
WHERE
|
||||||
UserId = :UserId
|
UserId = :UserId
|
||||||
AND Category = 'direct_channel_show')
|
AND Category = 'direct_channel_show')
|
||||||
ORDER BY UpdateAt DESC LIMIT 1
|
ORDER BY UpdateAt DESC
|
||||||
`, map[string]interface{}{"UserId": userId})
|
`, map[string]interface{}{"UserId": userId})
|
||||||
if err != nil {
|
|
||||||
result.Data = fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.GetMillis(), utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress)
|
if err != nil || len(ids) == 0 {
|
||||||
|
result.Data = fmt.Sprintf("%v.%v.0.%v.%v", model.CurrentVersion, model.GetMillis(), utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress)
|
||||||
} else {
|
} else {
|
||||||
result.Data = fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, updateAt, utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress)
|
allIds := strings.Join(ids, "")
|
||||||
|
result.Data = fmt.Sprintf("%v.%v.%v.%v.%v", model.CurrentVersion, md5.Sum([]byte(allIds)), len(ids), utils.Cfg.PrivacySettings.ShowFullName, utils.Cfg.PrivacySettings.ShowEmailAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
storeChannel <- result
|
storeChannel <- result
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user