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

fix(notifications): associate the corresponding action #346

Merged
merged 1 commit into from
Nov 26, 2023
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
10 changes: 7 additions & 3 deletions hinghwa-dict-backend/article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def post(self, request) -> JsonResponse:
article.author = user
article.save()
content = f"我创建了文章(id={article.id}),请及时去审核"
sendNotification(article.author, None, content, title="【提醒】文章待审核")
sendNotification(
article.author, None, content, title="【提醒】文章待审核", action_object=article
)
return JsonResponse({"id": article.id}, status=200)

# AT0202 文章内容批量获取
Expand Down Expand Up @@ -162,7 +164,9 @@ def put(self, request, id) -> JsonResponse:
article.visibility = False
article.save()
content = f"我修改了文章(id={article.id}),请及时去审核"
sendNotification(article.author, None, content, title="【提醒】文章待审核")
sendNotification(
article.author, None, content, title="【提醒】文章待审核", action_object=article
)
return JsonResponse({}, status=200)

# AT0102 删除文章
Expand Down Expand Up @@ -197,7 +201,7 @@ def put(self, request, id) -> JsonResponse:
None,
[article.author],
content=content,
target=article,
action_object=article,
title="【通知】文章审核结果",
)
article.save()
Expand Down
1 change: 1 addition & 0 deletions hinghwa-dict-backend/word/application/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,6 @@ def put(self, request, id) -> JsonResponse:
content,
target=application,
title=title,
action_object=application.word,
)
return JsonResponse({"word": feedback}, status=200)
6 changes: 3 additions & 3 deletions hinghwa-dict-backend/word/pronunciation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def delete(request, id):
get_request_user(request),
[pronunciation.contributor],
f"您的语音(id={pronunciation.id}) 已被删除,理由是:\n\t{message}",
target=pronunciation,
action_object=pronunciation,
title=f"【通知】语音{pronunciation.word.word}被删除",
)

Expand Down Expand Up @@ -376,7 +376,7 @@ def post(request, id):
verifier,
[contributor],
content=content + reason,
target=pronunciation,
action_object=pronunciation,
title=f"【通知】语音({pronunciation.word.word})审核结果",
)
return JsonResponse(transaction_info, status=200)
Expand Down Expand Up @@ -406,7 +406,7 @@ def put(request, id):
verifier,
[contributor],
content=content + f",理由是:{message}。",
target=pronunciation,
action_object=pronunciation,
title=f"【通知】语音({pronunciation.word.word})审核结果变更",
)
return JsonResponse(transaction_info, status=200)
Expand Down
Loading