From 3ce8c142b8730c3191b483b8b30f070620e41698 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 Apr 2022 12:00:47 +0200 Subject: [PATCH 1/2] Improve actor cards integration Signed-off-by: Thomas Citharel --- js/src/components/Account/ActorCard.vue | 11 ++++++- js/src/views/Admin/AdminGroupProfile.vue | 18 ++-------- js/src/views/Event/Event.vue | 42 +++++++++++++++++++----- js/tailwind.config.js | 3 ++ 4 files changed, 50 insertions(+), 24 deletions(-) diff --git a/js/src/components/Account/ActorCard.vue b/js/src/components/Account/ActorCard.vue index 448ca385c..62eb1a70a 100644 --- a/js/src/components/Account/ActorCard.vue +++ b/js/src/components/Account/ActorCard.vue @@ -31,7 +31,11 @@

@@ -95,3 +99,8 @@ export default class ActorCard extends Vue { displayName = displayName; } + diff --git a/js/src/views/Admin/AdminGroupProfile.vue b/js/src/views/Admin/AdminGroupProfile.vue index a330a69f8..67c6d1b4a 100644 --- a/js/src/views/Admin/AdminGroupProfile.vue +++ b/js/src/views/Admin/AdminGroupProfile.vue @@ -14,8 +14,8 @@ }, ]" /> -
-

+

+

-table, -section { - margin: 2rem 0; -} - -.actor-card { - background: #fff; - padding: 1.5rem; - border-radius: 10px; -} - diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index cbc5d5451..ad5cfc7da 100755 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -24,10 +24,14 @@ :actor="event.organizerActor" :inline="true" > - - @{{ usernameWithDomain(event.organizerActor) }} + + {{ + displayName(event.organizerActor) + }}
@@ -36,9 +40,23 @@ :actor="event.attributedTo" :inline="true" > - - @{{ usernameWithDomain(event.attributedTo) }} + {{ displayName(event.attributedTo) }} @@ -474,7 +492,13 @@ import { } from "../../graphql/event"; import { CURRENT_ACTOR_CLIENT, PERSON_STATUS_GROUP } from "../../graphql/actor"; import { EventModel, IEvent } from "../../types/event.model"; -import { IActor, IPerson, Person, usernameWithDomain } from "../../types/actor"; +import { + displayName, + IActor, + IPerson, + Person, + usernameWithDomain, +} from "../../types/actor"; import { GRAPHQL_API_ENDPOINT } from "../../api/_entrypoint"; import DateCalendarIcon from "../../components/Event/DateCalendarIcon.vue"; import MultiCard from "../../components/Event/MultiCard.vue"; @@ -659,6 +683,8 @@ export default class Event extends EventMixin { usernameWithDomain = usernameWithDomain; + displayName = displayName; + RouteName = RouteName; observer!: IntersectionObserver; diff --git a/js/tailwind.config.js b/js/tailwind.config.js index 789383b10..75a55ff73 100644 --- a/js/tailwind.config.js +++ b/js/tailwind.config.js @@ -16,6 +16,9 @@ module.exports = { secondary: withOpacityValue("--color-secondary"), "violet-title": withOpacityValue("--color-violet-title"), }, + lineClamp: { + 10: "10", + }, }, }, plugins: [require("@tailwindcss/line-clamp")], From e4a22bdb8314bd1dad5ea41ef32797fb7fe2371d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 Apr 2022 12:02:14 +0200 Subject: [PATCH 2/2] Fix latest group not refreshing in admin section Signed-off-by: Thomas Citharel --- lib/graphql/resolvers/admin.ex | 8 +------- lib/mobilizon/actors/actors.ex | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/graphql/resolvers/admin.ex b/lib/graphql/resolvers/admin.ex index 036f855e7..ce2002eb9 100644 --- a/lib/graphql/resolvers/admin.ex +++ b/lib/graphql/resolvers/admin.ex @@ -213,12 +213,6 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do _ -> nil end - last_group_created = - case Actors.list_actors(:Group) do - %Page{elements: [group | _]} -> group - _ -> nil - end - {:ok, %{ number_of_users: Statistics.get_cached_value(:local_users), @@ -231,7 +225,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do number_of_followers: Statistics.get_cached_value(:instance_followers), number_of_followings: Statistics.get_cached_value(:instance_followings), last_public_event_published: last_public_event_published, - last_group_created: last_group_created + last_group_created: Actors.last_group_created() }} end diff --git a/lib/mobilizon/actors/actors.ex b/lib/mobilizon/actors/actors.ex index bf3b640d0..5fa587254 100644 --- a/lib/mobilizon/actors/actors.ex +++ b/lib/mobilizon/actors/actors.ex @@ -444,6 +444,15 @@ defmodule Mobilizon.Actors do |> Repo.preload(:organized_events) end + @spec last_group_created :: Actor.t() | nil + def last_group_created do + Actor + |> where(type: :Group, suspended: false) + |> order_by(desc: :inserted_at) + |> limit(1) + |> Repo.one() + end + @doc """ Builds a page struct for actors by their name or displayed name. """