Fix too long declare incident link (#1342)

# What this PR does

## Which issue(s) this PR fixes
Issue with too long declare incident link in Slack

## Checklist

- [x] `CHANGELOG.md` updated
This commit is contained in:
Yulya Artyukhina 2023-02-20 11:42:44 +01:00 committed by GitHub
parent ca987efd55
commit 058665b8a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed too long declare incident link in Slack
## v1.1.24 (2023-02-16)
### Added

View file

@ -480,6 +480,7 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
incident_link = urljoin(self.channel.organization.grafana_url, "a/grafana-incident-app/incidents/declare/")
caption = urllib.parse.quote_plus("OnCall Alert Group")
title = urllib.parse.quote_plus(self.web_title_cache) if self.web_title_cache else DEFAULT_BACKUP_TITLE
title = title[:2000] # set max title length to avoid exceptions with too long declare incident link
link = urllib.parse.quote_plus(self.web_link)
return urljoin(incident_link, f"?caption={caption}&url={link}&title={title}")