mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed {{gh-pluralize}} errors
refs fd91b593a5
- fixed incorrect call `pluralize(undefined, {withoutCount: true})` when number is undefined - `pluralize()` expects only one argument when no number is provided
- fixed destructuring in ghPluralize
- fixed linting error for undefined method after removal of `formatNumber` import
- fixed typo of import path in members controller
This commit is contained in:
parent
fd91b593a5
commit
45a857c951
3 changed files with 5 additions and 4 deletions
|
@ -3,7 +3,7 @@ import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import {A} from '@ember/array';
|
import {A} from '@ember/array';
|
||||||
import {action} from '@ember/object';
|
import {action} from '@ember/object';
|
||||||
import {ghPluralize} from 'ghost-admin/helpers/pluralize';
|
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
import {task} from 'ember-concurrency-decorators';
|
import {task} from 'ember-concurrency-decorators';
|
||||||
import {timeout} from 'ember-concurrency';
|
import {timeout} from 'ember-concurrency';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {helper} from '@ember/component/helper';
|
||||||
import {isBlank} from '@ember/utils';
|
import {isBlank} from '@ember/utils';
|
||||||
import {pluralize} from 'ember-inflector';
|
import {pluralize} from 'ember-inflector';
|
||||||
|
|
||||||
export function ghPluralize(number, word, {'without-count': withoutCount} = {}) {
|
export function ghPluralize(number, word, {withoutCount} = {}) {
|
||||||
let output = [];
|
let output = [];
|
||||||
|
|
||||||
if (!isBlank(number) && withoutCount !== true) {
|
if (!isBlank(number) && withoutCount !== true) {
|
||||||
|
@ -12,7 +12,7 @@ export function ghPluralize(number, word, {'without-count': withoutCount} = {})
|
||||||
|
|
||||||
// default {{pluralize}} allows for {{pluralize "word"}} with no number
|
// default {{pluralize}} allows for {{pluralize "word"}} with no number
|
||||||
if (isBlank(number)) {
|
if (isBlank(number)) {
|
||||||
output.push(pluralize(word, {withoutCount: true}));
|
output.push(pluralize(word));
|
||||||
} else {
|
} else {
|
||||||
output.push(pluralize(number, word, {withoutCount: true}));
|
output.push(pluralize(number, word, {withoutCount: true}));
|
||||||
}
|
}
|
||||||
|
@ -22,5 +22,5 @@ export function ghPluralize(number, word, {'without-count': withoutCount} = {})
|
||||||
|
|
||||||
// like {{pluralize}} but formats the number according to current locale
|
// like {{pluralize}} but formats the number according to current locale
|
||||||
export default helper(function ([number, word], {'without-count': withoutCount} = {}) {
|
export default helper(function ([number, word], {'without-count': withoutCount} = {}) {
|
||||||
return ghPluralize(number, word, {'without-count': withoutCount});
|
return ghPluralize(number, word, {withoutCount});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import MemberImportError from 'ghost-admin/errors/member-import-error';
|
import MemberImportError from 'ghost-admin/errors/member-import-error';
|
||||||
import Service, {inject as service} from '@ember/service';
|
import Service, {inject as service} from '@ember/service';
|
||||||
import validator from 'validator';
|
import validator from 'validator';
|
||||||
|
import {formatNumber} from 'ghost-admin/helpers/format-number';
|
||||||
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
|
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
|
||||||
import {isEmpty} from '@ember/utils';
|
import {isEmpty} from '@ember/utils';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue