ApiCoreThank: support subtypes in AllowedLogTypes

Bug: T191599
Bug: T316860
Change-Id: I0e21b3da5888bd5323bda6b59c5edddcb6ae14f1
This commit is contained in:
Taavi Väänänen 2022-09-18 14:15:03 +03:00
parent 43f43c9a26
commit 62810454f3
No known key found for this signature in database
GPG key ID: EF242F709F912FBE

View file

@ -140,7 +140,8 @@ class ApiCoreThank extends ApiThank {
// Make sure this log type is allowed.
$allowedLogTypes = $this->getConfig()->get( 'ThanksAllowedLogTypes' );
if ( !in_array( $logEntry->getType(), $allowedLogTypes ) ) {
if ( !in_array( $logEntry->getType(), $allowedLogTypes )
&& !in_array( $logEntry->getType() . '/' . $logEntry->getSubtype(), $allowedLogTypes ) ) {
$err = $this->msg( 'thanks-error-invalid-log-type', $logEntry->getType() );
$this->dieWithError( $err, 'thanks-error-invalid-log-type' );
}