[ZEPPELIN-3092] Load notebook from repository when requested

This commit is contained in:
Mohamed Magdy 2017-12-18 21:43:07 +01:00
parent d1d43eb514
commit 4d6cc765eb
2 changed files with 9 additions and 7 deletions

View file

@ -823,7 +823,7 @@ public class NotebookServer extends WebSocketServlet
String user = fromMessage.principal;
Note note = notebook.getNote(noteId);
Note note = notebook.getNoteAfterReloadFromRepo(noteId);
if (note != null) {
if (!hasParagraphReaderPermission(conn, notebook, noteId,

View file

@ -297,12 +297,14 @@ public class Notebook implements NoteEventListener {
}
public Note getNoteAfterReloadFromRepo(String noteId) {
// Each time the notebook is requested, it is loaded from the storage repository. This helps
// in fetching the latest versions of the notebook if a remote repository is used. For example,
// if GitHub is integrated, wheneve the notebook is requested, it is pulled from the remote
// repository.
loadNoteFromRepo(noteId, new AuthenticationInfo(StringUtils.EMPTY));
return getNote(noteId);
synchronized (notes) {
// Each time the notebook is requested, it is loaded from the storage repository. This helps
// in fetching the latest versions of the notebook if a remote repository is used. For example,
// if GitHub is integrated, whenever the notebook is requested, it is pulled from the remote
// repository.
loadNoteFromRepo(noteId, new AuthenticationInfo(StringUtils.EMPTY));
return notes.get(noteId);
}
}
public Folder getFolder(String folderId) {