Changeset 35972 in osm for applications/editors


Ignore:
Timestamp:
2022-05-25T20:00:14+02:00 (2 years ago)
Author:
taylor.smock
Message:

ReverterUploadHook: Use modifyChangesetTags instead of checkUpload

This also fixes an issue where any reverter change on any OSM layer
would cause the changeset created_by tag to be changed, even if
the reverter plugin was not used on that OSM layer.

See #20025 for more information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reverter/src/reverter/ReverterUploadHook.java

    r35868 r35972  
    11// License: GPL. For details, see LICENSE file.
    22package reverter;
     3
     4import java.util.Map;
     5import java.util.Objects;
    36
    47import org.openstreetmap.josm.actions.upload.UploadHook;
    58import org.openstreetmap.josm.command.Command;
    69import org.openstreetmap.josm.command.SequenceCommand;
    7 import org.openstreetmap.josm.data.APIDataSet;
    810import org.openstreetmap.josm.data.UndoRedoHandler;
    911import org.openstreetmap.josm.gui.MainApplication;
     
    2628
    2729    @Override
    28     public boolean checkUpload(APIDataSet apiDataSet) {
     30    public void modifyChangesetTags(Map<String, String> tags) {
    2931        if (ReverterPlugin.reverterUsed.get()) {
    3032            for (Command cmd : UndoRedoHandler.getInstance().getUndoCommands()) {
    31                 if (isReverterCmd(cmd)) {
    32                     MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("created_by", pluginString);
     33                if (Objects.equals(MainApplication.getLayerManager().getEditDataSet(), cmd.getAffectedDataSet()) && isReverterCmd(cmd)) {
     34                    tags.put("created_by", pluginString);
    3335                    break;
    3436                }
    3537            }
    3638        }
    37         return true;
    3839    }
    3940
Note: See TracChangeset for help on using the changeset viewer.