Bidi isolate content items in notification header text

Bug: T127407
Change-Id: I25c426f3d0190bd33c4aa1c2ffb3c97fe1424567
This commit is contained in:
Moriel Schottlender 2016-03-09 16:22:52 -08:00
parent c25265673b
commit 9a1defa57f
4 changed files with 15 additions and 9 deletions

View file

@ -53,7 +53,7 @@ class EchoEditUserTalkPresentationModel extends EchoEventPresentationModel {
} elseif ( $this->hasSection() ) {
$msg = $this->getMessageWithAgent( "notification-header-{$this->type}-with-section" );
$msg->params( $this->getViewingUserForGender() );
$msg->params( $this->getSectionTitleSnippet() );
$msg->params( $this->language->embedBidi( $this->getSectionTitleSnippet() ) );
return $msg;
} else {
$msg = parent::getHeaderMessage();

View file

@ -245,7 +245,7 @@ abstract class EchoEventPresentationModel implements JsonSerializable {
if ( $this->userCan( Revision::DELETED_USER ) ) {
// Not deleted
return array(
$this->language->embedBidi( $this->getTruncatedUsername( $agent ) ),
$this->getTruncatedUsername( $agent ),
$agent->getName()
);
} else {
@ -375,12 +375,12 @@ abstract class EchoEventPresentationModel implements JsonSerializable {
}
protected function getTruncatedUsername( User $user ) {
return $this->language->truncate( $user->getName(), self::USERNAME_RECOMMENDED_LENGTH, '...', false );
return $this->language->embedBidi( $this->language->truncate( $user->getName(), self::USERNAME_RECOMMENDED_LENGTH, '...', false ) );
}
protected function getTruncatedTitleText( Title $title, $includeNamespace = false ) {
$text = $includeNamespace ? $title->getPrefixedText() : $title->getText();
return $this->language->truncate( $text, self::PAGE_NAME_RECOMMENDED_LENGTH, '...', false );
return $this->language->embedBidi( $this->language->truncate( $text, self::PAGE_NAME_RECOMMENDED_LENGTH, '...', false ) );
}
/**

View file

@ -65,7 +65,7 @@ class EchoMentionPresentationModel extends EchoEventPresentationModel {
// make sure it is a user talk page but NOT the agent's talk page.
} elseif ( $this->onUserTalkpage() ) {
$username = $this->event->getTitle()->getText();
$msg->params( $this->language->truncate( $username, self::USERNAME_RECOMMENDED_LENGTH, '...', false ) );
$msg->params( $this->getTruncatedUsername() );
$msg->params( $username );
} else {
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
@ -73,13 +73,13 @@ class EchoMentionPresentationModel extends EchoEventPresentationModel {
$section = $this->getSection();
if ( $section ) {
$msg->params(
$msg->params( $this->language->bidiEmbed(
EchoDiscussionParser::getTextSnippet(
$section,
$this->language,
self::SECTION_TITLE_RECOMMENDED_LENGTH
)
);
) );
}
return $msg;

View file

@ -11,8 +11,14 @@ class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
public function getHeaderMessage() {
list( $formattedName, $genderName ) = $this->getAgentForOutput();
$add = $this->getLocalizedGroupNames( array_values( $this->event->getExtraParam( 'add', array() ) ) );
$remove = $this->getLocalizedGroupNames( array_values( $this->event->getExtraParam( 'remove', array() ) ) );
$add = array_map(
array( $this->language, 'embedBidi' ),
$this->getLocalizedGroupNames( array_values( $this->event->getExtraParam( 'add', array() ) ) )
);
$remove = array_map(
array( $this->language, 'embedBidi' ),
$this->getLocalizedGroupNames( array_values( $this->event->getExtraParam( 'remove', array() ) ) )
);
if ( $add && !$remove ) {
$msg = $this->msg( 'notification-header-user-rights-add-only' );
$msg->params( $genderName );