MM-36862: removes participant from thread (#18795)
* MM-36862: removes participant from thread Removing a participant upon last reply deleted from thread didn't work reliably, a suspect on this is the replica lag, since we are first deleting the post and then counting non-deleted posts of the participant to decide on whether to delete or not. The findings that led to this conclusion is that the reply count gets updated but the participant is not removed (participant removal depends on the number of replies this participant has in the thread.) This commit fixes that by removing first the participant and then deleting the post. So we delete the participant if they have 1 post in that thread, and then we delete the post, so now they have no posts in the thread. * Makes deleting posts transactional This commit makes deleting a post transactional and also tries to fix permanent deletion of posts. Currently when we permanently delete all posts by a user we don't update the threads reply count nor the participant's array. This commit tries to fix that. * Adds comments on deleting posts Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -117,6 +117,24 @@ func (m *StringMap) Scan(value interface{}) error {
|
||||
return errors.New("received value is neither a byte slice nor string")
|
||||
}
|
||||
|
||||
func (si *StringInterface) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
buf, ok := value.([]byte)
|
||||
if ok {
|
||||
return json.Unmarshal(buf, si)
|
||||
}
|
||||
|
||||
str, ok := value.(string)
|
||||
if ok {
|
||||
return json.Unmarshal([]byte(str), si)
|
||||
}
|
||||
|
||||
return errors.New("received value is neither a byte slice nor string")
|
||||
}
|
||||
|
||||
var translateFunc i18n.TranslateFunc
|
||||
var translateFuncOnce sync.Once
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user