Merge branch 'jespino-merge-release-4.9'

This commit is contained in:
Derrick Anderson
2018-04-10 10:55:25 -04:00
7 changed files with 27 additions and 21 deletions

View File

@@ -897,7 +897,9 @@ func GetExplicitMentions(message string, keywords map[string][]string) *Explicit
continue
}
if strings.ContainsAny(word, ".-:") {
if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
ret.OtherPotentialMentions = append(ret.OtherPotentialMentions, word[1:])
} else if strings.ContainsAny(word, ".-:") {
// This word contains a character that may be the end of a sentence, so split further
splitWords := strings.FieldsFunc(word, func(c rune) bool {
return c == '.' || c == '-' || c == ':'
@@ -908,16 +910,10 @@ func GetExplicitMentions(message string, keywords map[string][]string) *Explicit
continue
}
if _, ok := systemMentions[splitWord]; !ok && strings.HasPrefix(splitWord, "@") {
username := splitWord[1:]
ret.OtherPotentialMentions = append(ret.OtherPotentialMentions, username)
ret.OtherPotentialMentions = append(ret.OtherPotentialMentions, splitWord[1:])
}
}
}
if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
username := word[1:]
ret.OtherPotentialMentions = append(ret.OtherPotentialMentions, username)
}
}
}

View File

@@ -234,6 +234,12 @@ func TestGetExplicitMentions(t *testing.T) {
OtherPotentialMentions: []string{"potential"},
},
},
"PotentialOutOfChannelUserWithPeriod": {
Message: "this is an message for @potential.user",
Expected: &ExplicitMentions{
OtherPotentialMentions: []string{"potential.user"},
},
},
"InlineCode": {
Message: "`this shouldn't mention @channel at all`",
Keywords: map[string][]string{},

9
glide.lock generated
View File

@@ -1,5 +1,5 @@
hash: 287b82849f1c7303ee3eb29c9d0879d404469f7df2ba9b37828e55b0320ef11f
updated: 2018-03-21T13:01:34.996412416+01:00
hash: 7d775d1a082e77da96bee605ebea97ba0230e270f7169fade50f64e5fe7842cb
updated: 2018-04-05T18:31:48.282177324+02:00
imports:
- name: github.com/alecthomas/log4go
version: 3fbce08846379ec7f4f6bc7fce6dd01ce28fae4c
@@ -117,6 +117,8 @@ imports:
version: 995ddf2264c4ad45fbaf342f7500e4787ebae84a
- name: github.com/mattermost/html2text
version: d47a5532a7bc36ad7b2b8ec3eebe24e975154f94
- name: github.com/mattermost/minio-go
version: e30d3b9eaff9a3fbfa74cda4c56cb22bec264ffa
- name: github.com/mattermost/rsc
version: bbaefb05eaa0389ea712340066837c8ce4d287f9
subpackages:
@@ -130,7 +132,8 @@ imports:
- name: github.com/miekg/dns
version: 5364553f1ee9cddc7ac8b62dce148309c386695b
- name: github.com/minio/minio-go
version: 706c81d3ee2a18cdd8239faf544de8a066e7e261
version: e30d3b9eaff9a3fbfa74cda4c56cb22bec264ffa
repo: https://github.com/mattermost/minio-go.git
subpackages:
- pkg/credentials
- pkg/encrypt

View File

@@ -31,7 +31,8 @@ import:
subpackages:
- qr
- package: github.com/minio/minio-go
version: 4.0.7
repo: https://github.com/mattermost/minio-go.git
version: 4.0.7.1
subpackages:
- pkg/credentials
- package: github.com/nicksnyder/go-i18n

View File

@@ -81,7 +81,7 @@ func (srv *JobServer) SetJobError(job *model.Job, jobError *model.AppError) *mod
if job.Data == nil {
job.Data = make(map[string]string)
}
job.Data["error"] = jobError.Message + " (" + jobError.DetailedError + ")"
job.Data["error"] = jobError.Message + " " + jobError.DetailedError
if result := <-srv.Store.Job().UpdateOptimistically(job, model.JOB_STATUS_IN_PROGRESS); result.Err != nil {
return result.Err

View File

@@ -260,13 +260,13 @@ func (c Client) uploadPart(ctx context.Context, bucketName, objectName, uploadID
// Set encryption headers, if any.
customHeader := make(http.Header)
for k, v := range metadata {
if len(v) > 0 {
if strings.HasPrefix(strings.ToLower(k), serverEncryptionKeyPrefix) {
customHeader.Set(k, v)
}
}
}
// for k, v := range metadata {
// if len(v) > 0 {
// if strings.HasPrefix(strings.ToLower(k), serverEncryptionKeyPrefix) {
// customHeader.Set(k, v)
// }
// }
// }
reqMetadata := requestMetadata{
bucketName: bucketName,

View File

@@ -207,7 +207,7 @@ func (c Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketName
if rErr == io.EOF && partNumber > 1 {
break
}
if rErr != nil && rErr != io.ErrUnexpectedEOF {
if rErr != nil && rErr != io.ErrUnexpectedEOF && rErr != io.EOF {
return 0, rErr
}
// Update progress reader appropriately to the latest offset