[MM-43649] - Ability for end users to notify admin to upgrade workspace (#20338)
* [MM-43649] - Ability for end users to notify admin to upgrade workspace * add test case * move code to app layer * feedback impl * feedback impl-1 * feedback impl * simplify logic * fix typo and lint * fix app layers * Use a single critical section for users notified admin (#20488) * Use a single critical section for users notifying admin * change persistence mechanism * add more tests * change bot message * fix translations * update logic to notify once within cooloff period Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Nathaniel Allred <neallred@protonmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
dad8eab777
Коммит
1d9fa3c333
@@ -48,6 +48,25 @@ func (api *API) InitCloud() {
|
||||
|
||||
// POST /api/v4/cloud/webhook
|
||||
api.BaseRoutes.Cloud.Handle("/webhook", api.CloudAPIKeyRequired(handleCWSWebhook)).Methods("POST")
|
||||
|
||||
api.BaseRoutes.Cloud.Handle("/notify-admin-to-upgrade", api.APISessionRequired(handleNotifyAdminToUpgrade)).Methods("POST")
|
||||
}
|
||||
|
||||
func handleNotifyAdminToUpgrade(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var notifyAdminRequest *model.NotifyAdminToUpgradeRequest
|
||||
err := json.NewDecoder(r.Body).Decode(¬ifyAdminRequest)
|
||||
if err != nil {
|
||||
c.SetInvalidParam("notifyAdminRequest")
|
||||
return
|
||||
}
|
||||
|
||||
appErr := c.App.NotifySystemAdminsToUpgrade(c.AppContext, notifyAdminRequest.CurrentTeamId)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
}
|
||||
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
|
||||
func getSubscription(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Ссылка в новой задаче
Block a user