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

12385 Коммитов

Автор SHA1 Сообщение Дата
Agniva De Sarker
4fe52d677c MM-24652: Bump golangci to 1.25.1 (#14409)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 10:36:58 +05:30
Agniva De Sarker
c7f53cf02b MM-24759: fix order of calling SetstatusOnline (#14450)
We would call SetStatusOnline in a goroutine before actually calling HubRegister.
This could cause the message not to be sent after all, because there's no guarantee
that Register would actually happen before it.

To fix it, we just change the order of things.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 00:16:24 +05:30
Martin Kraft
3f6c9ab40c Adds server awareness. (#14271)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-11 11:45:54 -04:00
Eli Yukelzon
744ec281d2 Layer generators error return type fix (#14526) 2020-05-11 12:37:02 +03:00
Agniva De Sarker
2e1dc79a03 Remove concurrent write to websocket connection (#14527)
This test writes directly to a connection
which causes panics and more frustration in an already fragile CI.

Since this anyways checks an edge condition, and will anyways be
removed in v6, let's remove this for now and let CI be happy.
2020-05-11 13:19:00 +05:30
Agniva De Sarker
48256721c4 MM-24611: Fix flaky test TestDeletePreferencesWebsocket (#14399)
After registering the conn in the hub, we proceeded to send a
direct message to the user. We had changed it to send the direct message
in the same hub goroutine that handles the registration. This was the correct
behavior and fixes chances of having panics due to sending to closed channels.

However, often fixing something unearths some deeper underlying bug. This was
such a case :)

The issue was that register channel had a buffer size of 1. And we were sending
a direct message after registration. In the code to send direct message, we
were checking if the user has been registered or not, and if not, then skip it.

Therefore, since the register channel buffer was 1, it could very well be that
the select case would pick up the direct message send case first - in which
case it would not have been registered, and therefore no hello message would be sent.

The fix is to unbuffer the register and unregister channels. There does not seem
to be a valid reason to make these buffered channels. They are meant to be
synchronous operations, because the code following them assumes that the user
has been registered.

While here, we also remove all the time.Sleeps before waiting on the Response channel
because they are not required at all. Waiting on a channel is already blocking.

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-05-09 08:45:03 +05:30
Farhan Munshi
fff93cb73f [MM-24987] Dont call GetSchemeRolesForChannel and instead load the scheme from channel (#14514)
* MM-24987 Dont call a.GetSchemeRolesForChannel and instead load the scheme using the channel directly

* Trigger CI

* MM-24987 Add a test for concurrent patch to channel moderation

* MM-24987 Cleanup
2020-05-08 17:50:45 -04:00
Farhan Munshi
8fe003876d [MM-24828] Take into account group synced state of team and channel when sending notifications (#14477)
* MM-24828 Take into account group synced state of team and channel when getting groups for mentions

* Update app/notification_test.go

* i18n-extract

* Revert "i18n-extract"

This reverts commit dcb0426b98afa4646c26870c0e3a1236f99fda17.

* Trigger CI

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-08 16:32:48 -04:00
Farhan Munshi
0d1eb02341 [MM-24827] Disable group mentions on e10 or team edition (#14475)
* MM-24827 Disable group mentions when ldap groups not enabled

* Trigger CI

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-08 14:19:01 -04:00
Martin Kraft
4c2d34b097 Fix log message typo. (#14472) 2020-05-08 13:51:52 -04:00
Agniva De Sarker
82e27982d0 MM-24310: Recycle DB connections properly (#14378)
Automatic Merge
2020-05-07 22:03:54 -07:00
Scott Bishel
80c846412d MM-24692: Add a since parameter to getGroups api (#14444)
* add a since parameter to getGroups api

* update for lint error

* when using since, return deleted groups as well.

* update flaky test, groups have same create time

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 14:35:09 -06:00
Scott Bishel
1031e27fd8 MM-23038: Compliance Report Fixes (#14242)
* add warning count as return value

* add warning count as return value

* fix file name

* update mock

* add setting warning to db

* replace wrongly removed string

* add dummy function to see if it will build

* remove dummy function

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 14:12:47 -06:00
Scott Bishel
bdd0e9febb MM-24694: Add getGroupsByUserId to API layer (#14443)
* add getGroupsByUserId to API layer

* update for lint errors

* add check for contextId = userId or ManageSystem Permission

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 13:35:56 -06:00
Shibasis Patel
882b0324b5 MM_22682_Centralize_ID_Validation (#14237)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 13:27:35 -04:00
Jesús Espino
ef5ac519d9 Disable read/search db replicas in TE/E0 (#14400)
* Disable read/search db replicas in TE/E0

* fixing tests

* Removing unnecesary text.

* Updating without-license read-replicas config before store initialization

* Reconnecting to database after remove read replicas
2020-05-07 14:11:05 +02:00
Juho Nurminen
37f43a7094 Move Dependency-Check configs to a separate repo (#14497) 2020-05-07 12:05:49 +02:00
dantepippi
539c8ba4bb [MM-24662] Refactor license_store to use squirrel Closes #14422 (#14451)
* Refactor license_store to use squirrel

* Fix query build error string
2020-05-07 14:42:51 +05:30
Federico Martín Alconada Verzini
d9a0f89446 [GH-13461] add unit tests to the RemoveChannelUsersCmd mmctl command (#14178)
* add unit tests to the RemoveChannelUsersCmd mmctl command

* add changes requested by @mgdelacroix

Co-authored-by: Federico Martín Alconada Verzini <fedealconada@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 10:22:53 +02:00
Doug Lauder
41ccd0c755 MM-24484 allow base64 certs in config for TLS Syslog (#14445) 2020-05-06 19:45:03 -04:00
Doug Lauder
5e59b5f70c MM-23935 extend session expiry on user activity (#14275)
* MM-23935  extend session expiry on user activity

- if user types anything before a session expires the session will be extended to now + session length

- ensures new session expiries are not written to DB too frequently

- new session store func for updating session ExpiresAt

- session length defaults for mobile and web/ldap changed from 180 days to 30 days
2020-05-06 15:41:10 -04:00
catalintomai
58305b080f Check license expiration, disable license and notify administrator (#14420)
* Check license expiration and notify administrator
2020-05-06 10:28:49 -07:00
Carlos Tadeu Panato Junior
5ad3eaf7ee upgrade DB to 5.23 (#14469) 2020-05-06 10:47:58 +02:00
Siyuan Liu
10538b4813 cache v2 interface - store serialized cache (#14118)
Automatic Merge
2020-05-05 11:59:25 -07:00
Carlos Tadeu Panato Junior
4c16924832 bump base package for MM in dockerfile (#14468) 2020-05-05 18:43:12 +02:00
Gabe Jackson
22c949618c Fix API ping endpoint race condition (#14365)
This corrects an issue found when running multiple clustered
Mattermost servers and using the optional `get_server_status`
check on the ping API endpoint. This is done by allowing each
server to write and read from its own health check key in the
system table.
2020-05-05 22:44:18 +08:00
Hossein Ahmadian-Yazdi
40b20c3eaf [MM-24177] Adds props to post for front end to know if highlight or not (#14348)
* Add props to post

* Address PR comments

* address PR comments

* Fix styling problems

* Address PR comments

* address PR comments

* Add PR suggestion

* fix usage

* fix error

* remove err

* fix golang lint
2020-05-05 06:00:59 -04:00
George Goldberg
3dbb0201a4 MM-24780: Fix subpath CSP rewriting after Rudder addition. (#14459)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-05 09:19:25 +01:00
Tomas
5dcd37d7e3 Convert tests in model/search_params_test.go into table testing (#14058)
* Convert tests in model/search_params_test.go into table testing

* remove the not needed definitions

* gofmt

* update msg strings

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-05 09:39:02 +02:00
Agniva De Sarker
462a21dcd1 MM-24547: Fix deadlock in pingTimeoutTimer (#14440)
Automatic Merge
2020-05-04 22:01:53 -07:00
Juho Nurminen
cf3ba6661d Fix dependency alerting (#14457)
Automatic Merge
2020-05-04 04:21:47 -07:00
Doug Lauder
a6a58f99e7 MM-24707 fix reply import bug (#14442) 2020-05-01 14:13:06 -04:00
Agniva De Sarker
4f022aff6d MM-24547: Fix writer leak when connection closes (#14406)
* MM-24547: Fix writer leak when connection closes

When the connection is closed, the exit path does not
shut down the writer goroutine. In which case, it will keep spinning forever.

Since we already have the CAS mechanism now, we can move the closing
functionality into the main Close method and just call that in the defer block.

This makes closing the websocket client idempotent from both perspective -
- Explicitly closing.
- Closing due to connection tear down.

There are still 2 races left:
- Using the exported Conn to directly write messages. We cannot do anything about
that as long as clients directly using that.
- Setting the wsc.pingTimeoutTimer field in a separate goroutine when calling
.Connect(). This will need to be seen later.

* Fix ineffectual assignment

* Duplicate the closing of writer

The problem with refactoring the writer closing to a common
function was that we needed to wait for the reader to exit
before closing the EventChannel and ResponseChannel.

But then there is another problem that the API can be used in such
a way that the client is liable to call Close without even calling
Listen. In that case, we cannot wait for Listen to quit.

So from Close, we can only close the connection. And therefore
we need to duplicate the writer closing in the read loop's
defer block.

* Cleanup some comments
2020-04-30 23:50:13 +05:30
Eli Yukelzon
7800116429 MM-23093 Implement Server Setup telemetry - server configuration (#14374)
* added advanced first day diagnostics reporting

* typo

* config corrected

* defaults

* moved from config to system db table

* missing file

* added error handling

* tests

* typos

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-04-30 18:18:12 +03:00
Mario de Frutos Dieguez
278c295869 Move Rolestore.GetByNames query to raw query (#14403)
Given that this query is part of the top 5 most used queries
we want to move it to use raw queries instead of gorp so we
can get rid of the reflection overhead
2020-04-30 16:28:59 +02:00
Agniva De Sarker
5cb16c9fc7 MM-24395: Set response header to be attachment for SVG images. (#14385)
* MM-24395: Set response header to be attachment for SVG images.

We check the file extension and appropriately set the response header.
SVG images without a file extension aren't proxied at all. So there's no
problem with that.

* Add test

* Improve test a bit

* Capture content type

* incorporate comments

* Set attachment mode in case of error too
2020-04-30 09:03:13 +05:30
Agniva De Sarker
03a55367d9 MM-24312: Fix Dependency updates (#14391)
Automatic Merge
2020-04-29 14:06:09 -07:00
Doug Lauder
a3cf490a4d MM-24575 handle auto-respond to self (#14410) 2020-04-29 14:19:18 -04:00
Miguel de la Cruz
f85cbf6b5c Refactor audit_store to use squirrel (#14393)
* Refactor audit_store to use squirrel

* Add query build error translation
2020-04-29 16:18:27 +02:00
Juho Nurminen
6b99d68818 Suppress jQuery issue in Dependency-Check (#14396) 2020-04-29 10:38:19 +03:00
Christopher Speller
68ff87708a Update restricted team names. (#14386) 2020-04-28 07:37:19 -07:00
Agniva De Sarker
f0eb0a9a01 MM-24397: Reusing the read buffer while reading messages from websockets (#14368)
* MM-24397: Reusing the read buffer while reading messages from websockets

The core problem was that conn.ReadMessage allocated a buffer every time it was read.
This created heavy amount of allocations every single time we read a message from the websocket.

To avoid this, we bypass the ReadMessage which was more of a helper method,
and actually call the NextReader which returns a reader object.
We can then reuse a single byte.Buffer instance to read the object unmarshal
into a WebSocketEvent object. This gets rid of the allocation in the read path completly
and allows GC more time to do other tasks.

* Incorporate review comments

* Move reset buffer to top of loop

* Cleanup further

* Fix test

* Final fix
2020-04-28 19:38:11 +05:30
Jesús Espino
8781c36eb3 Fixing system messages about non-visible users (#14254)
* Fixing system messages about non-visible users

* Adding unit tests to verify the new behavior

* Regenerating app layers

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-04-28 12:58:34 +02:00
Jesús Espino
224b72c61e MM-24037 Adding getKnowUsers API endpoint (#14332)
* Adding getKnowUsers API endpoint

* Adding i18n strings

* Fixing golint errors

* Adding doc strings

* Remove debug line

* Updating app_iface

* Fixing gofmt
2020-04-28 12:52:43 +02:00
Agniva De Sarker
d3b36e3455 app: outdent skipSend condition (#14377)
We invert the skipSend condition and outdent the remaining block
to make the code a bit more idiomatic.

While here, we also change the dropping message level from info to
warn because that's what it should be.
2020-04-28 15:27:58 +05:30
Nev Angelova
6362926b5c [MM-23827] - Update nps plugin version (#14369)
Co-authored-by: Nevyana Angelova <nevyangelova@Nevyanas-MBP.fritz.box>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-04-28 10:54:07 +02:00
Mario de Frutos Dieguez
9853056b7a Implementation of expectation tests (#14191) 2020-04-27 21:54:46 +02:00
Agniva De Sarker
f79b7567b1 MM-23896: Fix clearing of batched emails on user activity (#14340)
On user activity, we were clearing the job.pendingNotifications map.
But we had already created a copy of the notifications slice while
iterating the map. Therefore, if we pass the copied slice, it would
still have the old notifications which were originally deleted.

The unit tests would not catch this because it was testing the
job.pendingNotifications map and not actually checking if the email
handler was being called or not. We fix that now.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-04-28 00:59:48 +05:30
Farhan Munshi
b29b70da09 MM-23605 Create new team scheme updated socket event (#14305) 2020-04-27 13:26:52 -04:00
Farhan Munshi
7bc630a600 [MM-23727] Make channel validation consistent on the server (#14230)
* MM-23727 Ensure user ids not allowed in channel name:

MM-23727 Move channel name validation to model level

* MM-23727 Update wording
2020-04-26 12:38:33 -04:00