Commit Graph

2572 Commits

Author SHA1 Message Date
Eli Yukelzon
611e03de94 MM-35300 CRT: No mention badge on Threads when user is mentioned in both the root post and a reply post (#17541) 2021-04-29 13:59:38 +03:00
Eli Yukelzon
861745e33b MM-35123 - CRT: Replying to a post with mention causes two mention badges to appear (#17506)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-29 12:15:27 +03:00
Eli Yukelzon
29341b8fe5 MM-35290 CRT: Reply on a unfollowed thread causes re-following (#17537) 2021-04-29 10:52:29 +03:00
Claudio Costa
d1e38fa74b [MM-35222] Fix DoGuestRolesCreationMigration (#17523)
* Set guest role based on scope

* Fix team scheme

* Fix scope
2021-04-29 09:13:42 +02:00
Harrison Healey
3c162999a5 MM-22678 Use more user-friendly errors for channel commands (#17520)
* MM-22678 Use more user-friendly errors for channel commands

* Update text from ticket

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-28 15:01:44 -04:00
Claudio Costa
6af032d06a [MM-35077] Add basic support for plugin intra-cluster communication (#17495)
* Add basic support for plugin intra-cluster communication

* Some renaming for added clarity

* Allow sending cluster event to specific nodes

* Improve naming and documentation

* Improve logging
2021-04-28 19:59:32 +02:00
Haardik Dharma
ccc7365ac3 Bump golangci version to v1.38.0 (#17154)
* Update golangci to v1.38.0

Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-28 16:43:41 +02:00
Agniva De Sarker
2d0f5f910a MM-35239: Fix racy test HubSessionRevokeRace (#17534)
Automatic Merge
2021-04-28 11:36:05 +02:00
Harshil Sharma
79dd9b13dc MM-18818 Prompt admins to set the Support Email (#17296)
* MM-18818 Set default support to empty and handled the same in email templates

* #MM-18818 Admin advisor now warns for inconfigured support email address

* Updated text

* #MM-18818 gofmt'ed files

* #MM-18818 updated text and removed unused i18n strings:

* #MM-18818 updated i18n string ordering

* #MM-18818 Added test for support email advisory

* MM-18818 gofmt'd the file

* MM-18818 separated contextual notifications from configuration notifications in Admin Advisor

* #MM-18818 prevented support email with whitepsaces from being detected as filled

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-28 12:05:38 +05:30
Martin Kraft
49178bf480 MM-24455: Fix role responses. (#17385)
Automatic Merge
2021-04-27 18:36:05 +02:00
Eli Yukelzon
d819eb224c MM-35103 Replies in a thread with an initial mention triggers notification each time (#17503)
* only process parent post mentions for threads in order to autofollow

* don't use merge since it modifies the original

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-27 18:23:01 +03:00
Agniva De Sarker
978d886e3f MM-35239: Skip TestHubSessionRevokeRace (#17524)
https://mattermost.atlassian.net/browse/MM-35239

```release-note
NONE
```
2021-04-27 20:49:17 +05:30
Eli Yukelzon
3d6e69b002 MM-35128 CRT: Global Threads item should not be affected by 'mark as unread' in channel (#17505)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-27 16:56:06 +03:00
Eli Yukelzon
89281c00b1 MM-35127 CRT: Marking thread as unread doesn't set the timestamp correctly (#17507)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-27 15:48:43 +03:00
Eli Yukelzon
ba302cf512 MM-35125 CRT: Mention badge on threads doesn't appear until refresh (#17504) 2021-04-27 10:18:20 +03:00
Agniva De Sarker
cd4d322e4a MM-32950: Reliable WebSockets: Basic single server (#17406)
* MM-32950: Reliable WebSockets: Basic single server

This PR adds reliable websocket support for a single server.

Below is a brief overview of the three states of a connection:

Normal:
- All messages are routed via web hub.
- Each web conn has a send queue to which it gets pushed.
- A message gets pulled from the queue, and before it
gets written to the wire, it is added to the dead queue.

Disconnect:
- Hub Unregister gets called, where the connection is just
marked as inactive. And new messages keep getting pushed
to the send queue.

If it gets full, the channel is closed and the conn gets removed
from conn index.

Reconnect:
- We query the hub for the connection ID, and get back the
queues.
- We construct a WebConn reusing the old queues, or a fresh one
depending on whether the connection ID was found or not.
- Now there is a tricky bit here which needs to be carefully processed.
On register, we would always send the hello message in the send queue.
But we cannot do that now because the send queue might already have messages.

Therefore, we don't send the hello message from web hub, if we reuse a connection.

Instead, we move that logic to the web conn write pump. We check if
the sequence number is in dead queue, and if it is, then we drain
the dead queue, and start consuming from the active queue.
No hello message is sent here.

But if the message does not exist in the dead queue, and the sequence number
is actually something that should have existed, then we set
a new connction id and clear the dead queue, and send a hello message.
The client, on receiving a new connection id will automatically
set its sequence number to 0, and make the sync API calls to manage
any lost data.

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

```release-note
NONE
```

* gofmt

* Add EnableReliableWebSockets to the client config

* Refactoring isInDeadQueue

* Passing index to drainDeadQueue

* refactoring webconn

* fix pointer

* review comments

* simplify hasMsgLoss

* safety comment

* fix test

* Trigger CI

* Trigger CI

Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-26 19:51:25 +05:30
Allan Guwatudde
fd546cdff2 [MM-35039] - Send trial ended email (#17478)
* [MM-35039] - Send trial ended email

* Generations

* Use First name with fallback to username

* Use First name with fallback to username for trial ending email
2021-04-23 21:45:47 +03:00
Ibrahim Serdar Acikgoz
5f9870ac06 [MM-34216] app/import: do not break import process if a dm channel is invalid (#17391)
* app/import: do not break import process if a dm channel is invalid

* update test headers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-22 12:42:22 +03:00
darkLord19
f6505e1ee6 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>
2021-04-22 12:33:45 +08:00
Ben Schumacher
f14b0097dd [MM-34798] Respect MM_SERVER_PATH when looking for templates (#17410) 2021-04-21 20:35:57 +02:00
Ibrahim Serdar Acikgoz
28ff4dc8d0 [MM-32281] SqlRoleStore/GetByName: add context to allow read from master (#17176)
* role_store/GetByName: add context

* propagate context in the app layer

* propagate context in the app layer

* add missing import

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-21 18:01:02 +03:00
Chetanya Kandhari
9eceeaa8db Custom status fixes (#17122)
* Changed the request type to POST for the remove recent custom status API

Fixed the custom status clear slash command

* Added Delete method in the remove recent custom status endpoint

* Added one new endpoint to remove recent custom status with POST method

* Added comments for the recent custom status API

Co-authored-by: Manoj <manoj@brightscout.com>
Co-authored-by: Chetanya Kandhari <availchet@gmail.com>
Co-authored-by: Manoj <77336594+manojosh@users.noreply.github.com>
2021-04-21 11:37:17 +03:00
Eli Yukelzon
dd9a1918e1 MM-34872 CRT: thread last_viewed_at updated when channel is viewed (#17448) 2021-04-21 09:48:59 +03:00
Eli Yukelzon
56198a99c6 MM-34871 CRT: Participants of thread include non-replying followers (and past followers) (#17447)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-21 09:48:30 +03:00
Max Erenberg
f36f5c74b1 Mm 30807 granular data retention scaffold (#17464) 2021-04-20 13:16:40 -04:00
Agniva De Sarker
4295a1f556 MM-34125: Remove WebSocketDelay feature flag (#17441)
It has been soaked for enough time in community-daily
and also in community. Enabling it for all.

```release-note
TCP_NO_DELAY is disabled for websocket connections
to allow for higher throughput
```

https://mattermost.atlassian.net/browse/MM-34125
2021-04-20 10:10:22 +05:30
Harshil Sharma
a16fdb5001 #MM-34893 Completely disabled Admin Advisor (#17422)
* #MM-34893 Completely disabled Admin Advisor

* #MM-34893 added lint fixes
2021-04-20 05:43:01 +05:30
Hossein
93c8c6e9d8 Remove the Remove System Permissions (#17401)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-19 12:44:14 -04:00
Ben Schumacher
730dc6b985 [MM-34919] Use Mattermost-Plugin-ID header to pass ID in inter-plugin requests (#17418) 2021-04-19 14:02:00 +02:00
Agniva De Sarker
e0efdd708b Revert "Mm 30807 granular data retention scaffold (#16891)" (#17437)
This reverts commit 3ea75332e7.
2021-04-18 22:41:50 +05:30
Ibrahim Serdar Acikgoz
3a13987ee1 [MM-34725] app/user: check if username or email is in use before patching a user (#17392)
* app/user: check if username or email is in use before patching a user

* reflect review comments

* fix tests
2021-04-16 23:41:32 +08:00
Max Erenberg
3ea75332e7 Mm 30807 granular data retention scaffold (#16891)
create the necessary tables, models and APIs for the granular data retention policy feature
2021-04-16 11:32:09 -04:00
Eli Yukelzon
f90209c8a3 MM-34609 Mark-as-unread on a post in a thread should cause auto-follow (#17343)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-16 10:26:08 +03:00
Eli Yukelzon
9a27d135a1 MM-34774 Root post with mention should be auto-followed but hidden from thread results (#17390) 2021-04-15 17:32:01 +03:00
Allan Guwatudde
ab8b8e8bf2 [MM-34240] - Cloud: "Congratulations" welcome email missing images (#17350)
* [MM-34240]-Cloud: Congratulations welcome email missing images

* Use img instead of svg

* Add fallback font Arial

* Feedback impl

* EOF

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-15 13:23:03 +03:00
Doug Lauder
9799fe9be6 MM-34549 shared channels; add users to channel that were already sync'd (#17361)
Fixes a bug and adds a feature for shared channels:
- The Bug: when creating new shared channels, users that had already been sync'd via another channel were not added to the new channel's member list, since the users were not sync'd again. This PR sync's users per channel.
- The Feature: support custom statuses
2021-04-14 14:59:26 -04:00
Maria A Nunez
81c40174e6 Feature: Support Cloud 14-day Trial (#17397)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Nick Misasi <nick.misasi@mattermost.com>
Co-authored-by: Allan Guwatudde <guwats10@gmail.com>
2021-04-14 11:36:36 -04:00
Agniva De Sarker
6f87eb991f MM-34786: Fix racy test TestStartServerTLSSuccess (#17387)
* MM-34786: Fix racy test TestStartServerTLSSuccess

There were a bunch of more tests which concurrently
updated config along with starting the server.

We apply the same fix as before in https://github.com/mattermost/mattermost-server/pull/17215

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

```release-note
NONE
```

* Refactor newServer

* checking for error too
2021-04-13 21:12:48 +05:30
Doug Lauder
f69cb38249 MM-32133 shared channel username collisions (#17347)
Support for handling username collisions between remote clusters. Users belonging to remote clusters have their username changed to include the remote name e.g. wiggin becomes wiggin:mattermost.

@mentions are also modified so the munged username is replaced with the original username when the post is sync'd with the remote the user belongs to.

When adding remote users:
- append the remote name to the username with colon separator
- append the remote name to the email address with colon separator
- store the original username and email address in user props
- when resolving @mentions replace with the stored original username
2021-04-13 10:40:12 -04:00
Max Erenberg
869da7a78b [MM-32044] Reset SAML auth data (#17161)
Automatic Merge
2021-04-13 00:46:30 +02:00
Jesse Hallam
2de65cfb11 MM-33180: Extend Group APIs for plugins. (#17232)
Add `GetGroupMemberUsers` (mapping to `GetGroupMemberUsersPage`) and `GetGroupsBySource`.

Fixes: https://mattermost.atlassian.net/browse/MM-33180

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-12 14:01:28 -03:00
Eli Young
17a7d5ce29 [MM-31899] Use a custom user-agent when previewing links (#17186)
* Use a custom user-agent when previewing links

Many websites block requests made with Go's default user-agent. We had
previous special-cased Twitter links to use a nonstandard user-agent.
This makes that behavior apply everywhere and also customizes the
user-agent to belong specifically to Mattermost.

* Correctly use custom transport for link previews

This allows us to use the custom user-agent defined in
services/httpservice/client.go.

* Stop leaking server version in custom user-agent

Since the custom user-agent is now used when previewing links, exposing
the server version could provide a vector for a malicious actor to
gather information about private deployments. To avoid this, we switch
to a generic string.

* Remove extraneous Transport creation

MakeClient already creates a transport for us, so this is unnecessary.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-12 09:30:48 -04:00
Jesús Espino
35d00b4644 Enable the errorAssertions govet check for mattermost-server code (#17346)
* Enable the errorAssertions govet check for mattermost-server code

* Removing unnecesary change

* Fixing some tests

* Fixing tests

* Fixing more after merge

* Fixing new offending entries

* Fixing small vet checks

* Fixing new cases detected by govet

* Fixing remote_cluster_test errors

* Fixing assertion

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-12 12:51:31 +02:00
Max Erenberg
3a3ec001bf [MM-33826] add more detailed S3 error messages (#17182)
Automatic Merge
2021-04-09 18:16:30 +02:00
Jesús Espino
819e4c0c64 Improve document extraction and including a document extraction command (#17183)
* Add extract documents content command

* Adding the extraction command and making the pure go pdf library as secondary option

* Improving the memory usage and docextractor interface

* Enable content extraction by default in all the instances

* Tiny improvement on archive indexing

* Adding App interface generation and the opentracing layer

* Fixing linter errors

* Addressing PR review comments

* Addressing PR review comments
2021-04-07 13:27:20 +02:00
Ben Schumacher
75824257d5 Add missing wrapped errors (#17339) 2021-04-07 10:44:50 +02:00
Hossein
daec0b3201 All Sections to SubSections (#16917)
* initial

* Revert "initial"

This reverts commit 3d631aeecd.

* [MM-32352] Add Experimental Subsections BACKEND (#16887)

Automatic Merge

* update appiface

* Fix app layers

* Ancillary Permissions on backend (#17061)

Automatic Merge

* [MM-32799] Add About Section (#17015)

* Add About Section

* add mock key

* Update role.go

* Update role.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* [MM-33437] Fix config access tags for experimental settings (#17111)

Automatic Merge

* [MM-32794] Reporting Sub Section (#17035)

* test

* revert

* add permissions

* add new permission stuff

* add store mock

* fix bad merge

* gofmt fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* [MM-32343] Environment SubSection (#17054)

* pre-checkout commit

* fix permission for testSiteURL

* pre-merge commit

* increase size of Permissions column in Roles table

* add entry for ENVIRONMENT to testlib/store.go

* use TEXT for Permissions column in Roles table

* use environment subsection permissions for API endpoints

* use subsections permissions for /config/environment

* add suggestions from hahmadia

* update tests to use subsection permissions

* add permissions column back in

* comment out code in upgradeDatabaseToVersion534

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* MM-32351: Add Compliance Subsections (#17023)

* add subsections for compliance sectin

* add to mock functions

* updates for read job

* fixes

* fix test

* update tests

* update tests

* another test fix

* some cleanup

* update mlog

* fix linting

* Fix bad merges

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Hossein <hahmadia@users.noreply.github.com>
Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>

* MM-32347 Site Subsections (#17095)

* Init

* Added migration key in testlib store

* Fix syntax error

* fix bad merge

* fix lint

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* MM-32350 Integrations (#17097)

* implement server subsections

* fix tests

* update test

* go fmt

Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>

* patch forgotten endpoints

* Adding subsection permissions for Authentication (#17087)

* adding new permissions, migrations to do

* permission migrations and ancilary permissions

* running make app-layers

* fixing tests and lint

* adding permissions to saml

* ldap write permissions

* running make app-layers

* fixing conflict

* making app layers

* clean up and fix tests

* change job type

* fix js error, if site url not returned

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Update permissions_migrations.go

* gofmt

* upgrade to 535

* gofmt

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Max Erenberg <max.erenberg@mattermost.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Co-authored-by: Anurag Shivarathri <anurag6713@gmail.com>
Co-authored-by: Ben Cooke <benkcooke@gmail.com>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
2021-04-06 10:39:48 -04:00
Allan Guwatudde
ec5f099313 [MM-34240]-Cloud: Congratulations welcome email missing images (#17338) 2021-04-06 10:13:14 -04:00
Haardik Dharma
343c51830f Fix initialism errors (PR-2) (#17032)
* Fix initialism errors

* Fix check-mocks test

* Revert mlog and filestore packages

* Update plugin_hooks_test.go

* Update opentracinglayer.go

* Regenerate mocks and check store layers

* Revert plugin's context changes

* Update context.go

* Update plugin_requests.go

* Update plugin_hooks_test.go

* Regenerate mocks

* Regenerate mocks and store layers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-04-03 12:43:22 +05:30
Agniva De Sarker
db01f2a91b MM-34002: Improve AddUserToChannel (#17174)
* MM-34002: Improve AddUserToChannel

When we would add a user to a channel, we would
check whether the user is removed from that team or not.

During LDAP sync, this check is not required because the
team member would have just been created. Hence, we
pass a boolean flag to bypass the check.

And with that done, we can freely query the replica.

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

```release-note
NONE
```

* Refactor code

* Rename a struct field

* fix double negative
2021-04-02 14:33:23 +05:30