-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send out emails: URL hardcoded for join event #406
base: development
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request makes several code style and formatting changes to improve consistency and readability across multiple Python files in the project. The changes primarily involve updating import statements, reformatting code to comply with PEP 8 guidelines, and reorganizing some function definitions. There are no significant functional changes to the codebase. Class diagram for SendGridEmail classclassDiagram
class SendGridEmail {
- api_key: str
+ __init__(api_key)
+ test(from_addr)
+ bytes_to_base64_string(value: bytes) str
+ build_attachment(input)
+ send_messages(emails)
}
Class diagram for TemplateBasedMailRenderer classclassDiagram
class TemplateBasedMailRenderer {
+ template_name()
+ render(plain_body: str, plain_signature: str, subject: str, order, position) str
}
Class diagram for ClassicMailRenderer and UnembellishedMailRenderer classesclassDiagram
TemplateBasedMailRenderer <|-- ClassicMailRenderer
TemplateBasedMailRenderer <|-- UnembellishedMailRenderer
class ClassicMailRenderer {
+ verbose_name: str = "Default"
+ identifier: str = "classic"
+ thumbnail_filename: str = "pretixbase/email/thumb.png"
+ template_name: str = "pretixbase/email/plainwrapper.html"
}
class UnembellishedMailRenderer {
+ verbose_name: str = "Simple with logo"
+ identifier: str = "simple_logo"
+ thumbnail_filename: str = "pretixbase/email/thumb_simple_logo.png"
+ template_name: str = "pretixbase/email/simple_logo.html"
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @odkhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- While the code formatting improvements are welcome, please separate formatting changes from functional changes in future pull requests. This makes it easier for reviewers to focus on the important parts. The functional changes (like the new
generate_sample_video_url()
function) look good, but were hard to spot among the formatting changes.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -127,11 +131,17 @@ def _save_decoupled(self, form): | |||
self.request.event.settings.set(f, self.request.event.settings.get(f)) | |||
|
|||
|
|||
class EventUpdate(DecoupleMixin, EventSettingsViewMixin, EventPermissionRequiredMixin, MetaDataEditorMixin, UpdateView): | |||
class EventUpdate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider refactoring the EventUpdate and EventPlugins classes to improve code organization and readability.
The EventUpdate class has grown in complexity, particularly in the get_context_data and form_valid methods. Consider refactoring these methods to improve readability and maintainability:
- Extract logic from form_valid into helper methods:
class EventUpdate(DecoupleMixin, EventSettingsViewMixin, EventPermissionRequiredMixin, MetaDataEditorMixin, UpdateView):
# ... existing code ...
def form_valid(self, form):
self._save_form_data(form)
self._handle_formsets()
self._log_changes(form)
self._handle_css_regeneration(form)
return super().form_valid(form)
def _save_form_data(self, form):
self._save_decoupled(self.sform)
self.sform.save()
self.save_meta()
def _handle_formsets(self):
self.save_item_meta_property_formset(self.object)
self.save_confirm_texts_formset(self.object)
self.save_footer_links_formset(self.object)
def _log_changes(self, form):
# ... logging logic ...
def _handle_css_regeneration(self, form):
# ... CSS regeneration logic ...
- In the EventPlugins class, simplify the get_context_data method by extracting the plugin sorting and grouping logic:
class EventPlugins(EventSettingsViewMixin, EventPermissionRequiredMixin, TemplateView, SingleObjectMixin):
# ... existing code ...
def get_context_data(self, *args, **kwargs) -> dict:
context = super().get_context_data(*args, **kwargs)
context["plugins"] = self._get_sorted_grouped_plugins()
context["plugins_active"] = self.object.get_plugins()
context["show_meta"] = settings.PRETIX_PLUGINS_SHOW_META
return context
def _get_sorted_grouped_plugins(self):
plugins = self._get_visible_plugins()
grouped_plugins = self._group_plugins_by_category(plugins)
return self._sort_grouped_plugins(grouped_plugins)
def _get_visible_plugins(self):
return [p for p in get_all_plugins(self.object) if not p.name.startswith(".") and getattr(p, "visible", True)]
def _group_plugins_by_category(self, plugins):
# ... grouping logic ...
def _sort_grouped_plugins(self, grouped_plugins):
# ... sorting logic ...
These refactorings will improve code organization and make it easier to understand and maintain the complex logic in these classes.
This PR related to issue #362
Instead of hardcoded video domain, using current video domain, testing other place holder in email settings
Summary by Sourcery
Enhancements: