mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
refactor code (#2513)
This commit is contained in:
@@ -40,7 +40,7 @@ class ReviewListView extends React.Component {
|
||||
className={classnames({ active: this.state.activeTab === 'open' })}
|
||||
onClick={() => { this.toggle('open');}}
|
||||
>
|
||||
Open
|
||||
{gettext('Open')}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
<NavItem>
|
||||
@@ -48,7 +48,7 @@ class ReviewListView extends React.Component {
|
||||
className={classnames({ active: this.state.activeTab === 'finished' })}
|
||||
onClick={() => { this.toggle('finished');}}
|
||||
>
|
||||
Published
|
||||
{gettext('Published')}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
<NavItem>
|
||||
@@ -56,7 +56,7 @@ class ReviewListView extends React.Component {
|
||||
className={classnames({ active: this.state.activeTab === 'closed' })}
|
||||
onClick={() => { this.toggle('closed');}}
|
||||
>
|
||||
Closed
|
||||
{gettext('Closed')}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
</Nav>
|
||||
|
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
|
||||
/* eslint-disable */
|
||||
import Prism from 'prismjs';
|
||||
/* eslint-enable */
|
||||
import { siteRoot, gettext, draftID, reviewID, draftOriginFilePath, draftFilePath, draftOriginRepoID, draftFileName, opStatus, publishFileVersion, originFileVersion } from './utils/constants';
|
||||
import { siteRoot, gettext, draftID, reviewID, draftOriginFilePath, draftFilePath, draftOriginRepoID, draftFileName, opStatus, publishFileVersion, originFileVersion, author, authorAvatar } from './utils/constants';
|
||||
import { seafileAPI } from './utils/seafile-api';
|
||||
import axios from 'axios';
|
||||
import DiffViewer from '@seafile/seafile-editor/dist/viewer/diff-viewer';
|
||||
@@ -41,8 +41,6 @@ class DraftReview extends React.Component {
|
||||
showReviewerDialog: false,
|
||||
reviewers: [],
|
||||
};
|
||||
this.authorName = '';
|
||||
this.authorAvatar = '';
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -164,13 +162,6 @@ class DraftReview extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
getAuthorInfo = () => {
|
||||
seafileAPI.getAccountInfo().then((res) => {
|
||||
this.authorName = res.data.name;
|
||||
this.authorAvatar = res.data.avatar_url;
|
||||
});
|
||||
}
|
||||
|
||||
listReviewers = () => {
|
||||
seafileAPI.listReviewers(reviewID).then((res) => {
|
||||
this.setState({
|
||||
@@ -181,7 +172,6 @@ class DraftReview extends React.Component {
|
||||
|
||||
componentWillMount() {
|
||||
this.getCommentsNumber();
|
||||
this.getAuthorInfo();
|
||||
this.listReviewers();
|
||||
}
|
||||
|
||||
@@ -299,8 +289,8 @@ class DraftReview extends React.Component {
|
||||
<div className="review-side-panel-header">{gettext('Author')}</div>
|
||||
</div>
|
||||
<div className="author-info">
|
||||
<img className="avatar author-avatar" src={this.authorAvatar} alt=""/>
|
||||
<span className="author-name">{this.authorName}</span>
|
||||
<img className="avatar author-avatar" src={authorAvatar} alt=""/>
|
||||
<span className="author-name">{author}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -44,3 +44,5 @@ export const opStatus = window.draftReview ? window.draftReview.config.opStatus
|
||||
export const reviewPerm = window.draftReview ? window.draftReview.config.perm : '';
|
||||
export const publishFileVersion = window.draftReview ? window.draftReview.config.publishFileVersion : '';
|
||||
export const originFileVersion = window.draftReview ? window.draftReview.config.originFileVersion : '';
|
||||
export const author = window.draftReview ? window.draftReview.config.author : '';
|
||||
export const authorAvatar = window.draftReview ? window.draftReview.config.authorAvatar : '';
|
||||
|
Reference in New Issue
Block a user