mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 17:41:33 +03:00
publish: fix breakage from merge
This commit is contained in:
parent
ef7bb37f8f
commit
6264091148
@ -1,8 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/- *group
|
||||
=======
|
||||
/- *group, store=graph-store
|
||||
>>>>>>> release/next-userspace
|
||||
/+ resource
|
||||
^?
|
||||
|%
|
||||
@ -12,12 +8,6 @@
|
||||
$% [%group rid=resource]
|
||||
[%policy =policy]
|
||||
==
|
||||
<<<<<<< HEAD
|
||||
:: $app: An app that is associated to a graph-store mark
|
||||
::
|
||||
+$ app-name ?(%chat %publish %links)
|
||||
=======
|
||||
>>>>>>> release/next-userspace
|
||||
::
|
||||
:: $error: An error from a graph-view poke
|
||||
::
|
||||
@ -41,16 +31,6 @@
|
||||
rid=resource
|
||||
title=@t
|
||||
description=@t
|
||||
<<<<<<< HEAD
|
||||
app=app-name
|
||||
=associated
|
||||
==
|
||||
[%delete rid=resource]
|
||||
[%leave rid=resource]
|
||||
[%join rid=resource =ship app=app-name]
|
||||
::[%invite rid=resource ships=(set ship)]
|
||||
[%groupify rid=resource app=app-name to=(unit resource)]
|
||||
=======
|
||||
mark=(unit mark)
|
||||
=associated
|
||||
module=@t
|
||||
@ -61,7 +41,6 @@
|
||||
::[%invite rid=resource ships=(set ship)]
|
||||
[%groupify rid=resource to=(unit resource)]
|
||||
[%forward rid=resource =update:store]
|
||||
>>>>>>> release/next-userspace
|
||||
==
|
||||
--
|
||||
|
||||
|
@ -138,7 +138,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
}
|
||||
|
||||
addNodes(ship: Patp, name: string, nodes: Object) {
|
||||
this.hookAction(ship, {
|
||||
return this.hookAction(ship, {
|
||||
'add-nodes': {
|
||||
resource: { ship, name },
|
||||
nodes
|
||||
|
@ -39,7 +39,7 @@ export interface StoreState {
|
||||
permissions: Permissions;
|
||||
s3: S3State;
|
||||
graphs: Graphs;
|
||||
graphKeys: Set<String>;
|
||||
graphKeys: Set<string>;
|
||||
|
||||
|
||||
// App specific states
|
||||
|
@ -18,7 +18,7 @@ export type Serial = string;
|
||||
export type Jug<K,V> = Map<K,Set<V>>;
|
||||
|
||||
// name of app
|
||||
export type AppName = 'chat' | 'link' | 'contacts' | 'publish';
|
||||
export type AppName = 'chat' | 'link' | 'contacts' | 'publish' | 'graph';
|
||||
|
||||
export function getTagFromFrond<O>(frond: O): keyof O {
|
||||
const tags = Object.keys(frond) as Array<keyof O>;
|
||||
|
@ -71,13 +71,13 @@ export default function PublishApp(props: PublishAppProps) {
|
||||
? "sidebar"
|
||||
: "rightPanel";
|
||||
|
||||
const appAssociations = props.associations?.publish || {};
|
||||
const appAssociations = props.associations?.graph || {};
|
||||
const graphs = props.graphs || {}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet defer={false}>
|
||||
<title>{unreadTotal > 0 ? `(${unreadTotal}) ` : ""}OS1 - Publish</title>
|
||||
<Helmet>
|
||||
<title>OS1 - Publish</title>
|
||||
</Helmet>
|
||||
<Route
|
||||
path={[
|
||||
@ -88,7 +88,6 @@ export default function PublishApp(props: PublishAppProps) {
|
||||
]}
|
||||
>
|
||||
<RouterSkeleton
|
||||
popout={location.pathname.includes("popout/")}
|
||||
active={active}
|
||||
sidebarShown={sidebarShown}
|
||||
invites={invites}
|
||||
@ -97,6 +96,7 @@ export default function PublishApp(props: PublishAppProps) {
|
||||
associations={associations}
|
||||
contacts={contacts}
|
||||
api={api}
|
||||
graphKeys={props.graphKeys}
|
||||
>
|
||||
<Switch>
|
||||
<Route exact path="/~publish">
|
||||
@ -156,10 +156,10 @@ export default function PublishApp(props: PublishAppProps) {
|
||||
const notebookContacts =
|
||||
bookGroupPath in contacts ? contacts[bookGroupPath] : {};
|
||||
|
||||
const notebook = notebooks?.[ship]?.[book];
|
||||
const graph = graphs[`${ship.slice(1)}/${book}`];
|
||||
|
||||
return (
|
||||
<NotebookRoutes
|
||||
notebook={notebook}
|
||||
ship={ship}
|
||||
book={book}
|
||||
groups={groups}
|
||||
@ -168,12 +168,11 @@ export default function PublishApp(props: PublishAppProps) {
|
||||
association={association}
|
||||
associations={associations}
|
||||
graphs={graphs}
|
||||
sidebarShown={sidebarShown}
|
||||
api={api}
|
||||
hideNicknames={hideNicknames}
|
||||
hideAvatars={hideAvatars}
|
||||
remoteContentPolicy={remoteContentPolicy}
|
||||
associations={associations}
|
||||
graph={graph}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
@ -34,7 +34,7 @@ export function EditPost(props: EditPostProps & RouteComponentProps) {
|
||||
const nodes = editPost(newRev, noteId, title, body);
|
||||
await api.graph.addNodes(ship, book, nodes);
|
||||
await waiter(p => {
|
||||
const [rev] = getLatestRevision(note);
|
||||
const [rev] = getLatestRevision(p.note);
|
||||
return rev === newRev;
|
||||
});
|
||||
history.push(`/~publish/notebook/ship/${ship}/${book}/note/${noteId}`);
|
||||
|
@ -34,7 +34,7 @@ function NavigationItem(props: {
|
||||
function getAdjacentId(graph: Graph, child: number, backwards = false): number | null {
|
||||
const children = Array.from(graph);
|
||||
const i = children.findIndex(([index]) => index === child);
|
||||
const target = children[backwards ? i-1 : i+1];
|
||||
const target = children[backwards ? i+1 : i-1];
|
||||
return target?.[0] || null;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import { Groups } from "~/types/group-update";
|
||||
import { Contacts, Rolodex } from "~/types/contact-update";
|
||||
import GlobalApi from "~/logic/api/global";
|
||||
import styled from "styled-components";
|
||||
import { Associations } from "~/types";
|
||||
import { Associations, Graph, Association } from "~/types";
|
||||
import { deSig } from "~/logic/lib/util";
|
||||
|
||||
interface NotebookProps {
|
||||
@ -55,16 +55,18 @@ export class Notebook extends PureComponent<
|
||||
api,
|
||||
ship,
|
||||
book,
|
||||
notebook,
|
||||
notebookContacts,
|
||||
groups,
|
||||
history,
|
||||
hideNicknames,
|
||||
associations,
|
||||
association,
|
||||
graph
|
||||
} = this.props;
|
||||
const { state } = this;
|
||||
const { metadata } = association;
|
||||
|
||||
const group = groups[notebook?.["writers-group-path"]];
|
||||
const group = groups[association?.['group-path']];
|
||||
if (!group) return null; // Waitin on groups to populate
|
||||
|
||||
const contact = notebookContacts[ship];
|
||||
@ -75,8 +77,6 @@ export class Notebook extends PureComponent<
|
||||
const isWriter =
|
||||
isOwn || group.tags?.publish?.[`writers-${book}`]?.has(window.ship);
|
||||
|
||||
const notesList = notebook?.["notes-by-date"] || [];
|
||||
const notes = notebook?.notes || {};
|
||||
const showNickname = contact?.nickname && !hideNicknames;
|
||||
|
||||
return (
|
||||
@ -94,7 +94,7 @@ export class Notebook extends PureComponent<
|
||||
<Link to="/~publish">{"<- All Notebooks"}</Link>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text> {notebook?.title}</Text>
|
||||
<Text> {metadata?.title}</Text>
|
||||
<br />
|
||||
<Text color="lightGray">by </Text>
|
||||
<Text fontFamily={showNickname ? "sans" : "mono"}>
|
||||
@ -103,7 +103,7 @@ export class Notebook extends PureComponent<
|
||||
</Box>
|
||||
<Row justifyContent={["flex-start", "flex-end"]}>
|
||||
{isWriter && (
|
||||
<Link to={`/~publish/notebook/${ship}/${book}/new`}>
|
||||
<Link to={`/~publish/notebook/ship/${ship}/${book}/new`}>
|
||||
<Button primary>New Post</Button>
|
||||
</Link>
|
||||
)}
|
||||
@ -120,8 +120,8 @@ export class Notebook extends PureComponent<
|
||||
destructive
|
||||
onClick={() => {
|
||||
this.setState({ isUnsubscribing: true });
|
||||
api.publish
|
||||
.unsubscribeNotebook(deSig(ship), book)
|
||||
|
||||
api.graph.leaveGraph(ship, book)
|
||||
.then(() => {
|
||||
history.push("/~publish");
|
||||
})
|
||||
@ -168,8 +168,7 @@ export class Notebook extends PureComponent<
|
||||
</Tabs>
|
||||
{state.tab === "all" && (
|
||||
<NotebookPosts
|
||||
notes={notes}
|
||||
list={notesList}
|
||||
graph={graph}
|
||||
host={ship}
|
||||
book={book}
|
||||
contacts={notebookContacts}
|
||||
@ -178,16 +177,17 @@ export class Notebook extends PureComponent<
|
||||
)}
|
||||
{state.tab === "about" && (
|
||||
<Box mt="3" color="black">
|
||||
{notebook?.about}
|
||||
{metadata?.description}
|
||||
</Box>
|
||||
)}
|
||||
{state.tab === "subscribers" && (
|
||||
<Subscribers
|
||||
host={ship}
|
||||
book={book}
|
||||
notebook={notebook}
|
||||
api={api}
|
||||
groups={groups}
|
||||
associations={associations}
|
||||
association={association}
|
||||
contacts={{}}
|
||||
/>
|
||||
)}
|
||||
{state.tab === "settings" && (
|
||||
@ -195,9 +195,9 @@ export class Notebook extends PureComponent<
|
||||
host={ship}
|
||||
book={book}
|
||||
api={api}
|
||||
notebook={notebook}
|
||||
contacts={notebookContacts}
|
||||
associations={associations}
|
||||
association={association}
|
||||
groups={groups}
|
||||
/>
|
||||
)}
|
||||
|
@ -25,14 +25,14 @@ export function Sidebar(props: any) {
|
||||
? alphabetiseAssociations(props.associations.contacts)
|
||||
: {};
|
||||
const appAssociations =
|
||||
props.associations && "publish" in props.associations
|
||||
? props.associations.publish
|
||||
props.associations && "graph" in props.associations
|
||||
? props.associations.graph
|
||||
: {};
|
||||
|
||||
const groups = props.groups || {};
|
||||
|
||||
const groupedItems = _.chain(props.graphs)
|
||||
.reduce((acc, g, path) => {
|
||||
const groupedItems = _.chain(Array.from(props.graphKeys))
|
||||
.reduce((acc, path) => {
|
||||
const appPath = `/ship/~${path}`;
|
||||
return appPath in appAssociations
|
||||
? [...acc, appAssociations[appPath]]
|
||||
|
@ -30,6 +30,7 @@ export default function NewPost(props: NewPostProps & RouteComponentProps) {
|
||||
try {
|
||||
const [noteId, nodes] = newPost(title, body)
|
||||
await api.graph.addNodes(ship, book, nodes)
|
||||
await waiter(p => p.graph.has(noteId));
|
||||
history.push(`/~publish/notebook/ship/${ship}/${book}/note/${noteId}`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
@ -44,16 +44,16 @@ export function NewScreen(props: NewScreenProps & RouteComponentProps) {
|
||||
bookId,
|
||||
name,
|
||||
description,
|
||||
group,
|
||||
"publish",
|
||||
group
|
||||
);
|
||||
} else {
|
||||
await props.api.graph.createUnmanagedGraph(
|
||||
bookId,
|
||||
name,
|
||||
description,
|
||||
{ open: { banned: [], banRanks: [] } },
|
||||
"publish",
|
||||
{ open: { banned: [], banRanks: [] } }
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ type SkeletonProps = RouteComponentProps<{
|
||||
associations: Associations;
|
||||
contacts: Rolodex;
|
||||
graphs: Graphs;
|
||||
graphKeys: Set<string>;
|
||||
api: GlobalApi;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
@ -90,6 +91,7 @@ export function Skeleton(props: SkeletonProps) {
|
||||
<Sidebar
|
||||
notebooks={props.notebooks}
|
||||
graphs={props.graphs}
|
||||
graphKeys={props.graphKeys}
|
||||
contacts={props.contacts}
|
||||
path={path}
|
||||
hidden={hideSidebar}
|
||||
|
Loading…
Reference in New Issue
Block a user