From 7ef85fe19bd401c81108a3711b9bb9714809287b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 20 Nov 2023 12:15:19 +0100 Subject: [PATCH] fix(announcements): load group announcements Signed-off-by: Thomas Citharel --- .sobelow-skips | 6 +- lib/graphql/resolvers/conversation.ex | 2 +- lib/service/formatter/text.ex | 9 +- .../Conversations/AnnouncementListItem.vue | 97 +++++++++++++++++++ .../Conversations/EventConversations.vue | 21 ++-- .../Participation/NewPrivateMessage.vue | 7 +- src/i18n/en_US.json | 3 +- src/i18n/fr_FR.json | 5 +- test/service/notifier/email_test.exs | 3 +- 9 files changed, 124 insertions(+), 29 deletions(-) create mode 100644 src/components/Conversations/AnnouncementListItem.vue diff --git a/.sobelow-skips b/.sobelow-skips index eb69fdfc3..3ce31fbbd 100644 --- a/.sobelow-skips +++ b/.sobelow-skips @@ -3,13 +3,13 @@ 1C29EE70E90ECED01AF28EC58D2575B5 31CE26BC979C57B9E3CC97B40C290CE5 3529E7A4CECC24D02678820E6F521162 -4A4B7002DEB734A943B467DF7D2BD1AA +37E854EA3BDF7275C6A7631F80804EC4 4E7C044C59E0BCB76AA826789998F624 53CBBEB6243FAF5C37249CBA17DE6F4C -5804C3D68F833A3E8D258C0704DEE775 5BCE3651A03711295046DE48BDFE007E +5C16A2AE6A24E4795F95DDE20EEC458E +5C4CED447689F00D9D1ACEB9B895ED29 630C0972985257251EDF89A7117DE423 -81BAE1F18B4148E83C3265F81FFA6F5C 94ACF7B17C3FF42F64E57DD1DA936BD8 A32E125003F1EDFAD95C487C6A969725 ACF6272A1DBB3A2ABD96C0C120B5CA69 diff --git a/lib/graphql/resolvers/conversation.ex b/lib/graphql/resolvers/conversation.ex index 33c76c333..5c76683ca 100644 --- a/lib/graphql/resolvers/conversation.ex +++ b/lib/graphql/resolvers/conversation.ex @@ -29,7 +29,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Conversation do if Actors.is_member?(actor_id, attributed_to_id) do {:ok, event_id - |> Conversations.find_conversations_for_event(actor_id, page, limit) + |> Conversations.find_conversations_for_event(attributed_to_id, page, limit) |> conversation_participant_to_view()} else {:ok, %Page{total: 0, elements: []}} diff --git a/lib/service/formatter/text.ex b/lib/service/formatter/text.ex index 140502f16..2a46e9f4c 100644 --- a/lib/service/formatter/text.ex +++ b/lib/service/formatter/text.ex @@ -13,16 +13,15 @@ defmodule Mobilizon.Service.Formatter.Text do def paragraph(string, max_line_length, prefix \\ "") do string |> String.split("\n\n", trim: true) - |> Enum.map(&subparagraph(&1, max_line_length, prefix)) - |> Enum.join("\n#{prefix}\n") + |> Enum.map_join("\n#{prefix}\n", &subparagraph(&1, max_line_length, prefix)) end defp subparagraph(string, max_line_length, prefix) do [word | rest] = String.split(string, ~r/\s+/, trim: true) - lines_assemble(rest, max_line_length - String.length(prefix), String.length(word), word, []) - |> Enum.map(&"#{prefix}#{&1}") - |> Enum.join("\n") + rest + |> lines_assemble(max_line_length - String.length(prefix), String.length(word), word, []) + |> Enum.map_join("\n", &"#{prefix}#{&1}") end defp lines_assemble([], _, _, line, acc), do: [line | acc] |> Enum.reverse() diff --git a/src/components/Conversations/AnnouncementListItem.vue b/src/components/Conversations/AnnouncementListItem.vue new file mode 100644 index 000000000..8d49311e4 --- /dev/null +++ b/src/components/Conversations/AnnouncementListItem.vue @@ -0,0 +1,97 @@ + + diff --git a/src/components/Conversations/EventConversations.vue b/src/components/Conversations/EventConversations.vue index 77139b99e..83aa2c693 100644 --- a/src/components/Conversations/EventConversations.vue +++ b/src/components/Conversations/EventConversations.vue @@ -2,18 +2,10 @@
-

{{ t("Conversations") }}

- +

{{ t("Announcements") }}

- @@ -30,15 +22,14 @@ >
- - {{ t("There's no conversations yet") }} + + {{ t("There's no announcements yet") }}