mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Avoid additional checks ...
This commit is contained in:
parent
7ba21f85bf
commit
58ed80d763
@ -26,8 +26,8 @@ public class SessionExpiredException
|
||||
public static final String MSG_KEY = "MINDMAP_TIMESTAMP_OUTDATED";
|
||||
private User lastUpdater;
|
||||
|
||||
public SessionExpiredException(@NotNull User lastUpdater) {
|
||||
super("Map has been updated by " + (lastUpdater != null ? lastUpdater.getEmail() : ""), Severity.FATAL);
|
||||
public SessionExpiredException(@NotNull String debugInfo, @NotNull User lastUpdater) {
|
||||
super(debugInfo, Severity.FATAL);
|
||||
this.lastUpdater = lastUpdater;
|
||||
}
|
||||
|
||||
|
@ -188,15 +188,15 @@ public class MindmapController extends BaseController {
|
||||
if (lockInfo.getSession() == session) {
|
||||
// Timestamp might not be returned to the client. This try to cover this case, ignoring the client timestamp check.
|
||||
final User lastEditor = mindmap.getLastEditor();
|
||||
// lockInfo.getPreviousTimestamp() == timestamp : In case the timestap is not returned. Give a second chance.
|
||||
if (outdated && (lockInfo.getPreviousTimestamp() != timestamp || lastEditor == null || !lastEditor.identityEquality(user))) {
|
||||
throw new SessionExpiredException(lastEditor);
|
||||
boolean editedBySameUser = lastEditor == null || user.identityEquality(lastEditor);
|
||||
if (outdated && !editedBySameUser) {
|
||||
throw new SessionExpiredException("Map has been updated by " + (lastEditor.getEmail()) + ",Timestamp:" + timestamp + "," + mindmap.getLastModificationTime().getTimeInMillis(), lastEditor);
|
||||
}
|
||||
} else if (outdated) {
|
||||
throw new MultipleSessionsOpenException("Sessions:" + session + ":" + lockInfo.getSession() + ",Timestamp: " + timestamp + ": " + lockInfo.getTimestamp());
|
||||
}
|
||||
} else {
|
||||
throw new SessionExpiredException(lockInfo.getUser());
|
||||
throw new SessionExpiredException("Different Users.", lockInfo.getUser());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user