1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

feat: change favicon after notification read all

This commit is contained in:
liuhongbo
2024-03-01 15:22:47 +08:00
parent 0cadfc88dc
commit fb17628cc8
2 changed files with 13 additions and 1 deletions

View File

@@ -18,7 +18,8 @@ const propTypes = {
dirPath: PropTypes.string.isRequired, dirPath: PropTypes.string.isRequired,
toggleStar: PropTypes.func.isRequired, toggleStar: PropTypes.func.isRequired,
unmarkDraft: PropTypes.func.isRequired, unmarkDraft: PropTypes.func.isRequired,
onNewNotification: PropTypes.func.isRequired onNewNotification: PropTypes.func.isRequired,
onNotificationCleared: PropTypes.func.isRequired
}; };
class ExternalOperations extends React.Component { class ExternalOperations extends React.Component {
@@ -43,6 +44,7 @@ class ExternalOperations extends React.Component {
this.unsubscribeFreezeDocument = eventBus.subscribe(EXTERNAL_EVENT.FREEZE_DOCUMENT, this.onFreezeDocument); this.unsubscribeFreezeDocument = eventBus.subscribe(EXTERNAL_EVENT.FREEZE_DOCUMENT, this.onFreezeDocument);
this.unsubscribeUnfreeze = eventBus.subscribe(EXTERNAL_EVENT.UNFREEZE, this.unFreeze); this.unsubscribeUnfreeze = eventBus.subscribe(EXTERNAL_EVENT.UNFREEZE, this.unFreeze);
this.unsubscribeNewNotification = eventBus.subscribe(EXTERNAL_EVENT.NEW_NOTIFICATION, this.onNewNotification); this.unsubscribeNewNotification = eventBus.subscribe(EXTERNAL_EVENT.NEW_NOTIFICATION, this.onNewNotification);
this.unsubscribeClearNotification = eventBus.subscribe(EXTERNAL_EVENT.CLEAR_NOTIFICATION, this.onNotificationCleared);
this.unsubscribeCreateSdocFile = eventBus.subscribe(EXTERNAL_EVENT.CREATE_SDOC_FILE, this.onCreateSdocFile); this.unsubscribeCreateSdocFile = eventBus.subscribe(EXTERNAL_EVENT.CREATE_SDOC_FILE, this.onCreateSdocFile);
} }
@@ -55,6 +57,7 @@ class ExternalOperations extends React.Component {
this.unsubscribeUnfreeze(); this.unsubscribeUnfreeze();
this.unsubscribeNewNotification(); this.unsubscribeNewNotification();
this.unsubscribeCreateSdocFile(); this.unsubscribeCreateSdocFile();
this.unsubscribeClearNotification();
} }
onInternalLinkToggle = (options) => { onInternalLinkToggle = (options) => {
@@ -123,6 +126,10 @@ class ExternalOperations extends React.Component {
this.props.onNewNotification(); this.props.onNewNotification();
}; };
onNotificationCleared = () => {
this.props.onNotificationCleared();
};
onCreateSdocFile = (params) => { onCreateSdocFile = (params) => {
if (params?.newFileName) { if (params?.newFileName) {
this.setState({fileType: `${params.newFileName}.sdoc`}); this.setState({fileType: `${params.newFileName}.sdoc`});

View File

@@ -43,6 +43,10 @@ export default class SdocEditor extends React.Component {
this.onSetFavicon('_notification'); this.onSetFavicon('_notification');
}; };
onNotificationCleared = () => {
this.onSetFavicon();
};
getDirPath = () => { getDirPath = () => {
const { docPath } = window.seafile; const { docPath } = window.seafile;
const index = docPath.lastIndexOf('/'); const index = docPath.lastIndexOf('/');
@@ -87,6 +91,7 @@ export default class SdocEditor extends React.Component {
toggleStar={this.toggleStar} toggleStar={this.toggleStar}
unmarkDraft={this.unmarkDraft} unmarkDraft={this.unmarkDraft}
onNewNotification={this.onNewNotification} onNewNotification={this.onNewNotification}
onNotificationCleared={this.onNotificationCleared}
/> />
</Fragment> </Fragment>
); );