hide new post button when we don't have permission to post

This commit is contained in:
Isaac Visintainer 2019-07-09 12:57:22 -07:00
parent 9f126122de
commit 2fea43b568
3 changed files with 13 additions and 5 deletions

View File

@ -143,9 +143,11 @@ export class Blog extends Component {
if (this.state.awaiting) {
return null;
} else {
let create = (this.props.ship === window.ship);
return (
<div>
<PathControl pathData={data.pathData}/>
<PC pathData={data.pathData} create={create}/>
<div className="absolute"
style={{top:124, marginLeft: 16, marginRight: 16, marginTop: 32}}>
<div className="flex-col">

View File

@ -10,6 +10,7 @@ const PC = withRouter(PublishCreate);
export class PathControl extends Component {
constructor(props){
super(props);
}
buildPathData(){
@ -84,8 +85,11 @@ export class PathControl extends Component {
}
});
let create = ((window.location.pathname == '/~publish/new-blog') ||
(window.location.pathname == '/~publish/new-post'))
console.log("props", this.props);
let create = ((window.location.pathname === '/~publish/new-blog') ||
(window.location.pathname === '/~publish/new-post')) ||
(this.props.create === false)
? false
: 'post';

View File

@ -379,9 +379,10 @@ export class Post extends Component {
let date = moment(this.state.post.info["date-created"]).fromNow();
let authorDate = `${this.state.post.info.creator}${date}`;
let create = (this.props.ship === window.ship);
return (
<div>
<PathControl pathData={this.state.pathData}/>
<PathControl pathData={this.state.pathData} create={create}/>
<div className="absolute w-100" style={{top:124}}>
<div className="mw-688 center mt4 flex-col" style={{flexBasis: 688}}>
<Link to={blogLink}>
@ -429,9 +430,10 @@ export class Post extends Component {
let date = moment(this.state.post.info["date-created"]).fromNow();
let authorDate = `${this.state.post.info.creator}${date}`;
let create = (this.props.ship === window.ship);
return (
<div>
<PathControl pathData={this.state.pathData}/>
<PathControl pathData={this.state.pathData} create={create}/>
<div className="absolute w-100" style={{top:124}}>
<div className="mw-688 center mt4 flex-col" style={{flexBasis: 688}}>
<Link to={blogLink}>