Skip to content

Commit dfc5391

Browse files
authored
Merge branch 'enext' into 404-urls-fix
2 parents 01d71dc + 2770941 commit dfc5391

File tree

58 files changed

+212723
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+212723
-457
lines changed

app/eventyay/agenda/views/schedule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_text(self, request, **kwargs):
116116
result = draw_ascii_schedule(data, output_format=output_format)
117117
except StopIteration: # pragma: no cover
118118
result = draw_ascii_schedule(data, output_format='list')
119-
result += '\n\n 📆 powered by eventyay'
119+
result += '\n\n powered by eventyay'
120120
return HttpResponse(response_start + result, content_type='text/plain; charset=utf-8')
121121

122122
def dispatch(self, request, **kwargs):

app/eventyay/base/models/room.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,16 @@ def with_permission(
9292
# When our user has traits, this is automatically ensured by the ALL() statement, but when traits=[] we
9393
# need to do a special case check since "IN ()" is not valid SQL
9494
for i, role in enumerate(roles):
95-
if traits:
95+
if traits and len(traits) > 0:
9696
ext = ""
9797
ext_args = []
9898
if not allow_empty_traits:
9999
ext = " AND jsonb_array_length(trait_grants->%s) > 0"
100100
ext_args.append(role)
101101

102+
# Build IN clause with proper placeholders for each trait
103+
in_placeholders = ','.join(['%s'] * len(traits))
104+
102105
qs = qs.annotate(
103106
**{
104107
f"has_role_{i}": RawSQL(
@@ -108,17 +111,17 @@ def with_permission(
108111
TRUE = ALL(
109112
SELECT (
110113
CASE jsonb_typeof(d{i}.elem)
111-
WHEN 'array' THEN EXISTS(SELECT 1 FROM jsonb_array_elements(d{i}.elem) e{i}(elem) WHERE e{i}.elem#>>'{"{}"}' IN %s )
112-
ELSE d{i}.elem#>>'{"{}"}' IN %s
114+
WHEN 'array' THEN EXISTS(SELECT 1 FROM jsonb_array_elements(d{i}.elem) e{i}(elem) WHERE e{i}.elem#>>'{"{}"}' IN ({in_placeholders}) )
115+
ELSE d{i}.elem#>>'{"{}"}' IN ({in_placeholders})
113116
END
114117
) FROM jsonb_array_elements( trait_grants->%s ) AS d{i}(elem)
115118
) {ext}
116119
)""",
117120
(
118121
role, # ? check
119122
role, # IS NOT NULL check
120-
tuple(traits), # IN check
121-
tuple(traits), # IN check
123+
*traits, # IN check - expand traits as individual params
124+
*traits, # IN check - expand traits as individual params
122125
role, # jsonb_array_elements
123126
*ext_args,
124127
),
@@ -155,7 +158,7 @@ class Room(VersionedModel, OrderedModel, PretalxModel):
155158
The Room object stores some meta information. Most, like capacity,
156159
are not in use right now.
157160
"""
158-
161+
159162
log_prefix = "pretalx.room"
160163

161164
deleted = models.BooleanField(default=False)

0 commit comments

Comments
 (0)