diff --git a/js/app/components/follow-button.tsx b/js/app/components/follow-button.tsx index d8ec6402..9e1c15d7 100644 --- a/js/app/components/follow-button.tsx +++ b/js/app/components/follow-button.tsx @@ -43,12 +43,9 @@ const FollowButton: React.FC = ({ setError(null); try { const res = await fetch( - `${streamplaceUrl}/xrpc/place.stream.graph.getFollowingUser?subjectDID=${encodeURIComponent(streamerDID)}`, + `${streamplaceUrl}/xrpc/place.stream.graph.getFollowingUser?subjectDID=${encodeURIComponent(streamerDID)}&userDID=${encodeURIComponent(currentUserDID)}`, { credentials: "include", - headers: { - "X-User-DID": currentUserDID || "", - }, }, ); diff --git a/js/app/features/bluesky/blueskySlice.tsx b/js/app/features/bluesky/blueskySlice.tsx index e2398320..df51bb78 100644 --- a/js/app/features/bluesky/blueskySlice.tsx +++ b/js/app/features/bluesky/blueskySlice.tsx @@ -975,12 +975,9 @@ export const blueskySlice = createAppSlice({ await bluesky.pdsAgent.deleteFollow(followUri); } else { const res = await fetch( - `${streamplace.url}/xrpc/place.stream.graph.getFollowingUser?subjectDID=${encodeURIComponent(subjectDID)}`, + `${streamplace.url}/xrpc/place.stream.graph.getFollowingUser?subjectDID=${encodeURIComponent(subjectDID)}&userDID=${encodeURIComponent(did)}`, { credentials: "include", - headers: { - "X-User-DID": did, - }, }, ); const data = await res.json(); diff --git a/js/docs/src/content/docs/lex-reference/graph/place-stream-graph-getfollowinguser.md b/js/docs/src/content/docs/lex-reference/graph/place-stream-graph-getfollowinguser.md index 5380bb41..7b73a951 100644 --- a/js/docs/src/content/docs/lex-reference/graph/place-stream-graph-getfollowinguser.md +++ b/js/docs/src/content/docs/lex-reference/graph/place-stream-graph-getfollowinguser.md @@ -13,13 +13,14 @@ description: Reference for the place.stream.graph.getFollowingUser lexicon **Type:** `query` -Get whether or not you're following a user. +Get whether or not user A is following user B. **Parameters:** -| Name | Type | Req'd | Description | Constraints | -| ------------ | -------- | ----- | ---------------------------------------------------------- | ------------- | -| `subjectDID` | `string` | ✅ | The DID of the user you want to check if you're following. | Format: `did` | +| Name | Type | Req'd | Description | Constraints | +| ------------ | -------- | ----- | ---------------------------------------------- | ------------- | +| `userDID` | `string` | ✅ | The DID of the potentially-following user | Format: `did` | +| `subjectDID` | `string` | ✅ | The DID of the user potentially being followed | Format: `did` | **Output:** @@ -43,15 +44,20 @@ Get whether or not you're following a user. "defs": { "main": { "type": "query", - "description": "Get whether or not you're following a user.", + "description": "Get whether or not user A is following user B.", "parameters": { "type": "params", - "required": ["subjectDID"], + "required": ["userDID", "subjectDID"], "properties": { + "userDID": { + "type": "string", + "format": "did", + "description": "The DID of the potentially-following user" + }, "subjectDID": { "type": "string", "format": "did", - "description": "The DID of the user you want to check if you're following." + "description": "The DID of the user potentially being followed" } } }, diff --git a/lexicons/place/stream/graph/getFollowingUser.json b/lexicons/place/stream/graph/getFollowingUser.json index 4346aae1..9544006d 100644 --- a/lexicons/place/stream/graph/getFollowingUser.json +++ b/lexicons/place/stream/graph/getFollowingUser.json @@ -4,15 +4,20 @@ "defs": { "main": { "type": "query", - "description": "Get whether or not you're following a user.", + "description": "Get whether or not user A is following user B.", "parameters": { "type": "params", - "required": ["subjectDID"], + "required": ["userDID", "subjectDID"], "properties": { + "userDID": { + "type": "string", + "format": "did", + "description": "The DID of the potentially-following user" + }, "subjectDID": { "type": "string", "format": "did", - "description": "The DID of the user you want to check if you're following." + "description": "The DID of the user potentially being followed" } } }, diff --git a/pkg/spxrpc/graph.go b/pkg/spxrpc/graph.go index 7c7ee71f..120ebac1 100644 --- a/pkg/spxrpc/graph.go +++ b/pkg/spxrpc/graph.go @@ -10,7 +10,7 @@ import ( placestreamtypes "stream.place/streamplace/pkg/streamplace" ) -func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context, userDID string, subjectDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) { +func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context, subjectDID string, userDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) { ctx, span := otel.Tracer("server").Start(ctx, "handlePlaceStreamGraphGetFollowingUser") defer span.End() diff --git a/pkg/spxrpc/stubs.go b/pkg/spxrpc/stubs.go index 7560b96c..ab3b31b0 100644 --- a/pkg/spxrpc/stubs.go +++ b/pkg/spxrpc/stubs.go @@ -56,14 +56,12 @@ func (s *Server) RegisterHandlersPlaceStream(e *echo.Echo) error { func (s *Server) HandlePlaceStreamGraphGetFollowingUser(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandlePlaceStreamGraphGetFollowingUser") defer span.End() - - userDID := c.Request().Header.Get("X-User-DID") subjectDID := c.QueryParam("subjectDID") - + userDID := c.QueryParam("userDID") var out *placestreamtypes.GraphGetFollowingUser_Output var handleErr error - // func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context,subjectDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) - out, handleErr = s.handlePlaceStreamGraphGetFollowingUser(ctx, userDID, subjectDID) + // func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context,subjectDID string,userDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) + out, handleErr = s.handlePlaceStreamGraphGetFollowingUser(ctx, subjectDID, userDID) if handleErr != nil { return handleErr } diff --git a/pkg/streamplace/graphgetFollowingUser.go b/pkg/streamplace/graphgetFollowingUser.go index 0075212f..4073c8fd 100644 --- a/pkg/streamplace/graphgetFollowingUser.go +++ b/pkg/streamplace/graphgetFollowingUser.go @@ -18,12 +18,14 @@ type GraphGetFollowingUser_Output struct { // GraphGetFollowingUser calls the XRPC method "place.stream.graph.getFollowingUser". // -// subjectDID: The DID of the user you want to check if you're following. -func GraphGetFollowingUser(ctx context.Context, c *xrpc.Client, subjectDID string) (*GraphGetFollowingUser_Output, error) { +// subjectDID: The DID of the user potentially being followed +// userDID: The DID of the potentially-following user +func GraphGetFollowingUser(ctx context.Context, c *xrpc.Client, subjectDID string, userDID string) (*GraphGetFollowingUser_Output, error) { var out GraphGetFollowingUser_Output params := map[string]interface{}{ "subjectDID": subjectDID, + "userDID": userDID, } if err := c.Do(ctx, xrpc.Query, "", "place.stream.graph.getFollowingUser", params, nil, &out); err != nil { return nil, err