Commit 3e65f40a authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '292820-update-user-api-docs-and-enable-ff' into 'master'

Enable clear_status_with_quick_options FF

See merge request gitlab-org/gitlab!54207
parents 2601e75f c1279510
---
title: Schedule user status cleanup after a given time interval via the REST API
merge_request: 54207
author:
type: added
...@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/320777 ...@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/320777
milestone: '13.9' milestone: '13.9'
type: development type: development
group: group::optimize group: group::optimize
default_enabled: false default_enabled: true
...@@ -628,7 +628,8 @@ Example response: ...@@ -628,7 +628,8 @@ Example response:
{ {
"emoji":"coffee", "emoji":"coffee",
"message":"I crave coffee :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>" "message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">☕</gl-emoji>",
"clear_status_at": null
} }
``` ```
...@@ -654,7 +655,8 @@ Example response: ...@@ -654,7 +655,8 @@ Example response:
{ {
"emoji":"coffee", "emoji":"coffee",
"message":"I crave coffee :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>" "message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">☕</gl-emoji>",
"clear_status_at": null
} }
``` ```
...@@ -666,15 +668,16 @@ Set the status of the current user. ...@@ -666,15 +668,16 @@ Set the status of the current user.
PUT /user/status PUT /user/status
``` ```
| Attribute | Type | Required | Description | | 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](https://github.com/bonusly/gemojione/blob/master/config/index.json). | | `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](https://github.com/bonusly/gemojione/blob/master/config/index.json). |
| `message` | string | no | The message to set as a status. It can also contain emoji codes. | | `message` | string | no | The message to set as a status. It can also contain emoji codes. |
| `clear_status_after` | string | no | Automatically clean up the status after a given time interval, allowed values: `30_minutes`, `3_hours`, `8_hours`, `1_day`, `3_days`, `7_days`, `30_days`
When both parameters `emoji` and `message` are empty, the status is cleared. When both parameters `emoji` and `message` are empty, the status is cleared. When the `clear_status_after` parameter is missing from the request, the previously set value for `"clear_status_after` is cleared.
```shell ```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "emoji=coffee" --data "message=I crave coffee" "https://gitlab.example.com/api/v4/user/status" curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "clear_status_after=1_day" --data "emoji=coffee" --data "message=I crave coffee" "https://gitlab.example.com/api/v4/user/status"
``` ```
Example responses Example responses
...@@ -683,7 +686,8 @@ Example responses ...@@ -683,7 +686,8 @@ Example responses
{ {
"emoji":"coffee", "emoji":"coffee",
"message":"I crave coffee", "message":"I crave coffee",
"message_html": "I crave coffee" "message_html": "I crave coffee",
"clear_status_at":"2021-02-15T10:49:01.311Z"
} }
``` ```
......
...@@ -1072,7 +1072,7 @@ module API ...@@ -1072,7 +1072,7 @@ module API
forbidden! unless can?(current_user, :update_user_status, current_user) forbidden! unless can?(current_user, :update_user_status, current_user)
update_params = declared_params update_params = declared_params
update_params.delete(:clear_status_after) if Feature.disabled?(:clear_status_with_quick_options, current_user) update_params.delete(:clear_status_after) if Feature.disabled?(:clear_status_with_quick_options, current_user, default_enabled: :yaml)
if ::Users::SetStatusService.new(current_user, update_params).execute if ::Users::SetStatusService.new(current_user, update_params).execute
present current_user.status, with: Entities::UserStatus present current_user.status, with: Entities::UserStatus
......
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