Skip to content

Commit

Permalink
Merge branch 'release/2.2.1' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
JDGrimes committed Jan 3, 2017
2 parents be894cc + 734a2b0 commit 8c6003d
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 33 deletions.
6 changes: 5 additions & 1 deletion .wordpoints-dev-lib-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export WORDPOINTS_PROJECT_TYPE=wordpoints
function wordpoints-dev-lib-config() {

# Use the develop branch for WPCS.
export WPCS_GIT_TREE=develop
if [[ $TRAVIS_BRANCH == stable || $TRAVIS_BRANCH =~ release ]]; then
export WPCS_GIT_TREE=0b8c692f1f44ce76721d1bb72bfbbe1d7bc1cc6a
else
export WPCS_GIT_TREE=develop
fi

# Use PHPCS 2.7.0, since WPCS 0.11.0 requires it.
export PHPCS_GIT_TREE=master
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ This is the developer changelog for WordPoints. For a user-centric changelog, se

## [Unreleased]

## [2.2.0]
## [2.2.1] - 2017-01-03

### Fixed

- Infinite loop on the Points Types screen when an event had args that have relationships with other entities of the same type. #593
- Points values not being formatted with prefix and suffix if one of these was not set. #588
- "Table exists" errors from the uninstaller tests when running against WordPress 4.7+. #595
- PHPCS errors being flagged when working on stable, by pinning the WPCS version.

## [2.2.0] - 2016-12-08

### Added

Expand Down Expand Up @@ -277,6 +286,7 @@ This is the developer changelog for WordPoints. For a user-centric changelog, se
- Notices for ophaned comments in comment points hooks. #436

[unreleased]: https://github.com/WordPoints/wordpoints/compare/stable...HEAD
[2.2.1]: https://github.com/WordPoints/wordpoints/compare/2.0.0...2.2.1
[2.2.0]: https://github.com/WordPoints/wordpoints/compare/2.1.5...2.2.0
[2.1.5]: https://github.com/WordPoints/wordpoints/compare/2.1.4...2.1.5
[2.1.4]: https://github.com/WordPoints/wordpoints/compare/2.1.3...2.1.4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordpoints",
"version": "2.2.0",
"version": "2.2.1",
"description": "Gamify your WordPress site with points.",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/admin/assets/js/hooks/views.manifested.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,19 @@ Args = Backbone.Model.extend({
return;
}

// If this is an entity, check if that entity is already in the
// hierarchy, and don't add it again, to prevent infinite loops.
if ( hierarchy.length % 2 === 0 ) {
var loops = _.filter( hierarchy, function ( item ) {
return item.get( 'slug' ) === arg.get( 'slug' );
});

// We allow it to loop twice, but not to add the entity a third time.
if ( loops.length > 1 ) {
return;
}
}

hierarchy.push( arg );

addMatching( subArgs, hierarchy );
Expand Down
8 changes: 6 additions & 2 deletions src/components/points/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,19 @@ function wordpoints_format_points_filter( $formatted, $points, $type ) {

$points_type = wordpoints_get_points_type( $type );

if ( isset( $points_type['prefix'], $points_type['suffix'] ) ) {
if ( isset( $points_type['prefix'] ) ) {

if ( $points < 0 ) {

$points = abs( $points );
$points_type['prefix'] = '-' . $points_type['prefix'];
}

$formatted = esc_html( $points_type['prefix'] . $points . $points_type['suffix'] );
$formatted = esc_html( $points_type['prefix'] . $points );
}

if ( isset( $points_type['suffix'] ) ) {
$formatted = $formatted . esc_html( $points_type['suffix'] );
}

return $formatted;
Expand Down
2 changes: 1 addition & 1 deletion src/includes/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @const WORDPOINTS_VERSION
*/
define( 'WORDPOINTS_VERSION', '2.2.0' );
define( 'WORDPOINTS_VERSION', '2.2.1' );

/**
* The full path to the plugin's main directory.
Expand Down
Binary file modified src/languages/wordpoints-es_ES.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions src/languages/wordpoints-es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WordPoints 1.5.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpoints\n"
"POT-Creation-Date: 2016-12-08 17:02:14+00:00\n"
"POT-Creation-Date: 2017-01-02 20:04:13+00:00\n"
"PO-Revision-Date: 2015-02-24 19:20+0200\n"
"Last-Translator: Gonzalo Exequiel Pedone <[email protected]>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/wordpoints/"
Expand Down Expand Up @@ -229,7 +229,7 @@ msgstr "Desactivar"
msgid "Activate %s"
msgstr "Activar"

#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.0) #-#-#-#-#
#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: admin/includes/functions.php:69
#: components/points/admin/includes/functions.php:316
Expand Down Expand Up @@ -1885,11 +1885,11 @@ msgstr "%s eliminado permanentemente."
msgid "Auto Draft"
msgstr "Proyecto Automático"

#: components/points/includes/functions.php:302
#: components/points/includes/functions.php:306
msgid "This points type uses a custom meta key: %s"
msgstr "Este tipo de puntos utiliza una clave personalizada meta: %s"

#: components/points/includes/functions.php:327
#: components/points/includes/functions.php:331
msgid ""
"This points type uses a custom meta key (&#8220;%s&#8221;). If this key is "
"also used by another plugin, changes made by it will not be logged. Only "
Expand Down
Binary file modified src/languages/wordpoints-lt.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions src/languages/wordpoints-lt.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WordPoints 1.10.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpoints\n"
"POT-Creation-Date: 2016-12-08 17:02:14+00:00\n"
"POT-Creation-Date: 2017-01-02 20:04:13+00:00\n"
"PO-Revision-Date: 2015-06-22 19:24+0200\n"
"Last-Translator: Rimantas <[email protected]>\n"
"Language-Team: Lithuanian <https://hosted.weblate.org/projects/wordpoints/"
Expand Down Expand Up @@ -230,7 +230,7 @@ msgstr "Atjungti"
msgid "Activate %s"
msgstr "Aktyvuoti"

#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.0) #-#-#-#-#
#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: admin/includes/functions.php:69
#: components/points/admin/includes/functions.php:316
Expand Down Expand Up @@ -1741,11 +1741,11 @@ msgstr ""
msgid "Auto Draft"
msgstr ""

#: components/points/includes/functions.php:302
#: components/points/includes/functions.php:306
msgid "This points type uses a custom meta key: %s"
msgstr ""

#: components/points/includes/functions.php:327
#: components/points/includes/functions.php:331
msgid ""
"This points type uses a custom meta key (&#8220;%s&#8221;). If this key is "
"also used by another plugin, changes made by it will not be logged. Only "
Expand Down
Binary file modified src/languages/wordpoints-pt_BR.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions src/languages/wordpoints-pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WordPoints_pt_BR\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpoints\n"
"POT-Creation-Date: 2016-12-08 17:02:14+00:00\n"
"POT-Creation-Date: 2017-01-02 20:04:13+00:00\n"
"PO-Revision-Date: 2015-08-27 23:54+0200\n"
"Last-Translator: Leonardo Faria <[email protected]>\n"
"Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/"
Expand Down Expand Up @@ -228,7 +228,7 @@ msgstr "Desativar"
msgid "Activate %s"
msgstr "Ativar"

#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.0) #-#-#-#-#
#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: admin/includes/functions.php:69
#: components/points/admin/includes/functions.php:316
Expand Down Expand Up @@ -1850,11 +1850,11 @@ msgstr "%s permanentemente deletado."
msgid "Auto Draft"
msgstr ""

#: components/points/includes/functions.php:302
#: components/points/includes/functions.php:306
msgid "This points type uses a custom meta key: %s"
msgstr ""

#: components/points/includes/functions.php:327
#: components/points/includes/functions.php:331
msgid ""
"This points type uses a custom meta key (&#8220;%s&#8221;). If this key is "
"also used by another plugin, changes made by it will not be logged. Only "
Expand Down
14 changes: 7 additions & 7 deletions src/languages/wordpoints.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (C) 2016 WordPoints
# Copyright (C) 2017 WordPoints
# This file is distributed under the same license as the WordPoints package.
msgid ""
msgstr ""
"Project-Id-Version: WordPoints 2.2.0\n"
"Project-Id-Version: WordPoints 2.2.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpoints\n"
"POT-Creation-Date: 2016-12-08 17:02:14+00:00\n"
"POT-Creation-Date: 2017-01-02 20:04:13+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"

Expand Down Expand Up @@ -217,7 +217,7 @@ msgstr ""
msgid "Activate %s"
msgstr ""

#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.0) #-#-#-#-#
#. #-#-#-#-# wordpoints.pot (WordPoints 2.2.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: admin/includes/functions.php:69
#: components/points/admin/includes/functions.php:316
Expand Down Expand Up @@ -1695,11 +1695,11 @@ msgstr ""
msgid "Auto Draft"
msgstr ""

#: components/points/includes/functions.php:302
#: components/points/includes/functions.php:306
msgid "This points type uses a custom meta key: %s"
msgstr ""

#: components/points/includes/functions.php:327
#: components/points/includes/functions.php:331
msgid ""
"This points type uses a custom meta key (&#8220;%s&#8221;). If this key is "
"also used by another plugin, changes made by it will not be logged. Only "
Expand Down
19 changes: 18 additions & 1 deletion src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TPXS6
Tags: points, awards, rewards, cubepoints, credits, gamify, multisite, ranks
Requires at least: 4.6
Tested up to: 4.8-alpha-39357
Stable tag: 2.2.0
Stable tag: 2.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -114,6 +114,19 @@ screens.

This plugin adheres to [Semantic Versioning](http://semver.org/).

= 2.2.1 — 2017-01-03 =

##### Fixed

- The Points Types screen locking up when creating a new reaction for some events.
This only affected events where conditions could be created for items that could
relate to another item of the same type (like how a comment could have a parent
comment), causing an infinite loop.
- Points values not being formatted with the prefix if the suffix wasn't set, and
vice versa. This would only happen when the value wasn't set at all, not just when it
was empty, and so only applies to points types that were created programmatically.
Points types created through the UI were still formatted as expected.

= 2.2.0 — 2016-12-08 =

**Requires: WordPress 4.6+**
Expand Down Expand Up @@ -504,6 +517,10 @@ choosing the points type to add it to.
* Initial release

== Upgrade Notice ==
= 2.2.1 =
* Fixes a bug that could cause the Points Types screen to lock up in some
circumstances.

= 2.2.0 =
* Introduces greater flexibility for Rate Limits for event reactions, and now
differentiates points log entries that are hidden from some users.
Expand Down
8 changes: 4 additions & 4 deletions src/wordpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* Plugin Name: WordPoints
* Plugin URI: https://wordpoints.org/
* Description: Create one or more points systems for your site, and reward user activity.
* Version: 2.2.0
* Version: 2.2.1
* Author: J.D. Grimes
* Author URI: https://codesymphony.co/
* License: GPLv2
* Text Domain: wordpoints
* Domain Path: /languages
*
* ---------------------------------------------------------------------------------|
* Copyright 2013-16 J.D. Grimes (email : [email protected])
* Copyright 2013-17 J.D. Grimes (email : [email protected])
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 or later, as
Expand Down Expand Up @@ -40,9 +40,9 @@
*
* @package WordPoints
* @author J.D. Grimes <[email protected]>
* @version 2.2.0
* @version 2.2.1
* @license https://opensource.org/licenses/gpl-license.php GPL, version 2 or later.
* @copyright 2013-16 J.D. Grimes
* @copyright 2013-17 J.D. Grimes
*/

/**
Expand Down
48 changes: 45 additions & 3 deletions tests/phpunit/tests/points/points.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,61 @@ public function minimum_filter() {
//

/**
* Test that the result is unaltered by defualt.
* Test that the result is unaltered by default.
*
* @since 1.0.0
*
* @covers ::wordpoints_format_points
* @covers ::wordpoints_format_points_filter
*/
public function test_default_format() {

$this->assertEquals( '$5pts.', wordpoints_format_points( 5, 'points', 'testing' ) );
}

/**
* Test that it formats negative values correctly.
*
* @since 1.0.0
*
* @covers ::wordpoints_format_points
* @covers ::wordpoints_format_points_filter
*/
public function test_format_negative() {

$this->assertEquals( '-$5pts.', wordpoints_format_points( -5, 'points', 'testing' ) );
}

/**
* Test that it formats with the prefix even when the suffix isn't set.
*
* @since 1.0.0
*
* @covers ::wordpoints_format_points
* @covers ::wordpoints_format_points_filter
*/
public function test_format_prefix() {

wordpoints_add_points_type( array( 'name' => 'Credits', 'prefix' => '$' ) );

$this->assertEquals( '$5', wordpoints_format_points( 5, 'credits', 'testing' ) );
}

/**
* Test that it formats with the suffix even when the prefix isn't set.
*
* @since 1.0.0
*
* @covers ::wordpoints_format_points
* @covers ::wordpoints_format_points_filter
*/
public function test_format_suffix() {

wordpoints_add_points_type( array( 'name' => 'Credits', 'suffix' => 'c.' ) );

$this->assertEquals( '5c.', wordpoints_format_points( 5, 'credits', 'testing' ) );
}

/**
* Test that the 'wordpoints_points_display' filter is called.
*
Expand All @@ -163,8 +207,6 @@ public function test_format_filter() {
add_filter( 'wordpoints_format_points', array( $this, 'format_filter' ), 10, 3 );

$this->assertEquals( '5points', wordpoints_format_points( 5, 'points', 'testing' ) );

remove_filter( 'wordpoints_format_points', array( $this, 'format_filter' ), 10, 3 );
}

/**
Expand Down
Loading

0 comments on commit 8c6003d

Please sign in to comment.