This commit is contained in:
parent
12c9e17c4b
commit
dff031397e
14 changed files with 710 additions and 253 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/rs/zerolog/hlog"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/shared"
|
||||
"git.mstar.dev/mstar/linstrom/storage-new"
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
|
@ -64,7 +65,7 @@ func postAs(w http.ResponseWriter, r *http.Request) {
|
|||
AccessLevel: models.NOTE_TARGET_PUBLIC,
|
||||
OriginId: 1,
|
||||
}
|
||||
n.Select(
|
||||
err = n.Select(
|
||||
n.CreatorId,
|
||||
n.RawContent,
|
||||
n.Remote,
|
||||
|
@ -74,6 +75,26 @@ func postAs(w http.ResponseWriter, r *http.Request) {
|
|||
n.AccessLevel,
|
||||
n.OriginId,
|
||||
).Create(¬e)
|
||||
if err != nil {
|
||||
log.Error().
|
||||
Err(err).
|
||||
Str("username", data.Username).
|
||||
Str("content", data.Content).
|
||||
Msg("Failed to create message")
|
||||
webutils.ProblemDetailsStatusOnly(w, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
activity := models.Activity{
|
||||
Id: shared.NewId(),
|
||||
Type: string(models.ActivityCreate),
|
||||
ObjectId: note.ID,
|
||||
ObjectType: uint32(models.ActivitystreamsActivityTargetNote),
|
||||
}
|
||||
a := dbgen.Activity
|
||||
err = a.Create(&activity)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to create activity for new note")
|
||||
}
|
||||
}
|
||||
|
||||
func notesFrom(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue