Merge branch 'fixes' into 'main'
Various fixes Closes #1198 et #1210 See merge request framasoft/mobilizon!1341
This commit is contained in:
commit
454a6188cc
|
@ -39,7 +39,7 @@ config :mobilizon, Mobilizon.Storage.Repo,
|
||||||
password: System.get_env("MOBILIZON_DATABASE_PASSWORD", "password"),
|
password: System.get_env("MOBILIZON_DATABASE_PASSWORD", "password"),
|
||||||
database: System.get_env("MOBILIZON_DATABASE_DBNAME", "mobilizon"),
|
database: System.get_env("MOBILIZON_DATABASE_DBNAME", "mobilizon"),
|
||||||
hostname: System.get_env("MOBILIZON_DATABASE_HOST", "postgres"),
|
hostname: System.get_env("MOBILIZON_DATABASE_HOST", "postgres"),
|
||||||
port: System.get_env("MOBILIZON_DATABASE_PORT", 5432),
|
port: System.get_env("MOBILIZON_DATABASE_PORT", "5432"),
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
config :mobilizon, Mobilizon.Web.Email.Mailer,
|
config :mobilizon, Mobilizon.Web.Email.Mailer,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<li
|
<li
|
||||||
|
class="bg-white dark:bg-zinc-800 rounded p-2"
|
||||||
:class="{
|
:class="{
|
||||||
reply: comment.inReplyToComment,
|
reply: comment.inReplyToComment,
|
||||||
'bg-purple-2': comment.isAnnouncement,
|
'bg-mbz-purple-50 dark:bg-mbz-purple-500': comment.isAnnouncement,
|
||||||
'bg-violet-1': commentSelected,
|
'bg-mbz-bluegreen-50 dark:bg-mbz-bluegreen-600': commentSelected,
|
||||||
'shadow-none': !rootComment,
|
'shadow-none': !rootComment,
|
||||||
}"
|
}"
|
||||||
class="bg-white dark:bg-zinc-900 rounded p-2"
|
|
||||||
>
|
>
|
||||||
<article :id="commentId" dir="auto" class="mbz-comment">
|
<article :id="commentId" dir="auto" class="mbz-comment">
|
||||||
<div>
|
<div>
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
v-html="comment.text"
|
v-html="comment.text"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
:lang="comment.language"
|
:lang="comment.language"
|
||||||
|
class="prose dark:prose-invert xl:prose-lg !max-w-full" :class="{ 'text-black dark:text-white': comment.isAnnouncement}"
|
||||||
/>
|
/>
|
||||||
<div v-else>{{ t("[This comment has been deleted]") }}</div>
|
<div v-else>{{ t("[This comment has been deleted]") }}</div>
|
||||||
<nav class="flex gap-1 mt-1" v-if="!comment.deletedAt">
|
<nav class="flex gap-1 mt-1" v-if="!comment.deletedAt">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<o-button
|
<o-button
|
||||||
|
tag="a"
|
||||||
outlined
|
outlined
|
||||||
variant="primary"
|
variant="primary"
|
||||||
:icon-left="oauthProvider.id"
|
:icon-left="oauthProvider.id"
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
<span>{{ SELECTED_PROVIDERS[oauthProvider.id] }}</span></o-button
|
<span>{{ SELECTED_PROVIDERS[oauthProvider.id] }}</span></o-button
|
||||||
>
|
>
|
||||||
<o-button
|
<o-button
|
||||||
|
tag="a"
|
||||||
outlined
|
outlined
|
||||||
variant="primary"
|
variant="primary"
|
||||||
:href="`/auth/${oauthProvider.id}`"
|
:href="`/auth/${oauthProvider.id}`"
|
||||||
|
|
|
@ -246,6 +246,8 @@ const icons: Record<string, () => Promise<any>> = {
|
||||||
import(
|
import(
|
||||||
`../../../node_modules/vue-material-design-icons/BellOffOutline.vue`
|
`../../../node_modules/vue-material-design-icons/BellOffOutline.vue`
|
||||||
),
|
),
|
||||||
|
ExitToApp: () =>
|
||||||
|
import(`../../../node_modules/vue-material-design-icons/ExitToApp.vue`),
|
||||||
};
|
};
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|
|
@ -8,10 +8,16 @@ const shortDisjunctionFormatter = new Intl.ListFormat(undefined, {
|
||||||
type: "disjunction",
|
type: "disjunction",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const listFormatAvailable = typeof Intl?.ListFormat === "function";
|
||||||
|
|
||||||
export const listShortConjunctionFormatter = (list: Array<string>): string => {
|
export const listShortConjunctionFormatter = (list: Array<string>): string => {
|
||||||
return shortConjunctionFormatter.format(list);
|
return listFormatAvailable
|
||||||
|
? shortConjunctionFormatter.format(list)
|
||||||
|
: list.join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listShortDisjunctionFormatter = (list: Array<string>): string => {
|
export const listShortDisjunctionFormatter = (list: Array<string>): string => {
|
||||||
return shortDisjunctionFormatter.format(list);
|
return listFormatAvailable
|
||||||
|
? shortDisjunctionFormatter.format(list)
|
||||||
|
: list.join(",");
|
||||||
};
|
};
|
||||||
|
|
|
@ -184,7 +184,7 @@
|
||||||
<o-button
|
<o-button
|
||||||
variant="success"
|
variant="success"
|
||||||
v-if="props.row.role === MemberRole.NOT_APPROVED"
|
v-if="props.row.role === MemberRole.NOT_APPROVED"
|
||||||
@click="approveMember(props.row.id)"
|
@click="approveMember({ memberId: props.row.id })"
|
||||||
icon-left="check"
|
icon-left="check"
|
||||||
>{{ t("Approve member") }}</o-button
|
>{{ t("Approve member") }}</o-button
|
||||||
>
|
>
|
||||||
|
@ -238,7 +238,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { FETCH_GROUP } from "@/graphql/group";
|
|
||||||
import { MemberRole } from "@/types/enums";
|
import { MemberRole } from "@/types/enums";
|
||||||
import { IMember } from "@/types/actor/member.model";
|
import { IMember } from "@/types/actor/member.model";
|
||||||
import RouteName from "@/router/name";
|
import RouteName from "@/router/name";
|
||||||
|
@ -312,6 +311,12 @@ const {
|
||||||
refetchQueries: [
|
refetchQueries: [
|
||||||
{
|
{
|
||||||
query: GROUP_MEMBERS,
|
query: GROUP_MEMBERS,
|
||||||
|
variables: {
|
||||||
|
groupName: props.preferredUsername,
|
||||||
|
page: page.value,
|
||||||
|
limit: MEMBERS_PER_PAGE,
|
||||||
|
roles: roles.value,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
@ -363,6 +368,12 @@ const {
|
||||||
refetchQueries: [
|
refetchQueries: [
|
||||||
{
|
{
|
||||||
query: GROUP_MEMBERS,
|
query: GROUP_MEMBERS,
|
||||||
|
variables: {
|
||||||
|
groupName: props.preferredUsername,
|
||||||
|
page: page.value,
|
||||||
|
limit: MEMBERS_PER_PAGE,
|
||||||
|
roles: roles.value,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
@ -423,7 +434,20 @@ const {
|
||||||
onDone: onApproveMemberDone,
|
onDone: onApproveMemberDone,
|
||||||
onError: onApproveMemberError,
|
onError: onApproveMemberError,
|
||||||
} = useMutation<{ approveMember: IMember }, { memberId: string }>(
|
} = useMutation<{ approveMember: IMember }, { memberId: string }>(
|
||||||
APPROVE_MEMBER
|
APPROVE_MEMBER,
|
||||||
|
{
|
||||||
|
refetchQueries: [
|
||||||
|
{
|
||||||
|
query: GROUP_MEMBERS,
|
||||||
|
variables: {
|
||||||
|
groupName: props.preferredUsername,
|
||||||
|
page: page.value,
|
||||||
|
limit: MEMBERS_PER_PAGE,
|
||||||
|
roles: roles.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
onApproveMemberDone(() => {
|
onApproveMemberDone(() => {
|
||||||
|
@ -452,8 +476,13 @@ const {
|
||||||
>(UPDATE_MEMBER, () => ({
|
>(UPDATE_MEMBER, () => ({
|
||||||
refetchQueries: [
|
refetchQueries: [
|
||||||
{
|
{
|
||||||
query: FETCH_GROUP,
|
query: GROUP_MEMBERS,
|
||||||
variables: { name: props.preferredUsername },
|
variables: {
|
||||||
|
groupName: props.preferredUsername,
|
||||||
|
page: page.value,
|
||||||
|
limit: MEMBERS_PER_PAGE,
|
||||||
|
roles: roles.value,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -38,16 +38,16 @@ module.exports = {
|
||||||
},
|
},
|
||||||
"mbz-purple": {
|
"mbz-purple": {
|
||||||
DEFAULT: "#424056",
|
DEFAULT: "#424056",
|
||||||
50: "#9C9AB4",
|
50: "#CAC9D7",
|
||||||
100: "#918EAB",
|
100: "#BEBDCE",
|
||||||
200: "#7A779A",
|
200: "#A8A6BC",
|
||||||
300: "#666385",
|
300: "#918EAB",
|
||||||
400: "#54516D",
|
400: "#7A779A",
|
||||||
500: "#424056",
|
500: "#666385",
|
||||||
600: "#292836",
|
600: "#54516D",
|
||||||
700: "#111016",
|
700: "#424056",
|
||||||
800: "#000000",
|
800: "#292836",
|
||||||
900: "#000000",
|
900: "#111016",
|
||||||
},
|
},
|
||||||
"mbz-bluegreen": {
|
"mbz-bluegreen": {
|
||||||
DEFAULT: "#1E7D97",
|
DEFAULT: "#1E7D97",
|
||||||
|
|
|
@ -31,7 +31,7 @@ defmodule Mobilizon.Storage.Page do
|
||||||
fn -> Repo.all(paginate(query, page, limit)) end
|
fn -> Repo.all(paginate(query, page, limit)) end
|
||||||
]
|
]
|
||||||
|> Enum.map(&Task.async/1)
|
|> Enum.map(&Task.async/1)
|
||||||
|> Enum.map(&Task.await(&1, 15_000))
|
|> Enum.map(&Task.await(&1, 30_000))
|
||||||
|
|
||||||
%__MODULE__{total: total, elements: elements}
|
%__MODULE__{total: total, elements: elements}
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,11 +14,11 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do
|
||||||
@impl Oban.Worker
|
@impl Oban.Worker
|
||||||
def perform(%Job{args: %{"action" => "notify_of_new_event", "event_uuid" => event_uuid}}) do
|
def perform(%Job{args: %{"action" => "notify_of_new_event", "event_uuid" => event_uuid}}) do
|
||||||
case Events.get_event_by_uuid_with_preload(event_uuid) do
|
case Events.get_event_by_uuid_with_preload(event_uuid) do
|
||||||
%Event{} = event ->
|
%Event{draft: false} = event ->
|
||||||
Group.notify_of_new_event(event)
|
Group.notify_of_new_event(event)
|
||||||
|
|
||||||
nil ->
|
nil ->
|
||||||
# Event deleted inbetween, no worries, just ignore
|
# Event still a draft or event deleted inbetween, no worries, just ignore
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,7 +44,7 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do
|
||||||
)
|
)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
# Event deleted inbetween, no worries, just ignore
|
# Event still a draft or event deleted inbetween, no worries, just ignore
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,8 +85,9 @@ defmodule Mobilizon.Web.ActivityPubController do
|
||||||
actor = Map.get(conn.assigns, :actor)
|
actor = Map.get(conn.assigns, :actor)
|
||||||
|
|
||||||
if actor_applicant_group_member?(group, actor) do
|
if actor_applicant_group_member?(group, actor) do
|
||||||
json(
|
conn
|
||||||
conn,
|
|> put_resp_content_type("application/activity+json")
|
||||||
|
|> json(
|
||||||
ActorView.render("member.json", %{
|
ActorView.render("member.json", %{
|
||||||
member: member,
|
member: member,
|
||||||
actor_applicant: actor
|
actor_applicant: actor
|
||||||
|
@ -168,7 +169,7 @@ defmodule Mobilizon.Web.ActivityPubController do
|
||||||
def relay(conn, _params) do
|
def relay(conn, _params) do
|
||||||
with {status, %Actor{} = actor} when status in [:commit, :ok] <- Cache.get_relay() do
|
with {status, %Actor{} = actor} when status in [:commit, :ok] <- Cache.get_relay() do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(ActorView.render("actor.json", %{actor: actor}))
|
|> json(ActorView.render("actor.json", %{actor: actor}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -194,7 +195,7 @@ defmodule Mobilizon.Web.ActivityPubController do
|
||||||
page <- max(page, 1),
|
page <- max(page, 1),
|
||||||
%Actor{} = actor <- Actors.get_local_actor_by_name_with_preload(name) do
|
%Actor{} = actor <- Actors.get_local_actor_by_name_with_preload(name) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(
|
|> json(
|
||||||
ActorView.render("#{collection}.json", %{
|
ActorView.render("#{collection}.json", %{
|
||||||
actor: actor,
|
actor: actor,
|
||||||
|
@ -208,7 +209,7 @@ defmodule Mobilizon.Web.ActivityPubController do
|
||||||
defp actor_collection(conn, collection, %{"name" => name}) do
|
defp actor_collection(conn, collection, %{"name" => name}) do
|
||||||
with %Actor{} = actor <- Actors.get_local_actor_by_name_with_preload(name) do
|
with %Actor{} = actor <- Actors.get_local_actor_by_name_with_preload(name) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(
|
|> json(
|
||||||
ActorView.render("#{collection}.json", %{
|
ActorView.render("#{collection}.json", %{
|
||||||
actor: actor,
|
actor: actor,
|
||||||
|
|
|
@ -141,11 +141,13 @@ defmodule Mobilizon.Web.PageController do
|
||||||
%Tombstone{} ->
|
%Tombstone{} ->
|
||||||
conn
|
conn
|
||||||
|> put_status(:gone)
|
|> put_status(:gone)
|
||||||
|
|> maybe_add_content_type_header()
|
||||||
|> render(object_type, object: object)
|
|> render(object_type, object: object)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
conn
|
conn
|
||||||
|> maybe_add_noindex_header(object)
|
|> maybe_add_noindex_header(object)
|
||||||
|
|> maybe_add_content_type_header()
|
||||||
|> render(object_type, object: object)
|
|> render(object_type, object: object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -199,4 +201,14 @@ defmodule Mobilizon.Web.PageController do
|
||||||
@spec is_person?(Actor.t()) :: boolean()
|
@spec is_person?(Actor.t()) :: boolean()
|
||||||
defp is_person?(%Actor{type: :Person}), do: true
|
defp is_person?(%Actor{type: :Person}), do: true
|
||||||
defp is_person?(_), do: false
|
defp is_person?(_), do: false
|
||||||
|
|
||||||
|
defp maybe_add_content_type_header(conn) do
|
||||||
|
case get_format(conn) do
|
||||||
|
"html" ->
|
||||||
|
conn
|
||||||
|
|
||||||
|
"activity-json" ->
|
||||||
|
put_resp_content_type(conn, "application/activity+json")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue