RFR: 1818: Get rid of extra REST request in GitLabMergeRequest#author

Zhao Song zsong at openjdk.org
Mon Feb 13 22:33:11 UTC 2023

On Mon, 13 Feb 2023 22:26:01 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Currently, in GitLabMergeRequest#author, the bot makes an unnecessary REST request to retrieve the HostUser object. 
>> However, with recent advancements in GitLab, it's possible to parse the HostUser directly from the pull request JSON. 
>> Getting rid of this redundant REST request would also solve the 'user is inactive' issue.
> forge/src/main/java/org/openjdk/skara/forge/gitlab/GitLabMergeRequest.java line 85:
>> 83:     @Override
>> 84:     public HostUser author() {
>> 85:         return host.parseAuthorField(json);
> Did you test this? I would assume you need something like this:
> Suggestion:
>         return host.parseAuthorField(json.get("author"));

Yes, I tested it. We don't need to get author here. Because we get author in this method.

    HostUser parseAuthorField(JSONValue json) {
        return parseAuthorObject(json.get("author").asObject());


PR: https://git.openjdk.org/skara/pull/1471

More information about the skara-dev mailing list