* Update sync

* Add enter

* Address review suggestion

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Shota Gvinepadze
2022-07-21 18:11:45 +04:00
коммит произвёл GitHub
родитель dc366bc1e2
Коммит 638ee68935

Просмотреть файл

@@ -296,11 +296,11 @@ func (scs *Service) fetchPostUsersForSync(sd *syncData) error {
}
if sync {
sd.users[user.Id] = sanitizeUserForSync(user)
sd.users[user.Id] = user
}
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
@@ -369,6 +369,8 @@ func (scs *Service) filterPostsForSync(sd *syncData) {
func (scs *Service) sendSyncData(sd *syncData) error {
merr := merror.New()
sanitizeSyncData(sd)
// send users
if len(sd.users) != 0 {
if err := scs.sendUserSyncData(sd); err != nil {
@@ -531,3 +533,12 @@ func (scs *Service) sendSyncMsgToRemote(msg *syncMsg, rc *model.RemoteCluster, f
wg.Wait()
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)
}
}