mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
add notification (#2353)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
let slug, repoID, serviceUrl, initialFilePath;
|
||||
|
||||
export const dirPath = '/';
|
||||
export const gettext = window.gettext;
|
||||
|
||||
@@ -9,7 +11,11 @@ export const siteTitle = window.app.config.siteTitle;
|
||||
export const logoWidth = window.app.config.logoWidth;
|
||||
export const logoHeight = window.app.config.logoHeight;
|
||||
|
||||
export const slug = window.wiki.config.slug;
|
||||
export const repoID = window.wiki.config.repoId;
|
||||
export const serviceUrl = window.wiki.config.serviceUrl;
|
||||
export const initialFilePath = window.wiki.config.initial_file_path;
|
||||
if (window.wiki) {
|
||||
slug = window.wiki.config.slug;
|
||||
repoID = window.wiki.config.repoId;
|
||||
serviceUrl = window.wiki.config.serviceUrl;
|
||||
initialFilePath = window.wiki.config.initial_file_path;
|
||||
}
|
||||
|
||||
export { slug, repoID, serviceUrl, initialFilePath }
|
||||
|
@@ -175,7 +175,7 @@ class FilesActivities extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
const pageNum = 1
|
||||
this.props.seafileAPI.getActivities(pageNum)
|
||||
this.props.seafileAPI.listActivities(pageNum)
|
||||
.then(res => {
|
||||
// not logged in
|
||||
if (res.status == 403) {
|
||||
|
@@ -32,7 +32,7 @@ class MainSideNav extends React.Component {
|
||||
|
||||
loadGroups = () => {
|
||||
let _this = this;
|
||||
this.props.seafileAPI.getGroups().then(res =>{
|
||||
this.props.seafileAPI.listGroups().then(res =>{
|
||||
let data = res.data.groups;
|
||||
this.groupsHeight = (data.length + 1) * _this.listHeight;
|
||||
_this.setState({
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
const gettext = window.gettext;
|
||||
|
||||
class Notification extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@@ -14,13 +15,18 @@ class Notification extends React.Component {
|
||||
this.setState({
|
||||
showNotice: !this.state.showNotice
|
||||
})
|
||||
|
||||
if (!this.state.showNotice) {
|
||||
this.loadNotices()
|
||||
}
|
||||
|
||||
if (this.state.showNotice) {
|
||||
this.props.seafileAPI.updateNotifications()
|
||||
}
|
||||
}
|
||||
|
||||
loadNotices = () => {
|
||||
this.props.seafileAPI.getPopupNotices().then(res => {
|
||||
this.props.seafileAPI.listPopupNotices().then(res => {
|
||||
this.setState({
|
||||
notice_html: res.data.notice_html
|
||||
})
|
||||
@@ -28,6 +34,8 @@ class Notification extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { notice_html } = this.state;
|
||||
|
||||
return (
|
||||
<div id="notifications">
|
||||
<a href="#" onClick={this.onClick} className="no-deco" id="notice-icon" title="Notifications" aria-label="Notifications">
|
||||
@@ -41,7 +49,8 @@ class Notification extends React.Component {
|
||||
<a href="#" onClick={this.onClick} title={gettext('Close')} aria-label={gettext('Close')} className="sf-popover-close js-close sf2-icon-x1 op-icon float-right"></a>
|
||||
</div>
|
||||
<div className="sf-popover-con">
|
||||
<ul className="notice-list" dangerouslySetInnerHTML={{__html: this.state.notice_html}}></ul>
|
||||
<ul className="notice-list" dangerouslySetInnerHTML={{__html: notice_html}}>
|
||||
</ul>
|
||||
<a href="/notification/list/" className="view-all">{gettext('See All Notifications')}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -6,7 +6,7 @@ import MainPanel from './pages/dashboard/main-panel';
|
||||
import Account from './components/account';
|
||||
import Notification from './components/notification';
|
||||
|
||||
import { SeafileAPI } from './seafile-api';
|
||||
import { SeafileAPI } from 'seafile-js';
|
||||
import cookie from 'react-cookies';
|
||||
|
||||
import 'seafile-ui';
|
||||
@@ -15,7 +15,7 @@ import './css/dashboard.css';
|
||||
const siteRoot = window.app.config.siteRoot;
|
||||
|
||||
let seafileAPI = new SeafileAPI();
|
||||
let xcsrfHeaders = cookie.load('csrftoken');
|
||||
let xcsrfHeaders = cookie.load('sfcsrftoken');
|
||||
seafileAPI.initForSeahubUsage({ siteRoot, xcsrfHeaders });
|
||||
|
||||
class DashBoard extends Component {
|
||||
|
Reference in New Issue
Block a user