T126: Fixed standard profiles appearing as archived profiles.

Summary:
The `is_archived` attribute on the `User` model did not explicitly come
back as any particular type. The resulting JSON had the string `"0"` for what's
meant to be a falsey value, but it evaluated to truthy in JS.

`is_archived` now has a getter which explicitly casts it to `boolean` before being
returned anywhere.

Test Plan: Manually tested in dev.

Reviewers: Feld0

Reviewed By: Feld0

Subscribers: #pony.fm

Projects: #pony.fm

Maniphest Tasks: T126

Differential Revision: https://phabricator.poniverse.net/D6
This commit is contained in:
Peter Deltchev 2015-06-25 21:06:00 -07:00
parent a6a78e667a
commit 4b40c55512
2 changed files with 5 additions and 1 deletions

View file

@ -37,6 +37,10 @@
return $this->hasMany('Entities\Comment', 'profile_id')->orderBy('created_at', 'desc'); return $this->hasMany('Entities\Comment', 'profile_id')->orderBy('created_at', 'desc');
} }
public function getIsArchivedAttribute() {
return (bool) $this->attributes['is_archived'];
}
public function getUrlAttribute() { public function getUrlAttribute() {
return URL::to('/' . $this->slug); return URL::to('/' . $this->slug);
} }

View file

@ -164,7 +164,7 @@ gulp.task('build', [
'scripts-app', 'scripts-app',
'styles-app', 'styles-app',
'scripts-embed', 'scripts-embed',
'styles-embed', 'styles-embed'
]); ]);
gulp.task("watch", function() { gulp.task("watch", function() {