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

1407 Коммитов

Автор SHA1 Сообщение Дата
Conor Macpherson
c633a1d2fa Code review comments. 2022-12-27 16:03:04 -05:00
Conor Macpherson
40c94892ee Merge branch 'master' of github.com:mattermost/mattermost-server into MM-47853-true-up-review-telemetry-off-non-air-gapped 2022-12-27 11:20:09 -05:00
Vishal
dc533e59b8 Message export: Fix job progress calculation (#21925)
* use posts count instead of job duration to calculate progress

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-27 14:34:40 +05:30
Mattermod
b4d9d12856 Merge branch 'master' into MM-47853-true-up-review-telemetry-off-non-air-gapped 2022-12-23 23:12:20 +02:00
Conor Macpherson
64000da417 Convert due date string to millisecond format. 2022-12-23 15:37:31 -05:00
Conor Macpherson
6daa39fd62 Fix mysql migrations and db tests. 2022-12-23 11:08:41 -05:00
Agniva De Sarker
1e02b99bf1 MM-49354: Make compliance export query cancellable (#21943)
We accept a context that can cancel the query.
This allows us to exit a job faster.

```release-note
Compliance export job can now cancel the SQL query
execution during server shutdown which will allow
the job to exit faster.
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-23 19:56:49 +05:30
Conor Macpherson
40fbb00acc Remove auto create if no records present, add new error message. 2022-12-23 09:18:14 -05:00
Ibrahim Serdar Acikgoz
40cd6b1656 sqlstore/store: make SetupConnection public to be used by products (#21948) 2022-12-23 14:34:48 +03:00
Conor Macpherson
cedfc46bd9 Add more tests, add mocks. 2022-12-22 15:40:26 -05:00
Conor Macpherson
88090ea40b Add true up review status history, add migration for persisting history, add store to create, get, and update true up review history entries, cleanup errors, etc. 2022-12-22 14:59:05 -05:00
Kyriakos Z
37960c7680 MM-49077: fixes errors in migration job (#21911)
* MM-49077: fixes errors in migration job

UrgentMentionCount does not have a default values, so COALESCE has to be
used.
SELECT * FROM ChannelMembers fails for the above reason.
This commit SELECTs each and every column from ChannelMembers instead.

* Fixes syntax error

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-22 16:15:11 +02:00
Conor Macpherson
f65aa61440 remove webhook queries in favor of using existing ones that ignore deleted webhooks, enforce not implemented for cloud users, get seats from license.features.users. 2022-12-21 12:09:33 -05:00
Tim Scheuermann
0ce7c5e3da Use path rather than filepath for embedded files (#21896)
Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
2022-12-20 08:59:40 +01:00
Conor Macpherson
12328278f8 Merge branch 'master' of github.com:mattermost/mattermost-server into MM-47853-true-up-review-telemetry-off-non-air-gapped 2022-12-19 15:40:03 -05:00
cyrilzhang-mm
33b59e0e96 Add parameter to return group members in order of display name (#21775) 2022-12-15 14:20:36 -05:00
Claudio Costa
6fd174a95f [MM-48946] Fix read after write issue when uploading data (#21868)
* Fix read after write issue when uploading data

* Prefer request.CTX interface
2022-12-13 11:47:05 -06:00
Conor Macpherson
c0735ae689 Add route with functionality for building out the true up review profile. 2022-12-08 16:11:43 -05:00
Konstantinos Pittas
6e9dbbd237 [MM-46463] Return last_picture_update for new team members (#21758)
* return last picture update

* add API test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-07 11:16:56 +02:00
Kyriakos Z
a240cd53eb MM-48614: saves priority for drafts (#21752)
* MM-48614: saves priority for drafts

Adds a new column in the drafts table, "priority".
This way we can save post's priority in the draft.

Fixes OmitConnectionId, which when you published a ws event for a user
was getting bypassed.

Fixes Get for drafts returns deleted ones as well, which is needed for
upsert.

* Adds test case for the OmitConnectionId

* Addresses review comments, removes DeleteAt

* Vets

* Adds missing translation

* Re-instates DeleteAt column

* Adds separate case to get draft including deleted

* Fixes Update Draft

* Empty
2022-11-29 23:36:47 +02:00
Martin Kraft
3e7a8d8426 MM-48181: Invalidate cache to reflect permissions changes from a team scheme. (#21735)
* MM-48181: Bust the allChannelMembersForUserCache when assigning a team scheme.

* MM-48181: Tests cache fix.
2022-11-28 11:18:17 -05:00
Martin Kraft
a05dd722ed New isrole replacement (#21688)
* Adds new function to use in place of isRole that includes team and channel schemes.

* Adds tests. Fixes code.

* Adds warning to isRole.

* Fixes phrasing.

* Added more docs.

* Moved from strings to constants.

* Added some spacing and improved some comments.

* Renames some functions.

* Rename isNotRole to isNotExactRole. Add a new isNotRole function.

* Switch to only checking prefix.

* Ignores unused function warning.

* Lint fix.

* Switch from unused to deadcode.

* Adds test for isNotRole.
2022-11-24 07:41:09 -05:00
Kyriakos Z
5e5769c4ee MM-45317: global drafts endpoints and ws events (#20614)
* MM-23881: global drafts endpoints and ws events

Adds endpoints:
- create/update drafts
- delete draft
- get drafts

Adds WS events:
- draft_updated
- draft_created
- draft_deleted

* Ordering and WS event name fixes

* Adds PostID to the drafts table

In the future the drafts will include edited posts, this commit adds the
post id in the combined pkey of the table.

* Fixes route for deleting a thread draft

* Fixes failed checks

* Fixes migrations

* Fixes migration

* Extract translation strings

* Removes PostID since we won't sync editing posts

* Fixes tests

* Fixes i18n

* Update migrations for global drafts

* update branch with latest master changes

* Add feature flag for global drafts

* Set global drafts feature flag default to true

* Added support for files in drafts

* Fix failing i18n check

* Added support for deleting files in drafts

* Revert "Added support for deleting files in drafts"

This reverts commit 45dfd04a760359de2e8814d652c9ef46daf994f6.

* Triggering new test server

* Add config setting 'AllowSyncedDrafts' for syncing drafts with server

* Triggering new test server

* Triggering new test server

* Add guard for config setting and add initial tests

* Fix i18n and lint errors

* Triggering new test server

* Add tests for drafts

* fix lint issues

* Add tests for model/draft

* Triggering new test server

* Triggering new test server

* Trigger new test server

* Address PR comments

* Change left join to regular join in GetDraftsForUser

* Fix broken test

Maybe consider adding an inclDeleted field if we want to get deleted drafts in the future

* fix translations

* Add store tests for drafts

* fix test naming

* remove comment

* update migrations

* set feature flag default to false

* update migrations

Co-authored-by: Mylon Suren <mylonsuren@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 22:21:40 -05:00
Kyriakos Z
27db854089 MM-47750: Adds PostAcknowledgements table and apis (#21689)
* MM-46410: adds urgency on mention counts

We have introduced priority for posts in
https://github.com/mattermost/mattermost-webapp/pull/10951.
We do need to color the mention badges in the webapp with a prominent
color when a mention is posted in an urgent message.
A thread has urgent mentions if the root post is marked as urgent, and
the replies contain mentions to the user viewing the thread.

This PR adds two columns, urgentmentioncount, and isurgent, in
channelmembers, and threads tables respectively.
Furthermore when asking for team/thread mention counts, we also return
urgent mention counts for the user.

* Fixes method in tests

* empty commit

* Fixes method call

* Fixes single thread response is_urgent

* Fixes errors

* Fixes mysql migration and adds graphql schema

* Fixes tests

* Refactors IsUrgent and Adds PostsPriority table

Changes:
- removes is_urgent from the threads table
- adds a new table to hold posts priorities
- refactors priority out of the props and into the new table

* Fixes

* Adds translation strings

* Fixes migrations and tests

* Fixes tests

* empty

* Adds Priority to Copy

* empty

* Fixes priority not saved when boards is enabled

We are nilifying Metadata when post.ForPlugin(), which didn't save Priority
for a post when Boards was enabled.
This commit copies metadata again to the post, so metadata are
reinstated.

* Fixes tests

* Adding store tests and fixes syntax error

* Uses threads.ThreadTeamId

* Fixes error

* Adds UrgentMentionCount in graphql api test

* Fetches post priority in batches

* Addresses review comments

* Restore only priority on create post

* Fixes tests

* Nits

* Some refactoring

* Fixes get thread options when post priority enabled

* Adds missing translation

* Use the constant instead of "urgent" string

* Renames urgent constant

* MM-47750: Adds PostAcknowledgements table and apis

- Adds post acknowledgement api/app/store methods to be able to save and
delete post acknowledgements by users.
- Adds wesbsocket events for acknowledgement created/deleted
- Returns post acknowledgements in the post's metadata

* Empty

* Fixes incorrect urgent count when marking a post as unread

* Adds license

* Fixes ACK api, and adds tests

* Fixes vet

* Fixes tests

* Addresses review comments

* Remove unnecessary lines

* Adds config option and changes return of delete ack

* Empty

* Empty

* Enable config by default

* Fixes intl

* Fixes test after setting config default true

* Changes endpoints to PostForUser

* Avoids replica lag

* Fixes error in merge

* Fixes RetryLayer tests due to merge

* Empty

* Empty

* Empty

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 19:41:23 -05:00
Kyriakos Z
c44d37629a MM-46410: adds urgency on mention counts (#20999)
* MM-46410: adds urgency on mention counts

We have introduced priority for posts in
https://github.com/mattermost/mattermost-webapp/pull/10951.
We do need to color the mention badges in the webapp with a prominent
color when a mention is posted in an urgent message.
A thread has urgent mentions if the root post is marked as urgent, and
the replies contain mentions to the user viewing the thread.

This PR adds a column, urgentmentioncount, in channelmembers.
Furthermore when asking for team/thread mention counts, we also return
urgent mention counts for the user.

Adds a new table to hold posts priorities
Refactors priority out of the props and into the new table

We are nilifying Metadata when post.ForPlugin(), which didn't save Priority
for a post when Boards was enabled.
This commit copies metadata again to the post, so metadata are
reinstated.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Vishal Choudhary <vish9812@gmail.com>
2022-11-23 21:08:21 +02:00
Vishal
c78b78ed5e [MM-5046] Fix emails search for Postgres DB (#21590)
* Support emails search in Postgres

* Add @ exception for postgres

* update comment

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-22 12:02:33 -05:00
Ben Cooke
76f7872a50 [MM-46692] Channel group member count (#21270)
* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* adding channel member count to groups request

* fixing models

* adding a new test

* removing unused var

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.fritz.box>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.fritz.box>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-22 11:31:04 -05:00
Ibrahim Serdar Acikgoz
1edbf67bb2 migrations: bump morph dependency and reflect changes (#21670) 2022-11-17 19:36:08 +03:00
Shivashis Padhi
5be8557247 [MM-44168] Add feature to restore archived user groups (#20369)
* Add undelete feature, add mocks, tests

* Rename undelete->restore

* make store-layers

* make app-layers

* Store -> Store()

* Lint fixes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-17 14:53:54 +05:30
Shota Gvinepadze
98e685f07c Move Thread.GetPosts to PostStore.GetPostsByThread (#21633)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-16 13:42:26 +04:00
Shota Gvinepadze
44dd185506 Fix bad merge (#21632) 2022-11-10 11:30:49 +04:00
Jesse Hallam
5a0a3e6d13 Inline ThreadStore.MarkAllAsUnreadByTeam (#20958)
* Add teamId to Threads table

* Get rid of multiple teamId reads

* Fix failed test

* Inline ThreadStore.MarkAllAsUnreadByTeam

The query to `MarkAllAsUnreadByTeam` first fetched all thread memberships, then fed just the ids back to a second query to ensure all are marked as unread. Optimize this by simply doing a single `UPDATE` query with the necessary joins.

Co-authored-by: iomodo <wineson@gmail.com>
2022-11-09 14:00:07 -04:00
Shota Gvinepadze
b9d00a1f28 Simplify thread_store/GetThreadForUser (#21588) 2022-11-09 12:16:20 +04:00
Tim Scheuermann
033bdd6f1a Fix unchecked request when saving channel (#21043) 2022-11-07 11:28:31 +01:00
Ben Cooke
d855916c6e [MM-48049] Including users who were removed from group in not_in_group response (#21559)
Automatic Merge
2022-11-04 19:10:26 +02:00
Tim Scheuermann
b73bf144aa MM-47171 Export direct channel favorites (#21570) 2022-11-04 17:13:14 +01:00
Jesse Hallam
279754c6b0 Refactor common JoinThread helper struct (#21511)
* Refactor common JoinThread helper struct

* avoid exporting ToThreadResponse
2022-11-04 12:05:59 -03:00
Daniel Espino García
376f70842d Send deleted posts on getPostSince when collapsed threads is enabled (#20976) 2022-11-02 11:14:28 +01:00
Zubair Ahmed
79e4959d02 Return empty list of channels when requesting more channels at the end of cursor (#21557) 2022-11-02 15:10:51 +05:30
Shota Gvinepadze
96c8dc1281 [MM-45868] Replace TeamId column with ThreadTeamId (#21505)
* Replace TeamId column with TreadTeamId

* make migrations-extract
2022-10-26 19:50:37 +04:00
cyrilzhang-mm
82096a8cbb [MM-44336] Add timestamp parameter to test data slash commands (#21400) 2022-10-26 09:08:24 -04:00
cyrilzhang-mm
a648ced221 [MM-42421] Prevent guests from seeing users through groups API (#21151) 2022-10-25 11:54:51 -04:00
Shota Gvinepadze
fab9d350c7 [MM-45868] Add teamId to Threads table (#20915)
* Add teamId to Threads table

* Get rid of multiple teamId reads

* Fix failed test

* Add teamId to standard queries

* Fix linter

* Get teamId from db
2022-10-24 16:10:27 +04:00
Agniva De Sarker
10a627fac1 MM-45723: Include DM/GM channels for user indexing (#21391)
There were 2 separate issues here:

1. We were excluding DM/GM channels for user indexing.
Not sure why. This prevented users to be shown as
channel members in autocomplete results in both
Bleve and Elasticsearch.

2. We were incorrectly deciding to search across
the team based on if the current channel
is in the list of allowed channels or not. But we
were incorrectly wiping the list of allowed channels
even if a channelid was passed. This makes it work
same as a DB search.

One catch is that for the correct results to appear,
a re-indexing is required.

```release-note
Autocompletion results using Elasticsearch or Bleve will
correctly show a user as a channel member in DM/GM channels.
To force this change to appear, a re-indexing will be
necessary.
```
2022-10-19 20:51:00 +05:30
Shivashis Padhi
28698abb9f Apply role filters for /get/users in channel (#21251) 2022-10-19 09:50:41 +05:30
Julien Tant
3747d99806 [MM-46694] A/B Test: welcome post (#20926)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-10-13 14:23:22 -07:00
Rob Bierbooms
66b7c45e69 [MM-47367] Make sure mini preview is saved to database when updating database (#21304) 2022-10-12 15:19:00 +02:00
Daniel Espino García
79651874ea Do not send categories for teams deleted or not member of (#21038)
* Do not send categories for teams deleted or not member of

* Fix tests and add test for deleted teams and memberships
2022-10-11 15:33:29 +02:00
Vishal
6e9b808efd [MM-46644] Auto respond message (#20900)
Automatic Merge
2022-10-07 16:02:11 +03:00
Alejandro García Montoro
70c74fc10d MM-47374: Revert full text search (#21233)
* Revert "MM-46871: Add remining search parameters to be escaped (#20963)"

This reverts commit 8797bfcde7.

* Revert "MM-46503: Escape incorrect pg user search query (#20863)"

This reverts commit 8fd1762c3b.

* Revert "MM-44576 autocomplete names including utf 8 chars (#20367)"

This reverts commit 8444c45959.
2022-10-06 17:02:20 +02:00