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

Add avatar fallback for conversations view

Fixes #4991
parent 1c1af74e
// @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",
events: {
......@@ -39,8 +39,9 @@ app.views.ConversationsForm = Backbone.View.extend({
this.conversationRecipients.push(person);
this.updateContactIdsListInput();
/* 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 */
this.setupAvatarFallback(personEl);
},
prefill: function(handles) {
......
// @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",
events: {
......@@ -46,6 +46,7 @@ app.views.ConversationsInbox = Backbone.View.extend({
setupConversation: function() {
app.helpers.timeago($(this.el));
$(".control-icons a").tooltip({placement: "bottom"});
this.setupAvatarFallback(this.$el);
var conv = $(".conversation-wrapper .stream-element.selected"),
cBadge = $("#conversations-link .badge");
......
......@@ -60,6 +60,12 @@ describe("app.views.ConversationsForm", function() {
this.target.addRecipient({name: "diaspora user", handle: "diaspora-user@pod.tld"});
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() {
......
......@@ -100,6 +100,13 @@ describe("app.views.ConversationsInbox", function() {
$(".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() {
expect($(".conversation-wrapper > .conversation.selected")).toHaveClass("unread");
new app.views.ConversationsInbox();
......
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