Commit Graph

31 Commits

Author SHA1 Message Date
Adzim Zul Fahmi
37b726b651 Migrate "User.AnalyticsActiveCount" to Sync by default (#11419)
* migrate User.AnalyticActiveCount to sync default

* fixing shadowing variable err

* fixing shadowing variable err

* run query in async

* migrate app/diagnostic to explicit async

* remove error logging
2019-07-03 13:16:26 +02:00
jfrerich
95652da0b8 [MM-14720] Add Posts Per Day Analytics and Number Posts Previous Day Functionality (#11402)
* Add ability to get bot counts per day

Modify tests using AnalyticsPostCountsByDay to include extra input
(botsOnly)

Correctly generate the mock file with 'make store-mocks' target.  Didn't
see these comments earlier

* Initial commit for calculating total posts previous day and total posts
from bots previous day

* - Refactor to use asserts instead of if statements in tests
- Capture inputs to AnalyticsPostCountsByDay() function into an
  options struct
- Remove bot creation from diagnostics_test.go.

* Remove utils library

* create AnalyticsPostCountsOptions struct which is accepted as an input
to AnalyticsPostCountsByDay method

* Go vet fixes
2019-07-02 14:10:22 -07:00
Marc Argent
3bce32bbcf GH-11385 Migrate User.AnalyticsGetInactiveUsersCount to Sync by default (#11432)
* GH-11385 Migrate User.AnalyticsGetInactiveUsersCount to Sync by default

* GH-11385 fix TestGetAnalyticsOld
2019-06-28 07:39:52 -07:00
lassimus
8841e3dab9 MM-16564 Migrate "User.GetRecentlyActiveUsersForTeam" to Sync by default #11392 (#11399) 2019-06-26 15:46:38 -04:00
Alex Sahin
abaf0221b6 MM-16565 Migrate "User.GetNewUsersForTeam" to Sync by default (#11405)
* initial code

* rename result var to user

* rename var to users
2019-06-26 06:35:01 -07:00
Jesús Espino
6df57d7a83 Migrate User Store methods related to enterprise to sync by default (#11332) 2019-06-26 10:41:45 +02:00
Jesús Espino
7c4cc21475 Migrate Channel.AnalyticsTypeCount to Sync by default (#11097)
* Migrate Channel.AnalyticsTypeCount to Sync by default

* Fixing tests
2019-06-14 19:06:30 +02:00
Rodrigo Villablanca Vásquez
bd8e047458 Migrate POST.AnalyticsPostCount to Sync by default (#11179)
* Migrate POST.AnalyticsPostCount to Sync by default

* Fix: Query identation
2019-06-14 17:52:17 +02:00
Kyle Reczek
b61ded0ae4 [MM-16173] Migrate Team.AnalyticsTeamCount to Sync by default #11126 (#11132)
* [MM-16173] Migrate Team.AnalyticsTeamCount to Sync by default #11126
+ Modified team_store.AnalyticsTeamCount to return (int64, *model.AppError) instead of store.StoreChannel.
+ Updated the mock store to reflect new return value.
+ Updated referencing code to handle new sync return value.

* Fix shadowing of the err

* Fix the empty line between related code

* Fix team count call to be an explicit async.

* Added error logging to diagnostics.go

* Fix gofmt in file
2019-06-14 10:01:24 -04:00
Rodrigo Villablanca Vásquez
b757e7d129 Fix #10972. AnalyticsPostCountsByDay is sync now (#11013)
* Fix #10972. AnalyticsPostCountsByDay is sync now

* Revert go.mod and go.sum modifications

* Fix identation in querys

* Fix unnecessary else
2019-06-11 21:24:53 +02:00
Rodrigo Villablanca Vásquez
28cf642ccb Fix #10973. AnalyticsUserCountsWithPostsByDay is sync now (#11012)
* Fix #10975. AnalyticsUserCountsWithPostsByDay is sync now

* revert modifications to go.mod and go.sum

* removed unnecessary else sentence

* Querys identation
2019-06-11 21:06:40 +02:00
Bolarinwa Balogun
674b6f2285 [MM-15803] Migrate "Session.AnalyticsSessionCount" to Sync by default (#10948)
* [MM-15803] Migrate "Session.AnalyticsSessionCount" to Sync by default

* Use Explict Async for sessionChan in analytics.go
2019-05-27 18:54:46 +02:00
Puneeth Reddy
b462941f48 [MM-15192] Migrate "WebHook.AnalyticsOutgoingCount" to Sync by default (#10711) 2019-05-01 16:37:29 +02:00
Puneeth Reddy
d4225349ef MM-15295: Migrate commandstore.AnalyticsCommandCount to sync by default (#10746) 2019-04-30 11:24:05 +01:00
Jesús Espino
c8920588a0 Adding new "VIEW_MEMBERS" permissions restrict the scope of users visibility (#10487)
* MM-14138: Adding new "VIEW_MEMBERS" permissions restrict the scope of users visibility

* Fixing gofmt

* Fixing broken tests

* Addressing PR review comments from Miguel de la Cruz

* Removed hack

* A bit nicer and cleaner code in the UserBelongsToChannels function

* Adding cluster cache invalidation for user team ids

* Checking in the correct order permissions to not leek existency information

* Adding restrictions to TeamMembers and User status requests

* Fixing tests

* Fixing status endpoint permissions checks

* Adding more tests

* Fixing tests

* More tests and making the restrictions query based only on joins

* Adding more tests

* Adding more tests

* fixing merge problems

* Reverting status changes to avoid performance issues

* Adding more tests

* Fixing test

* i18n extract

* Adding extra method for get restrictions for a team

* Add the new elasticsearch functions to search users with restrictions

* Add missing translation string

* Rename restrictedChannelIds to restrictedToChannels

* Remove ToDo

* Adding the permission to the SystemAdmin role during permissions migrations
2019-04-29 16:56:56 +02:00
tengis b
88810a8ec7 [MM-15191] Migrate Webhook.AnalyticsIncomingCount to Sync (#10674)
* Migrate Webhook.AnalyticsIncomingCount to Sync

* update indentation

* fix indentation
2019-04-25 08:17:43 +02:00
Christopher Speller
06b579d18a MM-12393 Server side of bot accounts. (#10378)
* bots model, store and api (#9903)

* bots model, store and api

Fixes: MM-13100, MM-13101, MM-13103, MM-13105, MMM-13119

* uncomment tests incorrectly commented, and fix merge issues

* add etags support

* add missing licenses

* remove unused sqlbuilder.go (for now...)

* rejig permissions

* split out READ_BOTS into READ_BOTS and READ_OTHERS_BOTS, the latter
implicitly allowing the former
* make MANAGE_OTHERS_BOTS imply MANAGE_BOTS

* conform to general rest api pattern

* eliminate redundant http.StatusOK

* Update api4/bot.go

Co-Authored-By: lieut-data <jesse.hallam@gmail.com>

* s/model.UserFromBotModel/model.UserFromBot/g

* Update model/bot.go

Co-Authored-By: lieut-data <jesse.hallam@gmail.com>

* Update model/client4.go

Co-Authored-By: lieut-data <jesse.hallam@gmail.com>

* move sessionHasPermissionToManageBot to app/authorization.go

* use api.ApiSessionRequired for createBot

* introduce BOT_DESCRIPTION_MAX_RUNES constant

* MM-13512 Prevent getting a user by email based on privacy settings (#10021)

* MM-13512 Prevent getting a user by email based on privacy settings

* Add additional config settings to tests

* upgrade db to 5.7 (#10019)

* MM-13526 Add validation when setting a user's Locale field (#10022)

* Fix typos (#10024)

* Fixing first user being created with system admin privilages without being explicity specified. (#10014)

* Revert "Support for Embeded chat (#9129)" (#10017)

This reverts commit 3fcecd521a.

* s/DisableBot/UpdateBotActive

* add permissions on upgrade

* Update NOTICE.txt (#10054)

- add new dependency (text)
- handle switch to forked dependency (go-gomail -> go-mail)
- misc copyright owner updates

* avoid leaking bot knowledge without permission

* [GH-6798] added a new api endpoint to get the bulk reactions for posts (#10049)

* 6798 added a new api to get the bulk reactions for posts

* 6798 added the permsission check before getting the reactions

* GH-6798 added a new app function for the new endpoint

* 6798 added a store method to get reactions for multiple posts

* 6798 connected the app function with the new store function

* 6798 fixed the review comments

* MM-13559 Update model.post.is_valid.file_ids.app_error text per report (#10055)

Ticket: https://mattermost.atlassian.net/browse/MM-13559
Report: https://github.com/mattermost/mattermost-server/issues/10023

* Trigger Login Hooks with OAuth (#10061)

* make BotStore.GetAll deterministic even on duplicate CreateAt

* fix spurious TestMuteCommandSpecificChannel test failure

See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw

* fix race in TestExportUserChannels

* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway

* MM-13117: bot tokens (#10111)

* eliminate redundant Client/AdminClient declarations

* harden TestUpdateChannelScheme to API failures

* eliminate unnecessary config restoration

* minor cleanup

* make TestGenerateMfaSecret config dependency explicit

* TestCreateUserAccessToken for bots

* TestGetUserAccessToken* for bots

* leverage SessionHasPermissionToUserOrBot for user token APIs

* Test(Revoke|Disable|Enable)UserAccessToken

* make EnableUserAccessTokens explicit, so as to not rely on local config.json

* uncomment TestResetPassword, but still skip

* mark assert(Invalid)Token as helper

* fix whitespace issues

* fix mangled comments

* MM-13116: bot plugin api (#10113)

* MM-13117: expose bot API to plugins

This also changes the `CreatorId` column definition to allow for plugin
ids, as the default unless the plugin overrides is to use the plugin id
here. This branch hasn't hit master yet, so no migration needed.

* gofmt issues

* expunge use of BotList in plugin/client API

* introduce model.BotGetOptions

* use botUserId term for clarity

* MM-13129 Adding functionality to deal with orphaned bots (#10238)

* Add way to list orphaned bots.

* Add /assign route to modify ownership of bot accounts.

* Apply suggestions from code review

Co-Authored-By: crspeller <crspeller@gmail.com>

* MM-13120: add IsBot field to returned user objects (#10103)

* MM-13104: forbid bot login (#10251)

* MM-13104: disallow bot login

* fix shadowing

* MM-13136 Disable user bots when user is disabled. (#10293)

* Disable user bots when user is disabled.

* Grammer.

Co-Authored-By: crspeller <crspeller@gmail.com>

* Fixing bot branch for test changes.

* Don't use external dependancies in bot plugin tests.

* Rename bot CreatorId to OwnerId

* Adding ability to re-enable bots

* Fixing IsBot to not attempt to be saved to DB.

* Adding diagnostics and licencing counting for bot accounts.

* Modifying gorp to allow reading of '-' fields.

* Removing unnessisary nil values from UserCountOptions.

* Changing comment to GoDoc format

* Improving user count SQL

* Some improvments from feedback.

* Omit empty on User.IsBot
2019-03-05 07:06:45 -08:00
Hanzei
c8fab6e313 Fix shadowed variables in app package: Part 1 of 3 (#10000)
* Fix shadowed variables: Part 1

* Remove additional variable

* Fix tests

* Refactor JoinDefaultChannels
2019-01-25 17:40:56 +01:00
Jesús Espino
7636650a25 Migrate to idiomatic error handling app/a*.go and app/b*.go (#9455) 2018-09-25 08:42:06 -04:00
Joram Wilander
d6537deb3d Add inactive user count to analytics and fix client analytics function (#8695) 2018-05-02 07:50:56 -07:00
Christopher Speller
686c2fbab7 Structured logging (#8673)
* Implementing structured logging

* Changes to en.json to allow refactor to run.

* Fixing global logger

* Structured logger initalization.

* Add caller.

* Do some log redirection.

* Auto refactor

* Cleaning up l4g reference and removing dependancy.

* Removing junk.

* Copyright headers.

* Fixing tests

* Revert "Changes to en.json to allow refactor to run."

This reverts commit fd8249e99b.

* Fixing some auto refactor strangeness and typo.

* Making keys more human readable.
2018-04-27 12:49:45 -07:00
Chris
ce2b2be5de Refactoring cfg refs and load / save functions (#7749)
* refactoring cfg refs and load / save functions

* improve error output
2017-10-31 10:39:31 -04:00
Chris
8e19ba029f Reduce utils.Cfg references (#7650)
* app.UpdateConfig method

* test fix

* another test fix

* the config override option as-was is just error prone, remove it for now

* derp
2017-10-18 15:36:43 -07:00
Chris
8c80cdde38 remove remaining Global() calls (outside of tests) (#7521) 2017-09-28 00:52:34 +08:00
Chris
ac74066f0e remove einterface gets (#7455) 2017-09-19 18:31:35 -05:00
Christopher Speller
29fca51821 Renaming repo 2017-09-06 23:11:59 -07:00
Chris
1adfd0e9be app type transition (#7167) 2017-09-06 17:12:54 -05:00
Joram Wilander
5507154992 Add some basic sorting support for GET /users endpoint (#6801) 2017-06-30 12:07:23 -04:00
Harrison Healey
fb6f2a123c PLT-5860 Updated copyright date (#6058)
* PLT-5860 Updated copyright date in about modal

* PLT-5860 Updated copyright notice in JSX files

* PLT-5860 Updated copyright notice in go files

* Fixed misc copyright dates

* Fixed component snapshots
2017-04-12 08:27:57 -04:00
Corey Hulen
1359f7f391 Adding go vet from hack-a-thon (#5328)
* Adding go vet to the api package

* Adding go vet to app package

* Adding go vet to manualtesting package

* Adding go vet to the model package

* Adding go vet to the store dir

* Adding go vet to utils package

* Adding missing dirs with go files

* Fixing up makefile

* Fixing up makefile

* Removing root dir
2017-02-09 21:39:15 +00:00
Joram Wilander
d245b29f82 More app code migration (#5170)
* Migrate admin functions into app package

* More user function refactoring

* Move post functions into app package
2017-01-25 09:32:42 -05:00