Commit a951c40b authored by Steffen van Bergerem's avatar Steffen van Bergerem Committed by Benjamin Neff

Only reload profile header when changing aspect memberships

closes #7183

fixes #7072
parent 3930069e
......@@ -6,6 +6,7 @@
## Bug fixes
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
* Hide 'reshare' button on already reshared posts [#7169](https://github.com/diaspora/diaspora/pull/7169)
* Only reload profile header when changing aspect memberships [#7183](https://github.com/diaspora/diaspora/pull/7183)
## Features
* Show spinner when loading comments in the stream [#7170](https://github.com/diaspora/diaspora/pull/7170)
......
......@@ -31,7 +31,6 @@ app.pages.Profile = app.views.Base.extend({
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;
this.streamViewClass = _.has(opts, "streamView") ? opts.streamView : null;
this.model.on("change", this.render, this);
this.model.on("sync", this._done, this);
// bind to global events
......
......@@ -15,6 +15,7 @@ app.views.ProfileHeader = app.views.Base.extend({
initialize: function(opts) {
this.photos = _.has(opts, 'photos') ? opts.photos : null;
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
this.model.on("change", this.render, this);
$("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this));
$("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden);
},
......
......@@ -11,6 +11,34 @@ describe("app.views.ProfileHeader", function() {
loginAs(factory.userAttrs());
});
describe("initialize", function() {
it("calls #render when the model changes", function() {
spyOn(app.views.ProfileHeader.prototype, "render");
this.view.initialize();
expect(app.views.ProfileHeader.prototype.render).not.toHaveBeenCalled();
this.view.model.trigger("change");
expect(app.views.ProfileHeader.prototype.render).toHaveBeenCalled();
});
it("calls #mentionModalLoaded on modal:loaded", function() {
spec.content().append("<div id='mentionModal'></div>");
spyOn(app.views.ProfileHeader.prototype, "mentionModalLoaded");
this.view.initialize();
expect(app.views.ProfileHeader.prototype.mentionModalLoaded).not.toHaveBeenCalled();
$("#mentionModal").trigger("modal:loaded");
expect(app.views.ProfileHeader.prototype.mentionModalLoaded).toHaveBeenCalled();
});
it("calls #mentionModalHidden on hidden.bs.modal", function() {
spec.content().append("<div id='mentionModal'></div>");
spyOn(app.views.ProfileHeader.prototype, "mentionModalHidden");
this.view.initialize();
expect(app.views.ProfileHeader.prototype.mentionModalHidden).not.toHaveBeenCalled();
$("#mentionModal").trigger("hidden.bs.modal");
expect(app.views.ProfileHeader.prototype.mentionModalHidden).toHaveBeenCalled();
});
});
context("#presenter", function() {
it("contains necessary elements", function() {
expect(this.view.presenter()).toEqual(jasmine.objectContaining({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment