mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Fixed handler end of postback key.
This commit is contained in:
parent
c3ef49b17c
commit
1561111a0b
2 changed files with 8 additions and 5 deletions
|
@ -18,15 +18,17 @@ public class SnapshotPushPostbackContents implements JSONSource {
|
|||
|
||||
private final WriteLatexDataSource writeLatexDataSource;
|
||||
private final String projectName;
|
||||
private final String postbackKey;
|
||||
|
||||
private final SnapshotPostExceptionBuilder snapshotPostExceptionBuilder;
|
||||
|
||||
private int versionID;
|
||||
private SnapshotPostException exception;
|
||||
|
||||
public SnapshotPushPostbackContents(WriteLatexDataSource writeLatexDataSource, String projectName, String contents) {
|
||||
this.projectName = projectName;
|
||||
public SnapshotPushPostbackContents(WriteLatexDataSource writeLatexDataSource, String projectName, String postbackKey, String contents) {
|
||||
this.writeLatexDataSource = writeLatexDataSource;
|
||||
this.projectName = projectName;
|
||||
this.postbackKey = postbackKey;
|
||||
snapshotPostExceptionBuilder = new SnapshotPostExceptionBuilder();
|
||||
fromJSON(new Gson().fromJson(contents, JsonElement.class));
|
||||
}
|
||||
|
@ -41,9 +43,9 @@ public class SnapshotPushPostbackContents implements JSONSource {
|
|||
|
||||
public void processPostback() throws UnexpectedPostbackException {
|
||||
if (exception == null) {
|
||||
writeLatexDataSource.postbackReceivedSuccessfully(projectName, versionID);
|
||||
writeLatexDataSource.postbackReceivedSuccessfully(projectName, postbackKey, versionID);
|
||||
} else {
|
||||
writeLatexDataSource.postbackReceivedWithException(projectName, exception);
|
||||
writeLatexDataSource.postbackReceivedWithException(projectName, postbackKey, exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ public class SnapshotPushPostbackHandler extends AbstractHandler {
|
|||
String contents = getContentsOfReader(request.getReader());
|
||||
String projectName = request.getRequestURI().split("/")[1];
|
||||
System.out.println("Postback received for project: " + projectName);
|
||||
SnapshotPushPostbackContents postbackContents = new SnapshotPushPostbackContents(writeLatexDataSource, projectName, contents);
|
||||
String postbackKey = "postback";
|
||||
SnapshotPushPostbackContents postbackContents = new SnapshotPushPostbackContents(writeLatexDataSource, projectName, postbackKey, contents);
|
||||
try {
|
||||
postbackContents.processPostback();
|
||||
} catch (UnexpectedPostbackException e) {
|
||||
|
|
Loading…
Reference in a new issue