mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
NoteRename: Do it before trying to get the lock
Another operation coule be blocking git.
This commit is contained in:
@ -204,12 +204,12 @@ class StateContainer with ChangeNotifier {
|
|||||||
void renameNote(Note note, String newFileName) async {
|
void renameNote(Note note, String newFileName) async {
|
||||||
logEvent(Event.NoteRenamed);
|
logEvent(Event.NoteRenamed);
|
||||||
|
|
||||||
|
var oldNotePath = note.filePath;
|
||||||
|
note.rename(newFileName);
|
||||||
|
|
||||||
return _opLock.synchronized(() async {
|
return _opLock.synchronized(() async {
|
||||||
Log.d("Got renameNote lock");
|
Log.d("Got renameNote lock");
|
||||||
|
|
||||||
var oldNotePath = note.filePath;
|
|
||||||
note.rename(newFileName);
|
|
||||||
|
|
||||||
_gitRepo.renameNote(oldNotePath, note.filePath).then((NoteRepoResult _) {
|
_gitRepo.renameNote(oldNotePath, note.filePath).then((NoteRepoResult _) {
|
||||||
_syncNotes();
|
_syncNotes();
|
||||||
appState.numChanges += 1;
|
appState.numChanges += 1;
|
||||||
|
Reference in New Issue
Block a user