diff --git a/app/assets/javascripts/app/pages/profile.js b/app/assets/javascripts/app/pages/profile.js index 6410fad4971effc083a73741681a93600cb2d5ae..028e1b0774a4b193a57692fda91ab764356a9452 100644 --- a/app/assets/javascripts/app/pages/profile.js +++ b/app/assets/javascripts/app/pages/profile.js @@ -15,16 +15,19 @@ app.pages.Profile = app.views.Base.extend({ "click #edit-mode-toggle" : "toggleEdit" }, + personGUID : null, editMode : false, presenter : function(){ var bio = this.model.get("bio") || '' return _.extend(this.defaultPresenter(), {text : this.model && app.helpers.textFormatter(bio, this.model), - isOwnProfile : true }) + isOwnProfile : this.isOwnProfile() }) }, initialize : function(options) { + this.personGUID = options.personId + this.model = new app.models.Profile.findByGuid(options.personId) this.stream = options && options.stream || new app.models.Stream() this.stream.preloadOrFetch(); @@ -40,9 +43,6 @@ app.pages.Profile = app.views.Base.extend({ }, isOwnProfile : function() { - // this is all tested, but does not work. there is something weird going here :( - // i'm going to return true in the presenter for now until this is resolved. - - return(app.currentUser.get("diaspora_id") == this.model.get("diaspora_id")) + return(app.currentUser.get("guid") == this.personGUID) } }); \ No newline at end of file diff --git a/app/assets/stylesheets/new_styles/_profile.scss b/app/assets/stylesheets/new_styles/_profile.scss index 8eba2a120348745784af8307e34f4dcb439ef0f7..74d986322021594f894be00ef19685f846323201 100644 --- a/app/assets/stylesheets/new_styles/_profile.scss +++ b/app/assets/stylesheets/new_styles/_profile.scss @@ -78,6 +78,9 @@ text-align : right; padding : 10px 18px; + /* when our buttons aren't there, we still want to maintain a persistent height */ + min-height : 35px; + .control { @include transition(opacity); @include opacity(0.4); diff --git a/spec/javascripts/app/pages/profile_spec.js b/spec/javascripts/app/pages/profile_spec.js index 79f5f82b703cdb8afd616abbf9acf6284fede5ab..0dd76b126eb6095784aa4345f85aaccdc98f5395 100644 --- a/spec/javascripts/app/pages/profile_spec.js +++ b/spec/javascripts/app/pages/profile_spec.js @@ -82,7 +82,7 @@ describe("app.pages.Profile", function(){ describe("isOwnProfile", function(){ beforeEach(function(){ this.user = new app.models.User(factory.author()) - this.page.model = this.user + this.page.personGUID = this.user.get("guid") }) it("returns true if app.currentUser matches the current profile's user", function(){ @@ -91,7 +91,7 @@ describe("app.pages.Profile", function(){ }) it("returns false if app.currentUser does not match the current profile's user", function(){ - app.currentUser = new app.models.User(factory.author({diaspora_id : "foo@foo.com"})) + app.currentUser = new app.models.User(factory.author({guid : "nope!"})) expect(this.page.isOwnProfile()).toBeFalsy() }) })