Skip to content

Commit

Permalink
3.1.14 version bump
Browse files Browse the repository at this point in the history
Fix one issue with isUserAnon in AppExtension
  • Loading branch information
MusikAnimal committed Oct 25, 2017
1 parent 16c68e7 commit 3c5453b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
@@ -1,5 +1,13 @@
# Release Notes #

## 3.1.14 ##
- New Edit Summaries API endpoint.
- T178622: Show percentages when hovering over namespaces in the year/month
counts charts in the Edit Counter tool.
- T178618: Fix default sorting of AdminStats.
- T178259: Fix links to redirect pages in the Pages Created tool.
- Improved test coverage and code quality.

## 3.1.13 ##
- Major refactoring of controllers, standardizing parsing and decoding of
URL parameters.
Expand Down
2 changes: 1 addition & 1 deletion app/config/config.yml
Expand Up @@ -42,7 +42,7 @@ framework:
fragments: ~
http_method_override: true
assets:
version: '9'
version: '10'
version_format: '%%s?v=%%s'
cache:
app: "cache.adapter.%cache.adapter%"
Expand Down
2 changes: 1 addition & 1 deletion app/config/version.yml
Expand Up @@ -2,4 +2,4 @@
# The release process is documented at https://xtools.readthedocs.io/en/latest/development.html#releases

parameters:
app.version: 3.1.13
app.version: 3.1.14
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -10,7 +10,7 @@
# The release process is documented at https://xtools.readthedocs.io/en/latest/development.html#releases
copyright = u'2008–2017, XTools contributors'
version = '3.1'
release = '3.1.13'
release = '3.1.14'

# -- Options for HTML output ---------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions src/AppBundle/Twig/AppExtension.php
Expand Up @@ -630,12 +630,12 @@ public function percentFormat($numerator, $denominator = null, $precision = 1)
public function isUserAnon($user)
{
if ($user instanceof User) {
$username = $user->username;
$username = $user->getUsername();
} else {
$username = $user;
}

return filter_var($username, FILTER_VALIDATE_IP);
return (bool)filter_var($username, FILTER_VALIDATE_IP);
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/AppBundle/Twig/AppExtensionTest.php
Expand Up @@ -12,6 +12,7 @@
use AppBundle\Twig\AppExtension;
use AppBundle\Twig\Extension;
use DateTime;
use Xtools\User;

/**
* Tests for the AppExtension class.
Expand Down Expand Up @@ -167,4 +168,18 @@ public function testRequestTime()
{
$this->assertTrue(is_double($this->appExtension->requestMemory()));
}

/**
* Is the given user logged out?
*/
public function testUserIsAnon()
{
$user = new User('68.229.186.65');
$user2 = new User('Test user');
$this->assertTrue($this->appExtension->isUserAnon($user));
$this->assertFalse($this->appExtension->isUserAnon($user2));

$this->assertTrue($this->appExtension->isUserAnon('2605:E000:855A:4B00:3035:523D:F7E9:8F82'));
$this->assertFalse($this->appExtension->isUserAnon('192.0.blah.1'));
}
}

0 comments on commit 3c5453b

Please sign in to comment.