Don't show link to testing interface when the user cannot test filters

Clicking on this link only shows an error message unless the user can
edit filters.

Change-Id: Id912731e98f0f37b999d4a8e7ab190cd938825aa
This commit is contained in:
Matěj Suchánek 2016-12-16 20:08:52 +00:00
parent 3721431986
commit 0dca928f58

View file

@ -472,25 +472,27 @@ class AbuseFilterViewEdit extends AbuseFilterView {
$fields['abusefilter-edit-flags'] = $flags;
$tools = '';
if ( $filter != 'new' && $user->isAllowed( 'abusefilter-revert' ) ) {
$tools .= Xml::tags(
'p', null,
$this->linkRenderer->makeLink(
$this->getTitle( 'revert/' . $filter ),
$this->msg( 'abusefilter-edit-revert' )->text()
)
);
}
if ( $filter != 'new' ) {
// Test link
$tools .= Xml::tags(
'p', null,
$this->linkRenderer->makeLink(
$this->getTitle( "test/$filter" ),
new HtmlArmor( $this->msg( 'abusefilter-edit-test-link' )->parse() )
)
);
if ( $user->isAllowed( 'abusefilter-revert' ) ) {
$tools .= Xml::tags(
'p', null,
$this->linkRenderer->makeLink(
$this->getTitle( "revert/$filter" ),
$this->msg( 'abusefilter-edit-revert' )->text()
)
);
}
if ( $user->isAllowed( 'abusefilter-modify' ) ) {
// Test link
$tools .= Xml::tags(
'p', null,
$this->linkRenderer->makeLink(
$this->getTitle( "test/$filter" ),
new HtmlArmor( $this->msg( 'abusefilter-edit-test-link' )->parse() )
)
);
}
// Last modification details
$userLink =
Linker::userLink( $row->af_user, $row->af_user_text ) .