Add the message HTML to the UserStatus api
This commit is contained in:
parent
78c6f9a2d6
commit
12095251c3
|
@ -448,10 +448,17 @@ Get the status of the currently signed in user.
|
|||
GET /user/status
|
||||
```
|
||||
|
||||
```bash
|
||||
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/user/status"
|
||||
```
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"emoji":"coffee",
|
||||
"message":"I crave coffee"
|
||||
"message":"I crave coffee :coffee:",
|
||||
"message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">☕</gl-emoji>"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -463,19 +470,23 @@ Get the status of a user.
|
|||
GET /users/:id_or_username/status
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"emoji":"coffee",
|
||||
"message":"I crave coffee"
|
||||
}
|
||||
```
|
||||
|
||||
Parameters:
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `id_or_username` | string | yes | The id or username of the user to get a status of |
|
||||
|
||||
```bash
|
||||
curl "https://gitlab.example.com/users/janedoe/status"
|
||||
```
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"emoji":"coffee",
|
||||
"message":"I crave coffee :coffee:",
|
||||
"message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">☕</gl-emoji>"
|
||||
}
|
||||
```
|
||||
|
||||
## Set user status
|
||||
|
||||
|
@ -485,21 +496,26 @@ Set the status of the current user.
|
|||
PUT /user/status
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"emoji":"coffee",
|
||||
"message":"I crave coffee"
|
||||
}
|
||||
```
|
||||
|
||||
Parameters:
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `emoji` | string | no | The name of the emoji to use as status, if omitted `speech_balloon` is used. Emoji name can be one of the specified names in the [Gemojione index][gemojione-index]. |
|
||||
| `message` | string | no | The message to set as a status. It can also contain emoji codes. |
|
||||
|
||||
When both parameters are empty, the status will be cleared.
|
||||
When both parameters `emoji` and `message` are empty, the status will be cleared.
|
||||
|
||||
```bash
|
||||
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --data "emoji=coffee" --data "emoji=I crave coffee" https://gitlab.example.com/api/v4/user/status
|
||||
```
|
||||
|
||||
Example responses
|
||||
|
||||
```json
|
||||
{
|
||||
"emoji":"coffee",
|
||||
"message":"I crave coffee",
|
||||
"message_html": "I crave coffee"
|
||||
}
|
||||
```
|
||||
|
||||
## List user projects
|
||||
|
||||
|
|
|
@ -65,6 +65,9 @@ module API
|
|||
class UserStatus < Grape::Entity
|
||||
expose :emoji
|
||||
expose :message
|
||||
expose :message_html do |entity|
|
||||
MarkupHelper.markdown_field(entity, :message)
|
||||
end
|
||||
end
|
||||
|
||||
class Email < Grape::Entity
|
||||
|
|
|
@ -21,6 +21,7 @@ describe API::Users do
|
|||
|
||||
expect(response).to have_gitlab_http_status(:success)
|
||||
expect(json_response['message']).to be_present
|
||||
expect(json_response['message_html']).to be_present
|
||||
expect(json_response['emoji']).to be_present
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue