Add public setters for EchoEvent attributes

So extensions can modify an event, like bug 57234.

Change-Id: I60b61d635eb3ab033dc9cc8d8bbf751e2221acc8
This commit is contained in:
Kunal Mehta 2013-11-29 22:20:03 -08:00
parent ce5b5308aa
commit fbd127fc88

View file

@ -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.
*