Changeset 2567 in josm for trunk/src/org


Ignore:
Timestamp:
2009-12-03T23:21:53+01:00 (15 years ago)
Author:
Gubaer
Message:

applied #3738: patch by mjulius: Searching for non-existent usernames returns objects submitted by anonymous users

Location:
trunk/src/org/openstreetmap/josm/actions/search
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r2512 r2567  
    124124                    + "<li>"+tr("<b>type:</b> - type of the object (<b>node</b>, <b>way</b>, <b>relation</b>)")+"</li>"
    125125                    + "<li>"+tr("<b>user:</b>... - all objects changed by user")+"</li>"
     126                    + "<li>"+tr("<b>user:anonymous</b> - all objects changed by anonymous users")+"</li>"
    126127                    + "<li>"+tr("<b>id:</b>... - object with given ID (0 for new objects)")+"</li>"
    127128                    + "<li>"+tr("<b>nodes:</b>... - object with given number of nodes")+"</li>"
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r2565 r2567  
    389389        private User user;
    390390        public UserMatch(String user) {
    391             List<User> users = User.getByName(user);
    392             if (!users.isEmpty()) {
    393                 // selecting an arbitrary user
    394                 this.user = users.get(0);
    395             } else {
    396                 user = null;
    397             }
    398         }
     391            if (user.equals("anonymous")) {
     392                this.user = null;
     393            } else {
     394                List<User> users = User.getByName(user);
     395                if (!users.isEmpty()) {
     396                    // selecting an arbitrary user
     397                    this.user = users.get(0);
     398                } else {
     399                    this.user = User.createLocalUser(user);
     400                }
     401            }
     402        }
     403
    399404        @Override public boolean match(OsmPrimitive osm) {
    400405            if (osm.getUser() == null && user == null) return true;
     
    402407            return osm.getUser().equals(user);
    403408        }
     409
    404410        @Override public String toString() {
    405411            return "user=" + user == null ? "" : user.getName();
Note: See TracChangeset for help on using the changeset viewer.