stable
Clone or download
This is a technical refactoring. No functional changes are expected. This first step is needed to properly split the too big `PostMergeRequestWebhookActionProcessor`. The idea is to change the current situation ([simplified diagram][1]): ```mermaid sequenceDiagram participant A as WebhookActions participant Proc as PostMergeRequestWebhookActionProcessor participant Pars as WebhookTuleapReferencesParser participant R as ReferenceManager A->>+Proc: process() Proc->>Proc: getAlreadyExistingCrossReferencesFromMergeRequest() activate Proc Proc->>+Pars: ⭐extractCollectionOfTuleapReferences() Pars-->>-Proc: references deactivate Proc Proc->>Proc: createCrossReferencesFromMergeRequest() activate Proc Proc->>+Pars: ⭐extractCollectionOfTuleapReferences() Pars-->>-Proc: references Proc->>Proc: saveReferenceInEachIntegratedProject() activate Proc loop Proc->>R: insertCrossReference() end deactivate Proc deactivate Proc Proc->>Proc: saveMergeRequestData() Proc->>Proc: addCommentOnMergeRequest() deactivate Proc ``` We see that the call to `extractCollectionOfTuleapReferences()` − which extracts references of title + description of Merge Request − is common to two main parts: * `getAlreadyExistingCrossReferencesFromMergeRequest` * `createCrossReferencesFromMergeRequest` Those methods deserves their own dedicated object, but to not clutter the review, it will be done in dedicated commits. First we have to move the extraction of references. The current proposal produces [the following new sequence diagram][2]: ```mermaid sequenceDiagram participant A as WebhookActions participant Proc as PostMergeRequestWebhookActionProcessor participant E as TuleapReferencesFromMergeRequestDataExtractor participant Pars as WebhookTuleapReferencesParser participant R as ReferenceManager A->>+Proc: process() Proc->>Proc: getAlreadyExistingCrossReferencesFromMergeRequest() activate Proc Proc->>+E: extract() E->>+Pars: ⭐ extractCollectionOfTuleapReferences() Pars-->>-E: references E-->>-Proc: refercences deactivate Proc Proc->>Proc: createCrossReferencesFromMergeRequest() activate Proc Proc->>+E: extract() E->>+Pars: ⭐ extractCollectionOfTuleapReferences() Pars-->>-E: references E-->>-Proc: refercences Proc->>Proc: saveReferenceInEachIntegratedProject() activate Proc loop Proc->>R: insertCrossReference() end deactivate Proc deactivate Proc Proc->>Proc: saveMergeRequestData() Proc->>Proc: addCommentOnMergeRequest() deactivate Proc ``` Part of story #17182: reference tuleap artifacts in gitlab merge requests [1]: https://mermaid.ink/svg/eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG5wYXJ0aWNpcGFudCBBIGFzIFdlYmhvb2tBY3Rpb25zXG5wYXJ0aWNpcGFudCBQcm9jIGFzIFBvc3RNZXJnZVJlcXVlc3RXZWJob29rQWN0aW9uUHJvY2Vzc29yXG5wYXJ0aWNpcGFudCBQYXJzIGFzIFdlYmhvb2tUdWxlYXBSZWZlcmVuY2VzUGFyc2VyXG5wYXJ0aWNpcGFudCBSIGFzIFJlZmVyZW5jZU1hbmFnZXJcblxuQS0-PitQcm9jOiBwcm9jZXNzKClcblxuUHJvYy0-PlByb2M6IGdldEFscmVhZHlFeGlzdGluZ0Nyb3NzUmVmZXJlbmNlc0Zyb21NZXJnZVJlcXVlc3QoKVxuYWN0aXZhdGUgUHJvY1xuICAgIFByb2MtPj4rUGFyczog4q2QIGV4dHJhY3RDb2xsZWN0aW9uT2ZUdWxlYXBSZWZlcmVuY2VzKClcbiAgICBQYXJzLS0-Pi1Qcm9jOiByZWZlcmVuY2VzXG5kZWFjdGl2YXRlIFByb2NcblxuXG5Qcm9jLT4-UHJvYzogY3JlYXRlQ3Jvc3NSZWZlcmVuY2VzRnJvbU1lcmdlUmVxdWVzdCgpXG5hY3RpdmF0ZSBQcm9jXG4gICAgUHJvYy0-PitQYXJzOiDirZAgZXh0cmFjdENvbGxlY3Rpb25PZlR1bGVhcFJlZmVyZW5jZXMoKVxuICAgIFBhcnMtLT4-LVByb2M6IHJlZmVyZW5jZXNcbiAgICBQcm9jLT4-UHJvYzogc2F2ZVJlZmVyZW5jZUluRWFjaEludGVncmF0ZWRQcm9qZWN0KClcbiAgICBhY3RpdmF0ZSBQcm9jXG4gICAgICAgIGxvb3BcbiAgICAgICAgICAgIFByb2MtPj5SOiBpbnNlcnRDcm9zc1JlZmVyZW5jZSgpXG4gICAgICAgIGVuZFxuICAgIGRlYWN0aXZ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ZXF1ZXN0KClcbmFjdGl2YXRlIFByb2NcbiAgICBQcm9jLT4-K0U6IGV4dHJhY3QoKVxuICAgIEUtPj4rUGFyczog4q2QIGV4dHJhY3RDb2xsZWN0aW9uT2ZUdWxlYXBSZWZlcmVuY2VzKClcbiAgICBQYXJzLS0-Pi1FOiByZWZlcmVuY2VzXG4gICAgRS0tPj4tUHJvYzogcmVmZXJjZW5jZXNcbiAgICBQcm9jLT4-UHJvYzogc2F2ZVJlZmVyZW5jZUluRWFjaEludGVncmF0ZWRQcm9qZWN0KClcbiAgICBhY3RpdmF0ZSBQcm9jXG4gICAgICAgIGxvb3BcbiAgICAgICAgICAgIFByb2MtPj5SOiBpbnNlcnRDcm9zc1JlZmVyZW5jZSgpXG4gICAgICAgIGVuZFxuICAgIGRlYWN0aXZhdGUgUHJvY1xuZGVhY3RpdmF0ZSBQcm9jXG5cblByb2MtPj5Qcm9jOiBzYXZlTWVyZ2VSZXF1ZXN0RGF0YSgpXG5Qcm9jLT4-UHJvYzogYWRkQ29tbWVudE9uTWVyZ2VSZXF1ZXN0KClcblxuZGVhY3RpdmF0ZSBQcm9jXG5cbiAgICAgICAgICAgICIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In0sInVwZGF0ZUVkaXRvciI6ZmFsc2V9 Change-Id: I860c21c006c1604ee9b371df3407ce2d88064404
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/gitlab/include/Repository/Webhook/PostMergeRequest/PostMergeRequestWebhookActionProcessor.php | +14 | −25 | Go to diff View file |
A | plugins/gitlab/include/Repository/Webhook/PostMergeRequest/TuleapReferencesFromMergeRequestDataExtractor.php | +47 | −0 | Go to diff View file |
M | plugins/gitlab/include/gitlabPlugin.php | +4 | −1 | Go to diff View file |
M | plugins/gitlab/tests/unit/Repository/Webhook/PostMergeRequest/PostMergeRequestWebhookActionProcessorTest.php | +3 | −1 | Go to diff View file |
A | plugins/gitlab/tests/unit/Repository/Webhook/PostMergeRequest/TuleapReferencesFromMergeRequestDataExtractorTest.php | +50 | −0 | Go to diff View file |