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

934 Коммитов

Автор SHA1 Сообщение Дата
Jesús Espino
24621a22ed Add the content field to FileInfo (#15749)
* Add the content field to FileInfo

* Fixing the upgrade code

* Trying to fix the text-scheme

* Fixing test-schema

* Fixing test-schema

* Moving the migration to the next version
2020-11-02 15:43:48 +01:00
Eli Yukelzon
fe352ab57f MM-29703 Mark threads as read when channels are marked (#15994)
Co-authored-by: Jesús Espino <jespinog@gmail.com>
2020-10-30 17:00:21 +02:00
Carlos Tadeu Panato Junior
1729239385 upgrade DB to 5.29 (#16081) 2020-10-30 13:37:26 +01:00
Harrison Healey
8bb772638c MM-29067 Add deterministic IDs for default sidebar categories (#16030)
Automatic Merge
2020-10-29 10:24:01 -04:00
Alex Johnson
9cb704d537 Documents exported methods within SqlTeamStore methods (#15996)
Co-authored-by: Justine Geffen <justinegeffen@users.noreply.github.com>
2020-10-27 16:19:11 +01:00
Claudio Costa
9484366784 Fix nil dereference panic in SearchArchivedInTeam (#16064)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-26 15:19:14 +01:00
Rodrigo Villablanca
96f1739f8f UserStore migration (#15563)
* Migration completed

* Fix tests

* Fix tests

* Fix tests

* Suggestions

* Trigger CI

* Suggestions

* Merge with master

* Trigger CI

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-10-26 15:11:27 +05:30
Agniva De Sarker
d51d843fcd MM-22950: Remove supplier test (#16072)
This test is too flaky to be written as a test. Let's just remove it.

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

```release-note
NONE
```
2020-10-26 13:21:24 +05:30
Martin Kraft
d519ab580f MM-28815: Message export query optimization. (#15757)
* MM-28815: Optimizes message export query.

* MM-28815: Removes DeleteAt WHERE condition.

* MM-28815: Adds Id to the ORDER BY clause.

* MM-28815: Concatenates the string to remove the confusing '%%' in the query.

* MM-28115: Remvoes secondary sorting.

* MM-28815: Keeps the alias in the order by.

* MM-28815: Removing forced index.

* MM-28815: Formatting.
2020-10-16 10:21:36 -04:00
Eli Yukelzon
8844141df3 MM-28249 Auto follow threads (#15878)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-15 18:01:16 +03:00
Aayush Pal
fa9279a675 Added GoDoc for functions mentioned in Task 7 (#14004) team_store.go (#15762) 2020-10-14 12:53:48 +02:00
Jeremy MacArthur
71997eaac7 Adding godocs for the 4 functions listed: (#15806)
* Adding godocs for the 4 functions listed:

SqlTeamStore.UpdateLastTeamIconUpdate
SqlTeamStore.UpdateMembersRole
SqlTeamStore.UserBelongsToTeams
SqlTeamStore.GetTeamMembersForExport

* Apply suggestions from code review

Applying suggestions from the community to help clean up the grammar in the docs.

Co-authored-by: Justine Geffen <justinegeffen@users.noreply.github.com>

* Apply suggestions from code review part 2

Co-authored-by: Justine Geffen <justinegeffen@users.noreply.github.com>

Co-authored-by: Justine Geffen <justinegeffen@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-08 13:42:55 +02:00
Ibrahim Serdar Acikgoz
c67c46a684 [MM-28810] channel_store_categories: check if object is nil after the query (#15635)
* check if onj is nil

* channel_store_categories: add tests

* reflect review comments

* remove store declaraation
2020-10-07 09:33:18 +03:00
Eli Yukelzon
375931a4b9 Post image schema fix (#15763) 2020-10-04 16:14:06 +03:00
Rodrigo Villablanca
bb4df5a68e ChannelStore migration Part 3 (#15504)
* Migration finished

* Change error var name

* Fix imports

* Fix tests

* Merge with master

* Doing some suggestions

* More suggestions

* Fix i18n

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-10-04 10:12:29 +05:30
Joshua Bezaleel Abednego
5353bceaea MM-24948: Command webhook store squirrel refactor (#14659)
Automatic Merge
2020-10-03 22:57:28 -04:00
Eli Yukelzon
b8ceb610e6 MM-27353 Mini image previews (#15376) 2020-10-02 11:14:57 +03:00
Eli Yukelzon
595248b10e MM-28247 Threads metadata table (#15571) 2020-10-01 18:48:38 +03:00
catalintomai
1c0d590c81 Add AWS Metering service support (#15290) 2020-09-28 11:43:08 -07:00
catalintomai
f74b86ae95 MM-28733 : Admin Advisor v2 (#15515) 2020-09-25 14:59:41 -07:00
Carlos Tadeu Panato Junior
c392f993d6 upgrade DB to 5.28 (#15556) 2020-09-24 18:44:31 +02:00
Rodrigo Villablanca
8118cac350 Poststore migration part3 (#15505)
* Migration completed

* Order in translations file

* Fix: lints

* Trigger CI

* Fix message key

* Change mlog.Error for mlog.Warn

* Fix imports

* Adding translations needed for EE

* Trigger CI

* Fix merge with master

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-24 10:46:36 +05:30
Jaime Cepeda
f3cb2538a7 Refactor SQL queries in store/sqlstore/channel_member_history_store.go to use the squirrel builder (#15529) 2020-09-23 01:32:03 +02:00
Eli Yukelzon
4e9ddd4686 MM-27918 In-Product notices support (#15316) 2020-09-21 10:28:46 +03:00
Rodrigo Villablanca
1d4a7c0552 TeamStore migration part 2 (#15396)
* Migration completed

* Fix tests

* Reduce to one line

* Fix: change to plain error

* Fix imports

* Trigger CI

* Fix i18

* Fix merge with master

* Trigger CI
2020-09-16 21:54:39 -03:00
Rodrigo Villablanca
f0fc51244c TeamStore migration Part 3 (#15397)
* Migration completed

* TODO
2020-09-16 12:12:10 -03:00
Ibrahim Serdar Acikgoz
e69a2a41ca [MM-28210] sqlstore/user_store: filter deleted users for GetProfilesInChannel (#15390)
* sqlstore/user_store: filter deleted users for GetProfilesInChannel

* allow GetProfilesInChannel use userGetOptions

* sqlstore/user_store: add more test cases

* store/user_store: refine filter
2020-09-16 11:04:17 +03:00
Claudio Costa
9c272f0b20 [MM-26812] Add support for resumable file uploads (#15252)
* Implement AppendFile for FileBackend

* Split test into subtests

* [MM-26812] Add support for resumable file uploads (#15252)

* Implement UploadSession

* Implement UploadSessionStore

* Add error strings

* Implement resumable file uploads

* Add UploadType

* Fix retry layer tests

* Regenerate store layers

* Fix store error handling

* Use base for filename

* Prevent concurrent uploads on the same upload session

* Fix erroneus error string

* Improve error handling

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

* Fix translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-15 21:28:25 +02:00
Rodrigo Villablanca
9ee9c78412 ChannelStore migration Part 2 (#15405)
* Migration completed

* Several corrections in tests

* Fix imports

* Fix some errors after testing

* Trigger CI

* Fix tests

* Suggestions

* Suggestions

* Add license

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-15 23:18:30 +05:30
Claudio Costa
7abc4f5383 [MM-28033] Perform localcachelayer tests for one DB type only when in CI (#15433)
* Perform localcachelayer tests for one DB type only if in CI

* Add newStoreType() for sqlstore case
2020-09-15 15:05:13 +02:00
Ibrahim Serdar Acikgoz
9c2d2180e6 store/channel_store_categories: fix index out of bounds error (#15423) 2020-09-15 15:25:12 +03:00
Agniva De Sarker
42eca5315b MM-27957: Fix flaky test TestRecycleDBConns (#15415)
https://mattermost.atlassian.net/browse/MM-27957
2020-09-11 18:33:09 +05:30
Ayan Banerjee
748526cc4c [MM-23003] Document sql store 'SqlTeamStore' methods (Task 8) fixes (#15318)
Automatic Merge
2020-09-10 07:29:57 -04:00
Claudio Costa
4e1824e143 [MM-28397] Fix data race in SqlSupplier (#15419)
* Fix data race in SqlSupplier

* Add comment

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-10 09:57:00 +02:00
Doug Lauder
1b67322fb9 MM-27744 disable Zap for unit tests. (#15398)
MM-27744 disable Zap for unit tests.

Zap has no concept of shutdown or close. Zap is only shutdown when the app exits. Not a problem for console logging, but when creating a new Zap logger that outputs to files on every unit test, that leaves no easy way to clean up until process exit. Depending on what else is running this can exhaust all file handles and cause unit tests to fail.

Zap is now disabled unit tests and uses Logr instead, regardless of config settings. `make test-server` peak file handle usage dropped from ~5K to less than 100.
2020-09-09 15:25:55 -04:00
Agniva De Sarker
1fde5112b6 MM-28444: Optimize GetPostsSince in postgres (#15411)
GetPostsSince is used when loading posts for a channel.

An opportunity for optimization is that the primary SQL query
is repeated twice and then a UNION is constructed for the results.

```
SELECT
		       *
		FROM
		       Posts
		WHERE
		       UpdateAt > :Time AND ChannelId = :ChannelId
		       LIMIT 1000
```

But we can use a CTE for this which caches the results to be reused later.

This leads to the main query being executed once rather than twice. And from
Postgres 12 onwards, CTEs can be inlined which opens the door to further optimizations.

From the docs (https://www.postgresql.org/docs/10/queries-with.html)

> A useful property of WITH queries is that they are evaluated only once per
execution of the parent query, even if they are referred to more than once
by the parent query or sibling WITH queries. Thus, expensive calculations
that are needed in multiple places can be placed within a WITH query to avoid redundant work.
Another possible application is to prevent unwanted multiple evaluations of functions
with side-effects. However, the other side of this coin is that the optimizer is
less able to push restrictions from the parent query down into a WITH query than an ordinary subquery.

In our case, the caveat does not apply because we are only filtering columns and not rows,
so we can safely use it.

Following are the query plan comparisons:
Old: http://tatiyants.com/pev/#/plans/plan_1599394993105
New: http://tatiyants.com/pev/#/plans/plan_1599395970886

As we can see, in old bitmap index scan+heap scan happens twice, but in the new one,
it happens only once.

This has been load tested with a large dataset and confirmed to exhibit good improvements.
2020-09-09 21:22:54 +05:30
Rodrigo Villablanca
1ab06ffa7c Migration of PostStore Part 2 (#15181)
* Starting migration

* Lint: remove unnecessary use of sprintf

* Fix i18n

* Some suggestions

* Fix store layers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-03 18:49:11 +05:30
Rodrigo Villablanca
2cb655ed67 Migration of ChannelStore Part 1 (#15235)
* Lint: remove unnecessary use of sprintf

* Fix i18n

* Returning the right error (InternalServerError)

* Doing some suggestions

* Fix store layers

* Fix missed translation

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-03 11:24:46 +05:30
Rodrigo Villablanca
54f86e7fb1 Migration of TeamStore Part 1 (#15246)
Automatic Merge
2020-09-03 00:29:57 -04:00
Abdulkadir Poyraz
f12ca27bac [MM-24522] remove duplication in OR and IncludeDeletedChannels params for search (#14573) 2020-08-31 13:40:58 +02:00
Jesse Hallam
8ee5113a30 cleanup error logging from user_store (#15335)
Tracing this back, it looks like I'm responsible for leaving some spurious logging in the user store.
2020-08-25 10:58:46 -03:00
Martin Kraft
8354206e5c MM-25543: New Admin Roles (#14960)
* MM-23832: Initial set of changes

* MM-23832: further iteration

* MM-23832: further iteration

* MM-23832: further iteration

* MM-23832: Fixes merge.

* create migration for new Roles

* MM-23832: Renames some roles.

* MM-23832: Adds ability to see logs.

* MM-23832: Removes manage roles from restricted admin.

* MM-23832: Make authentication section read-only for restricted admin.

* MM-23832: Allow restricted admin to purge caches.

* MM-23832: Adds ability to recycle DB connections.

* MM-23832: Adds ability to purge indexes.

* MM-23832: Adds ability to test email and S3 config.

* MM-23832: Adds abilituy to read job status.

* MM-23832: Adds ability to read plugin statuses.

* MM-23832: Renames Restricted Admin to System Manager.

* MM-23832: Adds manage team roles to system_user_manager.

* MM-23832: Updates some permissions.

* MM-23832: Allow get all channels and get moderations.

* MM-23832: Adds some permissions to User Manager.

* MM-23832: Remove write users from user manager.

* MM-23832: Changes permissions for the usermanagement > users sysconsole section.

* MM-23832: Removes read_settings and write_settings permissions. Ensures the usermanagement parent permissions encompass the sub-permissions.

* MM-23832: Updates permissions.

* MM-23832: Changes some permissions checks, adds new permissions to roles.

* MM-23832: Adds ability to update a role.

* MM-23832: Permissions updates.

* MM-23832: Removes write access to plugins for system manager.

* MM-23832: Removes read compliance from new roles.

* MM-23832: Adds mock for new roles creation migration.

* MM-23832: Changes to variadic param.

* MM-23832: Removes some duplication in the permissions model. Renames some permissions constants.

* MM-23832: Updates some migrations.

* MM-23832: Removes some unnecessary constants.

* MM-23832: Changes back to old app method name.

* MM-23832: Fixes incorrect permission check.

* MM-23832: Changes write to read permission check.

* MM-23832: Removes the authentication permission from link/unlink group.

* MM-23832: Enable testing LDAP with read permissions.

* MM-23832: Make testing elasticsearch a read permission.

* MM-23832: Warn metrics are associated to any system console read permissions.

* MM-23832: Updates some permissions checks.

* MM-23832: Removes non-systemconsole permissions from roles.

* MM-23832: Update default permission assignment of sysadmin.

* MM-23832: Fixes incorrect permission check. Removes some unused stuff.

* MM-23832: Update permission to check.

* MM-23832: Switches to struct tags.

* MM-23832: Adds some docs for the permissions tag.

* MM-23832: Removes whitespace.

* MM-23832: Combines system admin restricted access with other acess-control tag.

* MM-23832: Fixes some tests.

* MM-23832: Clarifies docs, does not assume prior permission check in '-' access value case.

* MM-23832: Updates to correct access tag value.

* MM-23832: Adds test of the config settings tag access.

* MM-23832: Undoes whitespace change.

* MM-23832: Removes comment.

* MM-23832: Adds the permissions to the new roles rather than using OR conditions on the permissions checks.

* MM-23832: Removes or condition on permission check.

* MM-23832: Updates mapping.

* MM-23832: Typo fix.

* MM-23832: Adds new 'read_jobs' permission.

* MM-23832: Add read_jobs to all roles with manage_jobs.

* MM-23832: Adds new permission read_other_users_teams.

* MM-23832: Adds read filtering of config.

* MM-23932: Change tag value.

* MM-23832: Fixes some tests. Adds test for read config access tag.

* MM-23832: Adds permissions to list teams.

* MM-23832: Removes the '-' tag value. Adds a new permission read_channel_groups. Updates a permission check.

* MM-23832: Removes unnecessary parent permission for user_management. Fixes permission check change error.

* MM-23832: Removes unused parameter to filter/merge function.

* MM-23832: Renames migration name.

* MM-23832: Fix for godoc.

* MM-23832: Fixes tests.

* MM-23832: Only makes a map once rather than every function call. Doesn't require access tag on config field structs. Reverts one test update and fixes another.

* MM-23832: Removes all of the unnecessary uses of (*App).SessionHasPermissionToAny since removing the user_management parent permission.

* MM-23832: Updates constant type.

* MM-23832: Removes unnecessary comment.

* MM-23832: Renames permissions.

* MM-23832: Fix for permission name changes.

* MM-23832: Adds missing config access tags. Adds some requirec ancillary permissions for write_usermanagement_teams.

* MM-23832: Adds local API endpoint for getting config.

* MM-23832: If tag value is blank or restrict_sys_admin_write then don't do the permission check.

* MM-23832: nil check for strings prior to dereferencing.

* MM-23832: Fix for config display logic.

* MM-23832: Updates godoc.

* MM-23832: Delays the unrestricted check for parity with other permissions checks if the channel id does not exist.

* MM-23832: Removes tautology.

* MM-23832: Re-adds status code check.

* MM-23832: Adds new permission to edit brand image.

* MM-23832: Exports variable for use by mmctl.

* MM-23832: Initialize exported map for use by mmctl.

* MM-23832: Accept deprecated permissions as valid.

* MM-23832: Adds missing permissions to archive a channel.

* MM-23832: Adds missing permissions for managing team.

* MM-23832: Properly filters config values in patch and update API responses.

* MM-23832: Fixes license viewing and writing permissions.

* MM-23832: Require license to assign 'new system roles'.

* MM-23832: Adds translation keys.

* MM-23832: Updates translation order.

* MM-27529: Splits read_channel_groups into read_public_channel_groups and read_private_channel_groups.

* MM-23832: Prevent read-only permissions from editing site url test parameter.

* MM-23832: Prevent read permissions from sniffing ports and elastic password.

* MM-23832: Adds missing permission required for write user management channels.

* MM-23832: Allows new roles to search for channels.

* MM-23832: Adds ability for system_manager to manage jobs.

* MM-23832: Cluster status access by sysconsole permission, not manage_system.

* MM-23832: Adds 'add_user_to_team' permission to sysconsole write usermanagement teams.

* MM-23832: Fixes lint.

* MM-23832: Test fix.

* MM-23832: Test fix.

Co-authored-by: Catalin Tomai <catalin.tomai@mattermost.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-21 16:49:31 -04:00
Harrison Healey
52611a1761 Move channel category code into its own files (#15319)
* Move channel category code into its own files

* Move channel category tests into app/channel_category_test.go
2020-08-21 15:07:55 -04:00
Rodrigo Villablanca
6a50106cd9 Filter stop words when searching posts in mysql (#14509) 2020-08-21 17:58:17 +02:00
Agniva De Sarker
78766625df jobstore (#15250)
* Migration completed

* Modify test case

* Update en.json

* Fix layers

* Lint: remove unnecessary use of sprint

* trigger CI

* fix error

* Fixes

* fix test

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-20 19:37:19 +05:30
Agniva De Sarker
b451b3cf86 fileinfostore (#15236)
* Migration completed

* Fix i18n

* Fix imports

* Fix typos and improvements

* Add new error handling case

* Fix i18n

* Fix store layers

* Fix shadowing vars

* Lint: remove unnecessary use of sprintf

* Lint: remove unnecessary use of sprint

* Adding the translation message

* trigger CI

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-20 19:36:13 +05:30
Carlos Tadeu Panato Junior
df4524e231 db: upgrade db to 5.27 (#15277) 2020-08-19 14:21:03 +02:00
Mario de Frutos Dieguez
f619de2c83 [MM-25673] Upgrades and migrations to start using master gorp (#14823)
Database changes needed to reflect gorp master changes
2020-08-18 10:43:56 +02:00
Scott Bishel
0302e0f477 MM-27449: Compliance Jobs rerun after warning status (#15178)
* add warning as success result

* revert config changes

* add unit test, update unit test

* add a couple more tests

* update store layers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-17 21:18:33 -06:00
Brian Ledbetter
bda24c8fe0 Match Users Even When SAML (+other) Contains Mixed Case (#14587) 2020-08-14 14:03:15 +02:00