Часть технических описаний пока доступна на английском языке.

Пожаловаться на сообщение

POST https://z.u1v.ru/api/v1/messages/{message_id}/report

Sends a notification to the organization's moderation request channel, if it is configured, that reports the targeted message for review and moderation.

Clients should check the moderation_request_channel realm setting to decide whether to show the option to report messages in the UI.

If the report_type parameter value is "other", the description parameter is required. Clients should also enforce and communicate this behavior in the UI.

Changes: Before Zulip 13.0 (feature level 511), this endpoint did not return an error if the message report failed to be sent to the moderation request channel.

New in Zulip 11.0 (feature level 382). This API builds on the moderation_request_channel realm setting, which was added in feature level 331.

Примеры запросов

#!/usr/bin/env python3

import pero

# Pass the path to your perorc file here.
client = pero.Client(config_file="~/.perorc")

request = {
    "report_type": "harassment",
    "description": "Boromir is bullying Frodo.",
}
# Report a message, given the message's ID.
result = client.call_endpoint(f"/messages/{message_id}/report", method="POST", request=request)
print(result)

Параметр -u задаёт учётные данные для HTTP-аутентификации Basic. Как получить их для пользователя или бота, описано в разделе о заголовке Authorization.

curl -sSX POST https://z.u1v.ru/api/v1/messages/43/report \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode report_type=harassment \
    --data-urlencode 'description=This message insults and mocks Frodo, which is against the code of conduct.'

Параметры

message_id integer обязательно в пути

Пример: 43

ID целевого сообщения.


report_type string обязательно

Пример: "harassment"

Причина, которая лучше всего описывает, почему текущий пользователь отправляет жалобу на указанное сообщение для модерации.

Должна совпадать с одним из значений key в поле server_report_message_types ответа POST /register.

Изменения: До Zulip 12.0 (feature level 435) допускались только значения "harassment", "inappropriate", "norms", "other", "spam".


description string необязательно

Пример: "This message insults and mocks Frodo, which is against the code of conduct."

Краткое описание с дополнительным пояснением, почему текущий пользователь отправляет жалобу на указанное сообщение для модерации.

Клиенты должны ограничивать эту строку 1000 кодовыми точками Unicode.

Если параметр report_type равен "other", этот параметр обязателен, а его значение не может быть пустой строкой.


Ответ

Примеры ответов

Изменения: Начиная с Zulip 7.0 (уровень возможностей 167), успешный JSON-ответ содержит массив ignored_parameters_unsupported, если запрос включает параметры, которые метод не поддерживает.

Пример успешного JSON-ответа:

{
    "msg": "",
    "result": "success"
}

Пример JSON-ответа с ошибкой, если в организации не настроен канал запросов модерации:

{
    "code": "BAD_REQUEST",
    "msg": "Moderation request channel must be specified to enable message reporting.",
    "result": "error"
}