Troubleshoot misskey follows

Store the original follow request object and use it for approvals.
Closes #1690
This commit is contained in:
Gabe Kangas
2022-04-07 16:14:47 -07:00
parent f8181fd036
commit e46f8e2a66
15 changed files with 76 additions and 38 deletions

View File

@@ -1,4 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.13.0
package db

View File

@@ -1,4 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.13.0
package db
@@ -16,15 +18,16 @@ type ApAcceptedActivity struct {
}
type ApFollower struct {
Iri string
Inbox string
Name sql.NullString
Username string
Image sql.NullString
Request string
CreatedAt sql.NullTime
ApprovedAt sql.NullTime
DisabledAt sql.NullTime
Iri string
Inbox string
Name sql.NullString
Username string
Image sql.NullString
Request string
RequestObject []byte
CreatedAt sql.NullTime
ApprovedAt sql.NullTime
DisabledAt sql.NullTime
}
type ApOutbox struct {

View File

@@ -24,7 +24,7 @@ UPDATE ap_followers SET approved_at = $1, disabled_at = null WHERE iri = $2;
UPDATE ap_followers SET approved_at = null, disabled_at = $1 WHERE iri = $2;
-- name: GetFollowerByIRI :one
SELECT iri, inbox, name, username, image, request, created_at, approved_at, disabled_at FROM ap_followers WHERE iri = $1;
SELECT iri, inbox, name, username, image, request, request_object, created_at, approved_at, disabled_at FROM ap_followers WHERE iri = $1;
-- name: GetOutboxWithOffset :many
SELECT value FROM ap_outbox LIMIT $1 OFFSET $2;
@@ -39,7 +39,7 @@ SELECT value, live_notification, created_at FROM ap_outbox WHERE iri = $1;
DELETE FROM ap_followers WHERE iri = $1;
-- name: AddFollower :exec
INSERT INTO ap_followers(iri, inbox, request, name, username, image, approved_at) values($1, $2, $3, $4, $5, $6, $7);
INSERT INTO ap_followers(iri, inbox, request, request_object, name, username, image, approved_at) values($1, $2, $3, $4, $5, $6, $7, $8);
-- name: AddToOutbox :exec
INSERT INTO ap_outbox(iri, value, type, live_notification) values($1, $2, $3, $4);

View File

@@ -1,4 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.13.0
// source: query.sql
package db
@@ -10,17 +12,18 @@ import (
)
const addFollower = `-- name: AddFollower :exec
INSERT INTO ap_followers(iri, inbox, request, name, username, image, approved_at) values($1, $2, $3, $4, $5, $6, $7)
INSERT INTO ap_followers(iri, inbox, request, request_object, name, username, image, approved_at) values($1, $2, $3, $4, $5, $6, $7, $8)
`
type AddFollowerParams struct {
Iri string
Inbox string
Request string
Name sql.NullString
Username string
Image sql.NullString
ApprovedAt sql.NullTime
Iri string
Inbox string
Request string
RequestObject []byte
Name sql.NullString
Username string
Image sql.NullString
ApprovedAt sql.NullTime
}
func (q *Queries) AddFollower(ctx context.Context, arg AddFollowerParams) error {
@@ -28,6 +31,7 @@ func (q *Queries) AddFollower(ctx context.Context, arg AddFollowerParams) error
arg.Iri,
arg.Inbox,
arg.Request,
arg.RequestObject,
arg.Name,
arg.Username,
arg.Image,
@@ -229,7 +233,7 @@ func (q *Queries) GetFederationFollowersWithOffset(ctx context.Context, arg GetF
}
const getFollowerByIRI = `-- name: GetFollowerByIRI :one
SELECT iri, inbox, name, username, image, request, created_at, approved_at, disabled_at FROM ap_followers WHERE iri = $1
SELECT iri, inbox, name, username, image, request, request_object, created_at, approved_at, disabled_at FROM ap_followers WHERE iri = $1
`
func (q *Queries) GetFollowerByIRI(ctx context.Context, iri string) (ApFollower, error) {
@@ -242,6 +246,7 @@ func (q *Queries) GetFollowerByIRI(ctx context.Context, iri string) (ApFollower,
&i.Username,
&i.Image,
&i.Request,
&i.RequestObject,
&i.CreatedAt,
&i.ApprovedAt,
&i.DisabledAt,

View File

@@ -8,6 +8,7 @@ CREATE TABLE IF NOT EXISTS ap_followers (
"username" TEXT NOT NULL,
"image" TEXT,
"request" TEXT NOT NULL,
"request_object" BLOB,
"created_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"approved_at" TIMESTAMP,
"disabled_at" TIMESTAMP,