* MM-43529 - start freemium trial
* change the method to put
* Add unit testing for the request-trial-endpoint
* use correct require
* add the translation texts
* fix texts
* remove unnecessary log
* change response status code to forbidden when non cloud
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Just a quick POC to move fast :P
We use a search pointer to keep track of
the next row to inesrt to. For every new search
we increment the pointer and do modulo 5.
This means that the value will always remain
between 0-4. And that way, we will always overwrite
the oldest entry on every search.
And while getting the results, we get
all results for that user.
The search parameters are json marshalled
and stored as a JSON blob. This is because
there is no need to search/filter them
in the DB.
Pending items:
Tests obviously.
To improve:
The client needs to send the channel ids
instead of channel names.
We add 2 new params to channel members query.
1. Filter by teamId.
2. Negate that filter.
We include some more optimizations like:
- Moved the team role checks inside the dataloader.
- Moved the channel pretty name computation inside the loader.
Now that we load less data on initial load, we can reduce
the concurrency requirement to be a bit on the safer side.
```release-note
NONE
```
Upgrading the user resolver to dataloader
meant that multiple goroutines would access
the user struct.
Hence we move the user struct sanitization inside
the dataloader itself so prevent access outside
the dataloader.
https://mattermost.atlassian.net/browse/MM-44044
```release-note
NONE
```
We were throttling the amount of concurrent resolvers
at a given time. The idea behind this was to avoid overloading
the database with too many requests.
However, with the introduction of dataloaders, this limitation
actually becomes a bottleneck because all DB calls are actually
batched, so we are unnecessarily throttling the amount of
items that can be processed in a single batch.
The only caveat with this is that now all resolvers
need to backed by dataloaders, or otherwise not be queried
as part of a loop.
In a subsequent PR, we will be removing channel stats
from under channel to be a top-level object to be returned
for a given channel.
```release-note
NONE
```
We increase the timeout further. Without this, there is
no reliable way to wait for a message.
Also consolidated the timeout values for other tests.
https://mattermost.atlassian.net/browse/MM-42997
```release-note
NONE
```
We fall back to TeammateNameDisplay if a user display_name
preference is not found. This makes the logic consistent
with other parts of the app.
https://mattermost.atlassian.net/browse/MM-43829
```release-note
NONE
```
* MM-41211: Replaces SessionLength[Web|Mobile|SSO]InDays with SessionLength[Web|Mobile|SSO]InHours.
* MM-41211: Clear the value of the old config settings.
* Updating email templates for trial will end and trial will end emails
* put back variable
* Rebuilding
* fix tests
* Updates
* [MM-43339] Add Cloud Subscription Upgrade Confirmation Email (#19989)
* Add Cloud Upgrade Confirmation email
* Updates
* String change
* i18n-extract
* Updates
* make email-mocks
* Appease linter
* Add a test
* GMAIL NEVER RENDERS RIGHT
* Important EVERYWHERE because gmail just cant deal
* l
* Last one
* Update image
* Update tests
* Fix tests
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* [MM-42739] Initial setup for top channels for team
* [MM-42739] Add initial tests
* [MM-42739] Update tests
* [MM-42739] Add top channels for user
* [MM-42739] Fix query
* [MM-42739] Update query
* [MM-42739] Improve query performance
* [MM-42739] Remove rank
* [MM-42739] Fix tests to use new time range today
* [MM-42739] Add tests for top channels for user
* [MM-42739] Add test for pagination
* Remove top channels by time struct
* [MM-42739] Update test names
* [MM-42739] Remove rank from top reactions
* [MM-42739] Return empty array instead of nil when result is empty
* [MM-42739] Add additional tests and update permissions check for teams
* [MM-42739] Add excluded channel tests for top reactions
* [MM-42739] Move insights to api4/insights and keep time range as string until required
* [MM-42739] Update queries only check DeleteAt after union
* [MM-42739] Improve query performance by using publicchannels table
* [MM-42739] Fix broken query after merge
* MM-41565,MM-42473: fixes incorrect unread thread count
The infamous "-1 unread threads" bug, was due to incorrectly counting
previous unread mentions and replies.
When we calculate the previous counts, we didn't take into account if
a thread was newly followed one or not. So when a user gets added to a
thread via a mention receives a WS event with the previous count values
calculated by subtracting "1" from the current count values.
In the result the webapp subtracts the previous values for the thread
from the total values of all threads for the user.
This is wrong since the user just followed the thread those previous values
should be 0. Which results into showing a negative value of unread
threads to the user.
This commit fixes this issue by zeroing the previous count values when
the user was not following the thread previously.
* Adds test, and addresses comments
* Changes test's description
* Removes unneeded assertion
* Empty commit just to re-build
The issue seems to be that different distros
have different set of included mime types
built-in. Go looks into those directories
and it looks like our CI systems don't have
those files.
https://mattermost.atlassian.net/browse/MM-42877
```release-note
NONE
```
* [MM-41185]: new API to mark thread as unread
Until now we mark a thread as read/unread by sending a timestamp to the
server. This created some issues when marking a thread as unread from a
post. We needed to send the post.create_at - 1 as a timestamp but we
didn't do so consistently.
This commit adds a new API to set a thread as unread by post id.
Making all clients agnostic of the timestamp, and thus solving consistency issues.
Endpoint: /api/v4/users/{user_id}/teams/{team_id}/threads/{thread_id}/set_unread/{post_id}
* Updates client.go adding SetThreadUnreadByPostId
* Guards endpoint behind read channel permission
* Returns status 400 if post_id not belong in thread
* Root post as post_id should be permitted
We take a shallow copy of the team pointer before
we pass that to the other functions.
This is because the resolvers run in separate
goroutines.
https://mattermost.atlassian.net/browse/MM-43340
```release-note
NONE
```
* removed appending the root post to the posts list
also changed `UpdateAt` to `CreateAt` in thread_store.go in accordance with kyriakos
* fixed failing test after latest change
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-39058-invite-to-team-from-add-channel
* fix tests by validating the memberInvite is not nil
* fix i18n texts
* fix lint problem
* fix translation lines
* fix the data structure
* modify api4-team_local file to match with the expected structure
* fix unit tests, fix translation tests
* remove go routine cause not necesary
* add unit test for invite to team and channel
* remove unnecessary validation
* allow both data structures, simple string array and object with memberInvite struct
* fix texts
* fix linter
* fix problems with graceful invites workflow
* handle error while parsing body
* fix unit tests
* take the address just once
* rename channels to channelIds
* fix unit tests
* add tests and fix local channels invite support
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
* Disambiguates some units.
* Updates DB attribute.
* Updates some more error-prone units.
* Updates some tests with legible constants.
* Updates query for MySQL case sensitivity.
* Fixes more casing issues.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-40148: threadsOnly query param for user threads
Currently we always calculate counts when fetching user threads.
Those counts include total, unread replies, and unread mentions,
and are potentially expensive to calculate.
This commit adds a new query param 'threadsOnly' which won't calculate
any counts and just return threads.
Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
When the test fails, it is not clear whether the method
returned an error or it returned a channel with DeleteAt
set to 0. The if condition was also incorrect because
if the error was not-nil the condition would evaluate
to true and the test would pass.
We split the condition into 2 separate cases which will
let us know exactly what is failing.
https://mattermost.atlassian.net/browse/MM-42092
```release-note
NONE
```