diff --git a/components/core/CarouselSidebar.js b/components/core/CarouselSidebar.js index 21500447..5c92e808 100644 --- a/components/core/CarouselSidebar.js +++ b/components/core/CarouselSidebar.js @@ -282,7 +282,7 @@ export const FileTypeDefaultPreview = (props) => { class CarouselSidebar extends React.Component { state = { name: this.props.file.name || this.props.file.filename || "", - body: this.props.file.data.body || "", + body: this.props.file.body || "", source: this.props.file.data.source || "", author: this.props.file.data.author || "", tags: this.props.file.data.tags || [], @@ -366,13 +366,10 @@ class CarouselSidebar extends React.Component { this.props.onAction({ type: "UPDATE_VIEWER", viewer: { tags: this.state.suggestions } }); const response = await Actions.updateFile({ id: this.props.file.id, - data: { - name: this.state.name, - body: this.state.body, - source: this.state.source, - author: this.state.author, - tags: this.state.tags, - }, + name: this.state.name, + body: this.state.body, + source: this.state.source, + author: this.state.author, }); Events.hasError(response); this.setState({ showSavedMessage: true }); @@ -602,7 +599,7 @@ class CarouselSidebar extends React.Component { ); } else { const hasName = !Strings.isEmpty(file.name || file.filename); - const hasBody = !Strings.isEmpty(file.data.body); + const hasBody = !Strings.isEmpty(file.body); const hasSource = !Strings.isEmpty(file.data.source); const hasAuthor = !Strings.isEmpty(file.data.author); @@ -635,7 +632,7 @@ class CarouselSidebar extends React.Component { elements.push(
- +
); diff --git a/components/core/CollectionPreviewBlock/index.js b/components/core/CollectionPreviewBlock/index.js index 0f88585e..7df0a860 100644 --- a/components/core/CollectionPreviewBlock/index.js +++ b/components/core/CollectionPreviewBlock/index.js @@ -94,7 +94,7 @@ export default function CollectionPreview({ collection, viewer, owner, onAction const showControls = () => setShowControls(true); const hideControls = () => setShowControls(false); - const description = collection?.data?.body; + const description = collection?.body; const media = useMediaQuery(); const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({ disabled: !description || media.mobile, diff --git a/components/core/MarkdownFrame.js b/components/core/MarkdownFrame.js index 05149076..1a6a1f28 100644 --- a/components/core/MarkdownFrame.js +++ b/components/core/MarkdownFrame.js @@ -20,7 +20,7 @@ const STYLES_ASSET = (theme) => css` const STYLES_BODY = css` width: 100%; - // 687px to ensure we have maximum 70ch per line + /* 687px to ensure we have maximum 70ch per line */ max-width: 687px; margin: 0 auto; & > *:first-child { diff --git a/components/core/ObjectPreview/ObjectPreviewPrimitive.js b/components/core/ObjectPreview/ObjectPreviewPrimitive.js index bec5a9f7..bf396c18 100644 --- a/components/core/ObjectPreview/ObjectPreviewPrimitive.js +++ b/components/core/ObjectPreview/ObjectPreviewPrimitive.js @@ -89,7 +89,7 @@ export default function ObjectPreviewPrimitive({ // const showControls = () => setShowControls(true); // const hideControls = () => setShowControls(false); - const description = file?.data?.body; + const description = file?.body; const media = useMediaQuery(); const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({ disabled: !description || media.mobile, diff --git a/components/core/Profile.js b/components/core/Profile.js index b0f4491a..49663f41 100644 --- a/components/core/Profile.js +++ b/components/core/Profile.js @@ -325,9 +325,9 @@ export default class Profile extends React.Component { )} )} - {user.data.body ? ( + {user.body ? (
- +
) : null}
diff --git a/components/core/ProfilePreviewBlock.js b/components/core/ProfilePreviewBlock.js index 3001ec4d..aa82370e 100644 --- a/components/core/ProfilePreviewBlock.js +++ b/components/core/ProfilePreviewBlock.js @@ -66,9 +66,9 @@ export default function ProfilePreviewBlock({ onAction, viewer, profile }) { - {profile?.data?.body || "No Description"} + {profile?.body || "No Description"} {!isOwner && diff --git a/components/core/SlatePreviewBlock.js b/components/core/SlatePreviewBlock.js index c2ee8419..c67e8a8c 100644 --- a/components/core/SlatePreviewBlock.js +++ b/components/core/SlatePreviewBlock.js @@ -333,9 +333,7 @@ export class SlatePreviewBlock extends React.Component {
)} -
- {this.props.slate.data.body ? this.props.slate.data.body : null} -
+
{this.props.slate.body}
{objects.length === 0 ? (
)}
- {this.props.slate.data.body ? ( + {this.props.slate.body ? (
- {this.props.slate.data.body} + {this.props.slate.body}
) : (
diff --git a/components/sidebars/SidebarSingleSlateSettings.js b/components/sidebars/SidebarSingleSlateSettings.js index 8ad91f26..70335f2d 100644 --- a/components/sidebars/SidebarSingleSlateSettings.js +++ b/components/sidebars/SidebarSingleSlateSettings.js @@ -49,7 +49,7 @@ export default class SidebarSingleSlateSettings extends React.Component { state = { slatename: this.props.data.slatename, isPublic: this.props.data.isPublic, - body: this.props.data.data.body, + body: this.props.data.body, name: this.props.data.name, modalShow: false, }; @@ -60,7 +60,7 @@ export default class SidebarSingleSlateSettings extends React.Component { if (slate.id === this.props.data.id) { slate.name = this.state.name; slate.isPublic = this.state.isPublic; - slate.data.body = this.state.body; + slate.body = this.state.body; this.props.onAction({ type: "UPDATE_VIEWER", diff --git a/node_common/serializers.js b/node_common/serializers.js index 1ccc9c58..e78b51f6 100644 --- a/node_common/serializers.js +++ b/node_common/serializers.js @@ -12,9 +12,9 @@ export const sanitizeUser = (entity) => { slates: entity.slates, //NOTE(martina): this is not in the database. It is added after library: entity.library, //NOTE(martina): this is not in the database. It is added after name: entity.name, + body: entity.body, data: { photo: entity.data?.photo, - body: entity.data?.body, }, followerCount: entity.followerCount, slateCount: entity.slateCount, @@ -31,8 +31,8 @@ export const sanitizeSlate = (entity) => { objects: entity.objects, owner: entity.owner, user: entity.user, //NOTE(martina): this is not in the database. It is added after + body: entity.body, data: { - body: entity.data?.body, preview: entity.data?.preview, }, fileCount: entity.fileCount, @@ -49,10 +49,10 @@ export const sanitizeFile = (entity) => { filename: entity.filename, name: entity.name, createdAt: entity.createdAt, + body: entity.body, data: { type: entity.data?.type, size: entity.data?.size, - body: entity.data?.body, source: entity.data?.source, author: entity.data?.author, blurhash: entity.data?.blurhash, @@ -84,9 +84,9 @@ export const cleanUser = (entity) => { twitterId: entity.twitterId, authVersion: entity.authVersion, data: entity.data, + body: entity.body, // data: { // photo: entity.data?.photo, - // body: entity.data?.body, // tokens: entity.data?.tokens, // settings: entity.data?.settings, // onboarding: entity.data?.onboarding, @@ -105,8 +105,8 @@ export const cleanSlate = (entity) => { isPublic: entity.isPublic, ownerId: entity.ownerId, data: entity.data, + body: entity.body, // data: { - // body: entity.data?.body, // preview: entity.data?.preview, // }, }; @@ -124,10 +124,10 @@ export const cleanFile = (entity) => { data: entity.data, isLink: entity.isLink, url: entity.url, + body: entity.body, // data: { // type: entity.data?.type, // size: entity.data?.size, - // body: entity.data?.body, // source: entity.data?.source, // author: entity.data?.author, // blurhash: entity.data?.blurhash, @@ -163,6 +163,7 @@ export const slateProperties = [ "slates.id", "slates.slatename", "slates.name", + "slates.body", "slates.data", "slates.ownerId", "slates.isPublic", @@ -174,6 +175,7 @@ export const userProperties = [ "users.id", "users.username", "users.name", + "users.body", "users.data", "users.slateCount", "users.followerCount", @@ -186,6 +188,7 @@ export const fileProperties = [ "files.isPublic", "files.filename", "files.name", + "files.body", "files.data", "files.createdAt", "files.downloadCount", diff --git a/pages/_/profile[dep].js b/pages/_/profile[dep].js index 86bf9c89..4d2be91d 100644 --- a/pages/_/profile[dep].js +++ b/pages/_/profile[dep].js @@ -63,7 +63,7 @@ export default class ProfilePage extends React.Component { : `@${this.props.creator.username} on Slate` : "404"; const url = `https://slate.host/${title}`; - const description = this.props.creator.data.body; + const description = this.props.creator.body; const image = this.props.creator.data.photo; if (Strings.isEmpty(image)) { image = DEFAULT_IMAGE; diff --git a/pages/_/slate[dep].js b/pages/_/slate[dep].js index ef7e9c59..814083a3 100644 --- a/pages/_/slate[dep].js +++ b/pages/_/slate[dep].js @@ -212,8 +212,8 @@ export default class SlatePage extends React.Component { let url = `https://slate.host/${this.props.creator.username}/${this.props.slate.slatename}`; let headerURL = `https://slate.host/${this.props.creator.username}`; - let { objects, isPublic } = this.props.slate; - let { body, preview } = this.props.slate.data; + let { objects, isPublic, body } = this.props.slate; + let { preview } = this.props.slate.data; let image; if (Strings.isEmpty(this.props.cid)) { image = preview; diff --git a/scenes/SceneEditAccount.js b/scenes/SceneEditAccount.js index 57d7ff0a..c5a38bd7 100644 --- a/scenes/SceneEditAccount.js +++ b/scenes/SceneEditAccount.js @@ -46,7 +46,7 @@ export default class SceneEditAccount extends React.Component { username: this.props.viewer.username, password: "", confirm: "", - body: this.props.viewer.data.body, + body: this.props.viewer.body, photo: this.props.viewer.data.photo, name: this.props.viewer.name, deleting: false, diff --git a/scenes/SceneProfile.js b/scenes/SceneProfile.js index fc3c99e8..946c7173 100644 --- a/scenes/SceneProfile.js +++ b/scenes/SceneProfile.js @@ -158,12 +158,12 @@ export default class SceneProfile extends React.Component { } if (file) { title = `${file.name || file.filename}`; - description = file.data.body ? file.data.body : `View ${title}, a file from ${name} on Slate`; + description = file.body ? file.body : `View ${title}, a file from ${name} on Slate`; image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit); } else { image = user.data.photo; - if (user.data.body) { - description = `${name}. ${user.data.body}`; + if (user.body) { + description = `${name}. ${user.body}`; } else { description = `View collections and content from ${name} on Slate`; } diff --git a/scenes/SceneSlate.js b/scenes/SceneSlate.js index 548a5d68..131e3aba 100644 --- a/scenes/SceneSlate.js +++ b/scenes/SceneSlate.js @@ -218,13 +218,13 @@ export default class SceneSlate extends React.Component { } if (file) { title = `${file.name || file.filename}`; - description = file.data.body - ? file.data.body + description = file.body + ? file.body : `View ${title}, a file in the collection ${name} on Slate`; image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit); } else { - if (slate.data.body) { - description = `${name}. ${slate.data.body}`; + if (slate.body) { + description = `${name}. ${slate.body}`; } else { description = `View the collection ${name} on Slate`; } @@ -402,8 +402,7 @@ class SlatePage extends React.Component { }; render() { - const { user, data } = this.props.data; - const { body = "", preview } = data; + const { user, data, body } = this.props.data; let objects = this.props.data.objects; const isPublic = this.props.data.isPublic; const isOwner = this.props.viewer ? this.props.data.ownerId === this.props.viewer.id : false; diff --git a/scripts/flattening-migration.js b/scripts/flattening-migration.js index 709e77d6..5359c191 100644 --- a/scripts/flattening-migration.js +++ b/scripts/flattening-migration.js @@ -266,7 +266,7 @@ runScript(); /* Users [ - 'data.name', -> 'name' + 'data.name', -> 'name' MIGRATED 'data.body', -> 'body' 'data.photo', -> 'photo' 'data.status', -> 'hidePrivacyAlert' @@ -281,14 +281,14 @@ Users Slates [ - 'data.body', -> 'name' - 'data.name', -> 'body' + 'data.name', -> 'name' MIGRATED + 'data.body', -> 'body' ] Files [ - 'data.name', -> 'name' + 'data.name', -> 'name' MIGRATED 'data.size', -> 'size' 'data.type', -> 'type' 'data.blurhash', -> 'blurhash'