Merge branch 'next-minor' into develop
This commit is contained in:
commit
e91a0a57a3
12 changed files with 60 additions and 8 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
* Fix sharing indicator on profile page for blocked users [#7382](https://github.com/diaspora/diaspora/pull/7382)
|
* Fix sharing indicator on profile page for blocked users [#7382](https://github.com/diaspora/diaspora/pull/7382)
|
||||||
* Remove post only after a successful deletion on the server [#7385](https://github.com/diaspora/diaspora/pull/7385)
|
* Remove post only after a successful deletion on the server [#7385](https://github.com/diaspora/diaspora/pull/7385)
|
||||||
* Fix an issue where pod admins could get logged out when using sidekiq-web [#7395](https://github.com/diaspora/diaspora/pull/7395)
|
* Fix an issue where pod admins could get logged out when using sidekiq-web [#7395](https://github.com/diaspora/diaspora/pull/7395)
|
||||||
|
* Add avatar fallback for typeahead and conversations [#7414](https://github.com/diaspora/diaspora/pull/7414)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Add links to liked and commented pages [#5502](https://github.com/diaspora/diaspora/pull/5502)
|
* Add links to liked and commented pages [#5502](https://github.com/diaspora/diaspora/pull/5502)
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ app.Router = Backbone.Router.extend({
|
||||||
app.shortcuts = app.shortcuts || new app.views.StreamShortcuts({el: $(document)});
|
app.shortcuts = app.shortcuts || new app.views.StreamShortcuts({el: $(document)});
|
||||||
if ($("#publisher").length !== 0) {
|
if ($("#publisher").length !== 0) {
|
||||||
app.publisher = app.publisher || new app.views.Publisher({collection: app.stream.items});
|
app.publisher = app.publisher || new app.views.Publisher({collection: app.stream.items});
|
||||||
|
app.page.setupAvatarFallback($(".main-stream-publisher"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#main_stream").html(app.page.render().el);
|
$("#main_stream").html(app.page.render().el);
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ app.views.Base = Backbone.View.extend({
|
||||||
.html(this.template(presenter))
|
.html(this.template(presenter))
|
||||||
.attr("data-template", _.last(this.templateName.split("/")));
|
.attr("data-template", _.last(this.templateName.split("/")));
|
||||||
|
|
||||||
// add avatar fallback if it can't be loaded
|
this.setupAvatarFallback(this.$el);
|
||||||
this.$el.find(this.avatars.selector).on("error", this.avatars.fallback);
|
|
||||||
|
|
||||||
// add placeholder support for old browsers
|
// add placeholder support for old browsers
|
||||||
this.$("input, textarea").placeholder();
|
this.$("input, textarea").placeholder();
|
||||||
|
|
@ -154,6 +153,10 @@ app.views.Base = Backbone.View.extend({
|
||||||
$(this).attr("src", ImagePaths.get("user/default.png"));
|
$(this).attr("src", ImagePaths.get("user/default.png"));
|
||||||
},
|
},
|
||||||
selector: "img.avatar"
|
selector: "img.avatar"
|
||||||
|
},
|
||||||
|
|
||||||
|
setupAvatarFallback: function(el) {
|
||||||
|
el.find(this.avatars.selector).on("error", this.avatars.fallback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||||
|
|
||||||
app.views.ConversationsForm = Backbone.View.extend({
|
app.views.ConversationsForm = app.views.Base.extend({
|
||||||
el: ".conversations-form-container",
|
el: ".conversations-form-container",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
|
@ -39,8 +39,9 @@ app.views.ConversationsForm = Backbone.View.extend({
|
||||||
this.conversationRecipients.push(person);
|
this.conversationRecipients.push(person);
|
||||||
this.updateContactIdsListInput();
|
this.updateContactIdsListInput();
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
this.tagListElement.append(HandlebarsTemplates.conversation_recipient_tag_tpl(person));
|
var personEl = $(HandlebarsTemplates.conversation_recipient_tag_tpl(person)).appendTo(this.tagListElement);
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
|
this.setupAvatarFallback(personEl);
|
||||||
},
|
},
|
||||||
|
|
||||||
prefill: function(handles) {
|
prefill: function(handles) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||||
|
|
||||||
app.views.ConversationsInbox = Backbone.View.extend({
|
app.views.ConversationsInbox = app.views.Base.extend({
|
||||||
el: "#conversations-container",
|
el: "#conversations-container",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
|
@ -46,6 +46,7 @@ app.views.ConversationsInbox = Backbone.View.extend({
|
||||||
setupConversation: function() {
|
setupConversation: function() {
|
||||||
app.helpers.timeago($(this.el));
|
app.helpers.timeago($(this.el));
|
||||||
$(".control-icons a").tooltip({placement: "bottom"});
|
$(".control-icons a").tooltip({placement: "bottom"});
|
||||||
|
this.setupAvatarFallback(this.$el);
|
||||||
|
|
||||||
var conv = $(".conversation-wrapper .stream-element.selected"),
|
var conv = $(".conversation-wrapper .stream-element.selected"),
|
||||||
cBadge = $("#conversations-link .badge");
|
cBadge = $("#conversations-link .badge");
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ app.views.NotificationDropdown = app.views.Base.extend({
|
||||||
|
|
||||||
afterNotificationChanges: function(node) {
|
afterNotificationChanges: function(node) {
|
||||||
node.find(".unread-toggle .entypo-eye").tooltip("destroy").tooltip();
|
node.find(".unread-toggle .entypo-eye").tooltip("destroy").tooltip();
|
||||||
node.find(this.avatars.selector).on("error", this.avatars.fallback);
|
this.setupAvatarFallback(node);
|
||||||
},
|
},
|
||||||
|
|
||||||
finishLoading: function() {
|
finishLoading: function() {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ app.views.SearchBase = app.views.Base.extend({
|
||||||
if(options.customSearch) { this.setupCustomSearch(); }
|
if(options.customSearch) { this.setupCustomSearch(); }
|
||||||
this.setupTypeahead();
|
this.setupTypeahead();
|
||||||
if(options.autoselect) { this.setupAutoselect(); }
|
if(options.autoselect) { this.setupAutoselect(); }
|
||||||
|
this.setupTypeaheadAvatarFallback();
|
||||||
},
|
},
|
||||||
|
|
||||||
bloodhoundTokenizer: function(str) {
|
bloodhoundTokenizer: function(str) {
|
||||||
|
|
@ -110,6 +111,12 @@ app.views.SearchBase = app.views.Base.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setupTypeaheadAvatarFallback: function() {
|
||||||
|
this.typeaheadInput.on("typeahead:render", function() {
|
||||||
|
this.setupAvatarFallback(this.$el);
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
ignorePersonForSuggestions: function(person) {
|
ignorePersonForSuggestions: function(person) {
|
||||||
if(person.handle) { this.ignoreDiasporaIds.push(person.handle); }
|
if(person.handle) { this.ignoreDiasporaIds.push(person.handle); }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||||
|
|
||||||
app.views.Tags = Backbone.View.extend({
|
app.views.Tags = app.views.Base.extend({
|
||||||
initialize: function(opts) {
|
initialize: function(opts) {
|
||||||
if(app.publisher) {
|
if(app.publisher) {
|
||||||
app.publisher.setText("#"+ opts.hashtagName + " ");
|
app.publisher.setText("#"+ opts.hashtagName + " ");
|
||||||
}
|
}
|
||||||
// add avatar fallback if it can't be loaded
|
// add avatar fallback if it can't be loaded
|
||||||
$(app.views.Base.prototype.avatars.selector).on("error", app.views.Base.prototype.avatars.fallback);
|
this.setupAvatarFallback($("#tags_show"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,12 @@ describe("app.views.ConversationsForm", function() {
|
||||||
this.target.addRecipient({name: "diaspora user", handle: "diaspora-user@pod.tld"});
|
this.target.addRecipient({name: "diaspora user", handle: "diaspora-user@pod.tld"});
|
||||||
expect($(".conversation-recipient-tag").length).toBe(1);
|
expect($(".conversation-recipient-tag").length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("calls setupAvatarFallback", function() {
|
||||||
|
spyOn(this.target, "setupAvatarFallback");
|
||||||
|
this.target.addRecipient({name: "diaspora user", handle: "diaspora-user@pod.tld"});
|
||||||
|
expect(this.target.setupAvatarFallback).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("prefill", function() {
|
describe("prefill", function() {
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,13 @@ describe("app.views.ConversationsInbox", function() {
|
||||||
$(".conversation-wrapper > .conversation.unread").addClass("selected");
|
$(".conversation-wrapper > .conversation.unread").addClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("calls setupAvatarFallback", function() {
|
||||||
|
this.view = new app.views.ConversationsInbox();
|
||||||
|
spyOn(this.view, "setupAvatarFallback");
|
||||||
|
this.view.setupConversation();
|
||||||
|
expect(this.view.setupAvatarFallback).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it("removes the unread class from the conversation", function() {
|
it("removes the unread class from the conversation", function() {
|
||||||
expect($(".conversation-wrapper > .conversation.selected")).toHaveClass("unread");
|
expect($(".conversation-wrapper > .conversation.selected")).toHaveClass("unread");
|
||||||
new app.views.ConversationsInbox();
|
new app.views.ConversationsInbox();
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@ describe("app.views.SearchBase", function() {
|
||||||
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q"), autoselect: true});
|
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q"), autoselect: true});
|
||||||
expect(app.views.SearchBase.prototype.setupAutoselect).toHaveBeenCalled();
|
expect(app.views.SearchBase.prototype.setupAutoselect).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("calls setupTypeaheadAvatarFallback", function() {
|
||||||
|
spyOn(app.views.SearchBase.prototype, "setupTypeaheadAvatarFallback");
|
||||||
|
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q")});
|
||||||
|
expect(app.views.SearchBase.prototype.setupTypeaheadAvatarFallback).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("bloodhoundTokenizer", function() {
|
describe("bloodhoundTokenizer", function() {
|
||||||
|
|
@ -261,6 +267,19 @@ describe("app.views.SearchBase", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("setupTypeaheadAvatarFallback", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q")});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("calls setupAvatarFallback when showing the results", function() {
|
||||||
|
spyOn(this.view, "setupAvatarFallback");
|
||||||
|
this.view.setupTypeaheadAvatarFallback();
|
||||||
|
this.search(this.view, "user");
|
||||||
|
expect(this.view.setupAvatarFallback).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("ignorePersonForSuggestions", function() {
|
describe("ignorePersonForSuggestions", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q")});
|
this.view = new app.views.SearchBase({el: "#search_people_form", typeaheadInput: $("#q")});
|
||||||
|
|
|
||||||
|
|
@ -163,5 +163,11 @@ describe("app.views.Base", function(){
|
||||||
expect(window.autosize).toHaveBeenCalled();
|
expect(window.autosize).toHaveBeenCalled();
|
||||||
expect(window.autosize.calls.mostRecent().args[0].is("textarea")).toBe(true);
|
expect(window.autosize.calls.mostRecent().args[0].is("textarea")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("calls setupAvatarFallback", function() {
|
||||||
|
spyOn(this.view, "setupAvatarFallback");
|
||||||
|
this.view.renderTemplate();
|
||||||
|
expect(this.view.setupAvatarFallback).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue