1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-15 23:54:29 +02:00

Ported view limits to main (#3252)

* Ported view limits to main

* lint fix

* Added tests

* Added tests

* Fixed a server test

* fixed webapp test

* fixed webapp test

* fixing some tests

* implement check when duplicating views

* Fixed webapp tests

* Fixed webapp tests

* Fixed webapp tests

* Trying without race test

* Lets race again

* Made error descriptive

* Minor improvements

* Updates snapshots for changed alt text

* Updates snapshots for changed alt text

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
This commit is contained in:
Harshil Sharma
2022-06-29 18:05:24 +05:30
committed by GitHub
parent b40452e4ca
commit 2ac56dbfba
41 changed files with 1950 additions and 15 deletions

View File

@ -34,6 +34,8 @@ const (
ErrorNoTeamMessage = "No team"
)
var errAPINotSupportedInStandaloneMode = errors.New("API not supported in standalone mode")
type PermissionError struct {
msg string
}
@ -168,6 +170,7 @@ func (a *API) RegisterRoutes(r *mux.Router) {
// limits
apiv2.HandleFunc("/limits", a.sessionRequired(a.handleCloudLimits)).Methods("GET")
apiv2.HandleFunc("/teams/{teamID}/notifyadminupgrade", a.sessionRequired(a.handleNotifyAdminUpgrade)).Methods(http.MethodPost)
// System APIs
r.HandleFunc("/hello", a.handleHello).Methods("GET")
@ -4230,6 +4233,37 @@ func (a *API) handleHello(w http.ResponseWriter, r *http.Request) {
stringResponse(w, "Hello")
}
func (a *API) handleNotifyAdminUpgrade(w http.ResponseWriter, r *http.Request) {
// swagger:operation GET /api/v2/teams/{teamID}/notifyadminupgrade handleNotifyAdminUpgrade
//
// Notifies admins for upgrade request.
//
// ---
// produces:
// - application/json
// security:
// - BearerAuth: []
// responses:
// '200':
// description: success
// default:
// description: internal error
// schema:
// "$ref": "#/definitions/ErrorResponse"
if !a.MattermostAuth {
a.errorResponse(w, r.URL.Path, http.StatusNotFound, "", errAPINotSupportedInStandaloneMode)
return
}
vars := mux.Vars(r)
teamID := vars["teamID"]
if err := a.app.NotifyPortalAdminsUpgradeRequest(teamID); err != nil {
jsonStringResponse(w, http.StatusOK, "{}")
}
}
// Response helpers
func (a *API) errorResponse(w http.ResponseWriter, api string, code int, message string, sourceError error) {