Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
mattermost-server
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
2
Merge Requests
2
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
sysadmin
mattermost
mattermost-server
Commits
3abc825c
Unverified
Commit
3abc825c
authored
Oct 30, 2018
by
Chris Duarte
Committed by
Jesse Hallam
Nov 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for OOO bug that reply message does not get inserted consistently. (#9742)
parent
7982f4f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
18 deletions
+8
-18
app/auto_responder.go
app/auto_responder.go
+3
-3
app/auto_responder_test.go
app/auto_responder_test.go
+4
-10
app/notification.go
app/notification.go
+1
-5
No files found.
app/auto_responder.go
View file @
3abc825c
...
...
@@ -8,7 +8,7 @@ import (
"github.com/mattermost/mattermost-server/model"
)
func
(
a
*
App
)
SendAutoResponse
(
channel
*
model
.
Channel
,
receiver
*
model
.
User
,
rootId
string
)
{
func
(
a
*
App
)
SendAutoResponse
(
channel
*
model
.
Channel
,
receiver
*
model
.
User
)
{
if
receiver
==
nil
||
receiver
.
NotifyProps
==
nil
{
return
}
...
...
@@ -20,8 +20,8 @@ func (a *App) SendAutoResponse(channel *model.Channel, receiver *model.User, roo
autoResponderPost
:=
&
model
.
Post
{
ChannelId
:
channel
.
Id
,
Message
:
message
,
RootId
:
rootId
,
ParentId
:
rootId
,
RootId
:
""
,
ParentId
:
""
,
Type
:
model
.
POST_AUTO_RESPONDER
,
UserId
:
receiver
.
Id
,
}
...
...
app/auto_responder_test.go
View file @
3abc825c
...
...
@@ -94,28 +94,25 @@ func TestSendAutoResponseSuccess(t *testing.T) {
userUpdated1
,
err
:=
th
.
App
.
PatchUser
(
user
.
Id
,
patch
,
true
)
require
.
Nil
(
t
,
err
)
firstPost
,
_
:=
th
.
App
.
CreatePost
(
&
model
.
Post
{
th
.
App
.
CreatePost
(
&
model
.
Post
{
ChannelId
:
th
.
BasicChannel
.
Id
,
Message
:
"zz"
+
model
.
NewId
()
+
"a"
,
UserId
:
th
.
BasicUser
.
Id
},
th
.
BasicChannel
,
false
)
th
.
App
.
SendAutoResponse
(
th
.
BasicChannel
,
userUpdated1
,
firstPost
.
Id
)
th
.
App
.
SendAutoResponse
(
th
.
BasicChannel
,
userUpdated1
)
if
list
,
err
:=
th
.
App
.
GetPosts
(
th
.
BasicChannel
.
Id
,
0
,
1
);
err
!=
nil
{
require
.
Nil
(
t
,
err
)
}
else
{
autoResponderPostFound
:=
false
autoResponderIsComment
:=
false
for
_
,
post
:=
range
list
.
Posts
{
if
post
.
Type
==
model
.
POST_AUTO_RESPONDER
{
autoResponderIsComment
=
post
.
RootId
==
firstPost
.
Id
autoResponderPostFound
=
true
}
}
assert
.
True
(
t
,
autoResponderPostFound
)
assert
.
True
(
t
,
autoResponderIsComment
)
}
}
...
...
@@ -134,27 +131,24 @@ func TestSendAutoResponseFailure(t *testing.T) {
userUpdated1
,
err
:=
th
.
App
.
PatchUser
(
user
.
Id
,
patch
,
true
)
require
.
Nil
(
t
,
err
)
firstPost
,
_
:=
th
.
App
.
CreatePost
(
&
model
.
Post
{
th
.
App
.
CreatePost
(
&
model
.
Post
{
ChannelId
:
th
.
BasicChannel
.
Id
,
Message
:
"zz"
+
model
.
NewId
()
+
"a"
,
UserId
:
th
.
BasicUser
.
Id
},
th
.
BasicChannel
,
false
)
th
.
App
.
SendAutoResponse
(
th
.
BasicChannel
,
userUpdated1
,
firstPost
.
Id
)
th
.
App
.
SendAutoResponse
(
th
.
BasicChannel
,
userUpdated1
)
if
list
,
err
:=
th
.
App
.
GetPosts
(
th
.
BasicChannel
.
Id
,
0
,
1
);
err
!=
nil
{
require
.
Nil
(
t
,
err
)
}
else
{
autoResponderPostFound
:=
false
autoResponderIsComment
:=
false
for
_
,
post
:=
range
list
.
Posts
{
if
post
.
Type
==
model
.
POST_AUTO_RESPONDER
{
autoResponderIsComment
=
post
.
RootId
==
firstPost
.
Id
autoResponderPostFound
=
true
}
}
assert
.
False
(
t
,
autoResponderPostFound
)
assert
.
False
(
t
,
autoResponderIsComment
)
}
}
app/notification.go
View file @
3abc825c
...
...
@@ -81,11 +81,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
if
post
.
Type
!=
model
.
POST_AUTO_RESPONDER
{
a
.
Go
(
func
()
{
rootId
:=
post
.
Id
if
post
.
RootId
!=
""
&&
post
.
RootId
!=
post
.
Id
{
rootId
=
post
.
RootId
}
a
.
SendAutoResponse
(
channel
,
otherUser
,
rootId
)
a
.
SendAutoResponse
(
channel
,
otherUser
)
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment