Commit Graph

41 Commits

Author SHA1 Message Date
Rodrigo Villablanca
32b7d2b5f1 StatusStore migration (#14978)
* Finished!

* Typos

* Fix error

* Fix layers

* Lint: remove unnecessary use of sprint

* Fix shadowing err
2020-08-13 11:12:08 +05:30
Siyuan Liu
c183a5d380 MM-25115- migrate post, session and status cache to cache2 (#14667)
* use cache2.Provider cache

* use cache2.Provider cache

* clean up imports

* reset test runner

* add close() call

* Fixing i18n

* address review comments

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 14:47:00 +05:30
Eli Yukelzon
17523fa5d9 MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
2020-02-13 13:26:58 +01:00
Jesús Espino
06fb1458ca Use always strings for cache keys (#13631)
* Use always strings for cache keys

* fixing tests

* Addressing PR review comments

* Adding the base to FormatInt

* Fix typo
2020-01-22 15:59:59 +01:00
Hector
62b57143c8 [MM 19840] Create a Cache Interface abstraction to support multiple cache backends (#13384)
* Refactor to use structured logging

* Properly formatted with gofmt

* created interface Cache, but construction of cache is still coupled.

* Implementing cache factories to build caches

* Simple redis implementation without error handling. Keys and values by default are string

* refactor NewLocalCacheLayer to inject cache factory

* Removed redis impl to focus on cache abstraction

* CacheFactory injected on sqlsupplier and saved in Store struct

* remove useless private method

* replace concrete declaration of lru cache to cache abstraction

* discard spaces

* Renamed factory to provider because concrete implementations of factories may hold an state (such as a redis client for example)

* refactor to include all caches in the same package cache and subpackages

* method close cache. This method will be used for concrete implementations that need to release resources (close a connection, etc)

* closing cacheprovider and releasing resources while closing sql store

* fixed merge conflict fail

* gofmt files

* remove unused property from post_store

* naming refactor to avoid stutter. Added godocs on interface

* Store doesnt know anything about the cache and provider. Cache provider will be built after loading config and injected in localCacheLayer

* fixed broken test

* cache provider initialized before RunOldAppInitialization which initializes the localcachelayer

* move statusCache to server to initialize it with the new cache provider

* update terms_service and channel_layer to have new cacheProvider

* gofmt

* Add Connect method to the cache provider

* mock cacheprovider in user_layer_test

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-09 09:57:28 +01:00
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Doug Lauder
5abbe50258 MM-8607 Add ability to turn off non-critical services when under load (#13212)
* MM-8607: add ability to turn off non-critical services under load

* server busy invalid param unit tests

* MM-8607: rename server busy endpoints

* MM-8607: handle case where App not initialized

* MM-8607: additional unit test cases per feedback.

* MM-8607: use decorator to check isbusy when adding endpoint route

* MM-8607: rename endpoints, use struct for json

* Update api4/system.go

Fix misspelled log output

Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>

* MM-8607: fix i18n order; max seconds for server busy expiry
2019-11-27 20:41:09 -05:00
Abhishek Mane
5646b12686 (fixed) Refactor app/status.go to use structured logging #12723 (#12754) 2019-11-07 13:02:41 +01:00
Micah Thompson
7180002df8 [MM-16522] Migrate "Status.UpdateLastActivityAt" to Sync by default (#11444)
* [MM-16522] Migrate "Status.UpdateLastActivityAt" to Sync by default

* Remove unused import
2019-07-03 08:35:39 -04:00
Luke P
d0906a0c85 [MM-16517] Migrate "Status.Get" to Sync by default (#11367)
* Test

* Revert "Test"

This reverts commit 2bbf335ee9.

* Fixed typo in Makefile, line 564: 'persistent' misspelled

* Fixed return of status_store.Get to return model.Status and model.AppError, removed connections to result var in same method, generated new mocks and fixed tests.

* Fixed status_store.go under /sqlstore and /storetest in addition to removing personal comments

* SQL Indentation fix for consistency

* Revert merge change to store.go for SaveOrUpdate to avoid error introduced by merge

* Changed StoreChannel back to *model.Apperror for SaveOrUpdate in store.go, fixed resulting error in storetest/status_store.go so it did not have conflicting types. Fixed spelling errors in same file

* Test for status, err changed according to recommendation upon second look

* Changed status variable on line 77 to blank identifier to stop it from shadowing line 24 declaration

* It appears last statement in test was using 'status' variable where status is model.STATUS_ONLINE instead of model.STATUS_OFFLINE like status3, making comparison always be 'online != offline', which is always true, proceeding into if statement, guaranteeing test failure

* Build fails consistently when line 75 has 'status' in if statement due to shadowing issue due to existing declaration Jenkins complains about in line 24. If this fails then new variable will be necessary

* Renamed parameter to avoid overshadowing issue

* Undid code addition mistake in storetest/status_store.go and updated line 29 accordingly to account for multiple values.

* Remove status3 as used in line 71 in status_store.go.

* Undid change in storetest/status_store.go on line 67 which checked for wrong thing
2019-07-01 07:44:26 -04:00
Sheshagiri Rao Mallipedhi
1f6aedcdf3 Migrate "Status.GetByIds" to Sync by default (#11364)
* Migrate Status.GetByIds to Sync by default

* gofmt the files
2019-06-26 01:49:57 -04:00
Sheshagiri Rao Mallipedhi
cca41427a4 Migrate Status.SaveOrUpdate to Sync by default (#11359)
* Migrate Status.SaveOrUpdate to Sync by default

* address pr comments
2019-06-24 12:03:29 +02:00
Mukul Rawat
481d83a1e7 [MM-12537] Migrate to idiomatic error handling the file app/status.go in the mattermost-server (#9574) (#9589)
* Perform idiomatic error handling

* Golint gives warning when using the variable name 'userId' so change
it to 'userID'

* Change all ID back to Id
2018-10-14 16:24:06 +01:00
Joram Wilander
275731578e MM-10254 Add plugin APIs for getting/updating user statuses (#9101)
* Add plugin APIs for getting/updating user statuses

* Add and update tests

* Updates per feedback
2018-07-16 15:49:26 -04:00
Jesús Espino
5b63e87ab7 Deduplicating some code in app/status.go (#9095) 2018-07-11 21:56:35 +08:00
Joram Wilander
2114e96f00 Reset status to away after web conn disconnect if necessary (#8988) 2018-06-27 14:19:06 -07:00
Joram Wilander
46f969e5dd MM-10425 Include active_channel in cluster update user status messages (#8967)
* Include active_channel in cluster update user status messages

* Update to use new ToJson method

* Update tests
2018-06-21 10:42:20 -07:00
Joram Wilander
a9d083d119 Skip cluster send when getting non-cached statuses (#8824) 2018-05-18 15:02:40 -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
Stan Chan
7826774a14 Add Auto Responder handler (#8386)
WIP Out Of Office

Return error for status command if user status is OOO

Ignore notifications if Out Of Office

Disable AutoResponder if status is set to online

Add test for AutoResponder

DisableAutoResponse when manually setting status

Remove check on status slash command

return early if user does not exists in SendAutoResponse method

Add proper error handling

Add a newline after error handling

Revert back to err == nil in api4/status.go

Remove a.Go when using a.Publish

Add name consistency with the feature auto responder

Last changes for name consistency, also fix failing test with auto_responder

Fix names of functions in auto responder test

Add ExperimentalEnableAutomaticReplies flag

Auto Responder reply to a post
2018-04-12 15:02:36 -04:00
Stephen Kiers
302dae5bb9 MM-9274- Sort Users in Channel by status (#8181)
* sort by lastActivity

* added status ordering to Users

* sort offline before dnd

* remove data not needed

* added seperate call for when order=‘status’ is on GetUser request

* remove PrintLn

* styling fix

* remove mistake

* mistake 2

* better comment

* explicit if statemnt

* writing tests

* removed manually added mocks

* generated mock

* ICU-668 Added unit tests

* style fix

* sort by lastActivity

* added status ordering to Users

* sort offline before dnd

* remove data not needed

* added seperate call for when order=‘status’ is on GetUser request

* remove PrintLn

* styling fix

* remove mistake

* mistake 2

* better comment

* explicit if statemnt

* writing tests

* removed manually added mocks

* generated mock

* ICU-668 Added unit tests

* style fix

* reverse dnd and offline

* Fixed app.SaveStatusAndBroadcast

* Fixed incorrect merge

* Fixing incorrect merge again
2018-03-09 07:48:30 -05:00
Chris
4ebf974690 remove go Publish(...) idiom (#8373) 2018-03-02 16:49:18 +00:00
Chris
10c5a927cb more global config ref cleanup (#7802) 2017-11-09 14:46:20 -06:00
Carlos Tadeu Panato Junior
62b3569025 [PLT-4341] add dnd command (#7694) 2017-10-25 11:51:13 -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
5e69ce099f Goroutine wranglin (#7556)
* goroutine wranglin

* synchronize WebConn.WritePump
2017-10-03 10:53:53 -05: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
Corey Hulen
36f216cb7c PLT-6080 moving clustering to memberlist (#6499)
* PLT-6080 adding cluster discovery service

* Adding memberlist lib

* Adding memberlist lib

* WIP

* WIP

* WIP

* WIP

* Rolling back config changes

* Fixing make file

* Fixing config for cluster

* WIP

* Fixing system console for clustering

* Fixing default config

* Fixing config

* Fixing system console for clustering

* Tweaking hub setting

* Bumping up time

* merging vendor dir

* Updating vendor dir

* Fixing unit test

* Fixing bad merge

* Remove some testing code

* Moving comment

* PLT-6868 adding db ping retry

* Removing unused loc strings

* Adding defer to cancel
2017-06-19 08:44:04 -07:00
Joram Wilander
be7c53ec7f Send status change event if status changes on channel view (#6389) 2017-05-11 08:10:59 -04:00
Joram Wilander
0ae6886513 Detach session activity update from statuses (#6379) 2017-05-10 09:48:50 -04:00
Joram Wilander
1b82d98cdb Add config setting to disable statuses (#6254) 2017-04-28 10:10:58 -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
Carlos Tadeu Panato Junior
29e6db5713 Implement POST /users/status/ids for apiv4 (#5894) 2017-03-30 08:09:39 -07:00
Carlos Tadeu Panato Junior
5bf6ae04df [APIV4] GET /users/{user_id}/status - user status endpoint for apiV4 (#5824) 2017-03-24 17:23:32 +00:00
enahum
7de54f063c Fix push notifications where channel is set to all activity (#5594)
* Fix push notifications where channel is set to all activity

* feedback review

* moved push notification logic to DoesStatusAllowPushNotification

* Have every option handled in ShouldSendPushNotification

* unit tests
2017-03-02 18:38:38 -03: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
97558f6a6e PLT-4938 Add app package and move logic over from api package (#4931)
* Add app package and move logic over from api package

* Change app package functions to return errors

* Move non-api tests into app package

* Fix merge
2017-01-13 13:53:37 -05:00