From f23f04e0b1d117be714bf91d5266dab219ed741e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:49:37 +0200 Subject: [feature] Interaction requests client api + settings panel (#3215) * [feature] Interaction requests client api + settings panel * test accept / reject * fmt * don't pin rejected interaction * use single db model for interaction accept, reject, and request * swaggor * env sharting * append errors * remove ErrNoEntries checks * change intReqID to reqID * rename "pend" to "request" * markIntsPending -> mark interactionsPending * use log instead of returning error when rejecting interaction * empty migration * jolly renaming * make interactionURI unique again * swag grr * remove unnecessary locks * invalidate as last step --- internal/uris/uri.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'internal/uris') diff --git a/internal/uris/uri.go b/internal/uris/uri.go index 159508176..e1783b26c 100644 --- a/internal/uris/uri.go +++ b/internal/uris/uri.go @@ -46,7 +46,8 @@ const ( FileserverPath = "fileserver" // FileserverPath is a path component for serving attachments + media EmojiPath = "emoji" // EmojiPath represents the activitypub emoji location TagsPath = "tags" // TagsPath represents the activitypub tags location - AcceptsPath = "accepts" // AcceptsPath represents the activitypub accepts location + AcceptsPath = "accepts" // AcceptsPath represents the activitypub Accept's location + RejectsPath = "rejects" // RejectsPath represents the activitypub Reject's location ) // UserURIs contains a bunch of UserURIs and URLs for a user, host, account, etc. @@ -137,7 +138,7 @@ func GenerateURIForEmailConfirm(token string) string { return fmt.Sprintf("%s://%s/%s?token=%s", protocol, host, ConfirmEmailPath, token) } -// GenerateURIForAccept returns the AP URI for a new accept activity -- something like: +// GenerateURIForAccept returns the AP URI for a new Accept activity -- something like: // https://example.org/users/whatever_user/accepts/01F7XTH1QGBAPMGF49WJZ91XGC func GenerateURIForAccept(username string, thisAcceptID string) string { protocol := config.GetProtocol() @@ -145,6 +146,14 @@ func GenerateURIForAccept(username string, thisAcceptID string) string { return fmt.Sprintf("%s://%s/%s/%s/%s/%s", protocol, host, UsersPath, username, AcceptsPath, thisAcceptID) } +// GenerateURIForReject returns the AP URI for a new Reject activity -- something like: +// https://example.org/users/whatever_user/rejects/01F7XTH1QGBAPMGF49WJZ91XGC +func GenerateURIForReject(username string, thisRejectID string) string { + protocol := config.GetProtocol() + host := config.GetHost() + return fmt.Sprintf("%s://%s/%s/%s/%s/%s", protocol, host, UsersPath, username, RejectsPath, thisRejectID) +} + // GenerateURIsForAccount throws together a bunch of URIs for the given username, with the given protocol and host. func GenerateURIsForAccount(username string) *UserURIs { protocol := config.GetProtocol() -- cgit v1.3