Skip to content
Merged
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
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion Resources/Views/Hub/_carousel.leaf
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
#if(canViewDropInSessionParticipants):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

security is my passion

<div class="modal fade" id="session-#(session.id)" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">#(session.title)</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<ul>
#for(slot in session.slotsOrdered):
<li>#(slot.day) at #date(slot.date, "HH:mm")
<ul>
#for(name in slot.participants):
<li>#(name)</li>
#endfor
</ul>
</li>

#endfor
</ul>
</div>
</div>
</div>
</div>
#endif

<div class="d-flex flex-row align-items-center mt-5 mb-3">
<img src="#awsImage(session.ownerImageUrl)" class="d-block rounded" width="80" alt="#(session.ownerName)">
#if(canViewDropInSessionParticipants):
<a data-bs-toggle="modal" data-bs-target="\#session-#(session.id)" href="#">
<img src="#awsImage(session.ownerImageUrl)" class="d-block rounded" width="80" alt="#(session.ownerName)">
</a>
#else:
<img src="#awsImage(session.ownerImageUrl)" class="d-block rounded" width="80" alt="#(session.ownerName)">
#endif

<div class="ps-4">
<h5 class="fw-medium fs-lg mb-1">#(session.title)</h5>
<p class="fs-sm mb-0">#(session.ownerName)</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct TicketHubRouteController: RouteCollection {
emailUrl: "mailto:[email protected]?subject=Refund Request&body=Ticket \(ticket.reference)"
),
hasValidTicket: ticket.release?.metadata?.canBookDropInSession == true,
canViewDropInSessionParticipants: ticket.release?.metadata?.canViewDropInSessionParticipants == true,
prompt: req.query["prompt"],
event: EventContext(event: currentEvent)
))
Expand Down Expand Up @@ -210,7 +211,8 @@ struct TicketHubRouteController: RouteCollection {
isParticipant: slot.ticket.contains(slug),
isFullyBooked: slot.ticket.count == model.maxTicketsPerSlot,
isInPast: slot.date < Date(),
participantCount: slot.ticket.count
participantCount: slot.ticket.count,
participants: slot.ticketOwner
)
}
}
Expand Down Expand Up @@ -243,7 +245,8 @@ struct TicketHubRouteController: RouteCollection {
companyLink: model.companyLink,
maximumAttendance: model.maxTicketsPerSlot,
remainingSlots: slotsWithDay.map({ model.maxTicketsPerSlot - $0.participantCount }).reduce(0, +),
slots: slotsWithDay
slots: slotsWithDay,
slotsOrdered: slotsWithDay.sorted(by: { $0.date < $1.date })
)
}
}
Expand Down Expand Up @@ -274,6 +277,7 @@ struct TicketHubContext: Content {
let isFullyBooked: Bool
let isInPast: Bool
let participantCount: Int
let participants: [String]
}

struct Session: Codable {
Expand All @@ -293,6 +297,7 @@ struct TicketHubContext: Content {
let remainingSlots: Int

let slots: [SessionSlot]
let slotsOrdered: [SessionSlot]
}

struct VideoPresentation: Codable {
Expand All @@ -309,6 +314,7 @@ struct TicketHubContext: Content {
let groupSessions: [Session]
let refund: Refund
let hasValidTicket: Bool
let canViewDropInSessionParticipants: Bool
let prompt: String?
let event: EventContext
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,6 @@ struct ValidTicketMiddleware: AsyncMiddleware {

await request.storage.setWithAsyncShutdown(CurrentEventKey.self, to: currentEvent)

#if DEBUG
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Helpful when first building, nowadays it's just better to login properly. Not worth maintaining

// append ?skipTicket=true to route in debug builds in order to bypass tito
if request.application.environment.isRelease == false {
let value: String? = try? request.query.get(at: "skipTicket")

if value == "true" {
await request.storage.setWithAsyncShutdown(TicketStorage.self, to: .init(
first_name: "James",
last_name: "Sherlock",
slug: "ti_test_p05Ch95xJS5AStInfa8whFA",
company_name: nil,
avatar_url: nil,
responses: [:],
release: .init(metadata: .init(canBookDropInSession: true)),
email: "[email protected]",
reference: "ABCD-1",
qr_url: "https://qr.tito.io/tickets/ti_p1NWgFenXguSSrqE2XRDHnw"
))

return try await next.respond(to: request)
}
}
#endif

let returnUrl = request.url.path.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
.map { "?returnUrl=" + $0 } ?? ""

Expand Down
1 change: 1 addition & 0 deletions Sources/App/Features/Tickets/Models/TitoTicket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Foundation
struct TitoTicket: Codable {
struct Metadata: Codable {
let canBookDropInSession: Bool?
let canViewDropInSessionParticipants: Bool?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the JSON you can add to ticket types. Currently added to Internal but add it to as many types as you want (so talk show hosts). Scalable and configurable for future.

}

struct Release: Codable {
Expand Down
Loading