Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
孙永强 committed Dec 24, 2024
1 parent 8d6c5b6 commit fb08ab8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/dialog/publish-wiki-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PublishWikiDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
url: this.props.customUrl,
url: this.props.customUrlString,
errMessage: '',
isSubmitBtnActive: false,
};
Expand Down Expand Up @@ -129,7 +129,7 @@ class PublishWikiDialog extends React.Component {
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
</ModalBody>
<ModalFooter>
{this.props.customUrl !== '' &&
{this.props.customUrlString !== '' &&
<Button color="secondary" onClick={this.deleteCustomUrl}>{gettext('Unpublish')}</Button>
}
<Button color="primary" onClick={this.handleSubmit} disabled={!this.state.isSubmitBtnActive}>{gettext('Submit')}</Button>
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/wiki-card-view/wiki-card-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class WikiCardItem extends Component {
isShowShareDialog: false,
isShowPublishDialog: false,
isShowConvertDialog: false,
customUrl: this.props.wiki.url_string,
customUrlString: this.props.wiki.url_string,
};
}

Expand Down Expand Up @@ -73,7 +73,7 @@ class WikiCardItem extends Component {
};
handleCustomUrl = (url) => {
this.setState({
customUrl: url,
customUrlString: url,
});
};

Expand Down Expand Up @@ -111,7 +111,7 @@ class WikiCardItem extends Component {
const publish_url = url.substring(urlIndex + '/publish/'.length);
wikiAPI.publishWiki(this.props.wiki.id, publish_url).then((res) => {
const { publish_url } = res.data;
this.setState({ customUrl: publish_url });
this.setState({ customUrlString: publish_url });
toaster.success(gettext('Wiki published'));
}).catch((error) => {
if (error.response) {
Expand All @@ -125,7 +125,7 @@ class WikiCardItem extends Component {
wikiAPI.getPublishWikiLink(this.props.wiki.id).then((res) => {
const { publish_url } = res.data;
this.setState({
customUrl: publish_url,
customUrlString: publish_url,
isShowPublishDialog: !this.state.isShowPublishDialog,
});
}).catch((error) => {
Expand Down Expand Up @@ -279,7 +279,7 @@ class WikiCardItem extends Component {
</div>
<div className="wiki-item-bottom">
{dayjs(wiki.updated_at).fromNow()}
{this.state.customUrl && (<span>{gettext('Published')}</span>)}
{this.state.customUrlString && (<span>{gettext('Published')}</span>)}
</div>
</div>
{this.state.isShowDeleteDialog &&
Expand Down Expand Up @@ -351,7 +351,7 @@ class WikiCardItem extends Component {
handleCustomUrl={this.handleCustomUrl}
onPublish={this.publishWiki}
wiki={wiki}
customUrl={this.state.customUrl}
customUrlString={this.state.customUrlString}
/>
</ModalPortal>
}
Expand Down

0 comments on commit fb08ab8

Please sign in to comment.