Commit 12095251 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Add the message HTML to the UserStatus api

parent 78c6f9a2
......@@ -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,20 +470,24 @@ Get the status of a user.
GET /users/:id_or_username/status
```
| 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"
"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>"
}
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id_or_username` | string | yes | The id or username of the user to get a status of |
## Set user status
Set the status of the current user.
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment