1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 20:08:19 +00:00

[notice] mark related user msgs as read when close the popup

This commit is contained in:
llj
2014-07-05 18:56:50 +08:00
parent 9164e67317
commit 6803e62e5a

View File

@@ -24,6 +24,7 @@ from seahub.forms import RepoNewDirentForm, RepoRenameDirentForm, \
RepoCreateForm, SharedRepoCreateForm RepoCreateForm, SharedRepoCreateForm
from seahub.options.models import UserOptions, CryptoOptionNotSetError from seahub.options.models import UserOptions, CryptoOptionNotSetError
from seahub.notifications.models import UserNotification from seahub.notifications.models import UserNotification
from seahub.message.models import UserMessage
from seahub.signals import upload_file_successful, repo_created, repo_deleted from seahub.signals import upload_file_successful, repo_created, repo_deleted
from seahub.views import get_repo_dirents, validate_owner, \ from seahub.views import get_repo_dirents, validate_owner, \
check_repo_access_permission, get_unencry_rw_repos_by_user, \ check_repo_access_permission, get_unencry_rw_repos_by_user, \
@@ -1320,6 +1321,12 @@ def set_notices_seen(request):
notice.seen = True notice.seen = True
notice.save() notice.save()
# mark related user msg as read
if notice.is_user_message():
d = notice.user_message_detail_to_dict()
msg_from = d.get('msg_from')
UserMessage.objects.update_unread_messages(msg_from, username)
return HttpResponse(json.dumps({'success': True}), content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type)
@login_required_ajax @login_required_ajax