Skip to content
Extraits de code Groupes Projets
Valider 98531970 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

only show edit and new post controls if you're on your profile page

parent ec096f81
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......@@ -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);
......
......@@ -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()
})
})
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter