예제 #1
0
 @Override
 public Req understand(final Comment.Smart comment, final URI home) throws IOException {
   final Req req;
   final Issue.Smart issue = new Issue.Smart(comment.issue());
   final List<String> logins =
       Lists.transform(
           this.profile.read().xpath(this.xpath),
           new Function<String, String>() {
             @Override
             public String apply(final String input) {
               return input.toLowerCase(Locale.ENGLISH);
             }
           });
   final boolean legal =
       logins.isEmpty()
           || logins.contains(comment.author().login().toLowerCase(Locale.ENGLISH))
           || logins.contains(issue.author().login().toLowerCase(Locale.ENGLISH));
   if (legal) {
     req = this.origin.understand(comment, home);
   } else {
     new Answer(comment)
         .post(
             true,
             String.format(
                 QnByArchitect.PHRASES.getString("QnByArchitect.denied"),
                 logins.get(0).toLowerCase(Locale.ENGLISH)));
     req = Req.EMPTY;
   }
   return req;
 }
예제 #2
0
 @Override
 public Req understand(final Comment.Smart comment, final URI home) throws IOException {
   new Answer(comment)
       .post(
           true,
           String.format(
               QnConfig.PHRASES.getString("QnConfig.response"), this.profile.read().toString()));
   Logger.info(this, "config request in #%d", comment.issue().number());
   return Req.DONE;
 }