Commit graph

92 commits

Author SHA1 Message Date
Matias Bordese
8754f60530
Update schedule related users to use cached final representation (#5101)
Related to https://github.com/grafana/oncall/issues/4936

Cached final schedule keeps a (now - 15d, now + 6m) window
representation of a schedule (this representation always use users'
username; it will un-relate users that are not anymore associated to a
schedule).
2024-10-01 13:37:28 +00:00
Vadim Stepanov
e287dec9b5
Make Slack connection error more descriptive (#5007)
# What this PR does

<img width="517" alt="Screenshot 2024-09-10 at 17 11 51"
src="https://github.com/user-attachments/assets/086eb4ae-6ea3-467c-a1ed-6d6f51ddc3e7">


<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-10 16:24:09 +00:00
Matias Bordese
22cd4b86fc
Handle Slack invalid_auth error when posting alert group notification (#4970)
Also, make telegram error check more flexible (case insensitive, e.g. we
got some of these recently: `telegram.error.Unauthorized: Forbidden: bot
was blocked by the user`)
2024-09-02 16:37:27 +00:00
Yulya Artyukhina
c87d3018b9
Handle TimeoutError on sending message to Slack (#4916)
# What this PR does

## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-private/issues/2758

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-26 10:27:07 +00:00
Innokentii Konstantinov
5d92db18b1
Make root command configurable (#4863)
Makes IRM root command configurable via env
2024-08-21 06:54:47 +00:00
Ildar Iskhakov
48725888d1
Move slack log report from message thread to button (#4686)
# What this PR does

Continuation of [Add slack button to show log report
#4641](https://github.com/grafana/oncall/pull/4641)

## Which issue(s) this PR closes

Closes https://github.com/grafana/oncall/issues/3849

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-08-19 20:17:06 +00:00
Joey Orlando
93c92a7a4c
Update Slack user group for a schedule - handle paid_team_only Slack API error (#4793)
# What this PR does

Semi-related to https://github.com/grafana/oncall-private/issues/2131

Addresses occasional task failures for
`apps.slack.tasks.update_slack_user_group_for_schedules` when trying to
update a Slack user group for a non-paid Slack account. [Slack's
documentation](https://slack.com/help/articles/212906697-Create-a-user-group)
mentions this is a paid only feature, hence the error
([logs](https://ops.grafana-ops.net/goto/-AWfsrrIR?orgId=1) from an
actual task):
```
2024-08-08 16:20:36,613 source=engine:celery worker=ForkPoolWorker-16 task_id=6bdaae94-1552-4b6d-93e2-e2fa0bae57b1 task_name=apps.slack.tasks.update_slack_user_group_for_schedules name=apps.slack.models.slack_usergroup level=WARNING Slack usergroup S06LW5GJ88Z update failed: Slack API error! Response: {'ok': False, 'error': 'paid_teams_only'}
```

Updated our docs on our Slack integration to emphasize that this feature
_only_ works for paid Slack accounts

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-09 14:51:01 +00:00
Innokentii Konstantinov
1faffb3dae
chore: grafana-irm command (#4762) 2024-07-31 11:50:07 +00:00
Innokentii Konstantinov
94219c25bb
Introduce slash command matcher (#4717)
With the Unified Slack app we now have two ways of calling commands.
1. Legacy one when command invoked directly: /escalate
2. Unified one: /grafana escalate
On top of that we have different slach commands for each environment:
/escalate-local, /escalate-dev, etc. It was leading to a weird command
to escalate via Unified App in dev u need to type: /grafana-dev
escalate-develop.

To support both, I introduced a matcher function for SlashCommandRoutes.
It allows to simplify handling of such cases without complex workarounds
in an EventAPIEndpoint.


# What this PR does

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-24 09:53:06 +00:00
Vadim Stepanov
87d7982250
Unified Slack app reinstall (#4682)
# What this PR does

Adds a button to reinstall the Slack app to migrate to Unified Slack
App. Also adds backend support for this.

<img width="1204" alt="Screenshot 2024-07-18 at 18 33 08"
src="https://github.com/user-attachments/assets/a326b4a2-fc65-4b88-98c0-2955e3717e3a">


## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-gateway/issues/252

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-19 11:53:06 +00:00
Innokentii Konstantinov
1465db36e5
Support stack header from chatops-proxy (#4578)
This PR supports new flow of selecting org to run command in a slack
workspace if several stacks are using it. In this case user selects
default stack to run commands or pass a --stack flag. Both handled by
chatops-proxy which injects selected stack as a header.
On a side note - I found one ScenarioStep with incompatible set of
arguments with parent class. I didn't fixed it, just left TODO
https://github.com/grafana/oncall/pull/4578/files#diff-e323b5f38ed665f73d5da3fa0575958ed54ab587f6521b4cd87e1491b5430f8bR364

Related to https://github.com/grafana/oncall-gateway/issues/256

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2024-07-19 10:08:52 +00:00
Ildar Iskhakov
993725d2ee
Show incident button first when alert group is acknowledged (#4642)
# What this PR does

* Move declare incident button to first position when incident is
acknowledged
* Move resolved text above buttons, so buttons remain on the same place
when clicked
<img width="549" alt="Screenshot 2024-07-09 at 11 52 33 PM"
src="https://github.com/grafana/oncall/assets/2262529/68cfb42f-c7ad-42b9-8404-e3400eb70332">
<img width="529" alt="Screenshot 2024-07-09 at 11 52 41 PM"
src="https://github.com/grafana/oncall/assets/2262529/d8e36dec-ddfc-4db6-9918-0fb478c1462f">


## Which issue(s) this PR closes

Closes https://github.com/grafana/oncall/issues/1908

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-07-10 15:01:01 +00:00
Vadim Stepanov
b7dbb2a26e
Support message shortcut broadcast (#4518)
# What this PR does

Related to https://github.com/grafana/oncall-gateway/issues/206

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-17 10:31:43 +00:00
Joey Orlando
49d20f1a7e
bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495)
# What this PR does

- bumps `uwsgi` to latest version (`2.0.26`), which unblocks us from
bumping Python to 3.12
- bumps Python to 3.12.3
- refactor the Snyk GitHub Actions workflow to use the composable
actions for installed frontend and backend dependencies
- fixes several `AttributeError`s in our tests that went from a warning
to an error in Python 3.12 (see
https://github.com/python/cpython/issues/100690)

# Which issue(s) this PR closes

Closes #4358
Closes https://github.com/grafana/oncall/issues/4387
2024-06-10 15:33:37 -04:00
Vadim Stepanov
f47f9c29fd
Update resolution note message shortcut instruction (#4482)
# What this PR does

Updates the instruction that pops up when clicking the `Add Resolution
notes` button in Slack with an up-to-date GIF.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-07 13:54:45 +00:00
Innokentii Konstantinov
805d4421bd
Support grafana escalate (#4453)
# What this PR does
This PR adds support for **/grafana escalate** command alongside with
**/escalate.**
2024-06-05 05:51:26 +00:00
Innokentii Konstantinov
17f448c506
Prepare OnCall for Unified Slack App (#4232)
This PR does a bunch of changes to prepare OnCall for Unified Slack App:
1. Install Slack via Chatops-Proxy. This change contains two parts:
getting a Slack install link from chatops-proxy
([code](https://github.com/grafana/oncall/pull/4232/files#diff-437a77d49fc04b92d315651b3df5991000b1ab74cf60aabb21aa77cb2823bf52R46))
and receiving a "slack installed" event from chatops-proxy
([code](https://github.com/grafana/oncall/pull/4232/files#diff-976d106f0962be5c1de5e35582193f68435ed0c17f2defd6bd2857bf6e27f65d)).
Also it means that OnCall doesn't need to register slack_links anymore
when slack is connected/disconnected. These changes are behind
UNIFIED_SLACK_APP_ENABLED flag and should be no-op if flag is not
enabled.
2. Get rid of Multiregionatily restrictions - instrument all slack
interactions with a ProxyMeta - json data telling chatops-proxy where to
route the interaction. Note, that it doesn't apply for "Add to
resolution notes" message action - it will be handled differently in
following PR.
3. Move all chatops-proxy related stuff from common/oncall-gateway to
apps/chatops-proxy

Minor changes:
1. Remove usage of **CHATOPS_V3** flag. Chatops v3 is already released
(It's a refactoring from previous quarter)

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2024-06-03 09:07:10 +00:00
Matias Bordese
5291feeb51
Fix update slack group to not raise if group is not found (#4423)
Fixes https://github.com/grafana/oncall-private/issues/2664
2024-05-30 11:27:25 +00:00
Matias Bordese
d4ba57b68b
Avoid retrying to update Slack log message if cant_update_message (#4329)
Do not retry updating a message if Slack returns `cant_update_message`
API [error](https://api.slack.com/methods/chat.update#errors) (meaning
bot user has no permission to update the message).
2024-05-09 16:16:53 +00:00
Salvatore Giordano
720bcf983a
Update deep link URL for Slack messages (#4317)
# What this PR does

It updates the slack deep link url to respect the [correct
format](https://api.slack.com/reference/deep-linking#app_or_bot)
requested [here](https://github.com/grafana/oncall/issues/4122)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2024-05-09 10:18:48 +00:00
Matias Bordese
b3c1800f87
Add Slack deep link entry to alert group permalinks (#4205)
Related to https://github.com/grafana/oncall/issues/4122
2024-04-12 13:25:48 +00:00
Matias Bordese
4ac2df19b5
Update xdist load to use loadscope setting (#4187)
Changed xdist dist setting to use `loadscope` value
See
[docs](https://pytest-xdist.readthedocs.io/en/latest/distribution.html#running-tests-across-multiple-cpus)
2024-04-08 19:03:58 +00:00
Matias Bordese
398b09a85b
Allow getting details from connected integration webhooks (#4153)
Related to https://github.com/grafana/oncall-private/issues/2615
2024-04-08 14:13:17 +00:00
Matias Bordese
adaab1c6ad
Check for permissions on Slack escalate command (#3891)
Related to https://github.com/grafana/oncall/issues/3109

Fixes issue from https://github.com/grafana/oncall/pull/3881 (problem
was that there is no organization set in the Slack request, making it
impossible to check for user permissions; check permission once an
organization is set in the form instead).
2024-02-14 19:02:09 +00:00
Matias Bordese
5ecdc26b0a
Revert requiring permission on Slack direct paging (#3881)
Reverting part of https://github.com/grafana/oncall/pull/3861
2024-02-12 18:48:43 +00:00
Matias Bordese
160d501bbe
Add permission checks for Slack paging and shift swaps actions (#3861)
Fixes https://github.com/grafana/oncall/issues/3109
2024-02-09 12:30:05 +00:00
Joey Orlando
758c12790d
fix slack API rate limit errors in send_message_to_thread_if_bot_not_in_channel task (#3803)
# What this PR does

See [this
conversation](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1706722752735009)
for more context.

Additionally, improves logging for this task + adds unit tests.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2024-01-31 13:42:52 -05:00
Yulya Artyukhina
c7895c2308
Fix post message to slack channel (#3701)
# What this PR does
Extend list of exceptions to ignore on posting message to slack channel

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/3694

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2024-01-17 13:05:36 +00:00
Vadim Stepanov
6c248ed1c8
Fix posting Slack message when route is deleted (#3702)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/3646

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2024-01-17 13:00:25 +00:00
Vadim Stepanov
80f85cf4b4
Fix updating a shift swap with no Slack message (#3686)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/3648

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-01-15 17:36:01 +00:00
Joey Orlando
9657533b5b
fix duplicate teams showing up in teams dropdown for /escalate slack command (#3590)
# Which issue(s) this PR fixes
- Closes https://github.com/grafana/support-escalations/issues/8763
- Closes https://github.com/grafana/oncall/issues/3388

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-12-22 12:36:54 +00:00
Matias Bordese
e260e23715
Add missing success log entries for personal notifications (#3557) 2023-12-14 18:32:26 +00:00
Joey Orlando
76a88bc0c1
Revert "upgrade to Python 3.12 (#3456)" and "bump uwsgi version to latest #3466" (#3483)
# What this PR does

This reverts commits 7c4b40a046 and
cdb22285db.

See https://github.com/grafana/oncall-private/pull/2361 for more
details.
2023-12-01 09:56:26 -05:00
Joey Orlando
7c4b40a046
upgrade to Python 3.12 (#3456)
# What this PR does

Upgrade to Python 3.12 + fix several invalid test assertions that lead
to test failures in the latest version of `pytest`:
```
AttributeError: 'called_once_with' is not a valid assertion. Use a spec for the mock if 'called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?
```

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-30 13:47:41 +00:00
Matias Bordese
aa8a904a8d
Update when slack client ratelimit retry handler is enabled (#3447) 2023-11-30 12:35:46 +00:00
Yulya Artyukhina
863af25994
Fix alert group rendering (#3424)
# What this PR does
Fix alert group rendering when some links were broken because of
replacing `-` to `_`.

## Which issue(s) this PR fixes
https://github.com/grafana/support-escalations/issues/8119
https://github.com/grafana/support-escalations/issues/8468

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-24 15:39:37 +00:00
Matias Bordese
56d1b529e9
Add builtin slack retry on ratelimited error (#3401)
Fixes https://github.com/grafana/oncall-private/issues/2293

Enable Slack client retries on `ratelimited` errors: it will check the
`Retry-After` header before trying again. After 3 attempts it will raise
the error (and we will fallback to the usual error/task retry handling).
2023-11-21 17:32:29 +00:00
Joey Orlando
05ec0f97b5
fix issue in /escalate Slack command when selecting a team (#3381)
# Which issue(s) this PR fixes

Closes https://github.com/grafana/support-escalations/issues/8380

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-20 15:27:01 -05:00
Matias Bordese
3b90c6544b
Avoid msg_too_long errors when posting/updating slack resolution note (#3372) 2023-11-20 12:17:07 +00:00
Matias Bordese
eb849678a6
Update slack user group update not to retry on some errors (#3363) 2023-11-16 13:41:42 +00:00
Matias Bordese
e1e56fc414
Truncate resolution note text in slack message to satisfy block limits (#3351)
This should help with some retrying tasks.
2023-11-16 13:15:04 +00:00
Vadim Stepanov
456829f768
Pass all integration labels down to alert groups (#3302)
Reverts grafana/oncall#3301
2023-11-08 14:04:58 +00:00
Matias Bordese
ac01dd173d
Improve user permissions query (#3291)
The query for checking a user permission (used to get users from a Slack
usergroup, for example) is timing out (and generating retries, besides
affecting some use cases:
[logs](https://ops.grafana-ops.net/explore?panes=%7B%22FCQ%22:%7B%22datasource%22:%22c-R8UWvVk%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22amixr-prod%5C%22,%20cluster%3D%5C%22prod-us-central-0%5C%22%7D%20%7C%3D%20%5C%22Timeout%20exceeded%20in%20regular%20expression%20match.%5C%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22c-R8UWvVk%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1)):

`django.db.utils.OperationalError: (3699, 'Timeout exceeded in regular
expression match.')`

Change to a `contains` query except for SQLite (not supported), where a
simplified version of the original regex query is used.
2023-11-07 16:58:16 +00:00
Joey Orlando
2cbb20601e
Improve performance of GET /users and GET /teams endpoints used by add responders popup (#3241)
# What this PR does

- Improve performance of the specific `GET /users` and `GET /teams`
calls that're made by the Add Responders dropdown in the UI
- Add `GET /team/{teamId}` internal API route (needed by Grafana
Incident team for their Add Responders changes)
- Some UI improvements to the Add Responders popup (loading state +
pre-fetch users and teams when the drawer is opened)
- Re-enable django-admin only if `settings.SILK_PROFILER_ENABLED ==
True` (need to be able to log into django admin to auth to silk routes)

Closes #3231 
Closes https://github.com/grafana/oncall-private/issues/2252

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-11-03 12:40:54 -04:00
Joey Orlando
697248dc75
Add responders improvements (#3128)
# What this PR does

https://www.loom.com/share/c5e10b5ec51343d0954c6f41cfd6a5fb

## Summary of backend changes
- Add `AlertReceiveChannel.get_orgs_direct_paging_integrations` method
and `AlertReceiveChannel.is_contactable` property. These are needed to
be able to (optionally) filter down teams, in the `GET /teams` internal
API endpoint
([here](https://github.com/grafana/oncall/pull/3128/files#diff-a4bd76e557f7e11dafb28a52c1034c075028c693b3c12d702d53c07fc6f24c05R55-R63)),
to just teams that have a "contactable" Direct Paging integration
- `engine/apps/alerts/paging.py`
- update these functions to support new UX. In short `direct_paging` no
longer takes a list of `ScheduleNotifications` or an `EscalationChain`
object
  - add `user_is_oncall` helper function
- add `_construct_title` helper function. In short if no `title` is
provided, which is the case for Direct Pages originating from OnCall
(either UI or Slack), then the format is `f"{from_user.username} is
paging <team.name (if team is specified> <comma separated list of
user.usernames> to join escalation"`
- `engine/apps/api/serializers/team.py` - add
`number_of_users_currently_oncall` attribute to response schema
([code](https://github.com/grafana/oncall/pull/3128/files#diff-26af48f796c9e987a76447586dd0f92349783d6ea6a0b6039a2f0f28bd58c2ebR45-R52))
- `engine/apps/api/serializers/user.py` - add `is_currently_oncall`
attribute to response schema
([code](https://github.com/grafana/oncall/pull/3128/files#diff-6744b5544ebb120437af98a996da5ad7d48ee1139a6112c7e3904010ab98f232R157-R162))
- `engine/apps/api/views/team.py` - add support for two new optional
query params `only_include_notifiable_teams` and `include_no_team`
([code](https://github.com/grafana/oncall/pull/3128/files#diff-a4bd76e557f7e11dafb28a52c1034c075028c693b3c12d702d53c07fc6f24c05R55-R70))
- `engine/apps/api/views/user.py`
- in the `GET /users` internal API endpoint, when specifying the
`search` query param now also search on `teams__name`
([code](https://github.com/grafana/oncall/pull/3128/files#diff-30309629484ad28e6fe09816e1bd226226d652ea977b6f3b6775976c729bf4b5R223);
this is a new UX requirement)
- add support for a new optional query param, `is_currently_oncall`, to
allow filtering users based on.. whether they are currently on call or
not
([code](https://github.com/grafana/oncall/pull/3128/files#diff-30309629484ad28e6fe09816e1bd226226d652ea977b6f3b6775976c729bf4b5R272-R282))
- remove `check_availability` endpoint (no longer used with new UX; also
removed references in frontend code)
- `engine/apps/slack/scenarios/paging.py` and
`engine/apps/slack/scenarios/manage_responders.py` - update Slack
workflows to support new UX. Schedules are no longer a concept here.
When creating a new alert group via `/escalate` the user either
specifies a team and/or user(s) (they must specify at least one of the
two and validation is done here to check this). When adding responders
to an existing alert group it's simply a list of users that they can
add, no more schedules.
- add `Organization.slack_is_configured` and
`Organization.telegram_is_configured` properties. These are needed to
support [this new functionality
](https://github.com/grafana/oncall/pull/3128/files#diff-9d96504027309f2bd1e95352bac1433b09b60eb4fafb611b52a6c15ed16cbc48R271-R272)
in the `AlertReceiveChannel` model.

## Summary of frontend changes
- Refactor/rename `EscalationVariants` component to `AddResponders` +
remove `grafana-plugin/src/containers/UserWarningModal` (no longer
needed with new UX)
- Remove `grafana-plugin/src/models/user.ts` as it seemed to be a
duplicate of `grafana-plugin/src/models/user/user.types.ts`

Related to https://github.com/grafana/incident/issues/4278

- Closes #3115
- Closes #3116
- Closes #3117
- Closes #3118 
- Closes #3177 

## TODO
- [x] make frontend changes
- [x] update Slack backend functionality
- [x] update public documentation
- [x] add/update e2e tests

## Post-deploy To-dos
- [ ] update dev/ops/production Slack bots to update `/escalate` command
description (should now say "Direct page a team or user(s)")

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-10-27 12:12:07 -04:00
Yulya Artyukhina
f239fd7798
Quickfix for getting alert group from slack message payload (#3195)
# What this PR does

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2217

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-10-25 16:32:55 +00:00
Matias Bordese
848bd1277f
Handle None role when syncing users from Grafana (#3147)
Fixes https://github.com/grafana/oncall-private/issues/2201
2023-10-19 17:39:08 +00:00
Vadim Stepanov
8b2212c7dc
Improve Slack error handling (#3000)
# What this PR does

- Rename `SlackClientWithErrorHandling` to just `SlackClient`
- Add more error classes + improve the way errors are raised based on
the Slack error code
- Add API call retries on Slack server errors (e.g. when Slack returns
`5xx` errors)
- Refactor some methods working with Slack API + add tests

## Which issue(s) this PR fixes

- https://github.com/grafana/oncall-private/issues/1837
- https://github.com/grafana/oncall-private/issues/1840
- https://github.com/grafana/oncall-private/issues/1842

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-09-12 09:49:16 +00:00
Joey Orlando
4b0bb86ce4
Notify user when their shift swap request is taken (#2992)
# What this PR does

Closes #2868

**Slack thread message**
<img width="442" alt="Screenshot 2023-09-07 at 15 47 30"
src="https://github.com/grafana/oncall/assets/9406895/f8f39341-4d18-4a43-88be-066993275fcd">

**Push notification**
Clicking on the push notification goes to the SSR detail view

<img width="423" alt="Screenshot 2023-09-07 at 15 48 59"
src="https://github.com/grafana/oncall/assets/9406895/5bb0fbf3-3e55-47e3-bf24-9cb5690dc17c">


## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-09-07 14:59:54 +00:00
Vadim Stepanov
0d7352a17b
Fix handling Slack rate limits (#2991)
## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/2156

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-09-07 11:25:29 +00:00