Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
Go to file
Agniva De Sarker c9fc6297f3
MM-56877: Reduce usages of SessionHasPermissionToChannelByPost (#26239)
1. For file endpoints, a recent optimization added the ChannelID column
to be part of the fileinfo table. Therefore, we can skip the postID
and directly use the channelID.
2. For post endpoints, we reorder the sequence of calls such that
we get the channelID first, and use it to check the permission of the channel
rather than query the long way around by joining with the posts table
in the permissions query.

  The benefit is that SessionHasPermissionToChannel is cache-backed.
So in the happy path, we save a DB call. Because GetSinglePost anyways
needed to be called.
And in the bad path, we replace it with a more efficient call. Because
SessionHasPermissionToChannel is cache-backed, so effectively we
are replacing SessionHasPermissionToChannelByPost with GetSinglePost.
3. And then for the calls that don't have the channelID available,
we change the implementation itself to get the channelID by querying
the posts table first, and then calling SessionHasPermissionToChannel.
This creates the happy path as mentioned earlier.

While here, we also do some other optimizations:
4. Pre-populate the channelID while saving the reaction, so that
we don't need to query the posts table for every single reaction save.
5. Remove unnecessary goroutine spawning for publishing reaction events,
because anyways those are asynchronous.

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

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-02-29 09:34:55 +05:30
.github feat: Upgrade github actions for node20 (#26318) 2024-02-28 10:55:04 +02:00
api Deprecate admin advisor (#26045) 2024-02-26 09:05:00 +05:30
e2e-tests Deprecate admin advisor (#26045) 2024-02-26 09:05:00 +05:30
server MM-56877: Reduce usages of SessionHasPermissionToChannelByPost (#26239) 2024-02-29 09:34:55 +05:30
tools MM-55966 - Update ArrayFromJSON to use LimitedReader (#25510) 2024-01-09 10:04:16 -07:00
webapp [CLD-7029] Add a new system console page for configuring custom export FileSettings (#26034) 2024-02-28 16:06:17 +00:00
.editorconfig Move .editorconfig to repo root (#24398) 2023-08-30 16:29:07 -04:00
.gitignore Change notice generation configuration file (#25526) 2023-11-27 13:07:12 +02:00
.gitpod.yml Add .gitpod.yml to use mattermost-gitpod-config repo for Gitpod configuration (#19984) 2022-04-14 11:02:50 -04:00
.nvmrc MM-53989 Upgrade to Node 18 and NPM 9 (#24283) 2023-08-28 14:37:05 -04:00
CHANGELOG.md Changelog link (#8805) 2018-05-30 10:23:25 -04:00
CODEOWNERS Add CODEOWNERS for migrations (#23020) 2023-04-19 20:01:50 +05:30
CONTRIBUTING.md Remove outdated information from contributing file (#10749) 2019-05-01 23:46:00 +02:00
LICENSE.enterprise Source available metrics (#24879) 2024-01-08 10:47:24 -04:00
LICENSE.txt update LICENSE.txt (#22659) 2023-03-27 10:54:06 -03:00
NOTICE.txt chore: Update NOTICE.txt file with updated dependencies (#26107) 2024-02-05 16:42:05 +02:00
README.md Added YouTube Link in README.md Get the latest news Section (#25229) 2023-11-01 11:40:36 +01:00
SECURITY.md MM-41988 Updated links to legacy domain about.mm.com (#19552) 2022-03-16 19:47:57 +08:00

Mattermost logo

Mattermost is an open source platform for secure collaboration across the entire software development lifecycle. This repo is the primary source for core development on the Mattermost platform; it's written in Go and React and runs as a single Linux binary with MySQL or PostgreSQL. A new compiled version is released under an MIT license every month on the 16th.

Deploy Mattermost on-premises, or try it for free in the cloud.

mattermost user interface

Learn more about the following use cases with Mattermost:

Other useful resources:

Table of contents

Install Mattermost

Other install guides:

Native mobile and desktop apps

In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, macOS, and Linux.

Get Mattermost on Google Play Get Mattermost on the App Store Get Mattermost on Windows PC Get Mattermost on Mac OSX Get Mattermost on Linux

Get security bulletins

Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you're deploying Mattermost it's highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.

Subscribe here

Get involved

Learn more

License

See the LICENSE file for license rights and limitations.

Get the latest news

Contributing

Small Image

Please see CONTRIBUTING.md. Join the Mattermost Contributors server to join community discussions about contributions, development, and more.