1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 08:16:07 +00:00

add deleted_files_msg for email (#5554)

This commit is contained in:
WJH
2023-07-19 20:18:12 +08:00
committed by GitHub
parent 0f6298bbc9
commit c1ae47a16e
2 changed files with 17 additions and 0 deletions

View File

@@ -206,6 +206,17 @@ class Command(BaseCommand):
notice.inv_accept_at = inv.accept_time.strftime("%Y-%m-%d %H:%M:%S")
return notice
def format_deleted_files_msg(self, notice):
d = json.loads(notice.detail)
repo_id = d['repo_id']
repo = seafile_api.get_repo(repo_id)
repo_url = reverse('lib_view', args=[repo.id, repo.name, ''])
notice.repo_url = repo_url
notice.repo_name = repo.name
notice.avatar_src = self.get_avatar_src(notice.to_user)
return notice
def get_user_language(self, username):
return Profile.objects.get_user_language(username)
@@ -333,6 +344,9 @@ class Command(BaseCommand):
elif notice.is_guest_invitation_accepted_msg():
notice = self.format_guest_invitation_accepted_msg(notice)
elif notice.is_deleted_files_msg():
notice = self.format_deleted_files_msg(notice)
if notice is None:
continue

View File

@@ -62,6 +62,9 @@ You've got {{num}} new notices on {{ site_name }}:
{% elif notice.is_guest_invitation_accepted_msg %}
<p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.inv_accepter inv_url=notice.inv_url time=notice.inv_accept_at %}Guest {{user}} accepted your <a href="{{url_base}}{{inv_url}}">invitation</a> at {{time}}.{% endblocktrans %}</p>
{% elif notice.is_deleted_files_msg %}
<p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with repo_url=notice.repo_url repo_name=notice.repo_name %}Your library <a href="{{url_base}}{{ repo_url }}">{{ repo_name }}</a> has recently deleted a large number of files.{% endblocktrans %}</p>
{% endif %}
</td>
<td style="padding: 5px 3px; border-bottom: 1px solid #eee; font-size: 13px; color: #333; word-wrap: break-word;">{{ notice.timestamp|date:"Y-m-d G:i:s"}}</td>