MM-31339: Send only one direct message reply within one calendar day. (#17181)
* don't send auto response if already responded today * update query to get posts from channel for given user and Updatetime requires value in milli seconds * regenerate mocks and layers * update function to return true/false on existence of auto responded post in channel and add tests * add store tests * bubble up error and propagate upstream * fix error handling logic * use require instead of assert Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> * rename variable for better redability and logging fixes * update comment explaining function * use new function to generate test ids * add comments to clarify NewTestId copies * add translations for error id * fix translation Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Этот коммит содержится в:
@@ -5448,6 +5448,24 @@ func (s *OpenTracingLayerPostStore) GetSingle(id string, inclDeleted bool) (*mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.HasAutoResponsePostByUserSince")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
s.Root.Store.SetContext(origCtx)
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId)
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) InvalidateLastPostTimeCache(channelID string) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.InvalidateLastPostTimeCache")
|
||||
|
||||
Ссылка в новой задаче
Block a user