diff --git a/app/cells/decidim/author/avatar_image.erb b/app/cells/decidim/author/avatar_image.erb index bbdfdd5..df2d2d3 100644 --- a/app/cells/decidim/author/avatar_image.erb +++ b/app/cells/decidim/author/avatar_image.erb @@ -1,5 +1,5 @@ -<% if model.is_a?(Decidim::User) %> - <% if mode.public? %> +<% if model.class == Decidim::UserPresenter %> + <% if model.public? %> <%= image_tag model.avatar_url, alt: t("decidim.author.avatar", name: display_name), class: "author__avatar" %> <% else %> <%= image_tag model.default_avatar_url, alt: t("decidim.author.avatar", name: display_name), class: "author__avatar" %> diff --git a/app/views/decidim/messaging/conversations/_conversation.html.erb b/app/views/decidim/messaging/conversations/_conversation.html.erb new file mode 100644 index 0000000..e3999ce --- /dev/null +++ b/app/views/decidim/messaging/conversations/_conversation.html.erb @@ -0,0 +1,46 @@ +<% nickname ||= false %> +<% conversation_path = nickname ? decidim.profile_conversation_path(conversation, nickname:) : decidim.conversation_path(conversation) %> + +<%= link_to conversation_path, id: "conversation-#{conversation.id}", class: "conversation__item" do %> +
+ <% if conversation.interlocutors(current_user).count == 1 %> + <%= cell "decidim/author", present(conversation.interlocutors(current_user).first), layout: :avatar, skip_profile_link: true %> + <% else %> + <%= icon "group-line", class: "w-4 h-4 text-gray fill-current" %> + <% end %> +
+ +
+
+

+ <% if conversation.interlocutors(current_user).last.public? %> + <%= conversation.interlocutors(current_user).last.name %> + <% else %> + <%= I18n.t("unnamed_user", scope: "decidim.privacy.private_account") %> + <% end %> +

+ + <% if conversation.interlocutors(current_user).count > 1 %> +
+ <% conversation.interlocutors(current_user).each do |interlocutor| %> + + <%= cell "decidim/author", present(interlocutor), layout: :avatar, skip_profile_link: true %> + + <% end %> +
+ <% end %> +
+ +

<%= truncate conversation.last_message.body, length: 150 %>

+ +
+ <%= t("decidim.user_conversations.index.time_ago", time: time_ago_in_words(Time.zone.parse(conversation.last_message.created_at.to_s))) %> +
+
+ +
+ <% if conversation.unread_count(current_user).positive? %> + <%= conversation.unread_count(current_user) %> + <% end %> +
+<% end %> diff --git a/app/views/decidim/messaging/conversations/_messages.html.erb b/app/views/decidim/messaging/conversations/_messages.html.erb new file mode 100644 index 0000000..c0a8825 --- /dev/null +++ b/app/views/decidim/messaging/conversations/_messages.html.erb @@ -0,0 +1,23 @@ +<% messages.each do |message| %> +
"> +
+ <%= cell "decidim/author", present(sender), layout: :avatar %> +
+ +
+ "> + <%= if sender.public? + sender.name + else + I18n.t("unnamed_user", scope: "decidim.privacy.private_account") + end %> + +
+ <%= simple_format(message.body_with_links) %> +
+ "> + <%= messages.last.friendly_created_at %> + +
+
+<% end %>