Ticket #23179: v2-0002-Closing-note-comment-based-on-the-OSM-instance-UR.patch

File v2-0002-Closing-note-comment-based-on-the-OSM-instance-UR.patch, 1.9 KB (added by qeef, 2 years ago)
  • src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java

    From 807084d550ee55a54c2b0db7d25c1f441693d198 Mon Sep 17 00:00:00 2001
    From: Jiri Vlasak <jiri.hubacek@gmail.com>
    Date: Thu, 21 Sep 2023 08:31:27 +0200
    Subject: [PATCH v2 2/2] Closing note comment based on the OSM instance URL
    
    ---
     src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java | 8 ++++----
     1 file changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
    index 8282a6444a..ed2de52b84 100644
    a b public class NotesDialog extends ToggleDialog implements LayerChangeListener, No  
    428428            Note note = displayList.getSelectedValue();
    429429            String changesetUrl = "";
    430430            if (note != null) {
    431                 Boolean isDefaultOsmInstance = Config.getUrls().getDefaultOsmApiUrl().equals(OsmApi.getOsmApi().getServerUrl());
    432431                String noteUrlShort = "osm.org/note/" + note.getId();
    433                 String noteUrlLong = "openstreetmap.org/note/" + note.getId();
     432                String hostUrl = OsmApi.getOsmApi().getHost().substring(4); // substring removes "api."
     433                String noteUrlLong = hostUrl + "/note/" + note.getId();
    434434                for (Changeset cs: ChangesetCache.getInstance().getChangesets()) {
    435                     if (isDefaultOsmInstance && (cs.getComment().indexOf(noteUrlShort) > -1 || cs.getComment().indexOf(noteUrlLong) > -1)) {
    436                         changesetUrl = "https://www.osm.org/changeset/" + cs.getId();
     435                    if (cs.getComment().indexOf(noteUrlShort) > -1 || cs.getComment().indexOf(noteUrlLong) > -1) {
     436                        changesetUrl = "https://" + hostUrl + "/changeset/" + cs.getId();
    437437                    }
    438438                }
    439439            }