Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@contextlib.contextmanager
def fake_admin(event):
with rolledback_transaction():
event.is_public = True
event.live = True
event.custom_domain = None
event.feature_flags['show_schedule'] = True
event.save()
Expand Down
4 changes: 2 additions & 2 deletions app/eventyay/agenda/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def is_agenda_visible(user, event):
return bool(
event
and event.is_public
and event.live
and event.get_feature_flag("show_schedule")
and event.current_schedule
)
Expand All @@ -27,7 +27,7 @@ def has_agenda(user, event):
def are_featured_submissions_visible(user, event):
if (
not event
or not event.is_public
or not event.live
or event.get_feature_flag("show_featured") == "never"
):
return False
Expand Down
4 changes: 2 additions & 2 deletions app/eventyay/agenda/views/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def widget_js_etag(request, event, **kwargs):
return WIDGET_JS_CHECKSUM


def is_public_and_versioned(request, event, version=None):
def is_live_and_versioned(request, event, version=None):
if version and version == 'wip':
# We never cache the wip schedule
return False
Expand All @@ -52,7 +52,7 @@ def version_prefix(request, event, version=None):
@conditional_cache_page(
60,
key_prefix=version_prefix,
condition=is_public_and_versioned,
condition=is_live_and_versioned,
server_timeout=5 * 60,
headers={
'Access-Control-Allow-Headers': 'authorization,content-type',
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/cfp/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@rules.predicate
def is_event_visible(user, event):
return event and event.is_public
return event and event.live


@rules.predicate
Expand Down
4 changes: 2 additions & 2 deletions app/eventyay/cfp/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class LoginView(GenericLoginView):
template_name = 'cfp/event/login.html'

def dispatch(self, request, *args, **kwargs):
if not request.event.is_public:
logger.info('Event %s is not public. Blocking access.', request.event.slug)
if not request.event.live:
logger.info('Event %s is not live. Blocking access.', request.event.slug)
raise Http404()
return super().dispatch(request, *args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/common/middleware/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def process_request(self, request):
).order_by('-date_from')
if events:
request.uses_custom_domain = True
public_event = events.filter(is_public=True).first()
public_event = events.filter(live=True).first()
if public_event:
return redirect(public_event.urls.base.full())
# This domain is configured for an event, but does not have a public event
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/common/templates/common/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<img src="{{ request.event.header_image.url }}" id="header-image" alt="{{ request.event.name }}">
{% endif %}
</div>
{% if request.event and not request.event.is_public and not is_html_export %}
{% if request.event and not request.event.live and not is_html_export %}
<div id="event-nonpublic" class="d-print-none">
<i class="fa fa-user-secret"></i>
{% blocktranslate trimmed %}
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/event/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def _is_in_preparation(event):
return not event.is_public and now() <= event.date_from
return not event.live and now() <= event.date_from


def _is_cfp_open(event):
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/orga/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def orga_events(request):
context['html_head'] = ''.join(collect_signal(html_head, {'sender': request.event, 'request': request}))

if (
not request.event.is_public
not request.event.live
and request.event.custom_domain
and request.user.has_perm('base.view_event', request.event)
):
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/orga/templates/orga/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<ul class="navbar-nav mr-auto flip">
{% if request.event %}
<li class="nav-item">
{% if request.event.custom_domain and not request.event.is_public %}
{% if request.event.custom_domain and not request.event.live %}
<form action="{{ request.event.urls.auth.full }}"
method="post"
target="_blank"
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/orga/templates/orga/event/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h2>
<div class="dashboard-live-text">
{% translate "Your event is currently" %}
</div>
{% if request.event.is_public %}
{% if request.event.live %}
<div class="dashboard-live text-success">
<i class="fa fa-check-circle"></i>
{% translate "live" %}
Expand Down
8 changes: 4 additions & 4 deletions app/eventyay/orga/templates/orga/event/live.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

{% load i18n %}

{% block extra_title %}{% if request.event.is_public %}{% translate "Deactivate event" %}{% else %}{% translate "Go live" %}{% endif %} :: {% endblock extra_title %}
{% block extra_title %}{% if request.event.live %}{% translate "Deactivate event" %}{% else %}{% translate "Go live" %}{% endif %} :: {% endblock extra_title %}

{% block content %}
<h2>
{% if request.event.is_public %}
{% if request.event.live %}
{% translate "Deactivate event" %}
{% else %}
{% translate "Go live" %}
{% endif %}
</h2>

{% if request.event.is_public %}
{% if request.event.live %}
{% blocktranslate trimmed %}
Your event is currently live and publicly visible.
If you take it down, it will only be visible to you and your team.
Expand Down Expand Up @@ -54,7 +54,7 @@ <h4>{% translate "There may be easy ways to improve your event before its releas
<span></span>
<form method="post">
{% csrf_token %}
{% if request.event.is_public %}
{% if request.event.live %}
<button class="btn btn-lg btn-danger" type="submit" name="action" value="deactivate">{% translate "Go offline" %}</button>
{% else %}
<button class="btn btn-lg btn-success" type="submit" name="action" value="activate">{% translate "Go live" %}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ <h2 class="name">{{ event.name }}</h2>
{% translate "No proposals yet" %}
{% endif %}
</a>
<a href="{{ event.orga_urls.base }}" class="dashboard-block-addon dashboard-block-addon-{% if event.is_public %}success{% else %}secondary{% endif %}">
{% if event.is_public %}
<a href="{{ event.orga_urls.base }}" class="dashboard-block-addon dashboard-block-addon-{% if event.live %}success{% else %}secondary{% endif %}">
{% if event.live %}
<div class="state active">{% translate "live" %}</div>
{% else %}
<div class="state inactive">{% translate "Not public" %}</div>
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/orga/templates/orga/settings/widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h2>{% translate "Widget generation" %}</h2>
</p>
</div>

{% if request.event.is_public and request.event|get_feature_flag:"show_schedule" and request.event.current_schedule and not request.event.custom_domain %}
{% if request.event.live and request.event|get_feature_flag:"show_schedule" and request.event.current_schedule and not request.event.custom_domain %}
<div class="mw-100">
<h2>{% translate "Widget preview" %}</h2>
<p>
Expand Down
8 changes: 4 additions & 4 deletions app/eventyay/orga/views/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def post(self, request, *args, **kwargs):
event = request.event
action = request.POST.get('action')
if action == 'activate':
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (code-quality): We've found these issues:

if event.is_public:
if event.live:
messages.success(request, _('This event was already live.'))
else:
responses = activate_event.send_robust(event, request=request)
Expand All @@ -201,7 +201,7 @@ def post(self, request, *args, **kwargs):
mark_safe('\n'.join(render_markdown(e) for e in exceptions)),
)
else:
event.is_public = True
event.live = True
event.save()
event.log_action(
'eventyay.event.activate',
Expand All @@ -214,10 +214,10 @@ def post(self, request, *args, **kwargs):
if isinstance(response[1], str):
messages.success(request, response[1])
else: # action == 'deactivate'
if not event.is_public:
if not event.live:
messages.success(request, _('This event was already hidden.'))
else:
event.is_public = False
event.live = False
event.save()
event.log_action(
'eventyay.event.deactivate',
Expand Down
2 changes: 1 addition & 1 deletion app/eventyay/talk_rules/agenda.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def is_submission_visible_via_schedule(user, submission):
@rules.predicate
def is_agenda_visible(user, event):
event = event.event
return bool(event and event.is_public and event.get_feature_flag('show_schedule') and event.current_schedule)
return bool(event and event.live and event.get_feature_flag('show_schedule') and event.current_schedule)


can_view_schedule = is_agenda_visible | orga_can_change_submissions | (is_reviewer & can_view_speaker_names)
Expand Down
6 changes: 3 additions & 3 deletions app/eventyay/talk_rules/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

@rules.predicate
def is_event_visible(user, event):
return event and event.is_public
return event and event.live


def get_events_for_user(user, queryset=None):
from eventyay.base.models import Event

queryset = queryset or Event.objects.all()
if user.is_anonymous:
queryset = queryset.filter(is_public=True)
queryset = queryset.filter(live=True)
else:
events = user.get_events_with_any_permission().values_list('pk', flat=True)
queryset = queryset.filter(Q(is_public=True) | Q(pk__in=events))
queryset = queryset.filter(Q(live=True) | Q(pk__in=events))
return queryset.order_by('-date_from')


Expand Down
4 changes: 2 additions & 2 deletions app/eventyay/talk_rules/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def orga_can_change_submissions(user, obj):
@rules.predicate
def is_cfp_open(user, obj):
event = getattr(obj, 'event', None)
return event and event.is_public and event.cfp.is_open
return event and event.live and event.cfp.is_open


@rules.predicate
def are_featured_submissions_visible(user, event):
from eventyay.talk_rules.agenda import is_agenda_visible

show_featured = event.get_feature_flag('show_featured')
if not event.is_public or show_featured == 'never':
if not event.live or show_featured == 'never':
return False
if show_featured == 'always':
return True
Expand Down
2 changes: 1 addition & 1 deletion talk/src/pretalx/api/serializers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Meta:
fields = [
"name",
"slug",
"is_public",
"live",
"date_from",
"date_to",
"timezone",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def build_event(self, end_stage, slug):
name="DemoCon",
slug=slug,
organiser=organiser,
is_public=True,
live=True,
date_from=event_start.date(),
date_to=event_start.date() + dt.timedelta(days=2),
timezone="Europe/Berlin",
Expand Down
6 changes: 3 additions & 3 deletions talk/src/tests/agenda/test_agenda_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@pytest.mark.django_db
@pytest.mark.parametrize(
"is_public,show_schedule,has_schedule,result",
"live,show_schedule,has_schedule,result",
(
(True, True, True, True),
(True, True, False, False),
Expand All @@ -16,10 +16,10 @@
),
)
def test_agenda_permission_is_agenda_visible(
is_public, show_schedule, has_schedule, result, event
live, show_schedule, has_schedule, result, event
):
with scope(event=event):
event.is_public = is_public
event.live = live
event.feature_flags["show_schedule"] = show_schedule
event.save()
if has_schedule:
Expand Down
6 changes: 3 additions & 3 deletions talk/src/tests/agenda/test_agenda_schedule_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_schedule_single_ical_export(slot, client, django_assert_max_num_queries
def test_schedule_export_nonpublic(
exporter, slot, client, django_assert_max_num_queries
):
slot.submission.event.is_public = False
slot.submission.event.live = False
slot.submission.event.save()
exporter = "feed" if exporter == "feed" else f"export.{exporter}"

Expand Down Expand Up @@ -461,7 +461,7 @@ def test_html_export_full(
)

event.primary_color = "#111111"
event.is_public = False
event.live = False
event.save()
other_event.primary_color = "#222222"
other_event.save()
Expand Down Expand Up @@ -556,7 +556,7 @@ def test_html_export_full(
ics_path = settings.HTMLEXPORT_ROOT / f"test/test/talk/{slot.submission.code}.ics"
talk_ics = ics_path.read_text()
assert slot.submission.title in talk_ics
assert event.is_public is False
assert event.live is False

with django_assert_max_num_queries(33):
response = orga_client.get(
Expand Down
2 changes: 1 addition & 1 deletion talk/src/tests/agenda/views/test_agenda_talks.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_can_see_talk_does_accept_feedback(

@pytest.mark.django_db
def test_cannot_see_nonpublic_talk(client, django_assert_num_queries, event, slot):
event.is_public = False
event.live = False
event.save()
with django_assert_num_queries(10):
response = client.get(slot.submission.urls.public, follow=True)
Expand Down
6 changes: 3 additions & 3 deletions talk/src/tests/api/test_api_access_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def test_access_code_serializer(submission_type, event, track):
assert data["track"] == track.pk


@pytest.mark.parametrize("is_public", (True, False))
@pytest.mark.parametrize("live", (True, False))
@pytest.mark.django_db
def test_cannot_see_access_codes(client, event, is_public):
def test_cannot_see_access_codes(client, event, live):
with scope(event=event):
event.is_public = is_public
event.live = live
event.save()
response = client.get(event.api_urls.access_codes, follow=True)
assert response.status_code == 401
Expand Down
Loading