added new post button for all members of the notebook writers group

This commit is contained in:
Isaac Visintainer 2020-02-07 11:37:02 -08:00
parent 3e308fe15b
commit 7a64615cf7
2 changed files with 11 additions and 5 deletions

View File

@ -59,6 +59,7 @@ export class Notebook extends Component {
render() { render() {
let notebook = this.props.notebooks[this.props.ship][this.props.book]; let notebook = this.props.notebooks[this.props.ship][this.props.book];
let tabStyles = { let tabStyles = {
posts: "bb b--gray4 gray2 pv4 ph2", posts: "bb b--gray4 gray2 pv4 ph2",
about: "bb b--gray4 gray2 pv4 ph2" about: "bb b--gray4 gray2 pv4 ph2"
@ -96,15 +97,19 @@ export class Notebook extends Component {
let settings = base + '/settings'; let settings = base + '/settings';
let newUrl = base + '/new'; let newUrl = base + '/new';
let newPost = !(window.ship === this.props.ship.slice(1)) let newPost = null;
// XX TODO check based on authorized writers instead if (notebook["writers-group-path"] in this.props.groups){
? null let writers = notebook["writers-group-path"];
: <Link to={newUrl} className="NotebookButton bg-light-green green2"> if (this.props.groups[writers].has(window.ship)) {
newPost =
<Link to={newUrl} className="NotebookButton bg-light-green green2">
New Post New Post
</Link> </Link>
}
}
let unsub = (window.ship === this.props.ship.slice(1)) let unsub = (window.ship === this.props.ship.slice(1))
? null ? null
: <button onClick={this.unsubscribe} : <button onClick={this.unsubscribe}
className="NotebookButton bg-white black ba b--black ml3"> className="NotebookButton bg-white black ba b--black ml3">
Unsubscribe Unsubscribe

View File

@ -123,6 +123,7 @@ export class Root extends Component {
view={view} view={view}
ship={ship} ship={ship}
book={notebook} book={notebook}
groups={state.groups}
{...props} {...props}
/> />
</Skeleton> </Skeleton>