Browse Source

feat(workflow): Remove alert-rule-status-page checks (#33564)

Scott Cooper 2 years ago
parent
commit
9377cf3128

+ 0 - 4
src/sentry/notifications/notifications/digest.py

@@ -4,7 +4,6 @@ import logging
 from collections import defaultdict
 from typing import TYPE_CHECKING, Any, Mapping, MutableMapping, Sequence
 
-from sentry import features
 from sentry.db.models import Model
 from sentry.digests import Digest
 from sentry.digests.utils import (
@@ -104,9 +103,6 @@ class DigestNotification(ProjectNotification):
             "has_alert_integration": has_alert_integration(project),
             "project": project,
             "slack_link": get_integration_link(organization, "slack"),
-            "alert_status_page_enabled": features.has(
-                "organizations:alert-rule-status-page", project.organization
-            ),
             "rules_details": {rule.id: rule for rule in rule_details},
             "link_params_for_rule": get_email_link_extra_params(
                 "digest_email", None, rule_details, alert_timestamp

+ 0 - 5
src/sentry/notifications/notifications/rules.py

@@ -5,7 +5,6 @@ from typing import Any, Iterable, Mapping, MutableMapping
 
 import pytz
 
-from sentry import features
 from sentry.db.models import Model
 from sentry.models import Team, User, UserOption
 from sentry.notifications.notifications.base import ProjectNotification
@@ -87,9 +86,6 @@ class AlertRuleNotification(ProjectNotification):
     def get_context(self) -> MutableMapping[str, Any]:
         environment = self.event.get_tag("environment")
         enhanced_privacy = self.organization.flags.enhanced_privacy
-        alert_status_page_enabled = features.has(
-            "organizations:alert-rule-status-page", self.project.organization
-        )
         rule_details = get_rules(self.rules, self.organization, self.project)
         context = {
             "project_label": self.project.get_full_name(),
@@ -103,7 +99,6 @@ class AlertRuleNotification(ProjectNotification):
             "environment": environment,
             "slack_link": get_integration_link(self.organization, "slack"),
             "has_alert_integration": has_alert_integration(self.project),
-            "alert_status_page_enabled": alert_status_page_enabled,
         }
 
         # if the organization has enabled enhanced privacy controls we don't send

+ 3 - 7
src/sentry/templates/sentry/emails/digests/body.html

@@ -32,13 +32,9 @@
 
     <div class="rule">
       <div class="container">
-        {% if alert_status_page_enabled %}
-            {% with rule_details=rules_details|get_item:rule.id %}
-                You’re receiving this email because you’re subscribed to notifications for <a href="{% absolute_uri rule_details.status_url %}">{{ rule_details.label }}</a>
-            {% endwith %}
-        {% else %}
-            {{ rule.label }}
-        {% endif %}
+        {% with rule_details=rules_details|get_item:rule.id %}
+            You’re receiving this email because you’re subscribed to notifications for <a href="{% absolute_uri rule_details.status_url %}">{{ rule_details.label }}</a>
+        {% endwith %}
       </div>
     </div>
 

+ 12 - 17
src/sentry/templates/sentry/emails/error.html

@@ -68,15 +68,12 @@
         {% if environment %} in {{ environment }}{% endif %}
     </h2>
 
-    {% if rules and alert_status_page_enabled %}
-        <p class="via">
-            You’re receiving this email because you’re subscribed to notifications for:
-            {% for rule in rules %}
-                <a href="{% absolute_uri rule.status_url %}">{{ rule.label }}</a>{% if not forloop.last %}, {% endif %}
-            {% endfor %}
-        </p>
-    {% endif %}
-
+    <p class="via">
+        You’re receiving this email because you’re subscribed to notifications for:
+        {% for rule in rules %}
+            <a href="{% absolute_uri rule.status_url %}">{{ rule.label }}</a>{% if not forloop.last %}, {% endif %}
+        {% endfor %}
+    </p>
 
     {% if enhanced_privacy %}
       <div class="event">
@@ -205,14 +202,12 @@
       {% endif %}
     {% endif %}
 
-    {% if rules and not alert_status_page_enabled %}
-        <p class="via">
-            You are receiving this email due to matching rules:
-            {% for rule in rules %}
-                <a href="{% absolute_uri rule.url %}">{{ rule.label }}</a>{% if not forloop.last %}, {% endif %}
-            {% endfor %}
-        </p>
-    {% endif %}
+    <p class="via">
+        You are receiving this email due to matching rules:
+        {% for rule in rules %}
+            <a href="{% absolute_uri rule.url %}">{{ rule.label }}</a>{% if not forloop.last %}, {% endif %}
+        {% endfor %}
+    </p>
 
     {% if not has_integrations %}
         <div class="logo-container">

+ 1 - 2
src/sentry/web/frontend/debug/mail.py

@@ -18,7 +18,7 @@ from django.views.generic import View
 from rest_framework.request import Request
 from rest_framework.response import Response
 
-from sentry import eventstore, features
+from sentry import eventstore
 from sentry.app import tsdb
 from sentry.constants import LOG_LEVELS
 from sentry.digests import Record
@@ -293,7 +293,6 @@ def alert(request):
             "interfaces": interface_list,
             "tags": event.tags,
             "project_label": project.slug,
-            "alert_status_page_enabled": features.has("organizations:alert-rule-status-page", org),
             "commits": [
                 {
                     # TODO(dcramer): change to use serializer

+ 6 - 11
static/app/views/alerts/details/index.tsx

@@ -1,7 +1,6 @@
 import {cloneElement, isValidElement} from 'react';
 import type {RouteComponentProps} from 'react-router';
 
-import Feature from 'sentry/components/acl/feature';
 import LoadingIndicator from 'sentry/components/loadingIndicator';
 import useOrganization from 'sentry/utils/useOrganization';
 import useProjects from 'sentry/utils/useProjects';
@@ -20,16 +19,12 @@ function RuleDetailsContainer({children, params}: Props) {
     return <LoadingIndicator />;
   }
 
-  return (
-    <Feature organization={organization} features={['alert-rule-status-page']}>
-      {children && isValidElement(children)
-        ? cloneElement(children, {
-            organization,
-            project: projects[0],
-          })
-        : null}
-    </Feature>
-  );
+  return children && isValidElement(children)
+    ? cloneElement(children, {
+        organization,
+        project: projects[0],
+      })
+    : null;
 }
 
 export default RuleDetailsContainer;

+ 3 - 10
static/app/views/alerts/issueRuleEditor/index.tsx

@@ -272,16 +272,9 @@ class IssueRuleEditor extends AsyncView<Props, State> {
 
     metric.endTransaction({name: 'saveAlertRule'});
 
-    router.push(
-      organization.features.includes('alert-rule-status-page')
-        ? {
-            pathname: `/organizations/${organization.slug}/alerts/rules/${project.slug}/${rule.id}/details/`,
-          }
-        : {
-            pathname: `/organizations/${organization.slug}/alerts/rules/`,
-            query: {project: project.id},
-          }
-    );
+    router.push({
+      pathname: `/organizations/${organization.slug}/alerts/rules/${project.slug}/${rule.id}/details/`,
+    });
     addSuccessMessage(isNew ? t('Created alert rule') : t('Updated alert rule'));
   };
 

+ 0 - 2
static/app/views/alerts/rules/index.tsx

@@ -110,7 +110,6 @@ class AlertRulesList extends AsyncComponent<Props, State & AsyncComponent['state
     const {
       params: {orgId},
       location,
-      organization,
       router,
     } = this.props;
     const {loading, ruleList = [], ruleListPageLinks} = this.state;
@@ -229,7 +228,6 @@ class AlertRulesList extends AsyncComponent<Props, State & AsyncComponent['state
                         rule={rule}
                         orgId={orgId}
                         onDelete={this.handleDeleteRule}
-                        organization={organization}
                         userTeams={new Set(teams.map(team => team.id))}
                       />
                     ))

+ 6 - 14
static/app/views/alerts/rules/row.tsx

@@ -18,7 +18,7 @@ import {IconArrow, IconEllipsis} from 'sentry/icons';
 import {t, tct} from 'sentry/locale';
 import overflowEllipsis from 'sentry/styles/overflowEllipsis';
 import space from 'sentry/styles/space';
-import {Actor, Organization, Project} from 'sentry/types';
+import {Actor, Project} from 'sentry/types';
 import getDynamicText from 'sentry/utils/getDynamicText';
 import type {Color} from 'sentry/utils/theme';
 import {
@@ -32,7 +32,6 @@ import {isIssueAlert} from '../utils';
 type Props = {
   onDelete: (projectId: string, rule: CombinedMetricIssueAlerts) => void;
   orgId: string;
-  organization: Organization;
   projects: Project[];
   projectsLoaded: boolean;
   rule: CombinedMetricIssueAlerts;
@@ -49,7 +48,6 @@ const getProject = memoize((slug: string, projects: Project[]) =>
 
 function RuleListRow({
   rule,
-  organization,
   projectsLoaded,
   projects,
   orgId,
@@ -154,18 +152,12 @@ function RuleListRow({
     : null;
 
   const canEdit = ownerId ? userTeams.has(ownerId) : true;
-  const hasAlertRuleStatusPage = organization.features.includes('alert-rule-status-page');
-  // TODO(workflow): Refactor when removing alert-rule-status-page flag
   const alertLink = isIssueAlert(rule) ? (
-    hasAlertRuleStatusPage ? (
-      <Link
-        to={`/organizations/${orgId}/alerts/rules/${rule.projects[0]}/${rule.id}/details/`}
-      >
-        {rule.name}
-      </Link>
-    ) : (
-      rule.name
-    )
+    <Link
+      to={`/organizations/${orgId}/alerts/rules/${rule.projects[0]}/${rule.id}/details/`}
+    >
+      {rule.name}
+    </Link>
   ) : (
     <TitleLink to={isIssueAlert(rule) ? editLink : detailsLink}>{rule.name}</TitleLink>
   );

+ 6 - 10
tests/acceptance/test_organization_alert_rule_details.py

@@ -5,8 +5,6 @@ from django.utils import timezone
 from sentry.models import Rule, RuleFireHistory
 from sentry.testutils import AcceptanceTestCase, SnubaTestCase
 
-FEATURE_NAME = ["organizations:alert-rule-status-page"]
-
 
 class OrganizationAlertRuleDetailsTest(AcceptanceTestCase, SnubaTestCase):
     def setUp(self):
@@ -16,10 +14,9 @@ class OrganizationAlertRuleDetailsTest(AcceptanceTestCase, SnubaTestCase):
         self.path = f"/organizations/{self.organization.slug}/alerts/rules/{self.project.slug}/{self.rule.id}/details/"
 
     def test_empty_alert_rule_details(self):
-        with self.feature(FEATURE_NAME):
-            self.browser.get(self.path)
-            self.browser.wait_until_not('[data-test-id="loading-indicator"]')
-            self.browser.snapshot("alert rule details - empty state")
+        self.browser.get(self.path)
+        self.browser.wait_until_not('[data-test-id="loading-indicator"]')
+        self.browser.snapshot("alert rule details - empty state")
 
     def test_alert_rule_with_issues(self):
         group = self.create_group()
@@ -30,7 +27,6 @@ class OrganizationAlertRuleDetailsTest(AcceptanceTestCase, SnubaTestCase):
             date_added=timezone.now() - timedelta(days=1),
         )
 
-        with self.feature(FEATURE_NAME):
-            self.browser.get(self.path)
-            self.browser.wait_until_not('[data-test-id="loading-indicator"]')
-            self.browser.snapshot("alert rule details - issues")
+        self.browser.get(self.path)
+        self.browser.wait_until_not('[data-test-id="loading-indicator"]')
+        self.browser.snapshot("alert rule details - issues")

Some files were not shown because too many files changed in this diff