From 78e59b749b003f39053d82d001a2b91bebb706ee Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Tue, 11 Jul 2023 12:17:34 +0800 Subject: [PATCH] chore: slice replace loop --- activitypub.go | 9 ++------- db/create.go | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/activitypub.go b/activitypub.go index efc34f3..24c9766 100644 --- a/activitypub.go +++ b/activitypub.go @@ -644,10 +644,7 @@ func deleteFederatedPost(app *App, p *PublicPost, collID int64) error { for si, instFolls := range inboxes { na.CC = []string{} - for _, f := range instFolls { - na.CC = append(na.CC, f) - } - + na.CC = append(na.CC, instFolls...) da := activitystreams.NewDeleteActivity(na) // Make the ID unique to ensure it works in Pleroma // See: https://git.pleroma.social/pleroma/pleroma/issues/1481 @@ -713,9 +710,7 @@ func federatePost(app *App, p *PublicPost, collID int64, isUpdate bool) error { // add all followers from that instance // to the CC field na.CC = []string{} - for _, f := range instFolls { - na.CC = append(na.CC, f) - } + na.CC = append(na.CC, instFolls...) // create a new "Create" activity // with our article as object if isUpdate { diff --git a/db/create.go b/db/create.go index 8728d5d..1e9e679 100644 --- a/db/create.go +++ b/db/create.go @@ -247,10 +247,7 @@ func (b *CreateTableSqlBuilder) ToSQL() (string, error) { } things = append(things, columnStr) } - for _, constraint := range b.Constraints { - things = append(things, constraint) - } - + things = append(things, b.Constraints...) if thingLen := len(things); thingLen > 0 { str.WriteString(" ( ") for i, thing := range things {