Commit 1e1a1458 authored by Thomas Citharel's avatar Thomas Citharel
Browse files

Merge branch 'bugs' into 'main'

Various bugs

Closes #962, #964, #960 et #963

See merge request framasoft/mobilizon!1130
parents 402e3d97 4f0ba300
Pipeline #7634 canceled with stages
in 2 minutes and 36 seconds
......@@ -190,6 +190,21 @@ pages:
services:
- docker:stable-dind
cache: {}
before_script:
# Install buildx
- wget https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64
- mkdir -p ~/.docker/cli-plugins/
- mv buildx-v0.6.3.linux-amd64 ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# Create env
- docker context create tls-environment
- docker buildx create --use tls-environment
# Install qemu/binfmt
- docker pull tonistiigi/binfmt:latest
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
# Login to DockerHub
- mkdir -p ~/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json
tags:
- "privileged"
......@@ -199,13 +214,8 @@ build-docker-main:
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule"'
before_script:
# Login to DockerHub
- mkdir -p ~/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json
script:
- docker build -t framasoft/mobilizon:main -f docker/production/Dockerfile .
- docker push framasoft/mobilizon:main
- docker buildx build --push --platform linux/amd64 -t framasoft/mobilizon:main -f docker/production/Dockerfile .
build-docker-tag:
<<: *docker
......@@ -214,21 +224,6 @@ build-docker-tag:
when: never
- if: $CI_COMMIT_TAG
timeout: 3 hours
before_script:
# Install buildx
- wget https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64
- mkdir -p ~/.docker/cli-plugins/
- mv buildx-v0.6.3.linux-amd64 ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# Create env
- docker context create tls-environment
- docker buildx create --use tls-environment
# Install qemu/binfmt
- docker pull tonistiigi/binfmt:latest
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
# Login to DockerHub
- mkdir -p ~/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json
script:
- >
docker buildx build
......
......@@ -15,13 +15,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Make sure my group upcoming events are ordered by their start date
- Fix event participants pagination
- Always focus the search field after results have been fetched
- Don't sign fetches to instance actor when refreshing their keys
- Fix reject of already following instances
- Added missing timezone data to the Docker image
- Replace @tiptap/starter-kit with indidual extensions, removing unneeded extensions that caused issues on old Firefox versions
- Better handling of Friendica Update activities without actor information
- Always show pending/cancelled status on event cards
- Fixed nightly docker build
- Refresh loggeduser information before the final step of onboarding, avoiding loop when finishing onboarding
- Handle tz_world data being absent
### Translations
- Croatian (New !)
- Czech
- Gaelic
- Hungarian
......
......@@ -30,8 +30,7 @@ COPY rel ./rel
COPY support ./support
COPY --from=assets ./priv/static ./priv/static
RUN mix tz_world.update \
&& mix phx.digest.clean --all \
RUN mix phx.digest.clean --all \
&& mix release
# Finally setup the app
......@@ -50,11 +49,13 @@ LABEL org.opencontainers.image.title="mobilizon" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
RUN apk add --no-cache openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc musl-dev python3-dev pango libxslt-dev
RUN apk add --no-cache curl openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc musl-dev python3-dev pango libxslt-dev
RUN pip install weasyprint pyexcel-ods3
RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads
RUN mkdir -p /var/lib/mobilizon/timezones && chown nobody:nobody /var/lib/mobilizon/timezones
RUN mkdir -p /var/lib/mobilizon/timezones
RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets
RUN chown nobody:nobody /var/lib/mobilizon/timezones
RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon
USER nobody
......
......@@ -272,6 +272,11 @@ export default class NavBar extends Vue {
// If we don't have any identities, the user has validated their account,
// is logging for the first time but didn't create an identity somehow
if (this.identities.length === 0) {
console.debug(
"We have no identities listed for current user",
this.identities
);
console.debug("Pushing route to REGISTER_PROFILE");
try {
await this.$router.push({
name: RouteName.REGISTER_PROFILE,
......
......@@ -406,7 +406,6 @@ import Subtitle from "../components/Utils/Subtitle.vue";
DateComponent,
EventParticipationCard,
MultiCard,
"settings-onboard": () => import("./User/SettingsOnboard.vue"),
},
metaInfo() {
return {
......@@ -569,7 +568,9 @@ export default class Home extends Vue {
@Watch("loggedUser")
detectEmptyUserSettings(loggedUser: IUser): void {
console.debug("Try to detect empty user settings", loggedUser);
if (loggedUser?.id && loggedUser?.settings === null) {
console.debug("No user settings, pushing to onboarding assistant");
this.$router.push({
name: RouteName.WELCOME_SCREEN,
params: { step: "1" },
......
......@@ -49,7 +49,8 @@
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { USER_SETTINGS } from "@/graphql/user";
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { TIMEZONES } from "../../graphql/config";
import RouteName from "../../router/name";
import { IConfig } from "../../types/config.model";
......@@ -65,6 +66,7 @@ import { IConfig } from "../../types/config.model";
},
apollo: {
config: TIMEZONES,
loggedUser: USER_SETTINGS,
},
metaInfo() {
return {
......@@ -82,6 +84,11 @@ export default class SettingsOnboard extends Vue {
get stepIndex(): number {
return this.step - 1;
}
@Watch("stepIndex")
refetchUserSettings() {
this.$apollo.queries.loggedUser.refetch();
}
}
</script>
<style scoped lang="scss">
......
......@@ -14,37 +14,38 @@ defmodule Mobilizon.Federation.ActivityPub.Actor do
@doc """
Getting an actor from url, eventually creating it if we don't have it locally or if it needs an update
"""
@spec get_or_fetch_actor_by_url(url :: String.t(), preload :: boolean()) ::
@spec get_or_fetch_actor_by_url(url :: String.t(), options :: Keyword.t()) ::
{:ok, Actor.t()}
| {:error, make_actor_errors}
| {:error, :no_internal_relay_actor}
| {:error, :url_nil}
def get_or_fetch_actor_by_url(url, preload \\ false)
def get_or_fetch_actor_by_url(nil, _preload), do: {:error, :url_nil}
def get_or_fetch_actor_by_url(url, options \\ [])
def get_or_fetch_actor_by_url("https://www.w3.org/ns/activitystreams#Public", _preload) do
%Actor{url: url} = Relay.get_actor()
get_or_fetch_actor_by_url(url)
end
def get_or_fetch_actor_by_url(url, preload) do
def get_or_fetch_actor_by_url(url, options) when is_binary(url) and is_list(options) do
Logger.debug("Getting or fetching actor by URL #{url}")
preload = Keyword.get(options, :preload, false)
case Actors.get_actor_by_url(url, preload) do
{:ok, %Actor{} = cached_actor} ->
if Actors.needs_update?(cached_actor) do
__MODULE__.make_actor_from_url(url, preload: preload)
__MODULE__.make_actor_from_url(url, options)
else
{:ok, cached_actor}
end
{:error, :actor_not_found} ->
# For tests, see https://github.com/jjh42/mock#not-supported---mocking-internal-function-calls and Mobilizon.Federation.ActivityPubTest
__MODULE__.make_actor_from_url(url, preload: preload)
__MODULE__.make_actor_from_url(url, options)
end
end
def get_or_fetch_actor_by_url(nil, _preload), do: {:error, :url_nil}
@type make_actor_errors :: Fetcher.fetch_actor_errors() | :actor_is_local
@doc """
......
......@@ -210,7 +210,8 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
def handle_incoming(
%{"type" => "Follow", "object" => followed, "actor" => follower, "id" => id} = _data
) do
with {:ok, %Actor{} = followed} <- ActivityPubActor.get_or_fetch_actor_by_url(followed, true),
with {:ok, %Actor{} = followed} <-
ActivityPubActor.get_or_fetch_actor_by_url(followed, preload: true),
{:ok, %Actor{} = follower} <- ActivityPubActor.get_or_fetch_actor_by_url(follower),
{:ok, activity, object} <-
Actions.Follow.follow(follower, followed, id, false) do
......
......@@ -52,7 +52,8 @@ defmodule Mobilizon.Federation.HTTPSignatures.Signature do
{:ok, String.t()}
| {:error, :actor_not_found | :pem_decode_error}
defp get_public_key_for_url(url) do
with {:ok, %Actor{} = actor} <- ActivityPubActor.get_or_fetch_actor_by_url(url) do
with {:ok, %Actor{} = actor} <-
ActivityPubActor.get_or_fetch_actor_by_url(url, ignore_sign_object_fetches: true) do
get_actor_public_key(actor)
end
end
......
......@@ -69,8 +69,8 @@ defmodule Mobilizon.GraphQL.API.Follows do
)
case Actors.is_following(follower, followed) do
%Follower{approved: true} ->
{:error, "Follow already accepted"}
%Follower{approved: false} ->
{:error, "Follow already rejected"}
%Follower{} = follow ->
Actions.Reject.reject(
......
......@@ -18,6 +18,9 @@ defmodule Mobilizon.Service.TimezoneDetector do
{:error, :time_zone_not_found} ->
fallback
{:error, :enoent} ->
fallback
end
end
......
......@@ -126,7 +126,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActorTest do
needs_update?: fn _ -> false end
]},
{ActivityPubActor, [:passthrough],
make_actor_from_url: fn @actor_url, preload: false ->
make_actor_from_url: fn @actor_url, [] ->
{:ok,
%Actor{
preferred_username: "tcit",
......@@ -138,7 +138,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActorTest do
ActivityPubActor.get_or_fetch_actor_by_url(@actor_url)
assert_called(Actors.needs_update?(:_))
refute called(ActivityPubActor.make_actor_from_url(@actor_url, preload: false))
refute called(ActivityPubActor.make_actor_from_url(@actor_url, []))
end
# Fetch doesn't use cache if Actors.needs_update? returns true
......@@ -155,7 +155,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActorTest do
needs_update?: fn _ -> true end
]},
{ActivityPubActor, [:passthrough],
make_actor_from_url: fn @actor_url, preload: false ->
make_actor_from_url: fn @actor_url, [] ->
{:ok,
%Actor{
preferred_username: "tcit",
......@@ -169,7 +169,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActorTest do
assert_called(ActivityPubActor.get_or_fetch_actor_by_url(@actor_url))
assert_called(Actors.get_actor_by_url(@actor_url, false))
assert_called(Actors.needs_update?(:_))
assert_called(ActivityPubActor.make_actor_from_url(@actor_url, preload: false))
assert_called(ActivityPubActor.make_actor_from_url(@actor_url, []))
end
end
......@@ -182,7 +182,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActorTest do
assert match?(
{:error, :actor_deleted},
ActivityPubActor.make_actor_from_url(@actor_url, preload: false)
ActivityPubActor.make_actor_from_url(@actor_url, [])
)
end
......
Supports Markdown
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