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

#657 implement code url #670

Merged
merged 29 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6029204
#657 initial stubs for code-url feature
syjer Jun 22, 2019
4351a05
#657 add redirect from old url to api handler
syjer Jun 22, 2019
9df6306
port old event code handling code #657
syjer Jun 22, 2019
5d60c80
refactor: move createticketreservation in a separate method #657
syjer Jun 22, 2019
f8a1135
refactor: remove unused payment callback controller #657
syjer Jun 22, 2019
1491ad0
misc refactor: use try with resource
syjer Jun 22, 2019
92f00f2
misc cleanup: remove unused code
syjer Jun 22, 2019
61c8a6c
#657 remove unused code
syjer Jun 23, 2019
8916675
#657 refactor createTicketReservation
syjer Jun 23, 2019
b970802
#657 fallback locale
syjer Jun 23, 2019
825e499
enable partially the {code} functionality #657
syjer Jun 24, 2019
52194bc
for {code} functionality: enable the case: restricted category+url co…
syjer Jun 24, 2019
ad3cedc
disable tests #657
syjer Jun 24, 2019
48e2a38
add integration test for {code} for hidden category #657
syjer Jun 24, 2019
b6ae7d2
integration test: special price repository: check count #657
syjer Jun 24, 2019
94663bc
handle #671
syjer Jun 24, 2019
68d857b
refactor: remove specialPriceSessionId parameter #657
syjer Jun 24, 2019
fd775a1
refactor: remove specialPriceSessionId parameter #657
syjer Jun 24, 2019
ef0bb93
refactor: remove specialPriceSessionId parameter+misc conf manager #657
syjer Jun 24, 2019
bf7eadb
remove use of special price session id in admin reservation manager #657
syjer Jun 24, 2019
78bc78d
add test for reservation for hidden category #657
syjer Jun 25, 2019
e9d5d6a
remove last piece of sessionId in special price #657
syjer Jun 25, 2019
243ba1b
refactor: switch from Integer to int for param #657
syjer Jun 25, 2019
e92662e
select for update skip locked for special price #657
syjer Jun 25, 2019
ed0c618
return binding result #657
syjer Jun 26, 2019
ac5f085
{code} flow: add query string for errors #657
syjer Jun 26, 2019
ccc7719
{code} flow: add query string for errors #657
syjer Jun 26, 2019
8102450
update frontend #657
syjer Jun 26, 2019
5d5c280
update frontend #657
syjer Jun 26, 2019
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ dependencies {
compile "org.springframework.security:spring-security-web:$springSecurityConfigVersion"
compile "org.springframework.security:spring-security-config:$springSecurityConfigVersion"
compile 'org.springframework.session:spring-session:1.3.5.RELEASE'
compile "ch.digitalfondue.npjt-extra:npjt-extra:2.0.0"
compile "ch.digitalfondue.npjt-extra:npjt-extra:2.0.1"
compile "com.samskivert:jmustache:1.14"
compile "com.github.sps.mustache:mustache-spring-view:1.4"
compile "javax.mail:mail:1.5.0-b01"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ junitVersion=5.1.0
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"

# https://jitpack.io/#alfio-event/alf.io-public-frontend -> go to commit tab, set the version
alfioPublicFrontendVersion=c397155127
alfioPublicFrontendVersion=328724c45d
4 changes: 3 additions & 1 deletion src/main/java/alfio/controller/FileController.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public void showFile(@PathVariable("digest") String digest, HttpServletRequest r
response.setContentLength(metadata.getContentSize());
response.setHeader("ETag", digest);
response.setHeader("Cache-Control", MAX_AGE_6_MONTH);
manager.outputFile(digest, response.getOutputStream());
try (var os = response.getOutputStream()) {
manager.outputFile(digest, os);
}
}
} else {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/alfio/controller/IndexController.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.util.UriComponentsBuilder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
import java.util.Map;

import static alfio.model.system.ConfigurationKeys.ENABLE_CAPTCHA_FOR_LOGIN;

Expand Down Expand Up @@ -102,6 +105,14 @@ public void replyToIndex(HttpServletResponse response) throws IOException {
}
}

@RequestMapping("/event/{eventShortName}/code/{code}")
public String redirectCode(@PathVariable("eventShortName") String eventName,
@PathVariable("code") String code) {
return "redirect:" + UriComponentsBuilder.fromPath("/api/v2/public/event/{eventShortName}/code/{code}")
.build(Map.of("eventShortName", eventName, "code", code))
.toString();
}


// login related
@RequestMapping(value="/authentication", method = RequestMethod.GET)
Expand Down
138 changes: 0 additions & 138 deletions src/main/java/alfio/controller/PaymentCallbackController.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package alfio.controller.api.admin;

import alfio.controller.api.support.DescriptionsLoader;
import alfio.controller.api.support.EventListItem;
import alfio.controller.api.support.PageAndContent;
import alfio.controller.api.support.TicketHelper;
Expand All @@ -34,6 +33,7 @@
import alfio.model.user.Role;
import alfio.model.user.User;
import alfio.repository.DynamicFieldTemplateRepository;
import alfio.repository.EventDescriptionRepository;
import alfio.repository.SponsorScanRepository;
import alfio.repository.TicketFieldRepository;
import alfio.util.*;
Expand Down Expand Up @@ -93,7 +93,7 @@ public class EventApiController {
private final I18nManager i18nManager;
private final TicketReservationManager ticketReservationManager;
private final TicketFieldRepository ticketFieldRepository;
private final DescriptionsLoader descriptionsLoader;
private final EventDescriptionRepository eventDescriptionRepository;
private final TicketHelper ticketHelper;
private final DynamicFieldTemplateRepository dynamicFieldTemplateRepository;
private final UserManager userManager;
Expand Down Expand Up @@ -138,7 +138,7 @@ public List<EventListItem> getAllEventsForExternal(Principal principal, HttpServ
return eventManager.getActiveEvents().stream()
.filter(e -> userOrganizations.contains(e.getOrganizationId()))
.sorted(Comparator.comparing(e -> e.getBegin().withZoneSameInstant(ZoneId.systemDefault())))
.map(s -> new EventListItem(s, request.getContextPath(), descriptionsLoader.eventDescriptions().load(s)))
.map(s -> new EventListItem(s, request.getContextPath(), eventDescriptionRepository.findByEventId(s.getId())))
.collect(toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public void getLatestVersion(@PathVariable("eventName") String eventName,
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} else {
Pair<EventAndOrganizationId, Ticket> pair = validationResult.get();
try {
try (var os = response.getOutputStream()) {
response.setContentType("application/vnd.apple.pkpass");
passKitManager.writePass(pair.getRight(), pair.getLeft(), response.getOutputStream());
passKitManager.writePass(pair.getRight(), pair.getLeft(), os);
} catch (Exception e) {
log.warn("Error during pass generation", e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/alfio/controller/api/support/DataLoader.java

This file was deleted.

48 changes: 0 additions & 48 deletions src/main/java/alfio/controller/api/support/DescriptionsLoader.java

This file was deleted.

Loading