From f7dd715052741097616816f9cce600006e5c2290 Mon Sep 17 00:00:00 2001 From: Derrick Anderson Date: Thu, 5 Apr 2018 11:27:19 -0400 Subject: update db code for release branch only (#8584) --- model/version.go | 1 + store/sqlstore/upgrade.go | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/model/version.go b/model/version.go index 38ace0bde..a58ca4df6 100644 --- a/model/version.go +++ b/model/version.go @@ -13,6 +13,7 @@ import ( // It should be maintained in chronological order with most current // release at the front of the list. var versions = []string{ + "4.9.0", "4.8.1", "4.8.0", "4.7.2", diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go index 89c6e3d07..ae0ea7acd 100644 --- a/store/sqlstore/upgrade.go +++ b/store/sqlstore/upgrade.go @@ -396,16 +396,15 @@ func UpgradeDatabaseToVersion49(sqlStore SqlStore) { // a number of parameters in `config.json` to a `Roles` table in the database. The migration code can be seen // in the file `app/app.go` in the function `DoAdvancedPermissionsMigration()`. - //TODO: Uncomment the following condition when version 4.9.0 is released - //if shouldPerformUpgrade(sqlStore, VERSION_4_8_1, VERSION_4_9_0) { - sqlStore.CreateColumnIfNotExists("Teams", "LastTeamIconUpdate", "bigint", "bigint", "0") - defaultTimezone := model.DefaultUserTimezone() - defaultTimezoneValue, err := json.Marshal(defaultTimezone) - if err != nil { - l4g.Critical(err) + if shouldPerformUpgrade(sqlStore, VERSION_4_8_1, VERSION_4_9_0) { + sqlStore.CreateColumnIfNotExists("Teams", "LastTeamIconUpdate", "bigint", "bigint", "0") + defaultTimezone := model.DefaultUserTimezone() + defaultTimezoneValue, err := json.Marshal(defaultTimezone) + if err != nil { + l4g.Critical(err) + } + sqlStore.CreateColumnIfNotExists("Users", "Timezone", "varchar(256)", "varchar(256)", string(defaultTimezoneValue)) + sqlStore.RemoveIndexIfExists("idx_channels_displayname", "Channels") + saveSchemaVersion(sqlStore, VERSION_4_9_0) } - sqlStore.CreateColumnIfNotExists("Users", "Timezone", "varchar(256)", "varchar(256)", string(defaultTimezoneValue)) - sqlStore.RemoveIndexIfExists("idx_channels_displayname", "Channels") - // saveSchemaVersion(sqlStore, VERSION_4_9_0) - //} } -- cgit v1.2.3-1-g7c22 From e16217166dd39fe75a9dc995c2d4e77cb7485143 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 6 Apr 2018 21:41:45 +0800 Subject: fix out of channel mentions for mentioned word with valid punctuations (#8585) --- app/notification.go | 12 ++++-------- app/notification_test.go | 6 ++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/notification.go b/app/notification.go index 0ea03c9d9..5b7ed5ad2 100644 --- a/app/notification.go +++ b/app/notification.go @@ -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) - } } } diff --git a/app/notification_test.go b/app/notification_test.go index c72610b60..1abdd3d61 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -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{}, -- cgit v1.2.3-1-g7c22 From be972fde28af33e074c51e22028f41d7e80920dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 6 Apr 2018 21:59:09 +0200 Subject: Adding minio-go for to the dependencies to temporary fix 2 minio-go bugs (#8577) --- glide.lock | 9 ++++++--- glide.yaml | 3 ++- .../github.com/minio/minio-go/api-put-object-multipart.go | 14 +++++++------- vendor/github.com/minio/minio-go/api-put-object.go | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/glide.lock b/glide.lock index a51b5e246..4915b477b 100644 --- a/glide.lock +++ b/glide.lock @@ -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 diff --git a/glide.yaml b/glide.yaml index 195be0847..eb198b17e 100644 --- a/glide.yaml +++ b/glide.yaml @@ -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 diff --git a/vendor/github.com/minio/minio-go/api-put-object-multipart.go b/vendor/github.com/minio/minio-go/api-put-object-multipart.go index f5b8893e6..5262e8b91 100644 --- a/vendor/github.com/minio/minio-go/api-put-object-multipart.go +++ b/vendor/github.com/minio/minio-go/api-put-object-multipart.go @@ -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, diff --git a/vendor/github.com/minio/minio-go/api-put-object.go b/vendor/github.com/minio/minio-go/api-put-object.go index 6d90eab74..ca4052225 100644 --- a/vendor/github.com/minio/minio-go/api-put-object.go +++ b/vendor/github.com/minio/minio-go/api-put-object.go @@ -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 -- cgit v1.2.3-1-g7c22 From ffa24fbcb21d210c90071b98a357d965e48eb67c Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Mon, 9 Apr 2018 09:39:57 -0400 Subject: MM-8834: Changes separator between jobs message and details. (#8589) --- jobs/jobs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jobs/jobs.go b/jobs/jobs.go index f0a74e45a..b367730b5 100644 --- a/jobs/jobs.go +++ b/jobs/jobs.go @@ -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 -- cgit v1.2.3-1-g7c22