You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +02:00
Props to preferences (#3722)
* Added tab;le creation migration * WIP * Finished base impl * Added MySQL migration * WIP * Added personal server store methods * WIP * Fixed webapp tests * Updated server tests * generated code * generated code * generated code * used raw queries instead of plugin methods to avoid updating productapi package * Added API doc * Added sqlite migratins * used plugin APIs again s=instead of raw queries * WIP * Added missed case of SQL migration where personal server can run on Postgres and MySQL * CI * Removed unsupported POSL operator * Low on caffine. Making silly mistakes * json handling * int test * hope tests pass * Fix incorrect column size * Webapp lint fixes * remived debug code * Updated moigration version * Review fixes
This commit is contained in:
@ -18,6 +18,7 @@ func (a *API) registerUsersRoutes(r *mux.Router) {
|
||||
r.HandleFunc("/users/me/memberships", a.sessionRequired(a.handleGetMyMemberships)).Methods("GET")
|
||||
r.HandleFunc("/users/{userID}", a.sessionRequired(a.handleGetUser)).Methods("GET")
|
||||
r.HandleFunc("/users/{userID}/config", a.sessionRequired(a.handleUpdateUserConfig)).Methods(http.MethodPut)
|
||||
r.HandleFunc("/users/me/config", a.sessionRequired(a.handleGetUserPreferences)).Methods(http.MethodGet)
|
||||
}
|
||||
|
||||
func (a *API) handleGetUsersList(w http.ResponseWriter, r *http.Request) {
|
||||
@ -315,3 +316,44 @@ func (a *API) handleUpdateUserConfig(w http.ResponseWriter, r *http.Request) {
|
||||
jsonBytesResponse(w, http.StatusOK, data)
|
||||
auditRec.Success()
|
||||
}
|
||||
|
||||
func (a *API) handleGetUserPreferences(w http.ResponseWriter, r *http.Request) {
|
||||
// swagger:operation GET /users/me/config getUserConfig
|
||||
//
|
||||
// Returns an array of user preferences
|
||||
//
|
||||
// ---
|
||||
// produces:
|
||||
// - application/json
|
||||
// security:
|
||||
// - BearerAuth: []
|
||||
// responses:
|
||||
// '200':
|
||||
// description: success
|
||||
// schema:
|
||||
// "$ref": "#/definitions/Preferences"
|
||||
// default:
|
||||
// description: internal error
|
||||
// schema:
|
||||
// "$ref": "#/definitions/ErrorResponse"
|
||||
|
||||
userID := getUserID(r)
|
||||
|
||||
auditRec := a.makeAuditRecord(r, "getUserConfig", audit.Fail)
|
||||
defer a.audit.LogRecord(audit.LevelRead, auditRec)
|
||||
|
||||
preferences, err := a.app.GetUserPreferences(userID)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
data, err := json.Marshal(preferences)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
jsonBytesResponse(w, http.StatusOK, data)
|
||||
auditRec.Success()
|
||||
}
|
||||
|
Reference in New Issue
Block a user