Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.20.0 - put auto issued notices into NotRemind #789

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lyrebird/checker/event.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inspect
from lyrebird import application
from .. import checker

Expand All @@ -21,10 +22,21 @@ def issue(self, title, message):
"title": title,
"message": message
}
self.check_notice(notice)
application.server['event'].publish('notice', notice)

def publish(self, channel, message, *args, **kwargs):
if channel == 'notice':
self.check_notice(message)
application.server['event'].publish(channel, message, *args, **kwargs)

def check_notice(self, notice):
stack = inspect.stack()
script_path = stack[2].filename
script_name = script_path[script_path.rfind('/') + 1:]
if script_name in application.config.get('event.notice.autoissue.checker', []):
notice['title'] = f"【Extension】{notice.get('title')}"
notice['alert'] = False

@staticmethod
def register(func_info):
Expand Down
3 changes: 2 additions & 1 deletion lyrebird/notice_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def new_notice(self, msg):

"""
unique_key = msg.get('title')
alert = msg.get('alert', True)
if self.notice_hashmap.get(unique_key):
self.notice_hashmap[unique_key]['noticeList'].append(msg)
if self.notice_hashmap[unique_key].get('alert'):
Expand All @@ -86,7 +87,7 @@ def new_notice(self, msg):
self.notice_hashmap.update(
{
unique_key: {
'alert': True,
'alert': alert,
'noticeList': [msg]
}
}
Expand Down
2 changes: 1 addition & 1 deletion lyrebird/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
IVERSION = (2, 19, 2)
IVERSION = (2, 20, 0)
VERSION = ".".join(str(i) for i in IVERSION)
LYREBIRD = "Lyrebird " + VERSION
Loading