Ignore:
Timestamp:
2019-05-05T17:35:29+02:00 (5 years ago)
Author:
Don-vip
Message:

see #17634 - allow to define exceptions to the list of forbidden terms, through upload.comment.exception-terms property

File:
1 edited

Legend:

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

    r15040 r15051  
    599599        }
    600600
    601         static String validateUploadTag(String uploadValue, String preferencePrefix, List<String> defMandatory, List<String> defForbidden) {
     601        static String validateUploadTag(String uploadValue, String preferencePrefix,
     602                List<String> defMandatory, List<String> defForbidden, List<String> defException) {
    602603            String uploadValueLc = lower(uploadValue);
    603604            // Check mandatory terms
     
    608609            }
    609610            // Check forbidden terms
     611            List<String> exceptions = Config.getPref().getList(preferencePrefix+".exception-terms", defException);
    610612            List<String> forbiddenTerms = Config.getPref().getList(preferencePrefix+".forbidden-terms", defForbidden)
    611                     .stream().map(UploadAction::lower).filter(uploadValueLc::contains).collect(Collectors.toList());
     613                    .stream().map(UploadAction::lower)
     614                    .filter(x -> uploadValueLc.contains(x) && !exceptions.stream().anyMatch(uploadValueLc::contains))
     615                    .collect(Collectors.toList());
    612616            if (!forbiddenTerms.isEmpty()) {
    613617                return tr("The following forbidden terms have been found: {0}", forbiddenTerms);
     
    624628            final String uploadComment = dialog.getUploadComment();
    625629            final String uploadCommentRejection = validateUploadTag(
    626                     uploadComment, "upload.comment", def, def);
     630                    uploadComment, "upload.comment", def, def, def);
    627631            if ((isUploadCommentTooShort(uploadComment) && warnUploadComment()) ||
    628632                (uploadCommentRejection != null && warnRejectedUploadComment(uploadCommentRejection))) {
     
    633637            final String uploadSource = dialog.getUploadSource();
    634638            final String uploadSourceRejection = validateUploadTag(
    635                     uploadSource, "upload.source", def, def);
     639                    uploadSource, "upload.source", def, def, def);
    636640            if ((Utils.isStripEmpty(uploadSource) && warnUploadSource()) ||
    637641                    (uploadSourceRejection != null && warnRejectedUploadSource(uploadSourceRejection))) {
Note: See TracChangeset for help on using the changeset viewer.