Merge branch 'fixes' into 'master'

A few fixes before final release

Closes #646 et #660

See merge request framasoft/mobilizon!879
This commit is contained in:
Thomas Citharel 2021-03-30 07:46:50 +00:00
commit f11ad9cf15
11 changed files with 86 additions and 27 deletions

View File

@ -5,7 +5,13 @@ import {
} from "@/graphql/actor"; } from "@/graphql/actor";
import { FETCH_GROUP } from "@/graphql/group"; import { FETCH_GROUP } from "@/graphql/group";
import RouteName from "@/router/name"; import RouteName from "@/router/name";
import { Group, IActor, IGroup, IPerson } from "@/types/actor"; import {
Group,
IActor,
IGroup,
IPerson,
usernameWithDomain,
} from "@/types/actor";
import { MemberRole } from "@/types/enums"; import { MemberRole } from "@/types/enums";
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
@ -34,7 +40,7 @@ import { Component, Vue } from "vue-property-decorator";
variables() { variables() {
return { return {
id: this.currentActor.id, id: this.currentActor.id,
group: this.group.preferredUsername, group: usernameWithDomain(this.group),
}; };
}, },
subscribeToMore: { subscribeToMore: {

View File

@ -859,9 +859,12 @@ export default class EditEvent extends Vue {
*/ */
private async buildVariables() { private async buildVariables() {
let res = this.event.toEditJSON(); let res = this.event.toEditJSON();
if (this.event.organizerActor) { const organizerActor = this.event.organizerActor?.id
? this.event.organizerActor
: this.organizerActor;
if (organizerActor) {
res = Object.assign(res, { res = Object.assign(res, {
organizerActorId: this.event.organizerActor.id, organizerActorId: organizerActor.id,
}); });
} }
const attributedToId = this.event.attributedTo?.id const attributedToId = this.event.attributedTo?.id

View File

@ -79,6 +79,49 @@
}" }"
>{{ $t("Group settings") }}</b-button >{{ $t("Group settings") }}</b-button
> >
<b-dropdown
class="menu-dropdown"
aria-role="list"
v-if="isCurrentActorAGroupMember"
position="is-bottom-left"
>
<b-button
slot="trigger"
outlined
role="button"
icon-right="dots-horizontal"
>
</b-button>
<b-dropdown-item
aria-role="listitem"
v-if="ableToReport"
@click="isReportModalActive = true"
>
<span>
{{ $t("Report") }}
<b-icon icon="flag" />
</span>
</b-dropdown-item>
<hr class="dropdown-divider" />
<b-dropdown-item has-link aria-role="listitem">
<a
:href="`@${preferredUsername}/feed/atom`"
:title="$t('Atom feed for events and posts')"
>
{{ $t("RSS/Atom Feed") }}
<b-icon icon="rss" />
</a>
</b-dropdown-item>
<b-dropdown-item has-link aria-role="listitem">
<a
:href="`@${preferredUsername}/feed/ics`"
:title="$t('ICS feed for events')"
>
{{ $t("ICS/WebCal Feed") }}
<b-icon icon="calendar-sync" />
</a>
</b-dropdown-item>
</b-dropdown>
</div> </div>
</div> </div>
</div> </div>
@ -456,19 +499,19 @@
/> />
</div> </div>
</b-modal> </b-modal>
<b-modal
:active.sync="isReportModalActive"
has-modal-card
ref="reportModal"
>
<report-modal
:on-confirm="reportGroup"
:title="$t('Report this group')"
:outside-domain="group.domain"
@close="$refs.reportModal.close()"
/>
</b-modal>
</div> </div>
<b-modal
:active.sync="isReportModalActive"
has-modal-card
ref="reportModal"
>
<report-modal
:on-confirm="reportGroup"
:title="$t('Report this group')"
:outside-domain="group.domain"
@close="$refs.reportModal.close()"
/>
</b-modal>
</div> </div>
</template> </template>

View File

@ -171,7 +171,7 @@ export default class GroupFollowers extends mixins(GroupMixin) {
pending: boolean | null = pending: boolean | null =
(this.$route.query.pending as string) == "1" || null; (this.$route.query.pending as string) == "1" || null;
FOLLOWERS_PER_PAGE = 1; FOLLOWERS_PER_PAGE = 10;
usernameWithDomain = usernameWithDomain; usernameWithDomain = usernameWithDomain;

View File

@ -257,6 +257,7 @@ export default class Preferences extends Vue {
await this.$apollo.mutate<{ setUserSetting: string }>({ await this.$apollo.mutate<{ setUserSetting: string }>({
mutation: SET_USER_SETTINGS, mutation: SET_USER_SETTINGS,
variables: userSettings, variables: userSettings,
refetchQueries: [{ query: USER_SETTINGS }],
}); });
} }
} }

View File

@ -3,7 +3,7 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
alias Mobilizon.Actors alias Mobilizon.Actors
alias Mobilizon.Actors.{Actor, Follower, Member} alias Mobilizon.Actors.{Actor, Follower, Member}
alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Audience alias Mobilizon.Federation.ActivityPub.{Audience, Relay}
alias Mobilizon.Federation.ActivityPub.Types.Entity alias Mobilizon.Federation.ActivityPub.Types.Entity
alias Mobilizon.Federation.ActivityStream.Convertible alias Mobilizon.Federation.ActivityStream.Convertible
alias Mobilizon.GraphQL.API.Utils, as: APIUtils alias Mobilizon.GraphQL.API.Utils, as: APIUtils
@ -223,7 +223,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
%Follower{} = follower, %Follower{} = follower,
follow_as_data follow_as_data
) do ) do
unless follower.target_actor.manually_approves_followers do %Actor{id: relay_id} = Relay.get_actor()
unless follower.target_actor.manually_approves_followers or
follower.target_actor.id == relay_id do
{:accept, {:accept,
ActivityPub.accept( ActivityPub.accept(
:follow, :follow,

View File

@ -11,7 +11,7 @@ defmodule Mobilizon.Service.Export.Common do
@spec fetch_actor_event_feed(String.t()) :: String.t() @spec fetch_actor_event_feed(String.t()) :: String.t()
def fetch_actor_event_feed(name) do def fetch_actor_event_feed(name) do
with %Actor{} = actor <- Actors.get_local_actor_by_name(name), with %Actor{} = actor <- Actors.get_actor_by_name(name),
{:visibility, true} <- {:visibility, Actor.is_public_visibility?(actor)}, {:visibility, true} <- {:visibility, Actor.is_public_visibility?(actor)},
%Page{elements: events} <- Events.list_public_events_for_actor(actor), %Page{elements: events} <- Events.list_public_events_for_actor(actor),
%Page{elements: posts} <- Posts.get_public_posts_for_group(actor) do %Page{elements: posts} <- Posts.get_public_posts_for_group(actor) do

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Service.Formatter.HTML do
def strip_tags(html) do def strip_tags(html) do
case FastSanitize.strip_tags(html) do case FastSanitize.strip_tags(html) do
{:ok, html} -> {:ok, html} ->
html HtmlEntities.decode(html)
_ -> _ ->
raise "Failed to filter tags" raise "Failed to filter tags"

View File

@ -7,9 +7,7 @@ defmodule Mobilizon.Web.FeedController do
action_fallback(Mobilizon.Web.FallbackController) action_fallback(Mobilizon.Web.FallbackController)
alias Mobilizon.Config alias Mobilizon.Config
@formats ["ics", "atom"] def instance(conn, %{"format" => format}) do
def instance(conn, %{"format" => format}) when format in @formats do
if Config.get([:instance, :enable_instance_feeds], false) do if Config.get([:instance, :enable_instance_feeds], false) do
return_data(conn, format, "instance", Config.instance_name()) return_data(conn, format, "instance", Config.instance_name())
else else
@ -17,7 +15,7 @@ defmodule Mobilizon.Web.FeedController do
end end
end end
def actor(conn, %{"format" => format, "name" => name}) when format in @formats do def actor(conn, %{"format" => format, "name" => name}) do
return_data(conn, format, "actor_" <> name, name) return_data(conn, format, "actor_" <> name, name)
end end
@ -33,7 +31,7 @@ defmodule Mobilizon.Web.FeedController do
{:error, :not_found} {:error, :not_found}
end end
def going(conn, %{"token" => token, "format" => format}) when format in @formats do def going(conn, %{"token" => token, "format" => format}) do
return_data(conn, format, "token_" <> token, "events") return_data(conn, format, "token_" <> token, "events")
end end
@ -72,4 +70,8 @@ defmodule Mobilizon.Web.FeedController do
{:error, :not_found} {:error, :not_found}
end end
end end
defp return_data(_conn, _, _, _) do
{:error, :not_found}
end
end end

View File

@ -142,6 +142,7 @@ defmodule Mobilizon.Mixfile do
{:ex_cldr_languages, "~> 0.2.1"}, {:ex_cldr_languages, "~> 0.2.1"},
{:slugger, "~> 0.3"}, {:slugger, "~> 0.3"},
{:sentry, "~> 8.0"}, {:sentry, "~> 8.0"},
{:html_entities, "~> 0.5"},
# Dev and test dependencies # Dev and test dependencies
{:phoenix_live_reload, "~> 1.2", only: [:dev, :e2e]}, {:phoenix_live_reload, "~> 1.2", only: [:dev, :e2e]},
{:ex_machina, "~> 2.3", only: [:dev, :test]}, {:ex_machina, "~> 2.3", only: [:dev, :test]},

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Service.Metadata.UtilsTest do
"<h1>Biography</h1><p>It all started when someone wanted a <b>very long string</b> to be cut. However it's difficult to invent things to write when you've got nothing to say. Anyway, what's the deal here. We just need to reach 200 characters.", "<h1>Biography</h1><p>It all started when someone wanted a <b>very long string</b> to be cut. However it's difficult to invent things to write when you've got nothing to say. Anyway, what's the deal here. We just need to reach 200 characters.",
"fr" "fr"
) == ) ==
"Biography It all started when someone wanted a very long string to be cut. However it&#39;s difficult to invent things to write when you&#39;ve got nothing to say. Anyway, what&#39;s the deal here. We" "Biography It all started when someone wanted a very long string to be cut. However it's difficult to invent things to write when you've got nothing to say. Anyway, what's the deal here. We just need to"
end end
test "process_description/3 returns default if no description is provided" do test "process_description/3 returns default if no description is provided" do