Commit graph

159 commits

Author SHA1 Message Date
Vadim Stepanov
dc6fcf5c05
Add internal API fields for the mobile app (#910)
* add permalinks list to internal API alertgroup view

* add user's name and full avatar URL to the user view

* make avatar_full_url a property

* fix tests

* fix user connection criteria
2022-11-28 15:52:31 +00:00
Vadim Stepanov
54d14d1025
Move MobileAppAuthToken view to mobile_app (#902) 2022-11-28 12:50:58 +00:00
Innokentii Konstantinov
3b73522f5a
Fix saving source link template (#898)
* Add test for update integration templates

* Fix saving source link template
2022-11-24 16:26:12 +08:00
Vadim Stepanov
255964ceaf
Mobile app messaging backend (#874)
* move mobile notifications to a separate backend, remove critical notification

* remove outdated mobile app code

* MOBILE_APP_PUSH_NOTIFICATIONS_ENABLED -> FEATURE_MOBILE_APP_INTEGRATION_ENABLED

* create error log if no devices are set up

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* move mobile auth related code to the mobile_app Django app

* fix typing

* add GCMDevice todos

* add user connection capabilities

* add user connect/disconnect to the messaging backend

* move APNS endpoint to mobile_app Django app

* restore critical notifications

* support hackathon app

* tweak migrations so mobile app auth tokens are preserved

* reuse notify_by IDs

* use mobile app template to render push notification

* add GCM/FCM (Android) support

* fix unlink user

* logger.error -> logger.info
2022-11-23 15:56:43 +00:00
Joey Orlando
fd4877408a
remove grafana_plugin_management django app (#812)
* remove grafana_plugin_management django app

it seems to be no longer used or referenced. In addition apps.api.serializers.organization.PluginOrganizationSerializer was only
referenced from within grafana_plugin_management and is thereby safe
to remove.
2022-11-09 13:53:59 +01:00
Michael Derynck
fc78dd98da
Merge pull request #707 from grafana/add-region-to-organization
Add region info to organizations
2022-11-08 10:30:53 -07:00
Michael Derynck
f01d754851 Merge dev 2022-11-08 10:14:35 -07:00
Matias Bordese
a349d39f31 Enforce until on override shifts 2022-11-07 12:35:57 -03:00
Michael Derynck
25826690a8 Use common environment for templates 2022-11-05 00:31:51 -06:00
Maxim Mordasov
387b334d2a
Merge pull request #720 from grafana/matiasb/daily-shifts-by-day
Enable daily/by-day shifts option for web schedules
2022-11-04 14:23:09 +00:00
Michael Derynck
81702ba52d Merge dev 2022-11-03 12:42:36 -06:00
Michael Derynck
369a23551b Merge branch 'dev' into add-region-to-organization 2022-11-03 12:41:07 -06:00
Matias Bordese
b1a664df3b
Merge pull request #742 from grafana/matiasb/web-schedules-all-day-as-datetime
Update web schedule events to return all-day start/end as datetimes
2022-11-03 14:54:28 -03:00
Vadim Stepanov
e2456315af
Allow no-auth SMTP connection for email notifications (#759)
* DEFAULT_FROM_EMAIL -> EMAIL_FROM

* add EMAIL_FROM live setting

* EMAIL_FROM -> EMAIL_FROM_ADDRESS

* merge dev

* add test for get_from_email

* allow live settings to be null on internal API

* remove redundant tests
2022-11-03 16:18:37 +00:00
Matias Bordese
3e2d52ad51 Update web schedule events to return all-day as datetimes 2022-11-02 16:12:37 -03:00
Matias Bordese
98b187acd9 Add support for daily/by-day and custom interval 2022-11-02 16:12:16 -03:00
Matias Bordese
4bc3ed17a8 Make interval check more explicit 2022-11-02 16:12:16 -03:00
Matias Bordese
241283959a Enable daily/by-day shifts option for web schedules 2022-11-02 16:12:16 -03:00
Michael Derynck
a331a3f392 Rename to validate_settings 2022-11-01 18:24:44 -06:00
Michael Derynck
e019c70f67 Handle validation on update, remove redundant get_error call 2022-11-01 18:22:50 -06:00
Michael Derynck
2905423bad Merge dev 2022-11-01 17:56:03 -06:00
Matias Bordese
64570cc9fd Update schedules endpoint to filter by numeric type 2022-10-31 11:08:33 -03:00
Michael Derynck
cbde8cd680 Merge branch 'dev' into add-region-to-organization 2022-10-28 09:20:16 -06:00
Joey Orlando
5a4c3d6d77
remove POST /api/internal/v1/custom_buttons/{id}/action (#734)
* remove POST /api/internal/v1/custom_buttons/{id}/action
2022-10-28 10:44:37 +02:00
Michael Derynck
9d7c370752 Merge branch 'dev' into add-region-to-organization 2022-10-27 15:41:35 -06:00
Matias Bordese
565cb84bb1 Add optional type filter to internal schedules endpoint 2022-10-25 12:51:06 -03:00
Innokentii Konstantinov
2c6a27154f
Support mutliregion telegram (#676)
* Support mutliregion telegram

* Fix test_personal_message

* Fix tg verification code tests

* Simplify /start cmd handler

* Comment about link with org_id in tg msg
2022-10-25 14:53:07 +08:00
Michael Derynck
a3a0b22947 Merge branch 'dev' into add-region-to-organization 2022-10-24 09:14:30 -06:00
Matias Bordese
6439752949
Rewrite fallback condition for num escalation chains
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-20 12:57:59 -03:00
Matias Bordese
3d171f20f7 Defer large unused queryset fields when listing schedules 2022-10-19 17:07:06 -03:00
Matias Bordese
e4a7a5a23d Rework schedule escalation chains/policies count as a subquery 2022-10-19 17:07:06 -03:00
Michael Derynck
330f103844 Merge branch 'dev' into add-region-to-organization 2022-10-19 11:00:59 -06:00
Vadim Stepanov
e67d3519fe
Restore email notifications (#621)
* remove email verification related code

* remove email verification related code

* remove sendgrid callback

* remove sendgrid related code

* remove sendgrid related code

* rename sendgrid app to email

* remove email from built-in channels

* remove email from built-in channels

* remove email from built-in channels

* add email backend: https://github.com/grafana/oncall/pull/50

* add email templater

* add email templater

* convert md to html

* add email settings to live settings

* use task to send email, handle some exceptions to create logs

* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage

* add email limit logic

* fix tests

* add docs

* remove old email templates

* remove old email templates

* add template_fields to messaging backend

* add messaging backends templates to public api

* add comment for deprecated fields

* fix test

* fix tests

* disable email by default

* don't retry on SMTPException and TimeoutError

* add tests

* bring email back to public api docs

* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED

* make template_fields tuple

* build_subject_and_title -> build_subject_and_message

* add one more comment about template deprecation

* use 8 as backend id

* add comment about gaierror and BadHeaderError

* add comment on importing in notify_user_async

* edit oss docs
2022-10-19 12:32:56 +01:00
Ben Sully
e36757b293
Allow non-JSON custom webhook templates, provided they render as valid JSON (#639)
* Allow non-JSON custom webhook templates, provided they render as valid JSON

Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:

    {
      "labels": {{ alert_payload.labels | tojson }}
    }

even though this would be valid JSON after rendering.

This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as

    {
      "labels": {{ alert_payload.labels }}
    }

which would otherwise fail later if `labels` is not valid JSON.

This should resolve #638.

* Use defaultdict(str) instead of defaultdict(lambda: "")

* Add missing comment to resolution note validation code

* Update validation of resolution notes in public API, too

* Add extra test cases for JSON webhook templates endpoint of public API
2022-10-19 12:32:21 +01:00
Michael Derynck
0152c27f5e Re-validate all twilio settings when any change as they depend on each other 2022-10-18 16:05:49 -06:00
Michael Derynck
fa5d4f2674 Add region_slug column to organization 2022-10-11 12:04:33 -06:00
Matias Bordese
f378eab7b7 Allow enabling schedules alpha per organization 2022-10-05 14:06:42 -03:00
Matias Bordese
2a3fc397db Clear users cache before schedule tests logic/asserts 2022-10-03 15:00:23 -03:00
Matias Bordese
f8314ef9c2
Fix timing issue with schedule tests reusing cached users (#592)
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-03 11:37:59 +01:00
Rares Mardare
81df9c4838
Merge pull request #520 from grafana/472-wrong-team
472 wrong team
2022-09-29 14:59:52 +03:00
Joey Orlando
9f3f691ea4
Feat 549 - add telegram permalink to alert groups http response (#551)
* rename AlertGroup.permalink to slack_permalink

* add telegram key to alert_groups permalinks object in public API response
2022-09-28 16:59:57 +02:00
Rares Mardare
ea54d21b76 Merge branch 'dev' into 472-wrong-team 2022-09-26 13:34:46 +03:00
Maxim Mordasov
9330b89101
Schedules alpha fixes (#541)
* schedule alpha major fixes

* Fix shift update for web schedules

* Fix priority level regex, fix getting shifts without duration

* Fix shift update for web schedules

* Fix tests for shift update

* Fix priority level test

* schedule alpha fixes

* add final schedule click handler

* fix date time picker

* fix utc timzeonr time picker

* fix utc time data

* dont use user timezone on start

Co-authored-by: Julia <ferril.darkdiver@gmail.com>
2022-09-21 11:19:59 +01:00
Julia
aeb8de96a2 Update comment for wrong_team_response in UserView 2022-09-20 14:47:42 +03:00
Julia
c92faf23c6 Add tests for wrong team for user 2022-09-16 11:53:47 +03:00
Julia
4bcdcfa381 Wrong team error for user page 2022-09-16 11:52:38 +03:00
Julia
7d5636291a Wrong team error for integrations and escalation chains pages 2022-09-12 17:30:45 +03:00
Julia
e4ae10c678 Wrong team error for schedules and custom buttons, add flag to get object from the whole organization 2022-09-12 17:26:23 +03:00
Innokentii Konstantinov
3e8c7a24c8
Add hiding personal phone numbers (#411)
* Add hiding personal phone numbers

* Fix tests

* phone number toggler

* fixed issue where id was not set

* some improvement changes

* show toggle just for validated phone numbers

* ux changes + refactored PhoneVerification

* minor changes

* linter

* hide banner

* ux changes for phone verification

* make it full width

* linter

* show action only if phone is verified

* linter

* revert isCodeSent once phone is forgotten

* fix UserHiddenFieldsSerializer

* await for loadUser

* missing WithPermissions wrapper

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
Co-authored-by: Rares Mardare <40542072+teodosii@users.noreply.github.com>
2022-09-09 12:42:40 +05:00
Julia
67eb0b423d Merge branch 'dev' into on-call-shifts-rotation-index
# Conflicts:
#	engine/apps/schedules/models/on_call_schedule.py
2022-09-08 16:43:35 +03:00