1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Merge pull request #2713 from haiwen/bug-repair

Bug repair
This commit is contained in:
Daniel Pan
2018-12-25 21:06:04 +08:00
committed by GitHub
3 changed files with 36 additions and 28 deletions

View File

@@ -7,21 +7,27 @@ class Notification extends React.Component {
super(props);
this.state = {
showNotice: false,
notice_html: ''
notice_html: '',
unseenCount: 0,
};
}
onClick = () => {
this.setState({
showNotice: !this.state.showNotice
componentDidMount() {
seafileAPI.getUnseenNotificationCount().then(res => {
this.setState({unseenCount: res.data.unseen_count});
});
if (!this.state.showNotice) {
this.loadNotices();
}
onClick = () => {
if (this.state.showNotice) {
seafileAPI.updateNotifications();
this.setState({
showNotice: false,
unseenCount: 0
})
} else {
this.loadNotices();
this.setState({showNotice: true});
}
}
@@ -40,7 +46,7 @@ class Notification extends React.Component {
<div id="notifications">
<a href="#" onClick={this.onClick} className="no-deco" id="notice-icon" title="Notifications" aria-label="Notifications">
<span className="sf2-icon-bell"></span>
<span className="num hide">0</span>
<span className={`num ${this.state.unseenCount ? '' : 'hide'}`}>{this.state.unseenCount}</span>
</a>
<div id="notice-popover" className={`sf-popover ${this.state.showNotice ? '': 'hide'}`}>
<div className="outer-caret up-outer-caret"><div className="inner-caret"></div></div>

View File

@@ -195,7 +195,7 @@ class FilesActivities extends Component {
this.setState({
loading: false,
items: res.data.events,
has_more: res.data.events.length == '0' ? false : true
has_more: res.data.events.length < 25 ? false : true
});
}
});
@@ -203,11 +203,8 @@ class FilesActivities extends Component {
getMore() {
const pageNum = this.state.page + 1;
this.setState({
page: pageNum
});
seafileAPI.listActivities(pageNum)
.then(res => {
this.setState({page: pageNum});
seafileAPI.listActivities(pageNum).then(res => {
if (res.status == 403) {
this.setState({
loading: false,
@@ -218,7 +215,7 @@ class FilesActivities extends Component {
this.setState({
loading: false,
items: [...this.state.items, ...res.data.events],
has_more: res.data.events.length == '0' ? false : true
has_more: res.data.events.length < 25 ? false : true
});
}
});

View File

@@ -685,6 +685,11 @@ a.op-icon:focus {
top: 5px;
}
#notice-popover .sf-popover-hd {
border-bottom: 1px solid #dfdfe1;
margin: 0 10px;
}
/**** sf-popover ****/ /* e.g. top notice popup, group members popup */
.sf-popover-container {