コード例 #1
0
ファイル: message_flags.py プロジェクト: yushao2/zulip
def mark_all_as_read(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
    count = do_mark_all_as_read(user_profile, request.client)

    log_data_str = f"[{count} updated]"
    request._log_data["extra"] = log_data_str

    return json_success({"result": "success", "msg": ""})
コード例 #2
0
ファイル: message_flags.py プロジェクト: RekaVoelfinger/zulip
def mark_all_as_read(request: HttpRequest,
                     user_profile: UserProfile) -> HttpResponse:
    request_notes = RequestNotes.get_notes(request)
    count = do_mark_all_as_read(user_profile)

    log_data_str = f"[{count} updated]"
    assert request_notes.log_data is not None
    request_notes.log_data["extra"] = log_data_str

    return json_success(request)
コード例 #3
0
def mark_all_as_read(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
    request_notes = RequestNotes.get_notes(request)
    assert request_notes.client is not None
    count = do_mark_all_as_read(user_profile, request_notes.client)

    log_data_str = f"[{count} updated]"
    assert request_notes.log_data is not None
    request_notes.log_data["extra"] = log_data_str

    return json_success({"result": "success", "msg": ""})
コード例 #4
0
ファイル: bankrupt_users.py プロジェクト: BakerWang/zulip
    def handle(self, *args: Any, **options: str) -> None:
        realm = self.get_realm(options)
        for email in options['emails']:
            try:
                user_profile = self.get_user(email, realm)
            except CommandError:
                print("e-mail %s doesn't exist in the realm %s, skipping" % (email, realm))
                continue
            do_mark_all_as_read(user_profile, self.get_client())

            messages = Message.objects.filter(
                usermessage__user_profile=user_profile).order_by('-id')[:1]
            if messages:
                old_pointer = user_profile.pointer
                new_pointer = messages[0].id
                user_profile.pointer = new_pointer
                user_profile.save(update_fields=["pointer"])
                print("%s: %d => %d" % (email, old_pointer, new_pointer))
            else:
                print("%s has no messages, can't bankrupt!" % (email,))
コード例 #5
0
ファイル: bankrupt_users.py プロジェクト: zfeed/zulip
    def handle(self, *args: Any, **options: str) -> None:
        realm = self.get_realm(options)
        for email in options['emails']:
            try:
                user_profile = self.get_user(email, realm)
            except CommandError:
                print("e-mail %s doesn't exist in the realm %s, skipping" %
                      (email, realm))
                continue
            do_mark_all_as_read(user_profile, self.get_client())

            messages = Message.objects.filter(
                usermessage__user_profile=user_profile).order_by('-id')[:1]
            if messages:
                old_pointer = user_profile.pointer
                new_pointer = messages[0].id
                user_profile.pointer = new_pointer
                user_profile.save(update_fields=["pointer"])
                print("%s: %d => %d" % (email, old_pointer, new_pointer))
            else:
                print("%s has no messages, can't bankrupt!" % (email, ))