Ignore:
Timestamp:
2016-01-17T23:24:09+01:00 (8 years ago)
Author:
simon04
Message:

fix #7090 - Upload dialog allow select another user open changeset

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r9059 r9519  
    1010import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    1111import org.openstreetmap.josm.data.Preferences.StringSetting;
     12import org.openstreetmap.josm.data.osm.User;
    1213import org.openstreetmap.josm.data.osm.UserInfo;
    1314import org.openstreetmap.josm.gui.preferences.server.OAuthAccessTokenHolder;
     
    223224
    224225    /**
    225      * Replies true if the user with name <code>username</code> is the current
    226      * user
     226     * Replies true if the user with name <code>username</code> is the current user
    227227     *
    228228     * @param username the user name
    229      * @return true if the user with name <code>username</code> is the current
    230      * user
     229     * @return true if the user with name <code>username</code> is the current user
    231230     */
    232231    public boolean isCurrentUser(String username) {
    233         if (username == null || this.userName == null) return false;
    234         return this.userName.equals(username);
     232        return username != null && this.userName != null && this.userName.equals(username);
     233    }
     234
     235    /**
     236     * Replies true if the current user is {@link #isFullyIdentified() fully identified} and the {@link #getUserId() user ids} match,
     237     * or if the current user is not {@link #isFullyIdentified() fully identified} and the {@link #userName user names} match.
     238     *
     239     * @param user the user to test
     240     * @return true if given user is the current user
     241     */
     242    public boolean isCurrentUser(User user) {
     243        if (user == null) {
     244            return false;
     245        } else if (isFullyIdentified()) {
     246            return getUserId() == user.getId();
     247        } else {
     248            return isCurrentUser(user.getName());
     249        }
    235250    }
    236251
  • trunk/src/org/openstreetmap/josm/gui/io/OpenChangesetComboBoxModel.java

    r9078 r9519  
    4141    public void refresh() {
    4242        changesets.clear();
    43         changesets.addAll(ChangesetCache.getInstance().getOpenChangesets());
     43        changesets.addAll(ChangesetCache.getInstance().getOpenChangesetsForCurrentUser());
    4444        fireContentsChanged(this, 0, getSize());
    4545        int idx = changesets.indexOf(selectedChangeset);
Note: See TracChangeset for help on using the changeset viewer.