Skip to content

Commit

Permalink
Check note state online before asking whether to close notes
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
kmpoppe committed Apr 15, 2023
1 parent 771f7a2 commit 9664258
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,19 @@ public NoteSolverPlugin(final PluginInformation info) {
@Override
public boolean checkUpload(APIDataSet apiDataSet) {
boolean returnValue = true;
MainApplication.getLayerManager().getEditDataSet().getChangeSetTags().remove("closed:note");
// check online status before asking whether to close notes
if (rememberedNotes != null && rememberedNotes.size() > 0) {
for (Note note : rememberedNotes) {
String cOnlineStatus = getOnlineNoteStatus(note.getId());
if (note.getState() == State.CLOSED || cOnlineStatus.toLowerCase().trim().equals("closed")) {
solvedNotes.add(note);
}
}
for (Note note : solvedNotes)
if (rememberedNotes.containsNote(note)) rememberedNotes.remove(note);
}
if (rememberedNotes != null && rememberedNotes.size() > 0) {

StringBuilder noteList = new StringBuilder();
rememberedNotes.forEach((n) -> noteList.append("\n" + NoteText.noteShortText(n)));
Expand Down Expand Up @@ -120,7 +130,13 @@ public boolean checkUpload(APIDataSet apiDataSet) {
}
MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("created_by", "noteSolver_plugin/" + myPluginInformation.version);
MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("comment", comment);
MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("closed:note", closedNoteTag);
if (closedNoteTag == "")
{
MainApplication.getLayerManager().getEditDataSet().getChangeSetTags().remove("closed:note");
} else
{
MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("closed:note", closedNoteTag);
}
}
returnValue = true;
}
Expand Down

0 comments on commit 9664258

Please sign in to comment.