[MM-44948] Update sync (#20414)
* Update sync * Add enter * Address review suggestion Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
dc366bc1e2
Коммит
638ee68935
@@ -296,11 +296,11 @@ func (scs *Service) fetchPostUsersForSync(sd *syncData) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sync {
|
if sync {
|
||||||
sd.users[user.Id] = sanitizeUserForSync(user)
|
sd.users[user.Id] = user
|
||||||
}
|
}
|
||||||
|
|
||||||
if syncImage {
|
if syncImage {
|
||||||
sd.profileImages[user.Id] = sanitizeUserForSync(user)
|
sd.profileImages[user.Id] = user
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this was a mention then put the real username in place of the username+remotename, but only
|
// if this was a mention then put the real username in place of the username+remotename, but only
|
||||||
@@ -369,6 +369,8 @@ func (scs *Service) filterPostsForSync(sd *syncData) {
|
|||||||
func (scs *Service) sendSyncData(sd *syncData) error {
|
func (scs *Service) sendSyncData(sd *syncData) error {
|
||||||
merr := merror.New()
|
merr := merror.New()
|
||||||
|
|
||||||
|
sanitizeSyncData(sd)
|
||||||
|
|
||||||
// send users
|
// send users
|
||||||
if len(sd.users) != 0 {
|
if len(sd.users) != 0 {
|
||||||
if err := scs.sendUserSyncData(sd); err != nil {
|
if err := scs.sendUserSyncData(sd); err != nil {
|
||||||
@@ -531,3 +533,12 @@ func (scs *Service) sendSyncMsgToRemote(msg *syncMsg, rc *model.RemoteCluster, f
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sanitizeSyncData(sd *syncData) {
|
||||||
|
for id, user := range sd.users {
|
||||||
|
sd.users[id] = sanitizeUserForSync(user)
|
||||||
|
}
|
||||||
|
for id, user := range sd.profileImages {
|
||||||
|
sd.profileImages[id] = sanitizeUserForSync(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user