mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
Add public setters for EchoEvent attributes
So extensions can modify an event, like bug 57234. Change-Id: I60b61d635eb3ab033dc9cc8d8bbf751e2221acc8
This commit is contained in:
parent
ce5b5308aa
commit
fbd127fc88
|
@ -112,13 +112,7 @@ class EchoEvent {
|
|||
if ( !$obj->title instanceof Title ) {
|
||||
throw new MWException( 'Invalid title parameter' );
|
||||
}
|
||||
$pageId = $obj->title->getArticleId();
|
||||
if ( $pageId ) {
|
||||
$obj->pageId = $pageId;
|
||||
} else {
|
||||
$obj->extra['page_title'] = $obj->title->getDBKey();
|
||||
$obj->extra['page_namespace'] = $obj->title->getNamespace();
|
||||
}
|
||||
$obj->setTitle( $obj->title );
|
||||
}
|
||||
|
||||
if ( $obj->agent && !
|
||||
|
@ -415,6 +409,34 @@ class EchoEvent {
|
|||
return EchoNotificationController::getNotificationCategory( $this->type );
|
||||
}
|
||||
|
||||
public function setType( $type ) {
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function setVariant( $variant ) {
|
||||
$this->variant = $variant;
|
||||
}
|
||||
|
||||
public function setAgent( User $agent ) {
|
||||
$this->agent = $agent;
|
||||
}
|
||||
|
||||
public function setTitle( Title $title ) {
|
||||
$this->title = $title;
|
||||
$pageId = $title->getArticleId();
|
||||
if ( $pageId ) {
|
||||
$this->pageId = $pageId;
|
||||
} else {
|
||||
$this->extra['page_title'] = $title->getDBKey();
|
||||
$this->extra['page_namespace'] = $title->getNamespace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function setExtra( $name, $value ) {
|
||||
$this->extra[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message key of the primary or secondary link for a notification type.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue