Граф коммитов

2692 Коммитов

Автор SHA1 Сообщение Дата
Ben Schumacher
cbba2f1cca [MM-37664] Remove deprecated Backend field from plugin manifest (#18064) 2021-08-13 19:41:32 +02:00
Agniva De Sarker
d1b164ab1f Improve session cleanup (#18123)
- We move logging statements to the upper layer.
Store functions are low-level methods and should return error
upwards rather than logging.
- Used IN instead of any (array ()) which is equivalent.
- Made the delay to be of type time.Duration and un-exported it.
- Unexported the batch size constant.

```release-note
NONE
```
2021-08-13 20:15:24 +05:30
Agniva De Sarker
db80740414 MM-37378: Unskip TestPanicLog (#18119)
Config watcher has been removed from codebase.
It is safe to bring this back now.

https://mattermost.atlassian.net/browse/MM-37378

```release-note
NONE
```
2021-08-13 20:13:01 +05:30
Ben Schumacher
a8ca5c423f [MM-37557] Move error out of client4 response (#18101)
* Return an error seperately from Response

* Remove BuildErrorResponse

* Drop Response.Error from model/client4.go

* Migrate require.Nil checks

* Migrate require.NotNil checks

* More manual fixes

* Move error check out of CheckOKStatus and CheckCreatedStatus

* Move error check out of CheckForbiddenStatus

* Move error check out of CheckUnauthorizedStatus

* Move error check out of CheckNotFoundStatus

* Move error check out of CheckBadRequestStatus

* Move error check out of CheckNotImplementedStatus and CheckRequestEntityTooLargeStatus

* Move error check out of CheckInternalErrorStatus

* Move error check out of CheckServiceUnavailableStatus

* Remove error check from checkHTTPStatus

* Remove remaining references to Response.Error

* Check previously unchecked errors

* Manually fix compile and linter errors

* Return error in CreateWebSocket methods

* Return error instead of *AppError in DoApi methods

* Manually fix bad replacments

* Conistently return Response and error

* Use err instead of seperate bool return value to indicate success

* Reduce ussage of model.AppError in web/oauth_test.go

* Remove client4.Must

* Check error in buf.ReadFrom

* Fix failing tests
2021-08-13 13:12:16 +02:00
Claudio Costa
96593580ae Add MaxImageResolution config setting (#17941) 2021-08-12 17:43:10 +02:00
Ben Schumacher
fd853e74a6 [MM-37755] Idiomatic naming (SMTP, TLS, TCP, XML, CSS, HTML, HTTP) (#18103) 2021-08-12 11:49:16 +02:00
Claudio Costa
bd65e8daf9 Replace db count query in user signup process (#18072) 2021-08-12 11:23:21 +02:00
Ben Schumacher
225565f412 [MM-37716] Drop support for LHS specific bot icons (#18087) 2021-08-12 00:27:35 +02:00
Claudio Costa
868b8d91db [MM-36318] Set bot profile image and icon only if they have changed (#18008)
* Set bot profile image and icon only if they have changed

* Move equality check to the app layer

* Use ioutil.ReadAll

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-08-11 09:37:52 +02:00
Agniva De Sarker
555656d0f9 Skip TestPreparePostForClient (#18100)
https://mattermost.atlassian.net/browse/MM-37757

```release-note
NONE
```
2021-08-10 19:55:32 +05:30
Claudio Costa
afc393d8e9 Fix possible endless loop (#18079)
* Fix endless loop

* Add test
2021-08-10 10:12:43 +02:00
dave
16c2925ba2 Fix staticcheck errors from _test.go files (#18033)
Automatic Merge
2021-08-10 07:15:03 +02:00
Martin Kraft
21639f9c87 MM-22845: Added support for permalink previews. (#17796)
* MM-22845: Added support for permalink previews.

* MM-22845: Adds license to new file.

* MM-22845: Adds endpoint to retrieve multiple posts by id.

* MM-22845: Fix for deleted post.

* MM-22845: Adds config setting for permalink previews.

* MM-22845: Adds API test for new endpoint.

* MM-22845: Fix typo.

* MM-22845: Tests that post create or updated via App get the previewed_post prop.

* MM-22845: Tests for matching permalinks.

* MM-22845: Adds PreparePostForClient test for permalink previews.

* MM-22845: Embeds entire post in permalink metadata.

* MM-22845: Filter WS message payload of created and edited post based on permissions.

* MM-22845: Runs app layer generator.

* MM-22845: Lint check fix.

* MM-22845: Adds feature flag.

* MM-22845: Clones WS message.

* MM-22845: Removes knowledge of permalink from LinkMetadata table. Removes knowledge of user id from post embedding methods in favour of a 'sanitize' method/step.

* MM-22845: Handle nil post metadata.

* MM-22845: Switch to cloning post.

* MM-22845: Removes unused code.

* MM-22845: Refactor.

* MM-22845: Reverts whitespace change.

* MM-22845: Removes unnecessary code.

* MM-22845: Removes unnecessary function.

* MM-22845: Warn but don't error if permalinked referenced post or channel is not found.

* MM-22845: Fix for clone method.

* MM-22845: Fix for clone method.

* MM-22845: Updates translations.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-08-09 11:33:21 -04:00
Claudio Costa
ca755fdc34 [MM-37496] Temporarily disable admin advisor notifications (#18054)
Automatic Merge
2021-08-09 14:45:03 +02:00
Jesús Espino
a88702fdaf MM-37491: Fix flaky test on file content extraction (#18077)
* MM-37491: Fix flaky test on file content extraction

* Changing Error log to Warn log

* Fix uppercase and dot in the log file

* Simplifiying the test case

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-08-09 12:32:29 +02:00
Agniva De Sarker
4bc8eae04f Log error from a compliance job failure (#18075)
Found this while investigating https://github.com/mattermost/enterprise/pull/1044.

```release-note
NONE
```
2021-08-06 13:18:40 +05:30
Agniva De Sarker
9dc85ea092 MM-37579: Fix typo in map property (#18051)
* MM-37579: Fix typo in map property

https://mattermost.atlassian.net/browse/MM-37579

```release-note
NONE
```

* refactor

```release-note
NONE
```
2021-08-05 19:47:35 +05:30
Agniva De Sarker
e49f385598 MM-37576: Fix reference to incorrect error variable (#18066)
We use the correct error variable returned from
the store method prior to it.

https://mattermost.atlassian.net/browse/MM-37576

```release-note
NONE
```
2021-08-05 19:46:31 +05:30
Agniva De Sarker
7c22202330 MM-37575: Handle nil value in override_username (#18057)
* MM-37575: Handle nil value in override_username

Since props is a map[string]interface{}, an ", ok" check doesn't
really help because even if a key is not present, by default, a map
will always return the default value of the value, which would be a
nil interface.

So we can just check for the value of the map instead.

https://mattermost.atlassian.net/browse/MM-37575

```release-note
NONE
```

* Fix for integer case as well

```release-note
NONE
```

* Update app/notification.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2021-08-05 14:25:07 +05:30
Agniva De Sarker
32005b05d9 MM-37573: Ignore nil fields in attachments (#18052)
We extend the same logic done in https://github.com/mattermost/mattermost-server/pull/16556
to Field.

Also handled the case elsewhere in the code with a light grep
for extra safety.

https://mattermost.atlassian.net/browse/MM-37573

```release-note
NONE
```
2021-08-04 19:43:37 +05:30
Agniva De Sarker
c281d5eac6 MM-35754: Fail fast if templates directory is not found (#18053)
We used to log an error and move forward, which led to
panics later during server execution, because the templates
don't exist.

While technically speaking the server will run fine
because it's just one HTTP handler goroutine which panics,
but properly handling the error requires much more adjustments
in the code to check for nil templates.

It is better to fail earlier and force the application
to start in a clean slate.

https://mattermost.atlassian.net/browse/MM-37574

```release-note
NONE
```
2021-08-04 19:42:28 +05:30
Claudio Costa
a5463c8651 Implement content extraction job (#18022) 2021-08-04 11:10:53 +02:00
Ben Schumacher
758116f3e3 [M-36899] Remove deprecated SourcePluginId (#17884) 2021-08-03 18:52:14 +02:00
Agniva De Sarker
249a0b9870 MM-36990: Use upsert for system key update (#18037)
* MM-36990: Use upsert for system key update

We make the app migration idempotent by using DB native upsert.

https://mattermost.atlassian.net/browse/MM-36990

```release-note
NONE
```

* Fix SaveOrUpdateWithWarnMetricHandling too

```release-note
NONE
```

* Update store/sqlstore/system_store.go

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2021-08-03 14:23:47 +05:30
Harrison Healey
370321a823 MM-36127 Check for emojis in message attachment titles (#17943) 2021-08-02 14:23:10 -04:00
Ashish Bhate
296076bf2d [MM-36544][MM-37439] Don't re-follow on reply to unfollowed thread (#18020)
Summary
If a user has unfollowed a thread, another user's reply in the thread should not cause the first user to re-follow the thread. The first user will be re-followed if they are mentioned in the thread.
Simplify and make flexible the logic surrounding following and remove some duplicate code.

Ticket Link
https://mattermost.atlassian.net/browse/MM-36544
https://mattermost.atlassian.net/browse/MM-37439
2021-07-30 18:47:41 +05:30
Ashish Bhate
0f07a934ff [MM-37118] Don't mark channel as read for reply posts with CRT on (#17965)
Summary
With CRT on, posting a reply to a thread should NOT mark the channel containing the the thread as read

Ticket Link
https://mattermost.atlassian.net/browse/MM-37118
2021-07-29 14:47:28 +05:30
Martin Kraft
37b1e6d048 MM-37417: Push notification authz fix. (#18009)
* MM-37417: Push notification authz fix.

* MM-37417: Tests new app method.
2021-07-28 13:47:45 -04:00
Agniva De Sarker
0d075c32db MM-22051: Remove ToJson from model (part 1) (#18005)
https://mattermost.atlassian.net/browse/MM-22051

```release-note
Removed the following methods/functions:
(ad *AccessData) ToJson()
(ar *AccessResponse) ToJson()
(ar *AnalyticsRow) ToJson()
(ar AnalyticsRows) ToJson()
(o *Audit) ToJson()
(o Audits) ToJson()
(ad *AuthData) ToJson()
(ar *AuthorizeRequest) ToJson()
(o *ChannelPatch) ToJson()
(o *ChannelsWithCount) ToJson()
(o *ChannelCounts) ToJson()
(o *ChannelData) ToJson()
(o *ChannelMembers) ToJson()
(o *ChannelUnread) ToJson()
(o *ChannelUnreadAt) ToJson()
(o *ChannelStats) ToJson()
(o *ChannelView) ToJson()
(o *ChannelViewResponse) ToJson()
(o *ClusterDiscovery) ToJson()
(ci *ClusterInfo) ToJson()
(cs *ClusterStats) ToJson()
(o *Command) ToJson()
CommandListToJson(l []*Command) string
(o *CommandArgs) ToJson()
(cmr *CommandMoveRequest) ToJson()
(o *CommandResponse) ToJson()
(c *Compliance) ToJson()
(c Compliances) ToJson()
(o *Config) ToJson()
EmojiListToJson(emojiList []*Emoji)
```
2021-07-28 13:15:46 +05:30
Claudio Costa
baf8eda699 Improve log (#18012) 2021-07-27 19:43:59 +02:00
Claudio Costa
186475db3b [MM-35470] Disable config watching logic (#17913)
* Disable config watching logic

* Fix tests
2021-07-26 20:13:30 +02:00
Joram Wilander
b01f8ab0c8 MM-36545 Fix replica lag issue causing missed websocket events to update following (#17989)
* Fix replica lag issue causing missed websocket events to update following

* Add mutex to prevent data race

* Query thread membership if null

* Fix style
2021-07-26 11:28:01 -04:00
Agniva De Sarker
7be61af24f MM-25516: Changed to byte slice instead of string for cluster messages (#17998)
* MM-25516: Changed to byte slice instead of string for cluster messages

https://mattermost.atlassian.net/browse/MM-25116

Testing:
Manually tested.
Load-tested with Cluster Controller.

I looked into changing the serialization method to use msgpack,
but the ClusterMessage struct was mainly used for only 3 fields
which didn't lead to much of a CPU time improvement, whereas
actually led to more allocations using msgpack. Hence, I chose
to remain with JSON.

```
name              old time/op    new time/op    delta
ClusterMarshal-8    3.51µs ± 1%    3.10µs ± 2%  -11.59%  (p=0.000 n=9+10)

name              old alloc/op   new alloc/op   delta
ClusterMarshal-8      776B ± 0%     1000B ± 0%  +28.87%  (p=0.000 n=10+10)

name              old allocs/op  new allocs/op  delta
ClusterMarshal-8      12.0 ± 0%      13.0 ± 0%   +8.33%  (p=0.000 n=10+10)
```

```release-note
Changed the field type of Data in model.ClusterMessage to []byte from string.
```

* Trigger CI
```release-note
NONE
```
2021-07-26 13:41:20 +05:30
Agniva De Sarker
3f81d104a8 MM-37378: Skip TestPanicLog (#17997)
```release-note
NONE
```
2021-07-24 09:35:51 +02:00
Allan Guwatudde
e252608068 [MM-37064] - Onboarding flow is showing for existing users (#17977)
* [MM-37064] - Onboarding flow is showing for existing users

* add tests

* fix typo

* fix lint

* fix tests
2021-07-23 19:54:51 +03:00
Joram Wilander
3a11e34af9 Fix bad merge causing undefined CRT constant (#17987) 2021-07-22 15:30:45 -04:00
Joram Wilander
a0cc420e2a MM-35392 Load thread unreads for other teams on app load (#17944)
* Add ability to include thread unreads in team unreads api response

* Do not include GMs/DMs in team unreads for threads

* Fix bad merge
2021-07-22 10:24:20 -04:00
Agniva De Sarker
c4b4e1bc38 MM-36271: Bump major version to 6.0 (#17973)
https://mattermost.atlassian.net/browse/MM-36271

```release-note
We bump the major version to 6.0
```
2021-07-22 12:21:47 +05:30
Claudio Costa
1898670340 Fix outstanding linting issues 2021-07-21 16:38:39 +02:00
Agniva De Sarker
e199eba313 Remove FromJSON functions (Part 1) (#17961)
* Remove FromJSON functions (Part 1)

```release-note
Removed the following functions:
AccessDataFromJson
AccessResponseFromJson
AnalyticsRowFromJson
AnalyticsRowsFromJson
AuditFromJson
AuditsFromJson
AuthDataFromJson
AuthorizeRequestFromJson
BotFromJson
BotPatchFromJson
BotListFromJson
```

* fix tests

```release-note
NONE
```
2021-07-21 16:38:39 +02:00
Agniva De Sarker
7454680be5 Cleanup model/utils.go (#17945)
* Cleanup model/utils.go

- Removed some functions which were unsued. (The unused linter was somehow failing to catch this).
- Moved some functions inside other packages.
- Removed two duplicate instances of the same function - RemoveDuplicateStrings and UniqueStrings.
- Moved some regexes to global vars to prevent compilation every time.

```release-note
NONE
```

* fix lint

```release-note
NONE
```

* bring back unused exception

```release-note
NONE
```

* fix tests

```release-note
NONE
```

* Address review comments

```release-note
NONE
```
2021-07-21 16:38:39 +02:00
Agniva De Sarker
da7d71ccf7 MM-21357: Use typed constant for channel types (#17928)
* MM-21357: Use typed constant for channel types

https://mattermost.atlassian.net/browse/MM-21357

```release-note
- Introduced a new type ChannelType for all channel types.
- Updated the Client4.UpdateChannelPrivacy method to ChannelType.
```

* Address review comments

```release-note
NONE
```

* telemetry fix

```release-note
NONE
```
2021-07-21 16:38:39 +02:00
Claudio Costa
025a948905 Remove override of MaxNotificationsPerChannel (#17939) 2021-07-21 16:38:39 +02:00
Agniva De Sarker
623f8dc9af MM-21357: Use typed constants ClusterEvent (#17920)
* MM-21357: Use typed constants ClusterEvent

Use typed constants for:
- model.ClusterEvent

https://mattermost.atlassian.net/browse/MM-21357

```release-note
Use typed constant for model.ClusterEvent
```

* trigger CI
```release-note
NONE
```
2021-07-21 16:38:39 +02:00
Agniva De Sarker
f35b025bea Unexport fields in WebSocketEvent (#17912)
Automatic Merge
2021-07-21 16:38:39 +02:00
Agniva De Sarker
f49b5dc440 Move some variables out of model (#17909)
* Move some variables out of model

There were some stuff that's not necessary to be in model
and can just remain unexported variables.

```release-note
NONE
```

* Add license

```release-note
NONE
```
2021-07-21 16:38:39 +02:00
Ben Schumacher
97ccf0bdf6 [MM-16751] golint model (#17896) 2021-07-21 16:38:39 +02:00
Daniel Espino García
338f6a9db7 Consider empty body before unmarshal on do post action (#17879)
* Consider empty body before unmarshal on do post action

* Fix test and add test

* Fix test
2021-07-20 09:30:49 +02:00
Ibrahim Serdar Acikgoz
41dc05a6bd Decouple emailservice from app package (#17827)
* decouple emailservice from app package

* fix some escaped errors

* move email package under app directory

* fix i18n

* reflect review comments
2021-07-19 23:26:06 +08:00
Ashish Bhate
c88232d71e [MM-35925] Follow thread when posting in one, even if previously unfollowed (#17926) 2021-07-16 10:04:22 -04:00