mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-22 21:45:56 +03:00
converting data.body to body
This commit is contained in:
parent
b45be08ffb
commit
cabcdc31ec
@ -282,7 +282,7 @@ export const FileTypeDefaultPreview = (props) => {
|
|||||||
class CarouselSidebar extends React.Component {
|
class CarouselSidebar extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
name: this.props.file.name || this.props.file.filename || "",
|
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 || "",
|
source: this.props.file.data.source || "",
|
||||||
author: this.props.file.data.author || "",
|
author: this.props.file.data.author || "",
|
||||||
tags: this.props.file.data.tags || [],
|
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 } });
|
this.props.onAction({ type: "UPDATE_VIEWER", viewer: { tags: this.state.suggestions } });
|
||||||
const response = await Actions.updateFile({
|
const response = await Actions.updateFile({
|
||||||
id: this.props.file.id,
|
id: this.props.file.id,
|
||||||
data: {
|
name: this.state.name,
|
||||||
name: this.state.name,
|
body: this.state.body,
|
||||||
body: this.state.body,
|
source: this.state.source,
|
||||||
source: this.state.source,
|
author: this.state.author,
|
||||||
author: this.state.author,
|
|
||||||
tags: this.state.tags,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
Events.hasError(response);
|
Events.hasError(response);
|
||||||
this.setState({ showSavedMessage: true });
|
this.setState({ showSavedMessage: true });
|
||||||
@ -602,7 +599,7 @@ class CarouselSidebar extends React.Component {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const hasName = !Strings.isEmpty(file.name || file.filename);
|
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 hasSource = !Strings.isEmpty(file.data.source);
|
||||||
const hasAuthor = !Strings.isEmpty(file.data.author);
|
const hasAuthor = !Strings.isEmpty(file.data.author);
|
||||||
|
|
||||||
@ -635,7 +632,7 @@ class CarouselSidebar extends React.Component {
|
|||||||
elements.push(
|
elements.push(
|
||||||
<div key="sidebar-media-info-body" css={STYLES_SIDEBAR_SECTION}>
|
<div key="sidebar-media-info-body" css={STYLES_SIDEBAR_SECTION}>
|
||||||
<div css={STYLES_BODY}>
|
<div css={STYLES_BODY}>
|
||||||
<ProcessedText dark text={file.data.body} />
|
<ProcessedText dark text={file.body} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -94,7 +94,7 @@ export default function CollectionPreview({ collection, viewer, owner, onAction
|
|||||||
const showControls = () => setShowControls(true);
|
const showControls = () => setShowControls(true);
|
||||||
const hideControls = () => setShowControls(false);
|
const hideControls = () => setShowControls(false);
|
||||||
|
|
||||||
const description = collection?.data?.body;
|
const description = collection?.body;
|
||||||
const media = useMediaQuery();
|
const media = useMediaQuery();
|
||||||
const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({
|
const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({
|
||||||
disabled: !description || media.mobile,
|
disabled: !description || media.mobile,
|
||||||
|
@ -20,7 +20,7 @@ const STYLES_ASSET = (theme) => css`
|
|||||||
|
|
||||||
const STYLES_BODY = css`
|
const STYLES_BODY = css`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// 687px to ensure we have maximum 70ch per line
|
/* 687px to ensure we have maximum 70ch per line */
|
||||||
max-width: 687px;
|
max-width: 687px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
& > *:first-child {
|
& > *:first-child {
|
||||||
|
@ -89,7 +89,7 @@ export default function ObjectPreviewPrimitive({
|
|||||||
// const showControls = () => setShowControls(true);
|
// const showControls = () => setShowControls(true);
|
||||||
// const hideControls = () => setShowControls(false);
|
// const hideControls = () => setShowControls(false);
|
||||||
|
|
||||||
const description = file?.data?.body;
|
const description = file?.body;
|
||||||
const media = useMediaQuery();
|
const media = useMediaQuery();
|
||||||
const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({
|
const { isDescriptionVisible, showDescription, hideDescription } = useShowDescription({
|
||||||
disabled: !description || media.mobile,
|
disabled: !description || media.mobile,
|
||||||
|
@ -325,9 +325,9 @@ export default class Profile extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{user.data.body ? (
|
{user.body ? (
|
||||||
<div css={STYLES_DESCRIPTION}>
|
<div css={STYLES_DESCRIPTION}>
|
||||||
<ProcessedText text={user.data.body} />
|
<ProcessedText text={user.body} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
<div css={STYLES_STATS}>
|
<div css={STYLES_STATS}>
|
||||||
|
@ -66,9 +66,9 @@ export default function ProfilePreviewBlock({ onAction, viewer, profile }) {
|
|||||||
<Typography.P2
|
<Typography.P2
|
||||||
color="gray"
|
color="gray"
|
||||||
nbrOflines={1}
|
nbrOflines={1}
|
||||||
style={{ marginTop: 8, textIndent: 8, opacity: profile?.data?.body ? 1 : 0 }}
|
style={{ marginTop: 8, textIndent: 8, opacity: profile?.body ? 1 : 0 }}
|
||||||
>
|
>
|
||||||
{profile?.data?.body || "No Description"}
|
{profile?.body || "No Description"}
|
||||||
</Typography.P2>
|
</Typography.P2>
|
||||||
|
|
||||||
{!isOwner &&
|
{!isOwner &&
|
||||||
|
@ -333,9 +333,7 @@ export class SlatePreviewBlock extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div css={STYLES_BODY}>
|
<div css={STYLES_BODY}>{this.props.slate.body}</div>
|
||||||
{this.props.slate.data.body ? this.props.slate.data.body : null}
|
|
||||||
</div>
|
|
||||||
{objects.length === 0 ? (
|
{objects.length === 0 ? (
|
||||||
<div
|
<div
|
||||||
css={STYLES_PLACEHOLDER}
|
css={STYLES_PLACEHOLDER}
|
||||||
@ -372,9 +370,9 @@ export class SlatePreviewBlock extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{this.props.slate.data.body ? (
|
{this.props.slate.body ? (
|
||||||
<div css={STYLES_BODY} style={{ marginBottom: 16 }}>
|
<div css={STYLES_BODY} style={{ marginBottom: 16 }}>
|
||||||
{this.props.slate.data.body}
|
{this.props.slate.body}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ height: 8 }} />
|
<div style={{ height: 8 }} />
|
||||||
|
@ -49,7 +49,7 @@ export default class SidebarSingleSlateSettings extends React.Component {
|
|||||||
state = {
|
state = {
|
||||||
slatename: this.props.data.slatename,
|
slatename: this.props.data.slatename,
|
||||||
isPublic: this.props.data.isPublic,
|
isPublic: this.props.data.isPublic,
|
||||||
body: this.props.data.data.body,
|
body: this.props.data.body,
|
||||||
name: this.props.data.name,
|
name: this.props.data.name,
|
||||||
modalShow: false,
|
modalShow: false,
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ export default class SidebarSingleSlateSettings extends React.Component {
|
|||||||
if (slate.id === this.props.data.id) {
|
if (slate.id === this.props.data.id) {
|
||||||
slate.name = this.state.name;
|
slate.name = this.state.name;
|
||||||
slate.isPublic = this.state.isPublic;
|
slate.isPublic = this.state.isPublic;
|
||||||
slate.data.body = this.state.body;
|
slate.body = this.state.body;
|
||||||
|
|
||||||
this.props.onAction({
|
this.props.onAction({
|
||||||
type: "UPDATE_VIEWER",
|
type: "UPDATE_VIEWER",
|
||||||
|
@ -12,9 +12,9 @@ export const sanitizeUser = (entity) => {
|
|||||||
slates: entity.slates, //NOTE(martina): this is not in the database. It is added after
|
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
|
library: entity.library, //NOTE(martina): this is not in the database. It is added after
|
||||||
name: entity.name,
|
name: entity.name,
|
||||||
|
body: entity.body,
|
||||||
data: {
|
data: {
|
||||||
photo: entity.data?.photo,
|
photo: entity.data?.photo,
|
||||||
body: entity.data?.body,
|
|
||||||
},
|
},
|
||||||
followerCount: entity.followerCount,
|
followerCount: entity.followerCount,
|
||||||
slateCount: entity.slateCount,
|
slateCount: entity.slateCount,
|
||||||
@ -31,8 +31,8 @@ export const sanitizeSlate = (entity) => {
|
|||||||
objects: entity.objects,
|
objects: entity.objects,
|
||||||
owner: entity.owner,
|
owner: entity.owner,
|
||||||
user: entity.user, //NOTE(martina): this is not in the database. It is added after
|
user: entity.user, //NOTE(martina): this is not in the database. It is added after
|
||||||
|
body: entity.body,
|
||||||
data: {
|
data: {
|
||||||
body: entity.data?.body,
|
|
||||||
preview: entity.data?.preview,
|
preview: entity.data?.preview,
|
||||||
},
|
},
|
||||||
fileCount: entity.fileCount,
|
fileCount: entity.fileCount,
|
||||||
@ -49,10 +49,10 @@ export const sanitizeFile = (entity) => {
|
|||||||
filename: entity.filename,
|
filename: entity.filename,
|
||||||
name: entity.name,
|
name: entity.name,
|
||||||
createdAt: entity.createdAt,
|
createdAt: entity.createdAt,
|
||||||
|
body: entity.body,
|
||||||
data: {
|
data: {
|
||||||
type: entity.data?.type,
|
type: entity.data?.type,
|
||||||
size: entity.data?.size,
|
size: entity.data?.size,
|
||||||
body: entity.data?.body,
|
|
||||||
source: entity.data?.source,
|
source: entity.data?.source,
|
||||||
author: entity.data?.author,
|
author: entity.data?.author,
|
||||||
blurhash: entity.data?.blurhash,
|
blurhash: entity.data?.blurhash,
|
||||||
@ -84,9 +84,9 @@ export const cleanUser = (entity) => {
|
|||||||
twitterId: entity.twitterId,
|
twitterId: entity.twitterId,
|
||||||
authVersion: entity.authVersion,
|
authVersion: entity.authVersion,
|
||||||
data: entity.data,
|
data: entity.data,
|
||||||
|
body: entity.body,
|
||||||
// data: {
|
// data: {
|
||||||
// photo: entity.data?.photo,
|
// photo: entity.data?.photo,
|
||||||
// body: entity.data?.body,
|
|
||||||
// tokens: entity.data?.tokens,
|
// tokens: entity.data?.tokens,
|
||||||
// settings: entity.data?.settings,
|
// settings: entity.data?.settings,
|
||||||
// onboarding: entity.data?.onboarding,
|
// onboarding: entity.data?.onboarding,
|
||||||
@ -105,8 +105,8 @@ export const cleanSlate = (entity) => {
|
|||||||
isPublic: entity.isPublic,
|
isPublic: entity.isPublic,
|
||||||
ownerId: entity.ownerId,
|
ownerId: entity.ownerId,
|
||||||
data: entity.data,
|
data: entity.data,
|
||||||
|
body: entity.body,
|
||||||
// data: {
|
// data: {
|
||||||
// body: entity.data?.body,
|
|
||||||
// preview: entity.data?.preview,
|
// preview: entity.data?.preview,
|
||||||
// },
|
// },
|
||||||
};
|
};
|
||||||
@ -124,10 +124,10 @@ export const cleanFile = (entity) => {
|
|||||||
data: entity.data,
|
data: entity.data,
|
||||||
isLink: entity.isLink,
|
isLink: entity.isLink,
|
||||||
url: entity.url,
|
url: entity.url,
|
||||||
|
body: entity.body,
|
||||||
// data: {
|
// data: {
|
||||||
// type: entity.data?.type,
|
// type: entity.data?.type,
|
||||||
// size: entity.data?.size,
|
// size: entity.data?.size,
|
||||||
// body: entity.data?.body,
|
|
||||||
// source: entity.data?.source,
|
// source: entity.data?.source,
|
||||||
// author: entity.data?.author,
|
// author: entity.data?.author,
|
||||||
// blurhash: entity.data?.blurhash,
|
// blurhash: entity.data?.blurhash,
|
||||||
@ -163,6 +163,7 @@ export const slateProperties = [
|
|||||||
"slates.id",
|
"slates.id",
|
||||||
"slates.slatename",
|
"slates.slatename",
|
||||||
"slates.name",
|
"slates.name",
|
||||||
|
"slates.body",
|
||||||
"slates.data",
|
"slates.data",
|
||||||
"slates.ownerId",
|
"slates.ownerId",
|
||||||
"slates.isPublic",
|
"slates.isPublic",
|
||||||
@ -174,6 +175,7 @@ export const userProperties = [
|
|||||||
"users.id",
|
"users.id",
|
||||||
"users.username",
|
"users.username",
|
||||||
"users.name",
|
"users.name",
|
||||||
|
"users.body",
|
||||||
"users.data",
|
"users.data",
|
||||||
"users.slateCount",
|
"users.slateCount",
|
||||||
"users.followerCount",
|
"users.followerCount",
|
||||||
@ -186,6 +188,7 @@ export const fileProperties = [
|
|||||||
"files.isPublic",
|
"files.isPublic",
|
||||||
"files.filename",
|
"files.filename",
|
||||||
"files.name",
|
"files.name",
|
||||||
|
"files.body",
|
||||||
"files.data",
|
"files.data",
|
||||||
"files.createdAt",
|
"files.createdAt",
|
||||||
"files.downloadCount",
|
"files.downloadCount",
|
||||||
|
@ -63,7 +63,7 @@ export default class ProfilePage extends React.Component {
|
|||||||
: `@${this.props.creator.username} on Slate`
|
: `@${this.props.creator.username} on Slate`
|
||||||
: "404";
|
: "404";
|
||||||
const url = `https://slate.host/${title}`;
|
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;
|
const image = this.props.creator.data.photo;
|
||||||
if (Strings.isEmpty(image)) {
|
if (Strings.isEmpty(image)) {
|
||||||
image = DEFAULT_IMAGE;
|
image = DEFAULT_IMAGE;
|
||||||
|
@ -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 url = `https://slate.host/${this.props.creator.username}/${this.props.slate.slatename}`;
|
||||||
let headerURL = `https://slate.host/${this.props.creator.username}`;
|
let headerURL = `https://slate.host/${this.props.creator.username}`;
|
||||||
|
|
||||||
let { objects, isPublic } = this.props.slate;
|
let { objects, isPublic, body } = this.props.slate;
|
||||||
let { body, preview } = this.props.slate.data;
|
let { preview } = this.props.slate.data;
|
||||||
let image;
|
let image;
|
||||||
if (Strings.isEmpty(this.props.cid)) {
|
if (Strings.isEmpty(this.props.cid)) {
|
||||||
image = preview;
|
image = preview;
|
||||||
|
@ -46,7 +46,7 @@ export default class SceneEditAccount extends React.Component {
|
|||||||
username: this.props.viewer.username,
|
username: this.props.viewer.username,
|
||||||
password: "",
|
password: "",
|
||||||
confirm: "",
|
confirm: "",
|
||||||
body: this.props.viewer.data.body,
|
body: this.props.viewer.body,
|
||||||
photo: this.props.viewer.data.photo,
|
photo: this.props.viewer.data.photo,
|
||||||
name: this.props.viewer.name,
|
name: this.props.viewer.name,
|
||||||
deleting: false,
|
deleting: false,
|
||||||
|
@ -158,12 +158,12 @@ export default class SceneProfile extends React.Component {
|
|||||||
}
|
}
|
||||||
if (file) {
|
if (file) {
|
||||||
title = `${file.name || file.filename}`;
|
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);
|
image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit);
|
||||||
} else {
|
} else {
|
||||||
image = user.data.photo;
|
image = user.data.photo;
|
||||||
if (user.data.body) {
|
if (user.body) {
|
||||||
description = `${name}. ${user.data.body}`;
|
description = `${name}. ${user.body}`;
|
||||||
} else {
|
} else {
|
||||||
description = `View collections and content from ${name} on Slate`;
|
description = `View collections and content from ${name} on Slate`;
|
||||||
}
|
}
|
||||||
|
@ -218,13 +218,13 @@ export default class SceneSlate extends React.Component {
|
|||||||
}
|
}
|
||||||
if (file) {
|
if (file) {
|
||||||
title = `${file.name || file.filename}`;
|
title = `${file.name || file.filename}`;
|
||||||
description = file.data.body
|
description = file.body
|
||||||
? file.data.body
|
? file.body
|
||||||
: `View ${title}, a file in the collection ${name} on Slate`;
|
: `View ${title}, a file in the collection ${name} on Slate`;
|
||||||
image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit);
|
image = Utilities.getImageUrlIfExists(file, Constants.linkPreviewSizeLimit);
|
||||||
} else {
|
} else {
|
||||||
if (slate.data.body) {
|
if (slate.body) {
|
||||||
description = `${name}. ${slate.data.body}`;
|
description = `${name}. ${slate.body}`;
|
||||||
} else {
|
} else {
|
||||||
description = `View the collection ${name} on Slate`;
|
description = `View the collection ${name} on Slate`;
|
||||||
}
|
}
|
||||||
@ -402,8 +402,7 @@ class SlatePage extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { user, data } = this.props.data;
|
const { user, data, body } = this.props.data;
|
||||||
const { body = "", preview } = data;
|
|
||||||
let objects = this.props.data.objects;
|
let objects = this.props.data.objects;
|
||||||
const isPublic = this.props.data.isPublic;
|
const isPublic = this.props.data.isPublic;
|
||||||
const isOwner = this.props.viewer ? this.props.data.ownerId === this.props.viewer.id : false;
|
const isOwner = this.props.viewer ? this.props.data.ownerId === this.props.viewer.id : false;
|
||||||
|
@ -266,7 +266,7 @@ runScript();
|
|||||||
/*
|
/*
|
||||||
Users
|
Users
|
||||||
[
|
[
|
||||||
'data.name', -> 'name'
|
'data.name', -> 'name' MIGRATED
|
||||||
'data.body', -> 'body'
|
'data.body', -> 'body'
|
||||||
'data.photo', -> 'photo'
|
'data.photo', -> 'photo'
|
||||||
'data.status', -> 'hidePrivacyAlert'
|
'data.status', -> 'hidePrivacyAlert'
|
||||||
@ -281,14 +281,14 @@ Users
|
|||||||
|
|
||||||
Slates
|
Slates
|
||||||
[
|
[
|
||||||
'data.body', -> 'name'
|
'data.name', -> 'name' MIGRATED
|
||||||
'data.name', -> 'body'
|
'data.body', -> 'body'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
Files
|
Files
|
||||||
[
|
[
|
||||||
'data.name', -> 'name'
|
'data.name', -> 'name' MIGRATED
|
||||||
'data.size', -> 'size'
|
'data.size', -> 'size'
|
||||||
'data.type', -> 'type'
|
'data.type', -> 'type'
|
||||||
'data.blurhash', -> 'blurhash'
|
'data.blurhash', -> 'blurhash'
|
||||||
|
Loading…
Reference in New Issue
Block a user