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";
import { FETCH_GROUP } from "@/graphql/group";
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 { Component, Vue } from "vue-property-decorator";
@ -34,7 +40,7 @@ import { Component, Vue } from "vue-property-decorator";
variables() {
return {
id: this.currentActor.id,
group: this.group.preferredUsername,
group: usernameWithDomain(this.group),
};
},
subscribeToMore: {

View file

@ -859,9 +859,12 @@ export default class EditEvent extends Vue {
*/
private async buildVariables() {
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, {
organizerActorId: this.event.organizerActor.id,
organizerActorId: organizerActor.id,
});
}
const attributedToId = this.event.attributedTo?.id

View file

@ -79,6 +79,49 @@
}"
>{{ $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>
@ -456,6 +499,7 @@
/>
</div>
</b-modal>
</div>
<b-modal
:active.sync="isReportModalActive"
has-modal-card
@ -469,7 +513,6 @@
/>
</b-modal>
</div>
</div>
</template>
<script lang="ts">

View file

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

View file

@ -257,6 +257,7 @@ export default class Preferences extends Vue {
await this.$apollo.mutate<{ setUserSetting: string }>({
mutation: SET_USER_SETTINGS,
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.{Actor, Follower, Member}
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Audience
alias Mobilizon.Federation.ActivityPub.{Audience, Relay}
alias Mobilizon.Federation.ActivityPub.Types.Entity
alias Mobilizon.Federation.ActivityStream.Convertible
alias Mobilizon.GraphQL.API.Utils, as: APIUtils
@ -223,7 +223,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
%Follower{} = follower,
follow_as_data
) 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,
ActivityPub.accept(
:follow,

View file

@ -11,7 +11,7 @@ defmodule Mobilizon.Service.Export.Common do
@spec fetch_actor_event_feed(String.t()) :: String.t()
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)},
%Page{elements: events} <- Events.list_public_events_for_actor(actor),
%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
case FastSanitize.strip_tags(html) do
{:ok, html} ->
html
HtmlEntities.decode(html)
_ ->
raise "Failed to filter tags"

View file

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

View file

@ -142,6 +142,7 @@ defmodule Mobilizon.Mixfile do
{:ex_cldr_languages, "~> 0.2.1"},
{:slugger, "~> 0.3"},
{:sentry, "~> 8.0"},
{:html_entities, "~> 0.5"},
# Dev and test dependencies
{:phoenix_live_reload, "~> 1.2", only: [:dev, :e2e]},
{: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.",
"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
test "process_description/3 returns default if no description is provided" do