mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-25 18:13:10 +03:00
search websocket reconnect and private slate internal fix
This commit is contained in:
parent
ca4b3bbb49
commit
2f36713692
@ -168,7 +168,7 @@ export default class ApplicationPage extends React.Component {
|
|||||||
if (!page || !page.id) {
|
if (!page || !page.id) {
|
||||||
page = { id: "NAV_DATA", scrollTop: 0, data: null };
|
page = { id: "NAV_DATA", scrollTop: 0, data: null };
|
||||||
}
|
}
|
||||||
if (page.id === "NAV_SLATE" && this.state.data?.data?.ownerId === this.props.viewer.id) {
|
if (page.id === "NAV_SLATE" && this.state.data?.data?.ownerId === this.state.viewer.id) {
|
||||||
let data = this.state.data;
|
let data = this.state.data;
|
||||||
for (let slate of newViewerState.slates) {
|
for (let slate of newViewerState.slates) {
|
||||||
if (slate.id === data.id) {
|
if (slate.id === data.id) {
|
||||||
@ -262,7 +262,7 @@ export default class ApplicationPage extends React.Component {
|
|||||||
let slate = null;
|
let slate = null;
|
||||||
if (
|
if (
|
||||||
current.target.id === "NAV_SLATE" &&
|
current.target.id === "NAV_SLATE" &&
|
||||||
this.state.data?.data?.ownerId === this.props.viewer?.id
|
this.state.data?.data?.ownerId === this.state.viewer?.id
|
||||||
) {
|
) {
|
||||||
slate = this.state.data;
|
slate = this.state.data;
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,9 @@ const websocketSend = async (type, data) => {
|
|||||||
|
|
||||||
const ws = Websocket.get();
|
const ws = Websocket.get();
|
||||||
if (!ws) {
|
if (!ws) {
|
||||||
NodeLogging.error(`Can not find websocket ...`);
|
console.log("no websocket. creating now...");
|
||||||
return;
|
ws = Websocket.create();
|
||||||
|
await Window.delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const encryptedData = await Utilities.encryptWithSecret(
|
const encryptedData = await Utilities.encryptWithSecret(
|
||||||
|
@ -20,6 +20,13 @@ export default async (req, res) => {
|
|||||||
}
|
}
|
||||||
slate = Serializers.slate(slate);
|
slate = Serializers.slate(slate);
|
||||||
|
|
||||||
|
if (!slate.data.public && slate.data.ownerId !== req.body.data.id) {
|
||||||
|
return res.status(403).send({
|
||||||
|
decorator: "SLATE_PRIVATE_ACCESS_DENIED",
|
||||||
|
error: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let user = await Data.getUserById({ id: slate.data.ownerId });
|
let user = await Data.getUserById({ id: slate.data.ownerId });
|
||||||
if (!user || user.error) {
|
if (!user || user.error) {
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
|
@ -57,6 +57,7 @@ const STYLES_MOBILE_ONLY = css`
|
|||||||
export default class SceneSlate extends React.Component {
|
export default class SceneSlate extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
notFound: false,
|
notFound: false,
|
||||||
|
accessDenied: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
@ -119,6 +120,10 @@ export default class SceneSlate extends React.Component {
|
|||||||
if (query) {
|
if (query) {
|
||||||
response = await Actions.getSerializedSlate(query);
|
response = await Actions.getSerializedSlate(query);
|
||||||
}
|
}
|
||||||
|
if (response?.decorator == "SLATE_PRIVATE_ACCESS_DENIED") {
|
||||||
|
this.setState({ accessDenied: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Events.hasError(response)) {
|
if (Events.hasError(response)) {
|
||||||
this.setState({ notFound: true });
|
this.setState({ notFound: true });
|
||||||
return;
|
return;
|
||||||
@ -161,12 +166,16 @@ export default class SceneSlate extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.notFound) {
|
if (this.state.notFound || this.state.accessDenied) {
|
||||||
return (
|
return (
|
||||||
<ScenePage>
|
<ScenePage>
|
||||||
<EmptyState>
|
<EmptyState>
|
||||||
<SVG.Layers height="24px" style={{ marginBottom: 24 }} />
|
<SVG.Layers height="24px" style={{ marginBottom: 24 }} />
|
||||||
<div>We were unable to locate that slate</div>
|
<div>
|
||||||
|
{this.state.accessDenied
|
||||||
|
? "You do not have access to that slate"
|
||||||
|
: "We were unable to locate that slate"}
|
||||||
|
</div>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
</ScenePage>
|
</ScenePage>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user