RFR: Assign unassigned issues when resolving them

Erik Helin ehelin at openjdk.java.net
Thu Jan 16 09:53:46 UTC 2020


On Thu, 16 Jan 2020 09:16:45 GMT, Erik Helin <ehelin at openjdk.org> wrote:

>> Hi all,
>> 
>> Please review this change that sets the assignee of unassigned issues when resolving them.
>> 
>> Best regards,
>> Robin
> 
> bots/notify/src/main/java/org/openjdk/skara/bots/notify/IssueUpdater.java line 233:
> 
>> 232:         }
>> 233:     }
>> 234: 
> 
> Instead of repeating `Optional.of(issueProject.issueTracker().user(...))`, you might want to code this like:
>         String username = null;
> 
>         var authorEmail = EmailAddress.from(commit.author().email());
>         if (authorEmail.domain().equals("openjdk.org")) {
>             username = authorEmail.localPart();
>         } else {
>             var committerEmail = EmailAddress.from(commit.committer().email());
>             if (!committerEmail.domain().equals("openjdk.org")) {
>                 log.severe("Cannot determine issue tracker user name from committer email: " + committerEmail);
>             }
>             username = committerEmail.localPart();
>         }
> 
>         return username == null ? Optional.empty() : Optional.of(issueProject.issueTracker().user(username));

Oh, I should mention that I'm fine your version as well �� If you want to use your version with early return, then please remove the `else {` part after the return ��

-------------

PR: https://git.openjdk.java.net/skara/pull/357


More information about the skara-dev mailing list