diff options
author | FChannel <=> | 2021-01-28 16:49:39 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-28 16:49:39 -0800 |
commit | 51521e934b6d80f3b7267410e592fbef3580012f (patch) | |
tree | 9b05df5c143d1ae1a95a60e42afad3b7fde9d5c1 | |
parent | 0e07bcac00acdafd2f029fb54bfd2487ef2994ce (diff) |
sending post to followers of To adjustment
-rw-r--r-- | main.go | 31 |
1 files changed, 8 insertions, 23 deletions
@@ -1040,31 +1040,16 @@ func CreateObject(objType string) ObjectBase { } func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{ - followers := GetActorFollowDB(db, activity.Actor.Id) - - var nActivity Activity - var tempActivity Activity - for _, e := range followers { - aFollowers := GetActorCollection(e.Id + "/followers") + for _, e := range activity.To { + aFollowers := GetActorCollection(e + "/followers") for _, k := range aFollowers.Items { - bFollowing := GetActorCollection(k.Id + "/following") - var isFollowingActor = false - for _, n := range bFollowing.Items { - if n.Id == activity.Actor.Id { - isFollowingActor = true - break - } - } - - if isFollowingActor { - tempActivity.To = append(tempActivity.To, k.Id) - } + activity.To = append(activity.To, k.Id) } - - tempActivity.To = append(tempActivity.To, e.Id) } - for _, e := range tempActivity.To { + var nActivity Activity + + for _, e := range activity.To { var alreadyTo = false for _, k := range nActivity.To { if e == k || e == activity.Actor.Id { @@ -1077,8 +1062,8 @@ func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{ } } - activity.To = nActivity.To - + activity.To = nActivity.To + return activity } |