From 4b40c555126ad64e0906d3959415b4c7ea63fdaa Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Thu, 25 Jun 2015 21:06:00 -0700 Subject: [PATCH] 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 --- app/models/Entities/User.php | 4 ++++ gulpfile.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/Entities/User.php b/app/models/Entities/User.php index a16002af..b9b23a6f 100644 --- a/app/models/Entities/User.php +++ b/app/models/Entities/User.php @@ -37,6 +37,10 @@ return $this->hasMany('Entities\Comment', 'profile_id')->orderBy('created_at', 'desc'); } + public function getIsArchivedAttribute() { + return (bool) $this->attributes['is_archived']; + } + public function getUrlAttribute() { return URL::to('/' . $this->slug); } diff --git a/gulpfile.js b/gulpfile.js index 45fdfb4f..cdf1e55e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -164,7 +164,7 @@ gulp.task('build', [ 'scripts-app', 'styles-app', 'scripts-embed', - 'styles-embed', + 'styles-embed' ]); gulp.task("watch", function() {