mirror of
https://github.com/usememos/memos.git
synced 2025-02-22 06:07:51 +01:00
fix: pin memos of other people (#1870)
This commit is contained in:
parent
5fe644a3b6
commit
30fae208c2
@ -368,6 +368,17 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session")
|
return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memo, err := s.Store.GetMemo(ctx, &store.FindMemoMessage{
|
||||||
|
ID: &memoID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find memo").SetInternal(err)
|
||||||
|
}
|
||||||
|
if memo.CreatorID != userID {
|
||||||
|
return echo.NewHTTPError(http.StatusUnauthorized, "Unauthorized")
|
||||||
|
}
|
||||||
|
|
||||||
memoOrganizerUpsert := &api.MemoOrganizerUpsert{}
|
memoOrganizerUpsert := &api.MemoOrganizerUpsert{}
|
||||||
if err := json.NewDecoder(c.Request().Body).Decode(memoOrganizerUpsert); err != nil {
|
if err := json.NewDecoder(c.Request().Body).Decode(memoOrganizerUpsert); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo organizer request").SetInternal(err)
|
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo organizer request").SetInternal(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user