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.

Event Timeline

Catrope created this task.Nov 7 2015, 1:34 AM
Catrope updated the task description. (Show Details)
Catrope raised the priority of this task from to Needs Triage.
Catrope assigned this task to Legoktm.
Catrope added subscribers: Catrope, SBisson.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptNov 7 2015, 1:34 AM

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.

Legoktm reassigned this task from Legoktm to SBisson.Nov 16 2015, 11:41 PM
Legoktm added a subscriber: Legoktm.
SBisson triaged this task as Normal 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

Legoktm closed this task as Resolved.Nov 18 2015, 5:54 PM