mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 22:03:50 +03:00
publish: hide relevant inputs if we are missing permissions
This commit is contained in:
parent
fdf80d8eda
commit
4577df379d
1296
pkg/interface/package-lock.json
generated
1296
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ export function Note(props: NoteProps & RouteComponentProps) {
|
||||
|
||||
|
||||
let adminLinks: JSX.Element | null = null;
|
||||
if (window.ship === note?.post?.author) {
|
||||
if (true || window.ship === note?.post?.author) {
|
||||
adminLinks = (
|
||||
<Box display="inline-block" verticalAlign="middle">
|
||||
<Link to={`${baseUrl}/edit`}>
|
||||
|
@ -1,9 +1,10 @@
|
||||
import React from "react";
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
import { RouteComponentProps, Link } from "react-router-dom";
|
||||
import { NotebookPosts } from "./NotebookPosts";
|
||||
import { Col } from "@tlon/indigo-react";
|
||||
import { Col, Box, Text, Button, Row } from "@tlon/indigo-react";
|
||||
import GlobalApi from "~/logic/api/global";
|
||||
import { Contacts, Rolodex, Groups, Associations, Graph, Association, Unreads } from "~/types";
|
||||
import { useShowNickname } from "~/logic/lib/util";
|
||||
|
||||
interface NotebookProps {
|
||||
api: GlobalApi;
|
||||
@ -35,8 +36,27 @@ export function Notebook(props: NotebookProps & RouteComponentProps) {
|
||||
return null; // Waiting on groups to populate
|
||||
}
|
||||
|
||||
|
||||
const relativePath = (p: string) => props.baseUrl + p;
|
||||
|
||||
const contact = notebookContacts?.[ship];
|
||||
const isOwn = `~${window.ship}` === ship;
|
||||
console.log(association.resource);
|
||||
|
||||
const showNickname = useShowNickname(contact);
|
||||
|
||||
return (
|
||||
<Col gapY="4" pt={4} mx="auto" px={3} maxWidth="768px">
|
||||
<Row justifyContent="space-between">
|
||||
<Box>
|
||||
<Text display='block'>{association.metadata?.title}</Text>
|
||||
<Text color="lightGray">by </Text>
|
||||
<Text fontFamily={showNickname ? 'sans' : 'mono'}>
|
||||
{showNickname ? contact?.nickname : ship}
|
||||
</Text>
|
||||
</Box>
|
||||
</Row>
|
||||
<Box borderBottom="1" borderBottomColor="washedGray" />
|
||||
<NotebookPosts
|
||||
graph={graph}
|
||||
host={ship}
|
||||
|
@ -18,7 +18,7 @@ export class Writers extends Component {
|
||||
const ships = values.ships.map(e => `~${e}`);
|
||||
await api.groups.addTag(
|
||||
resource,
|
||||
{ app: 'publish', tag: `writers-${name}` },
|
||||
{ app: 'graph', resource: association.resource, tag: `writers` },
|
||||
ships
|
||||
);
|
||||
actions.resetForm();
|
||||
@ -28,7 +28,8 @@ export class Writers extends Component {
|
||||
actions.setStatus({ error: e.message });
|
||||
}
|
||||
};
|
||||
const writers = Array.from(groups?.[association?.group]?.tags.publish?.[`writers-${name}`] || new Set()).map(e => cite(`~${e}`)).join(', ');
|
||||
const writers = Array.from(groups?.[association?.group]?.tags.graph[association.resource]?.writers || []).map(s => `~${s}`).join(', ');
|
||||
|
||||
|
||||
return (
|
||||
<Box maxWidth='512px'>
|
||||
@ -51,10 +52,14 @@ export class Writers extends Component {
|
||||
</AsyncButton>
|
||||
</Form>
|
||||
</Formik>
|
||||
{writers.length > 0 && <>
|
||||
{writers.length > 0 ? <>
|
||||
<Text display='block' mt='2'>Current writers:</Text>
|
||||
<Text mt='2' display='block' mono>{writers}</Text>
|
||||
</>}
|
||||
</> :
|
||||
<Text display='block' mt='2'>
|
||||
All group members can write to this channel
|
||||
</Text>
|
||||
}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ 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));
|
||||
await waiter(p =>
|
||||
p.graph.has(noteId) && !p.graph.get(noteId)?.post?.pending
|
||||
);
|
||||
history.push(`${props.baseUrl}/note/${noteId}`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
Loading…
Reference in New Issue
Block a user