Page MenuHomePhabricator

D13440.id44474.diff
No OneTemporary

D13440.id44474.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -82,6 +82,8 @@
import {
legacyUpdateRelationshipsResponder,
legacyUpdateRelationshipInputValidator,
+ updateRelationshipsResponder,
+ updateRelationshipInputValidator,
} from './responders/relationship-responders.js';
import {
reportCreationResponder,
@@ -431,6 +433,11 @@
inputValidator: legacyUpdateRelationshipInputValidator,
policies: baseLegalPolicies,
},
+ update_relationships2: {
+ responder: updateRelationshipsResponder,
+ inputValidator: updateRelationshipInputValidator,
+ policies: baseLegalPolicies,
+ },
update_role: {
responder: roleUpdateResponder,
inputValidator: roleChangeRequestInputValidator,
diff --git a/keyserver/src/responders/relationship-responders.js b/keyserver/src/responders/relationship-responders.js
--- a/keyserver/src/responders/relationship-responders.js
+++ b/keyserver/src/responders/relationship-responders.js
@@ -10,6 +10,8 @@
legacyFarcasterRelationshipRequestValidator,
relationshipActions,
type RelationshipRequestUserInfo,
+ type RelationshipRequest,
+ relationshipActionsList,
} from 'lib/types/relationship-types.js';
import { tShape, tUserID } from 'lib/utils/validation-utils.js';
@@ -59,4 +61,22 @@
return await updateRelationships(viewer, request);
}
-export { legacyUpdateRelationshipsResponder };
+export const updateRelationshipInputValidator: TInterface<RelationshipRequest> =
+ tShape<RelationshipRequest>({
+ action: t.enums.of(relationshipActionsList, 'relationship action'),
+ users: t.dict(
+ tUserID,
+ tShape<RelationshipRequestUserInfo>({
+ createRobotextInThinThread: t.Boolean,
+ }),
+ ),
+ });
+
+async function updateRelationshipsResponder(
+ viewer: Viewer,
+ request: RelationshipRequest,
+): Promise<RelationshipErrors> {
+ return await updateRelationships(viewer, request);
+}
+
+export { legacyUpdateRelationshipsResponder, updateRelationshipsResponder };
diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js
--- a/lib/types/endpoints.js
+++ b/lib/types/endpoints.js
@@ -99,6 +99,7 @@
UPDATE_DEVICE_TOKEN: 'update_device_token',
UPDATE_ENTRY: 'update_entry',
LEGACY_UPDATE_RELATIONSHIPS: 'update_relationships',
+ UPDATE_RELATIONSHIPS: 'update_relationships2',
UPDATE_ROLE: 'update_role',
UPDATE_THREAD: 'update_thread',
UPDATE_USER_SUBSCRIPTION: 'update_user_subscription',
diff --git a/lib/types/validators/endpoint-validators.js b/lib/types/validators/endpoint-validators.js
--- a/lib/types/validators/endpoint-validators.js
+++ b/lib/types/validators/endpoint-validators.js
@@ -158,6 +158,7 @@
update_device_token: { validator: t.Nil },
update_entry: { validator: saveEntryResponseValidator },
update_relationships: { validator: relationshipErrorsValidator },
+ update_relationships2: { validator: relationshipErrorsValidator },
update_role: { validator: changeThreadSettingsResultValidator },
update_thread: { validator: changeThreadSettingsResultValidator },
update_user_subscription: { validator: subscriptionUpdateResponseValidator },

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 3:00 PM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535108
Default Alt Text
D13440.id44474.diff (3 KB)

Event Timeline