Vitor-Avila commented on code in PR #44992:
URL: https://github.com/apache/superset/pull/44992#discussion_r4191876377


##########
superset/commands/report/base.py:
##########
@@ -134,13 +148,33 @@ def _check_object_access(
                 raise ReportScheduleForbiddenError() from ex
         self._properties[kind] = obj
 
+    def requires_attachment(self) -> bool:
+        """Whether the effective schedule configuration requires attachment 
content."""
+        model = getattr(self, "_model", None)
+        report_type = self._properties.get(
+            "type", getattr(model, "type", ReportScheduleType.REPORT)
+        )
+        report_format = self._properties.get(
+            "report_format", getattr(model, "report_format", 
ReportDataFormat.PNG)
+        )
+        return report_type == ReportScheduleType.REPORT or (
+            report_format != ReportDataFormat.NONE
+            and bool(
+                ReportConfigDAO.get_effective_value(
+                    ReportConfigKey.ALERTS_ATTACH_REPORTS
+                )
+            )
+        )
+
     def validate_chart_dashboard(
         self, exceptions: list[ValidationError], update: bool = False
     ) -> None:
         """Validate chart or dashboard relation"""
         chart_id = self._properties.get("chart")
         dashboard_id = self._properties.get("dashboard")
         creation_method = self._properties.get("creation_method")
+        if not (requires_attachment := self.requires_attachment()):
+            return

Review Comment:
   Already addressed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to