Merge branch 'stable' into develop
This commit is contained in:
commit
179964fd15
3 changed files with 53 additions and 9 deletions
|
|
@ -94,7 +94,8 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure.
|
|||
## Bug fixes
|
||||
* Fix mention autocomplete when pasting the username [#6510](https://github.com/diaspora/diaspora/pull/6510)
|
||||
* Use and update updated\_at for notifications [#6573](https://github.com/diaspora/diaspora/pull/6573)
|
||||
* Ensure the author signature is checked when receiving a relayable [#6539](https://github.com/diaspora/diaspora/pull/6539)
|
||||
* Ensure the author signature is checked when receiving a relayable [#6539](https://github.com/diaspora/diaspora/pull/6539)
|
||||
* Do not try to display hovercards when logged out [#6587](https://github.com/diaspora/diaspora/pull/6587)
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ app.views.Hovercard = app.views.Base.extend({
|
|||
this.hashtags = this.$('.hashtags');
|
||||
this.person_link = this.$('a.person');
|
||||
this.person_handle = this.$('div.handle');
|
||||
this.active = true;
|
||||
this.active = app.currentUser.authenticated();
|
||||
},
|
||||
|
||||
postRenderTemplate: function() {
|
||||
|
|
@ -97,7 +97,7 @@ app.views.Hovercard = app.views.Base.extend({
|
|||
href += "/hovercard.json";
|
||||
|
||||
var self = this;
|
||||
$.get(href, function(person){
|
||||
$.ajax(href, {preventGlobalErrorHandling: true}).done(function(person){
|
||||
if( !person || person.length === 0 ) {
|
||||
throw new Error("received data is not a person object");
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ app.views.Hovercard = app.views.Base.extend({
|
|||
// TODO render me client side!!!
|
||||
var href = this.href();
|
||||
href += "/aspect_membership_button";
|
||||
$.get(href, function(response) {
|
||||
$.ajax(href, {preventGlobalErrorHandling: true}).done(function(response){
|
||||
self.dropdown_container.html(response);
|
||||
});
|
||||
new app.views.AspectMembership({el: self.dropdown_container});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,54 @@
|
|||
describe("app.views.Hovercard", function() {
|
||||
beforeEach(function() {
|
||||
this.view = new app.views.Hovercard();
|
||||
context("user not signed in", function() {
|
||||
beforeEach(function() {
|
||||
logout();
|
||||
this.view = new app.views.Hovercard();
|
||||
});
|
||||
|
||||
describe("initialize", function() {
|
||||
it("deactivates hovercards", function() {
|
||||
expect(this.view.active).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("mouseIsOverElement", function() {
|
||||
it("returns false if the element is undefined", function() {
|
||||
expect(this.view.mouseIsOverElement(undefined, $.Event())).toBeFalsy();
|
||||
context("user signed in", function() {
|
||||
beforeEach(function() {
|
||||
loginAs(factory.userAttrs());
|
||||
this.view = new app.views.Hovercard();
|
||||
});
|
||||
|
||||
describe("initialize", function() {
|
||||
it("activates hovercards", function() {
|
||||
expect(this.view.active).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("mouseIsOverElement", function() {
|
||||
it("returns false if the element is undefined", function() {
|
||||
expect(this.view.mouseIsOverElement(undefined, $.Event())).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("_populateHovercard", function() {
|
||||
it("prevents global error handling for the ajax call", function() {
|
||||
spyOn(jQuery, "ajax").and.callThrough();
|
||||
this.view.parent = spec.content();
|
||||
this.view._populateHovercard();
|
||||
expect(jQuery.ajax).toHaveBeenCalledWith("undefined/hovercard.json", {preventGlobalErrorHandling: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe("_populateHovercardWith", function() {
|
||||
it("prevents global error handling for the ajax call", function() {
|
||||
spyOn(jQuery, "ajax").and.callThrough();
|
||||
this.view.parent = spec.content();
|
||||
this.view._populateHovercardWith({});
|
||||
expect(jQuery.ajax).toHaveBeenCalledWith(
|
||||
"undefined/aspect_membership_button",
|
||||
{preventGlobalErrorHandling: true}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue