fix: 修复授权过期通知bug (#8404)

Co-authored-by: feng626 <1304903146@qq.com>
pull/8407/head
fit2bot 2022-06-15 15:01:56 +08:00 committed by GitHub
parent 2414f34a5a
commit e0a2d03f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -12,13 +12,13 @@ class PermedAssetsWillExpireUserMsg(UserMessage):
def __init__(self, user, assets, day_count=0): def __init__(self, user, assets, day_count=0):
super().__init__(user) super().__init__(user)
self.assets = assets self.assets = assets
self.count = day_count self.day_count = day_count
def get_html_msg(self) -> dict: def get_html_msg(self) -> dict:
subject = _("You permed assets is about to expire") subject = _("You permed assets is about to expire")
context = { context = {
'name': self.user.name, 'name': self.user.name,
'day_count': self.day_count, 'count': self.day_count,
'items': [str(asset) for asset in self.assets], 'items': [str(asset) for asset in self.assets],
'item_type': _("permed assets"), 'item_type': _("permed assets"),
'show_help': True 'show_help': True
@ -44,7 +44,7 @@ class AssetPermsWillExpireForOrgAdminMsg(UserMessage):
super().__init__(user) super().__init__(user)
self.perms = perms self.perms = perms
self.org = org self.org = org
self.count = day_count self.day_count = day_count
def get_items_with_url(self): def get_items_with_url(self):
items_with_url = [] items_with_url = []
@ -62,7 +62,7 @@ class AssetPermsWillExpireForOrgAdminMsg(UserMessage):
subject = _("Asset permissions is about to expire") subject = _("Asset permissions is about to expire")
context = { context = {
'name': self.user.name, 'name': self.user.name,
'day_count': self.day_count, 'count': self.day_count,
'items_with_url': items_with_url, 'items_with_url': items_with_url,
'item_type': _('asset permissions of organization {}').format(self.org) 'item_type': _('asset permissions of organization {}').format(self.org)
} }
@ -88,13 +88,13 @@ class PermedAppsWillExpireUserMsg(UserMessage):
def __init__(self, user, apps, day_count=0): def __init__(self, user, apps, day_count=0):
super().__init__(user) super().__init__(user)
self.apps = apps self.apps = apps
self.count = day_count self.day_count = day_count
def get_html_msg(self) -> dict: def get_html_msg(self) -> dict:
subject = _("Your permed applications is about to expire") subject = _("Your permed applications is about to expire")
context = { context = {
'name': self.user.name, 'name': self.user.name,
'day_count': self.day_count, 'count': self.day_count,
'item_type': _('permed applications'), 'item_type': _('permed applications'),
'items': [str(app) for app in self.apps] 'items': [str(app) for app in self.apps]
} }
@ -119,7 +119,7 @@ class AppPermsWillExpireForOrgAdminMsg(UserMessage):
super().__init__(user) super().__init__(user)
self.perms = perms self.perms = perms
self.org = org self.org = org
self.count = day_count self.day_count = day_count
def get_items_with_url(self): def get_items_with_url(self):
items_with_url = [] items_with_url = []
@ -134,6 +134,7 @@ class AppPermsWillExpireForOrgAdminMsg(UserMessage):
subject = _('Application permissions is about to expire') subject = _('Application permissions is about to expire')
context = { context = {
'name': self.user.name, 'name': self.user.name,
'count': self.day_count,
'item_type': _('application permissions of organization {}').format(self.org), 'item_type': _('application permissions of organization {}').format(self.org),
'items_with_url': items 'items_with_url': items
} }