Follow accept works and messags are pushed as expected
Some checks failed
/ docker (push) Failing after 2m50s

This commit is contained in:
Melody Becker 2025-05-10 11:18:28 +02:00
parent 9a3a330b1d
commit ff6a730e58
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
10 changed files with 482 additions and 19 deletions

View file

@ -17,7 +17,7 @@ import (
"git.mstar.dev/mstar/linstrom/storage-new/models"
)
type activityCreateOut struct {
type ActivityCreateOut struct {
Context any `json:"@context,omitempty"`
Id string `json:"id"`
Type string `json:"type"`
@ -28,7 +28,7 @@ type activityCreateOut struct {
func activityCreate(w http.ResponseWriter, r *http.Request) {
log := hlog.FromRequest(r)
id := r.PathValue("id")
activity, err := createFromStorage(r.Context(), id)
activity, err := CreateFromStorage(r.Context(), id)
switch err {
case gorm.ErrRecordNotFound:
webutils.ProblemDetailsStatusOnly(w, http.StatusNotFound)
@ -56,7 +56,7 @@ func activityCreate(w http.ResponseWriter, r *http.Request) {
// Does not set the context for the activity, in case the activity is embedded
// in another activity or object. That's the responsibility of the handler
// getting the final result
func createFromStorage(ctx context.Context, id string) (*activityCreateOut, error) {
func CreateFromStorage(ctx context.Context, id string) (*ActivityCreateOut, error) {
// log := log.Ctx(ctx)
a := dbgen.Activity
activity, err := a.Where(a.Type.Eq(string(models.ActivityCreate))).
@ -67,11 +67,11 @@ func createFromStorage(ctx context.Context, id string) (*activityCreateOut, erro
}
switch models.ActivitystreamsActivityTargetType(activity.ObjectType) {
case models.ActivitystreamsActivityTargetNote:
note, err := noteFromStorage(ctx, activity.ObjectId)
note, err := NoteFromStorage(ctx, activity.ObjectId)
if err != nil {
return nil, err
}
out := activityCreateOut{
out := ActivityCreateOut{
Id: config.GlobalConfig.General.GetFullPublicUrl() + "/api/activitypub/create/" + id,
Type: "Create",
Actor: note.AttributedTo,