Page MenuHomePhabricator

Support easy use of standard $1+$2 values (agent and agent for gender) in getBodyMessage
Closed, ResolvedPublic

Description

Right now, we have to write code like

public function getBodyMessage() {
	$msg = $this->msg( 'notification-body-flow-new-topic' );
	list( $formattedName, $genderName ) = $this->getAgentForOutput();
	$msg->params( $formattedName, $genderName );
	$msg->params( other stuff );
	// ...

whereas for getHeaderMessage, the parent method does this for us:

public function getHeaderMessage() {
	$msg = parent::getHeaderMessage();
	$msg->params( other stuff );
	// ...

See https://gerrit.wikimedia.org/r/#/c/251512/7/includes/Notifications/NewTopicPresentationModel.php for example.

There should be a way that we don't have to duplicate this code, either through parent method support in getBodyMessage or a helper that can be called by both getBodyMessage and getHeaderMessage.

Details

Related Changes in Gerrit:

Event Timeline

Catrope assigned this task to Legoktm.
Catrope raised the priority of this task from to Needs Triage.
Catrope updated the task description. (Show Details)
Catrope added subscribers: Catrope, SBisson.

Oh and standard message naming patterns (notification-body-$type just like notification-header-$type) would be nice too.

Has anything been started here? If not, I can do it since I have a ticket blocked on this. T116845: Write presentation models for notifications in Flow

Has anything been started here? If not, I can do it since I have a ticket blocked on this. T116845: Write presentation models for notifications in Flow

Not as far as I know. @Legoktm?

No, I haven't done any work on this yet.

SBisson triaged this task as Medium priority.Nov 17 2015, 5:49 PM
SBisson set Security to None.

Change 253647 had a related patch set uploaded (by Sbisson):
Extract getMessageWithAgent

https://gerrit.wikimedia.org/r/253647

Change 253647 merged by jenkins-bot:
Extract getMessageWithAgent

https://gerrit.wikimedia.org/r/253647