Skip to content

Commit

Permalink
Merge pull request #6094 from artsy/egdbear/chore/clean-up-devices
Browse files Browse the repository at this point in the history
chore: remove unstitched user devices feature flag
  • Loading branch information
egdbear authored Oct 9, 2024
2 parents d5bcd2b + c6ba24c commit fc6a57a
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 50 deletions.
1 change: 0 additions & 1 deletion _schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16097,7 +16097,6 @@ type Query {
last: Int
userId: ID!
): AuctionsLotStandingConnection!
_unused_gravity_devices(userId: ID!): [Device!]!

# Autocomplete resolvers.
_unused_gravity_matchPartners(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"deploy-cloudflare-workers": "yarn wrangler deploy --keep-vars --config=workers/caching/metaphysics-cdn.toml --env production",
"dev": "DEBUG=info,warn,error babel-node --extensions '.ts,.js' --inspect index.js",
"dump-schema": "babel-node --extensions '.ts,.js' ./scripts/dump-schema.ts",
"dump:local": "USE_UNSTITCHED_USER_DEVICES=false yarn dump-schema _schemaV2.graphql & wait",
"dump:local": "yarn dump-schema _schemaV2.graphql & wait",
"dump:staging": "node scripts/dump-staging-schema.js",
"lint": "eslint . --ext ts",
"lint:fix": "eslint . --fix --ext ts",
Expand Down
2 changes: 0 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const {
STATSD_HOST,
STATSD_PORT,
SYSTEM_ENVIRONMENT,
USE_UNSTITCHED_USER_DEVICES,
UNLEASH_ADMIN_TOKEN,
UNLEASH_API,
UNLEASH_APP_NAME,
Expand Down Expand Up @@ -216,7 +215,6 @@ export default {
UNLEASH_API: UNLEASH_API || "",
UNLEASH_APP_NAME: UNLEASH_APP_NAME || "",
UNLEASH_SERVER_KEY: UNLEASH_SERVER_KEY || "",
USE_UNSTITCHED_USER_DEVICES: USE_UNSTITCHED_USER_DEVICES === "true",
VORTEX_API_BASE,
VORTEX_APP_ID,
VORTEX_TOKEN,
Expand Down
7 changes: 1 addition & 6 deletions src/lib/stitching/gravity/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from "graphql-tools"
import { readFileSync } from "fs"

import config from "config"

const rootFieldsAllowList = [
"agreement",
"viewingRoom",
Expand All @@ -35,6 +33,7 @@ export const executableGravitySchema = () => {
"Artwork",
"ArtworkConnection",
"ArtworkEdge",
"Device",
"Lot",
"Money",
"MoneyInput",
Expand All @@ -50,10 +49,6 @@ export const executableGravitySchema = () => {
"ArtistSeriesConnection",
]

if (config.USE_UNSTITCHED_USER_DEVICES) {
duplicatedTypes.push("Device")
}

// Types which come from Gravity that are not (yet) needed in MP.
// In the future, these can be removed from this list as they are needed.
const unusedTypes = [
Expand Down
32 changes: 0 additions & 32 deletions src/lib/stitching/gravity/v2/stitching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { defineCustomLocale } from "lib/helpers"
import { toGlobalId } from "graphql-relay"
import { dateRange } from "lib/date"
import { GraphQLSchemaWithTransforms } from "graphql-tools"
import config from "config"

const useUnstitchedUserDevices = !!config.USE_UNSTITCHED_USER_DEVICES

const LocaleEnViewingRoomRelativeShort = "en-viewing-room-relative-short"
defineCustomLocale(LocaleEnViewingRoomRelativeShort, {
Expand Down Expand Up @@ -81,14 +78,6 @@ export const gravityStitchingEnvironment = (
id: ID!
}
${!useUnstitchedUserDevices
? `
extend type User {
devices: [Device!]!
}
`
: ""}
extend type ViewingRoom {
artworksConnection(
first: Int
Expand Down Expand Up @@ -220,27 +209,6 @@ export const gravityStitchingEnvironment = (
},
},
},
...(!useUnstitchedUserDevices && {
User: {
devices: {
fragment: gql`
... on User {
internalID
}
`,
resolve: ({ internalID: userId }, _args, context, info) => {
return info.mergeInfo.delegateToSchema({
schema: gravitySchema,
operation: "query",
fieldName: "_unused_gravity_devices",
args: { userId },
context,
info,
})
},
},
},
}),
UserAddress: {
id: {
fragment: gql`
Expand Down
5 changes: 0 additions & 5 deletions src/schema/v2/__tests__/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { toGlobalId } from "graphql-relay"
import { HTTPError } from "lib/HTTPError"
import gql from "lib/gql"
import { runAuthenticatedQuery } from "schema/v2/test/utils"
import config from "config"

describe("User", () => {
it("implements the NodeInterface", async () => {
Expand Down Expand Up @@ -1089,10 +1088,6 @@ describe("User", () => {
})
})

beforeAll(() => {
config.USE_UNSTITCHED_USER_DEVICES = true
})

describe("Devices", () => {
let context

Expand Down
3 changes: 2 additions & 1 deletion src/schema/v2/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
GraphQLList,
GraphQLNonNull,
GraphQLBoolean,
GraphQLID,
} from "graphql"
import { ResolverContext } from "types/graphql"

Expand All @@ -13,7 +14,7 @@ const DeviceType = new GraphQLObjectType<any, ResolverContext>({
fields: {
// FIXME: Use the InternalIDFields
id: {
type: GraphQLNonNull(GraphQLString),
type: GraphQLNonNull(GraphQLID),
description: "Unique ID for this device",
},
name: {
Expand Down
3 changes: 1 addition & 2 deletions src/schema/v2/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
import { UserInterestConnection } from "./userInterests"
import { UserSaleProfile } from "./userSaleProfile"
import { Devices } from "./devices"
import config from "config"

export const UserAdminNoteType = new GraphQLObjectType<any, ResolverContext>({
name: "UserAdminNotes",
Expand Down Expand Up @@ -203,7 +202,7 @@ export const UserType = new GraphQLObjectType<any, ResolverContext>({
return profiles[0]
},
},
...(config.USE_UNSTITCHED_USER_DEVICES ? { devices: Devices } : {}),
devices: Devices,
name: {
description: "The given name of the user.",
type: new GraphQLNonNull(GraphQLString),
Expand Down

0 comments on commit fc6a57a

Please sign in to comment.