Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 4 additions & 116 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@contentful/rich-text-react-renderer": "^16.1.6",
"@dcl/hooks": "^1.0.0",
"@dcl/schemas": "^24.0.0",
"@dcl/schemas": "^25.0.0",
"@sentry/browser": "^7.120.3",
"@well-known-components/pushable-channel": "^1.0.3",
"abort-controller": "^3.0.0",
Expand Down Expand Up @@ -100,7 +100,7 @@
"workbox-cli": "^6.5.2"
},
"overrides": {
"@dcl/schemas": "^24.0.0"
"@dcl/schemas": "^25.0.0"
},
"keywords": [
"gatsby"
Expand Down
5 changes: 4 additions & 1 deletion src/entities/CheckScenes/task/handleWorldSettingsChanged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import WorldModel from "../../World/model"
export async function handleWorldSettingsChanged(
event: WorldSettingsChangedEvent
): Promise<void> {
const worldName = event.key
const { worldName } = event.metadata

if (!worldName) {
logger.error("WorldSettingsChangedEvent missing world name (key)")
Expand Down Expand Up @@ -80,6 +80,9 @@ export async function handleWorldSettingsChanged(
show_in_places: event.metadata.showInPlaces,
single_player: event.metadata.singlePlayer,
skybox_time: event.metadata.skyboxTime,
is_private: event.metadata.accessType
? event.metadata.accessType !== "unrestricted"
: false,
})

loggerExtended.log(`Upserted world settings for: ${worldName}`)
Expand Down
5 changes: 4 additions & 1 deletion src/entities/World/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export default class WorldModel extends Model<WorldAttributes> {
show_in_places: world.show_in_places ?? true,
single_player: world.single_player ?? false,
skybox_time: world.skybox_time ?? null,
is_private: world.is_private ?? false,
likes: world.likes ?? 0,
dislikes: world.dislikes ?? 0,
favorites: world.favorites ?? 0,
Expand Down Expand Up @@ -362,7 +363,7 @@ export default class WorldModel extends Model<WorldAttributes> {
INSERT INTO ${table(this)} (
"id", "world_name", "title", "description", "image",
"content_rating", "categories", "owner", "show_in_places",
"single_player", "skybox_time", "likes", "dislikes", "favorites",
"single_player", "skybox_time", "is_private", "likes", "dislikes", "favorites",
"like_rate", "like_score", "disabled", "disabled_at",
"created_at", "updated_at"
) VALUES (
Expand All @@ -377,6 +378,7 @@ export default class WorldModel extends Model<WorldAttributes> {
${worldData.show_in_places},
${worldData.single_player},
${worldData.skybox_time},
${worldData.is_private},
${worldData.likes},
${worldData.dislikes},
${worldData.favorites},
Expand Down Expand Up @@ -410,6 +412,7 @@ export default class WorldModel extends Model<WorldAttributes> {
"show_in_places",
"single_player",
"skybox_time",
"is_private",
]

// Build changes object with only explicitly provided fields
Expand Down
4 changes: 4 additions & 0 deletions src/entities/World/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ export const worldSchema = schema({
minimum: 0,
description: "The number of favorites on the world",
},
is_private: {
type: "boolean",
description: "True if the world has restricted access (private)",
},
disabled: {
type: "boolean",
description: "True if the world is disabled",
Expand Down
1 change: 1 addition & 0 deletions src/entities/World/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type WorldAttributes = BaseEntityAttributes & {
show_in_places: boolean
single_player: boolean
skybox_time: number | null
is_private: boolean
}

/**
Expand Down
20 changes: 20 additions & 0 deletions src/migrations/1770729908000_add-is-private-to-worlds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Type } from "decentraland-gatsby/dist/entities/Database/types"
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"

import WorldModel from "../entities/World/model"

export const shorthands: ColumnDefinitions | undefined = undefined

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.addColumn(WorldModel.tableName, {
is_private: {
type: Type.Boolean,
default: false,
notNull: true,
},
})
}

export async function down(pgm: MigrationBuilder): Promise<void> {
pgm.dropColumn(WorldModel.tableName, "is_private")
}
13 changes: 4 additions & 9 deletions test/fixtures/worldSettingsEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@ export function createWorldSettingsChangedEvent(
timestamp: Date.now(),
...overrides,
metadata: {
title: "Test World",
description: "A test world for integration tests",
contentRating: "T",
categories: ["art", "game"],
showInPlaces: true,
singlePlayer: false,
skyboxTime: null,
thumbnailUrl: "https://example.com/thumbnail.png",
worldName: "testworld.dcl.eth",
...overrides.metadata,
},
} as WorldSettingsChangedEvent["metadata"],
}
}

Expand All @@ -38,6 +31,7 @@ export function createWorldSettingsUpgradeRatingEvent(
return createWorldSettingsChangedEvent({
key: worldName,
metadata: {
worldName: worldName,
contentRating: "A",
},
})
Expand All @@ -53,6 +47,7 @@ export function createWorldSettingsDowngradeRatingEvent(
return createWorldSettingsChangedEvent({
key: worldName,
metadata: {
worldName: worldName,
contentRating: "RP",
},
})
Expand Down
Loading
Loading