diff --git a/seahub/notifications/management/commands/send_notices.py b/seahub/notifications/management/commands/send_notices.py index e22e7d069b..0730a7792b 100644 --- a/seahub/notifications/management/commands/send_notices.py +++ b/seahub/notifications/management/commands/send_notices.py @@ -44,7 +44,15 @@ class Command(BaseCommand): repl = r'src="%s\1"' % get_site_scheme_and_netloc() return re.sub(pattern, repl, img_tag) - def get_file_upload_avatar_url(self, default_size=32): + def get_avatar_src(self, username, default_size=32): + avatar_img = self.get_avatar(username, default_size) + m = re.search('""" % \ (get_default_avatar_url(), default_size, default_size) @@ -52,6 +60,14 @@ class Command(BaseCommand): repl = r'src="%s\1"' % get_site_scheme_and_netloc() return re.sub(pattern, repl, img_tag) + def get_default_avatar_src(self, default_size=32): + avatar_img = self.get_default_avatar(default_size) + m = re.search(' -table { width:100%; margin:12px 0 20px; table-layout:fixed; border-spacing: 0; border-collapse: collapse;} -td, th { font-size: 13px; padding: 5px 3px; word-wrap: break-word; border-bottom: 1px solid #eee; } -th { text-align: left; font-weight: normal; color: #9c9c9c; } -td { color: #333; } -p { line-height: 1.5; margin:.2em 0; } -.hi { color:#121214;font-size:14px;margin-bottom:12px; } -.amount { font-size:14px;color:#434144; } -.avatar-cell { text-align:center; vertical-align:top; padding-top:8px; } -.avatar {border-radius: 1000px;} -.topic { padding: 4px 13px; border-left: 3px solid #e0e0e0; margin-left: 7px; } -.brief, .detail { margin-right:10px; } - - -

{% blocktrans with name=to_user|email2nickname %}Hi, {{ name }}{% endblocktrans %}

-

+

{% blocktrans with name=to_user|email2nickname %}Hi, {{ name }}{% endblocktrans %}

+

{% blocktrans count num=notice_count %} You've got 1 new notice on {{ site_name }}: {% plural %} @@ -27,53 +13,53 @@ You've got {{num}} new notices on {{ site_name }}: {% endblocktrans %}

- +
- - - + + + {% for notice in notices %} - - + - + {% endfor %}
{% trans "Message" %}{% trans "Time" %}{% trans "Message" %}{% trans "Time" %}
{{notice.avatar|safe}} + {% if notice.is_group_msg %} -

{% blocktrans with user=notice.notice_from grp_url=notice.group_url grp_name=notice.group_name%}{{user}} posted a new discussion in {{grp_name}}{% endblocktrans %}

+

{% blocktrans with user=notice.notice_from grp_url=notice.group_url grp_name=notice.group_name%}{{user}} posted a new discussion in {{grp_name}}{% endblocktrans %}

{% if notice.grp_msg %} -

{{notice.grp_msg}}

+

{{notice.grp_msg}}

{% endif %} {% elif notice.is_grpmsg_reply %} -

{% blocktrans with user=notice.notice_from reply_url=notice.group_msg_reply_url%}{{user}} replied your group discussion{% endblocktrans %}

+

{% blocktrans with user=notice.notice_from reply_url=notice.group_msg_reply_url%}{{user}} replied your group discussion{% endblocktrans %}

{% if notice.grp_reply_msg %} -
+
{% if notice.grpmsg_topic %} -

{{notice.grpmsg_topic|truncatechars:45}}

+

{{notice.grpmsg_topic|truncatechars:45}}

{% endif %} -

{{notice.grp_reply_msg}}

+

{{notice.grp_reply_msg}}

{% endif %} {% elif notice.is_repo_share_msg %} -

{% blocktrans with user=notice.notice_from lib_url=notice.repo_url lib_name=notice.repo_name%}{{user}} has shared a library named {{lib_name}} to you.{% endblocktrans %}

+

{% blocktrans with user=notice.notice_from lib_url=notice.repo_url lib_name=notice.repo_name%}{{user}} has shared a library named {{lib_name}} to you.{% endblocktrans %}

{% elif notice.is_priv_file_share_msg %} -

{% blocktrans with user=notice.notice_from file_url=notice.priv_shared_file_url file_name=notice.priv_shared_file_name %}{{user}} has shared a file named {{file_name}} to you.{% endblocktrans %}

+

{% blocktrans with user=notice.notice_from file_url=notice.priv_shared_file_url file_name=notice.priv_shared_file_name %}{{user}} has shared a file named {{file_name}} to you.{% endblocktrans %}

{% elif notice.is_user_message %} -

{% blocktrans with msg_url=notice.user_msg_url user=notice.notice_from %}You have received a new message from {{user}}.{% endblocktrans %}

+

{% blocktrans with msg_url=notice.user_msg_url user=notice.notice_from %}You have received a new message from {{user}}.{% endblocktrans %}

{% if notice.user_msg %} -

{{notice.user_msg}}

+

{{notice.user_msg}}

{% endif %} {% elif notice.is_file_uploaded_msg %} -

{% blocktrans with file_url=notice.file_link file_name=notice.file_name folder_url=notice.folder_link folder_name=notice.folder_name %}A file named {{file_name}} is uploaded to your folder {{folder_name}}.{% endblocktrans %}

+

{% blocktrans with file_url=notice.file_link file_name=notice.file_name folder_url=notice.folder_link folder_name=notice.folder_name %}A file named {{file_name}} is uploaded to your folder {{folder_name}}.{% endblocktrans %}

{% elif notice.is_group_join_request %} -

{% blocktrans with user_url=notice.grpjoin_user_profile_url user=notice.notice_from grp_url=notice.grpjoin_group_url grp_name=notice.grpjoin_group_name msg=notice.grpjoin_request_msg %}User {{user}} has asked to join group {{grp_name}}, verification message: {{msg}}{% endblocktrans %}

+

{% blocktrans with user_url=notice.grpjoin_user_profile_url user=notice.notice_from grp_url=notice.grpjoin_group_url grp_name=notice.grpjoin_group_name msg=notice.grpjoin_request_msg %}User {{user}} has asked to join group {{grp_name}}, verification message: {{msg}}{% endblocktrans %}

{% endif %}
{{ notice.timestamp|date:"Y-m-d G:i:s"}}{{ notice.timestamp|date:"Y-m-d G:i:s"}}