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

修复通知信箱无法即时更新的bug #852

Merged
merged 3 commits into from
Jan 17, 2025
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
4 changes: 2 additions & 2 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1815,8 +1815,8 @@ def notifications(request: HttpRequest):
receiver=request.user,
status=Notification.Status.UNDONE).order_by("-start_time")

done_list = notification2Display(done_notifications)
undone_list = notification2Display(undone_notifications)
notes_list = notification2Display(
done_notifications) + notification2Display(undone_notifications)

# 新版侧边栏, 顶栏等的呈现,采用 bar_display, 必须放在render前最后一步
bar_display = utils.get_sidebar_and_navbar(request.user,
Expand Down
10 changes: 6 additions & 4 deletions templates/notifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ <h5><i class="fa fa-envelope-o"></i> 已处理</h5>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active show" id="home">
<div id="undone-empty" style="display: none; margin-top: 40px; margin-bottom: -40px;">
<p style="text-align: center;">您的信箱很干净!没有要处理的信息.</p>
<p style="text-align: center;">您的信箱很干净!没有要处理的信息</p>
</div>
<div class="bio-skill-box">
<div id="undone-list" class="row">
{% for note in undone_list %}
{% for note in notes_list %}
<div class="col-12 col-xl-6 col-lg-12 mb-xl-4 mb-4 " id="undone={{note.id}}" {% if not note.status == "待处理" %} hidden {%endif%}>

<div class=" b-skills">
Expand Down Expand Up @@ -122,11 +122,11 @@ <h5>
</div>
<div class="tab-pane fade" id="done">
<div id="done-empty" style="display: none; margin-top: 40px; margin-bottom: -40px;">
<p style="text-align: center;">没有已处理的消息记录.</p>
<p style="text-align: center;">没有已处理的消息记录</p>
</div>
<div class="bio-skill-box">
<div id="done-list" class="row">
{% for note in done_list %}
{% for note in notes_list %}
<div class="col-12 col-xl-6 col-lg-12 mb-xl-4 mb-4 " id="done={{note.id}}" {% if not note.status == "已处理" %} hidden {%endif%}>

<div class=" b-skills">
Expand Down Expand Up @@ -261,6 +261,7 @@ <h5>
if (success) {
document.getElementById("undone="+String(this.id)).hidden = true;
document.getElementById("done="+String(this.id)).hidden = false;
document.getElementById("done-list").prepend(document.getElementById("done="+String(this.id)));
document.getElementById("mail_num").innerHTML = String(Number(document.getElementById("mail_num").innerHTML) - 1);
refresh();
}
Expand All @@ -270,6 +271,7 @@ <h5>
if (success) {
document.getElementById("done="+String(this.id)).hidden = true;
document.getElementById("undone="+String(this.id)).hidden = false;
document.getElementById("undone-list").prepend(document.getElementById("undone="+String(this.id)));
document.getElementById("mail_num").innerHTML = String(Number(document.getElementById("mail_num").innerHTML) + 1);
refresh();
}
Expand Down
Loading