You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +02:00
Workspace switcher (#1052)
* API WIP * WIP * Finished changes * Fixed colors: * Don't enforce charset adn collation in migration, pick from database DSN * Added MySQL query * Updated mocks * Added tests * Lint fixes * Fixed typo and removed unsed style * Checked in a snapshot * Updated snapshot * Updated Cypress test * Updated Cypress test * Updated Cypress test * Fixed review comments * Fixed tests * Added default collation for MySQL * Added documentation for ensuring correct database collation * Updated migrations * Fixed a bug with collation * Fixed lint errors * Used correct collation * debugging * Updating css * Minor UI changes * USe inbuilt default collation * Used only charset for mysql * Fixed linter issue: * Added migration for matching collation * Reverted local config changes * Reverted local config changes * Handled the case of personal server running on MySQL * WIP * Now running collation matching migration onlyt for plugins * Minor optimization * Multiple review fixes * Added group by clause to primary query * Supported for subpacth Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com>
This commit is contained in:
@ -94,6 +94,8 @@ func (a *API) RegisterRoutes(r *mux.Router) {
|
||||
|
||||
apiv1.HandleFunc("/workspaces/{workspaceID}/{rootID}/files", a.sessionRequired(a.handleUploadFile)).Methods("POST")
|
||||
|
||||
apiv1.HandleFunc("/workspaces", a.sessionRequired(a.handleGetUserWorkspaces)).Methods("GET")
|
||||
|
||||
// Get Files API
|
||||
|
||||
files := r.PathPrefix("/files").Subrouter()
|
||||
@ -1460,3 +1462,21 @@ func jsonBytesResponse(w http.ResponseWriter, code int, json []byte) { //nolint:
|
||||
w.WriteHeader(code)
|
||||
_, _ = w.Write(json)
|
||||
}
|
||||
|
||||
func (a *API) handleGetUserWorkspaces(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
session := ctx.Value(sessionContextKey).(*model.Session)
|
||||
userWorkspaces, err := a.app.GetUserWorkspaces(session.UserID)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
data, err := json.Marshal(userWorkspaces)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
jsonBytesResponse(w, http.StatusOK, data)
|
||||
}
|
||||
|
Reference in New Issue
Block a user