Ghost/ghost/admin/app/models/role.js
Kevin Ansfield a19c718e6c Fixed error causing missing sidebar after import
no issue
- the `Role.lowerCaseName` CP could throw an error when `name` was missing which caused the sidebar rendering to be aborted
- adds a guard to ensure we aren't calling string methods on `null` or `undefined`
2019-03-04 16:17:28 +00:00

18 lines
489 B
JavaScript

/* eslint-disable camelcase */
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import {computed} from '@ember/object';
export default Model.extend({
name: attr('string'),
description: attr('string'),
createdAtUTC: attr('moment-utc'),
updatedAtUTC: attr('moment-utc'),
createdBy: attr('number'),
updatedBy: attr('number'),
lowerCaseName: computed('name', function () {
return (this.name || '').toLocaleLowerCase();
})
});