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

2767 Коммитов

Автор SHA1 Сообщение Дата
Jesse Hallam
c1a27d8360 MM-39524: fix WebConn caching stale channel members (#18840)
When configured in a master/slave database environment, a read replica can sometimes return stale data to a `WebConn`, resulting in the user missing out on websocket events targetting that channel until the `WebConn` cache expires.

This is most easily reproducible by using Playbooks on community and starting a new run. The owner, or any automatically invited participants, typically find the websocket events dropped in that channel for up to 30 minutes, even after multiple page refreshes.

I've reproduced this locally, and while I've extended the unit tests, I note that they don't actually exercise this case given the need for a dedicated slave database during unit tests.

Fixes: https://mattermost.atlassian.net/browse/MM-39524
2021-10-28 11:08:09 -03:00
Doug Lauder
ceee3f4b5f re-config logger when config changes (#18860) 2021-10-28 08:06:34 -04:00
Kyriakos Z
4f2043bf97 MM-37934: supports channel override for CRT notifications (#18529)
* MM-37934: supports channel override for CRT notifications

Users with CRT 'ON' are enabled to override global CRT notification
settings per channel basis.

* Fixes brain freeze :o

* Fix push notification for CRT

* Some refactor and comments as per review comments

* Minor refactor

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-28 11:05:46 +03:00
Maria A Nunez
2ba20b5c82 MM-39591 - Restore custom message for guest invites (#18849) 2021-10-26 17:17:44 -04:00
Syerikjan Kh
1091710592 migrate from gorp to sqlx for Preference store (#18742)
Automatic Merge
2021-10-26 16:55:27 +02:00
Agniva De Sarker
e24f22745e [MM-18946] [MM-26721] [MM-6842] Cross team search+private channel autocomplete (#18468)
* Show private channels in autocomplete

This is supported in all Engines:
MySQL, Postgres, Bleve, Elasticsearch.

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

```release-note
Private channels will now appear in channel autocomplete.
If you are using Bleve or ElasticSearch, you will have to reindex
the channels again to populate them with the new attributes.
```

A large chunk of this work has been based on the earlier
effort at https://github.com/mattermost/mattermost-server/pull/17804.

Full credit goes to https://github.com/arvinDarmawan.

* Add comment

```release-note
NONE
```

* Adding more tests

```release-note
NONE
```

* fix more tests

```release-note
NONE
```

* tmp

```release-note
NONE
```

* more fixes

```release-note
NONE
```

* add tests

```release-note
NONE
```

* Add review comments from previous PR

```release-note
NONE
```

* Add API to return all channels from all team

```release-note
NONE
```

* Added support for bleve and ES

```release-note
NONE
```

* Streaming response for GetAllChannels

```release-note
NONE
```

* Fix tests

```release-note
NONE
```

* Trigger CI
```release-note
NONE
```

* fix tests

```release-note
NONE
```

* Addressing review comments

```release-note
NONE
```

* Fix lint

```release-note
NONE
```

* Removing flaky test

```release-note
NONE
```

* Address comments

```release-note
NONE
```

* Trigger CI
```release-note
NONE
```

* Added /users/<userid>/channel_members endpoint

```release-note
NONE
```

* Minor edit

```release-note
NONE
```

* Improve embedding

```release-note
NONE
```

* Fix lint error

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-26 11:30:59 +05:30
Agniva De Sarker
6bc6243131 Move some more atomic values under Channels (#18837)
* Move some more atomic values under Channels

The following fields were moved:

```
asymmetricSigningKey atomic.Value
clientConfig         atomic.Value
clientConfigHash     atomic.Value
limitedClientConfig  atomic.Value
```

And also moved the initialization order from NewServer
to Channels.Start to better reflect the order of things.

Removed AsymmetricSigningKey from ConfigService
as it was no longer used.

Removed calling regenerateClientConfig during startup explicitly
because it was anyways called from ensureAsymmetricSigningKey.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=87df1e15-588e-49ff-8bd1-ffa9651b8c82
```release-note
NONE
```

* Fix lint error

```release-note
NONE
```
2021-10-26 00:05:11 +05:30
Allan Guwatudde
246a0c297e [MM-39053] - A/B test for default notification settings (#18655)
* [MM-39053] - A/B test for default notification settings

* fix tests

* first name notifications on

* update

* Fix bad merge alignment

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2021-10-21 14:00:25 +03:00
Joe
dea8610f1e [MM-35863] Add IsEnterpriseReady Plugin API (#18676)
Automatic Merge
2021-10-20 12:12:58 +02:00
Daniel Espino García
5928e4f9e0 Fix race condition in telemetry (#18734)
* Fix race condition in telemetry

* Fix tests
2021-10-20 09:58:25 +02:00
Agniva De Sarker
fdf1afadf3 Fix Flaky test UpdateUserEmail (#18750)
Since the email sending would run in a separate goroutine,
it was possible that during the second th.App.UpdateUser call
the goroutine would run much later.

So the secondToken would be the same as the firstToken,
and the test would fail.

The fix is to ensure that the token received is different
from the firstToken.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=254a9782-a59b-4d38-8886-4927f593e715

```release-note
NONE
```
2021-10-19 19:17:08 +05:30
Agniva De Sarker
2a07d4641a Remove global variables and fix racy test (#18733)
https://community.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=65b44de0-1a9c-4643-84c1-5d803593f314

This PR improves on two things at once:
- It fixes the race condition by removing global variables.
- But instead of moving them to Server, it moves them inside Channels,
thereby making one more step towards the multi-product architecture.

```release-note
NONE
```
2021-10-18 19:38:16 +05:30
Agniva De Sarker
d949bd1638 Remove app initialization from WebHub (#18687)
- Make it a Server method.
- Pass Server instead of App.
- Remove global app instance from NewServer, rather
create local instances whenever needed.
- Remove App from Websocket router, and create dynamically
on every request.
- Remove HubStart and HubStop from App methods.
- Explicitly using s.Log instead of the global logger
to indicate dependency on Server. We could have passed the logger
explicitly but it doesn't look ideal.

```release-note
NONE
```
2021-10-18 12:36:13 +05:30
Allan Guwatudde
609fea0002 [MM-39205] Check that emails match during sign-up (#18635) 2021-10-18 09:34:10 +03:00
Agniva De Sarker
e6f36f0649 Pre-fill CreateAt to let link previews work. (#18698)
* Pre-fill CreateAt to let link previews work.

Because of the fact that getEmbedsAndImages has been now
refactored to work _before_ a post is saved. So the CreateAt
field of a post was absent.

This led to link previews being failed to save in the DB
because the timestamp wasn't there. So we just pre-fill
the field for it to work.

At the store layer, if the timestamp is present, it will just
reuse that.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=305651ab-a96f-40d3-8bcf-8391c0d3e306

```release-note
NONE
```

* Do not override existing time

```release-note
NONE
```
2021-10-16 09:09:22 +05:30
Agniva De Sarker
c27814393d Improve API4 initialization (#18680)
* Improve API4 initialization

- Refactored openGraphDataCache to be inside app layer.
- Moved the cache instance from global variable to be inside server.
- Moved out the app instantiation from the global commands package
to be instantiated on every call. Only the server instance is passed.
- Moved InitLocal to be called from inside Init.

```release-note
NONE
```

* Remove commented line

```release-note
NONE
```
2021-10-15 19:57:05 +05:30
Agniva De Sarker
43a99a5783 Move cloud init back to initEnterprise (#18668)
* Move cloud init back to initEnterprise

```release-note
NONE
```

* Remove debug lines

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-15 19:29:06 +05:30
Ibrahim Serdar Acikgoz
ba3a911c99 [MM-39299] Remove outdated translations and update go-i18n library (#18674)
* Remove outdated translations

* update go-i18n dependency

* reflect review comments

* add message count for languages which has two translations for plurals
2021-10-15 16:26:25 +03:00
Agniva De Sarker
99e6039472 Add functionality to cleanup old jobs (#18646)
* Add functionality to cleanup old jobs

Historically, we never cleaned up old jobs from the DB
leading to them being accumulated forever.

This PR introduces functionality to cleanup old jobs
older than a defined threshold.

The functionality is set to false by default and has
to be enabled for it to work.

```release-note
2 new config settings were added.

JobSettings.CleanupOldJobs: This indicates whether to clean up old jobs
from the DB or not. Default is false.

JobSettings.CleanupJobsThresholdHours: This defines the time gap in hours beyond
which older jobs will be removed. This has no effect if the above config
setting is set to false. Default is -1
```

* fix copy pasta

```release-note
NONE
```

* address review comments

```release-note
NONE
```

* Fix lint

```release-note
NONE
```

* Use single config option for everything

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-15 11:03:54 +05:30
darkLord19
98284a79eb remove timedDND feature flag (#18346) 2021-10-14 11:54:09 -04:00
Agniva De Sarker
850fef1ad1 Move ImageProxy inside Channels (#18656)
* Move ImageProxy inside Channels

```release-note
NONE
```

* Move back httpService

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-14 13:57:04 +05:30
Hossein
6521b0dfe3 Unfurl Focalboard Server PR (#18271)
* Allow Embeds editing without editing

* Add focalboard to embed after it being in props

* Fix tests

* change to boards

* remove extra gunk

* Fix tests

* Add Feature Flag

* update boardsunfurl

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-13 10:51:27 -04:00
Ibrahim Serdar Acikgoz
be203d9bf3 Initial team service implementation (#18279)
* initial service implementation

* reflect review comments
2021-10-13 15:20:40 +03:00
Agniva De Sarker
f0ecdcc5f5 Move Channels into App (#18623)
* Move Channels into App

In this PR, we make Channels as part of App
instead of Server. This is part of the transition period
of moving fields from Server to Channels.

For now, Channels contains Server. So the hierarchy is

App -> Channels -> Server.

And as a first step, we also move httpService to Channels.

```release-note
NONE
```

* Fixing another test

```release-note
NONE
```

* new method

```release-note
NONE
```
2021-10-12 11:39:49 +05:30
Agniva De Sarker
561bc968c8 Creating empty Channels shell (#18611)
* Creating empty Channels shell

This is the first step in moving to a product-based
isolated architecture.

For now, Channels is empty and does not contain anything.

Next step is to change App to contain Channels instead
of Server. Some of the initialization code in NewServer
would need to be moved inside NewChannels.

This would complete the full pass-through mode of accessing
everything.

The last step would be to gradually move Channels related
fields from Server into Channels, keeping Server to be
just the global level struct.

```release-note
NONE
```

* fix vet failure

```release-note
NONE
```
2021-10-11 19:24:50 +05:30
Martin Kraft
55ea07677d Removed PostPreview from MessageHasBeenPosted payload. (#18613)
Automatic Merge
2021-10-08 18:50:03 +02:00
Agniva De Sarker
76d492f9ab MM-37186: Update dependencies (#18604)
* MM-37186: Update dependencies

The split client libraries were excluded from being upgraded.

See: https://github.com/splitio/go-split-commons/issues/56

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

```release-note
NONE
```

* Ignore staticcheck deprecation warnings

```release-note
NONE
```
2021-10-07 12:57:51 +05:30
Agniva De Sarker
2898f988fc Move admin advisor to separate file (#18606)
```release-note
NONE
```
2021-10-07 12:20:40 +05:30
Allan Guwatudde
2a40a7d649 [MM-39072] - Run make build-templates on latest master (#18541)
* [MM-39072] - Run make build-templates on latest master

* fix guest template failure
2021-10-06 09:50:51 +03:00
Dmitrijs Zubriks
d0fad86246 [GH-15744] Remove direct token store access in api4/user module (#18411)
Automatic Merge
2021-10-05 09:50:02 +02:00
Agniva De Sarker
b6f0afb919 Remove searchEngine from App (#18540)
https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=c6753a1c-dbbf-4316-8e4e-c58ebb65d6e0

```release-note
NONE
```
2021-10-05 12:41:00 +05:30
Ben Cooke
0332e1545d [MM-38579] Removing some town square permissions stuff (#18464)
* removing some town square permissions stuff

* fixing error

* adding back in channel leave check

* removing tests

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
2021-09-27 22:01:16 -03:00
Agniva De Sarker
225461fd7e Exclude sending file metadata to plugin hooks (#18454)
* Exclude sending file metadata to plugin hooks

A FileInfo object contained a MiniPreview which is
a slice of bytes. This can be particularly costly
while marshalling to plugin hooks.

We avoid this by refactoring the Embeds and Images
population to a separate method and calling that
to prevent posts from getting updated.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=9c0b5413-5401-4ef2-83d5-b9f756585bbc

```release-note
NONE
```

* refactor to separate method

```release-note
NONE
```
2021-09-27 08:35:39 +05:30
Christopher Poile
b0f26cedf2 MM-38774 - partial fix for: Community running out of memory (#18445)
* prevent invalid images from entering generateMiniPreview in the future

* fixing err, err2, imgErr

* linting

* load actual pngs and gifs in tests

* consistent style
2021-09-23 13:17:37 -04:00
Daniel Espino García
02a9ef3f82 [MM-38216] Add API endpoint and adapt search to allow multi-team search (#18371)
* Add API endpoint and adapt search to allow multi-team search

* Refactor handler, refactor sql query to use squirrel, rename app and store functions and add tests

* Fix lint

* Fix search engines and remove unneeded comments

* Fix test

* Remove user from channel after test
2021-09-23 14:43:09 +02:00
Agniva De Sarker
8c62cf6e3d MM-38657 - Sentry crash: Fix nil dereference when post not found (#18440)
* Revert "Add debug log for nil referencedPost (#18437)"

This reverts commit e575315275.

* Ignores post not found errors at a higher level

And adds test

```release-note
NONE
```
2021-09-22 22:50:00 +05:30
Michael Kochell
e575315275 Add debug log for nil referencedPost (#18437)
* add debug log for nil post

* add post id for context

* log other vars that may be nil

* change from Warn to Debug
2021-09-21 18:44:03 -04:00
Claudio Costa
0c84885132 [MM-38375] Fix processing bulk import with attachments (#18352)
* Fix improper attachments in replies

* Fix import data path

* Improve errors

* Fix importing attachments directly from zip file

* Add some test cases to cover error paths
2021-09-21 17:39:52 +02:00
Allan Guwatudde
132f2e9680 [MM-36603] - Text is cut-off on the bottom of the 14-day trial 3 day to end of trial email notification (#18421)
* feedback impl

* add test
2021-09-21 12:55:52 +03:00
Christopher Poile
d69f9df09f MM-38635 - Debug statements for prepareImage errors on community-daily (#18416)
* add debug info to generateMiniPreview error

* linting

* simplify

* Update app/file.go

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

* add channel_id and creator_id to the log statement

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2021-09-20 11:13:49 -04:00
Martin Kraft
28ef5856ed MM-38081: Fix for disappearing permalink previews (#18400)
* MM-38081: Fix for disappearing previews.

* MM-38081: Update method signature in tests.

* MM-38081: Adds test replicating bug.
2021-09-17 17:47:00 -04:00
Allan Guwatudde
ad5591cf75 [MM-37730] - Self-managed: Update email template to new branding - Batch Email (#18221)
* [MM-37730] - Self-managed: Update email template to new branding - Batch Email

* batch email fixes

* simplify email title

* More fixes

* fix tests

* fix group message name on card

* fix bracket issue

* style the count

* account for  merged changes

* change truncating rule
2021-09-16 22:08:31 +03:00
Martin Kraft
acec8db7c5 MM-37721: Add prop for post preview before saving record. (#18361)
* MM-37721: Add prop for post preview before saving record.

* MM-37721: Test fix.

* MM-37721: Adds test.

* MM-37721: Fixes vet.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-09-16 13:54:38 -04:00
Ben Cooke
3b9324b389 [MM-36444] Manage config deprecations for 6.0 (#18035)
* removing deprecated stuff

* removing deprecations and marking others for deprecations

* removing some of the configs

* partially remove ExperimentalChannelOrganization

* fixing merge issues

* moving default permissions to defaultroles function

* removing experimentaltownsquare

* removing old tests and remove legacysidebar config

* fixing test

* removing log

* removing unused variables

* MM-36444: Fix for renamed functions.

* MM-36444: go mod tidy and go mod vendor.

* MM-36444: Vendored go modules.

* MM-36444: Removes UseExperimentalGossip config field from model.

* Fix vendors

* fixing test

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2021-09-14 13:22:59 -04:00
Claudio Costa
e542842bd1 Disable admin support status job on server startup (#18341) 2021-09-14 09:02:08 +02:00
Doug Lauder
bb659d03fd Fix plugin logging missing context fields
Fix an issue where context fields logged by server on behalf of plugins didn't contain correct name/value pairs:
- bump Logr version to add key/value methods to sugar logger
- expose factory args when configuring logging with custom target types (needed for FocalBoard to create log target adapter that converts typed fields into slices of interface{} as per plugin logging API)
2021-09-13 10:12:18 -04:00
Claudio Costa
bbd5ba9ff2 Bump Post.Props size limits (#18370) 2021-09-13 14:23:50 +02:00
Kyriakos Z
1c8bc159e0 MM-38093: updates notifications copy on CRT replies (#18332)
MM-38093: updates notifications copy on CRT replies

Updates texts form push and email notifications when the user has CRT "on"
and the post is a reply to a thread.

Email batches text aware of CRT threads

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-09-10 11:12:18 +03:00
Claudio Costa
6b08de10bb Fix possible race (#18328) 2021-09-07 19:14:29 +02:00
Claudio Costa
aaeaaf716b Fix flaky TestCreateDefaultMemberships (#18330) 2021-09-07 19:09:48 +02:00