Skip to content
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

Add online video link to menu #150

Merged
merged 15 commits into from
Sep 29, 2024
Merged

Conversation

lcduong
Copy link
Contributor

@lcduong lcduong commented Jul 29, 2024

This PR closes/references issue #133. It does so by

  • Have form in event setting to configure link video.

How has this been tested?

Checklist

  • I have added tests to cover my changes.

Summary by Sourcery

This pull request introduces a new feature allowing event organizers to add an online video link in the event settings. The video link, if configured, will be displayed in the event menu for easy access.

  • New Features:
    • Added a new field in the event settings form to configure an online video link.
  • Enhancements:
    • Updated the event menu to display the configured online video link if available.

Copy link

sourcery-ai bot commented Jul 29, 2024

Reviewer's Guide by Sourcery

This pull request adds a new 'video_link' field to the event settings form, allowing organizers to configure an online video link. This link will be displayed as a button in the event menu if set.

File-Level Changes

Files Changes
src/pretalx/orga/forms/event.py
src/pretalx/orga/templates/orga/settings/form.html
Added a new 'video_link' field to the event settings form and included it in the display settings.
src/pretalx/agenda/templates/agenda/header_row.html Added a button to the event menu to link to the online video if 'video_link' is set.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@lcduong
Copy link
Contributor Author

lcduong commented Jul 29, 2024

Video url in event setting

image

Video button on talk menu

image

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lcduong - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding more context to the PR description about the feature and its intended use.
  • While not necessary for this PR, consider adding unit tests for this feature in the future to ensure its functionality is maintained.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -18,6 +18,11 @@
<i class="fa fa-group"></i> {% translate "Tickets" %}
</a>
{% endif %}
{% if request.event.display_settings.video_link %}
<a href="{{ request.event.display_settings.video_link }}" target="_blank" class="btn btn-outline-success">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Enhance security for external link and improve accessibility

Consider adding rel="noopener noreferrer" to the link for security when opening in a new tab. Also, you might want to use a more specific label like "Live Stream" or "Video Stream" for better clarity.

Suggested change
<a href="{{ request.event.display_settings.video_link }}" target="_blank" class="btn btn-outline-success">
<a href="{{ request.event.display_settings.video_link }}" target="_blank" rel="noopener noreferrer" class="btn btn-outline-success">
<i class="fa fa-video-camera"></i> {% translate "Video Stream" %}
</a>

@@ -18,6 +18,11 @@
<i class="fa fa-group"></i> {% translate "Tickets" %}
</a>
{% endif %}
{% if request.event.display_settings.video_link %}
<a href="{{ request.event.display_settings.video_link }}" target="_blank" class="btn btn-outline-success">
<i class="fa fa-video-camera"></i> {% translate "Videos" %}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider using a more modern Font Awesome icon

If you're using a recent version of Font Awesome, you might want to use 'fa-video' instead of 'fa-video-camera' for a more modern look.

Suggested change
<i class="fa fa-video-camera"></i> {% translate "Videos" %}
<i class="fa fa-video"></i> {% translate "Videos" %}

@@ -120,6 +120,16 @@ class EventForm(ReadOnlyFlag, I18nHelpText, JsonSubfieldMixin, I18nModelForm):
}),
required=False,
)
video_link = forms.URLField(
Copy link

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 URL field definitions to reduce redundancy and improve maintainability.

The new code introduces some complexity and redundancy by adding a video_link field that is very similar to the existing ticket_link field. This can lead to maintenance issues and makes the form definition longer and harder to read. To improve maintainability and readability, consider refactoring the code to use a common method for defining URL fields. Here's an example:

def create_url_field(label, help_text, placeholder):
    return forms.URLField(
        label=label,
        help_text=help_text,
        widget=forms.TextInput(attrs={'placeholder': placeholder}),
        required=False,
    )

class EventForm(forms.Form):
    ticket_link = create_url_field(
        label=_("Event ticket shop URL"),
        help_text=_("Ticket shop link will be shown on event menu."),
        placeholder='e.g: https://tickets-dev.eventyay.com/2024/wikimania/'
    )
    video_link = create_url_field(
        label=_("Video Live URL"),
        help_text=_("Online video link will be shown on event menu."),
        placeholder='e.g: https://wikimania-live.eventyay.com/'
    )
    header_pattern = forms.ChoiceField(
        label=_("Frontpage header pattern"),
        help_text=_(
            "Choose how the frontpage header banner will be styled if you don’t upload an image. Pattern source: "
            '<a href="http://www.heropatterns.com/">heropatterns.com</a>, CC BY 4.0.'
        ),
        choices=(
            # Add your choices here
        ),
        required=False,
    )

    json_fields = {
        "imprint_url": "display_settings",
        "show_schedule": "feature_flags",
        "schedule": "display_settings",
        "show_featured": "feature_flags",
        "use_feedback": "feature_flags",
        "export_html_on_release": "feature_flags",
        "html_export_url": "display_settings",
        "ticket_link": "display_settings",
        "video_link": "display_settings",
        "header_pattern": "display_settings",
        "meta_noindex": "display_settings",
    }

This refactoring reduces redundancy and makes the code easier to maintain.

@odkhang
Copy link
Collaborator

odkhang commented Aug 6, 2024

image

popup if customer not order ticket or not login yet.

configuration need for this feature to working

  1. eventyay-video plugin need to be installed.
  2. join_url, secret, issuer, audience of eventyay-video plugin need to be fullfilled
  3. Ticket shop url in event setting need to fullfilled

image

@mariobehling
Copy link
Member

@odkhang @lcduong Is this already working in the way that the token to access the online video is included here and working? Could you resolve the conflicts, please?

@mariobehling mariobehling merged commit 7c659da into fossasia:development Sep 29, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants