Merge branch 'bugs' into 'master'
Various bugs See merge request framasoft/mobilizon!1097
This commit is contained in:
commit
1cc776622a
@ -210,10 +210,11 @@ pages:
|
|||||||
docker buildx build
|
docker buildx build
|
||||||
--push
|
--push
|
||||||
--platform linux/amd64,linux/arm64,linux/arm
|
--platform linux/amd64,linux/arm64,linux/arm
|
||||||
-t framasoft/mobilizon:multiarch
|
-t $DOCKER_IMAGE_NAME
|
||||||
-f docker/production/Dockerfile .
|
-f docker/production/Dockerfile .
|
||||||
tags:
|
tags:
|
||||||
- "privileged"
|
- "privileged"
|
||||||
|
timeout: 3 hours
|
||||||
|
|
||||||
build-docker-master:
|
build-docker-master:
|
||||||
<<: *docker
|
<<: *docker
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
class="ellipsis"
|
||||||
:title="
|
:title="
|
||||||
isDescriptionDifferentFromLocality
|
isDescriptionDifferentFromLocality
|
||||||
? `${physicalAddress.description}, ${physicalAddress.locality}`
|
? `${physicalAddress.description}, ${physicalAddress.locality}`
|
||||||
@ -22,7 +23,7 @@ import { PropType } from "vue";
|
|||||||
import { Prop, Vue, Component } from "vue-property-decorator";
|
import { Prop, Vue, Component } from "vue-property-decorator";
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class EventAddress extends Vue {
|
export default class InlineAddress extends Vue {
|
||||||
@Prop({ required: true, type: Object as PropType<IAddress> })
|
@Prop({ required: true, type: Object as PropType<IAddress> })
|
||||||
physicalAddress!: IAddress;
|
physicalAddress!: IAddress;
|
||||||
|
|
||||||
@ -34,3 +35,11 @@ export default class EventAddress extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.ellipsis {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-link
|
<router-link
|
||||||
class="card"
|
class="card"
|
||||||
:to="{ name: 'Event', params: { uuid: event.uuid } }"
|
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
||||||
>
|
>
|
||||||
<div class="card-image">
|
<div class="card-image">
|
||||||
<figure class="image is-16by9">
|
<figure class="image is-16by9">
|
||||||
@ -56,7 +56,7 @@
|
|||||||
{{ organizerDisplayName(event) }}
|
{{ organizerDisplayName(event) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<event-address
|
<inline-address
|
||||||
v-if="event.physicalAddress"
|
v-if="event.physicalAddress"
|
||||||
class="event-subtitle"
|
class="event-subtitle"
|
||||||
:physical-address="event.physicalAddress"
|
:physical-address="event.physicalAddress"
|
||||||
@ -87,13 +87,13 @@ import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
|||||||
import { Actor, Person } from "@/types/actor";
|
import { Actor, Person } from "@/types/actor";
|
||||||
import { EventStatus, ParticipantRole } from "@/types/enums";
|
import { EventStatus, ParticipantRole } from "@/types/enums";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
import EventAddress from "@/components/Event/EventAddress.vue";
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
DateCalendarIcon,
|
DateCalendarIcon,
|
||||||
LazyImageWrapper,
|
LazyImageWrapper,
|
||||||
EventAddress,
|
InlineAddress,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class EventCard extends Vue {
|
export default class EventCard extends Vue {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
>
|
>
|
||||||
{{ event.title }}
|
{{ event.title }}
|
||||||
</h3>
|
</h3>
|
||||||
<event-address
|
<inline-address
|
||||||
v-if="event.physicalAddress"
|
v-if="event.physicalAddress"
|
||||||
class="event-subtitle"
|
class="event-subtitle"
|
||||||
:physical-address="event.physicalAddress"
|
:physical-address="event.physicalAddress"
|
||||||
@ -107,13 +107,13 @@ import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
|||||||
import { ParticipantRole } from "@/types/enums";
|
import { ParticipantRole } from "@/types/enums";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
||||||
import EventAddress from "@/components/Event/EventAddress.vue";
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
DateCalendarIcon,
|
DateCalendarIcon,
|
||||||
LazyImageWrapper,
|
LazyImageWrapper,
|
||||||
EventAddress,
|
InlineAddress,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class EventMinimalistCard extends Vue {
|
export default class EventMinimalistCard extends Vue {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
<h3 class="title">{{ participation.event.title }}</h3>
|
<h3 class="title">{{ participation.event.title }}</h3>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<event-address
|
<inline-address
|
||||||
v-if="participation.event.physicalAddress"
|
v-if="participation.event.physicalAddress"
|
||||||
class="event-subtitle"
|
class="event-subtitle"
|
||||||
:physical-address="participation.event.physicalAddress"
|
:physical-address="participation.event.physicalAddress"
|
||||||
@ -270,7 +270,7 @@ import RouteName from "../../router/name";
|
|||||||
import { changeIdentity } from "../../utils/auth";
|
import { changeIdentity } from "../../utils/auth";
|
||||||
import PopoverActorCard from "../Account/PopoverActorCard.vue";
|
import PopoverActorCard from "../Account/PopoverActorCard.vue";
|
||||||
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
||||||
import EventAddress from "@/components/Event/EventAddress.vue";
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
||||||
import { PropType } from "vue";
|
import { PropType } from "vue";
|
||||||
|
|
||||||
const defaultOptions: IEventCardOptions = {
|
const defaultOptions: IEventCardOptions = {
|
||||||
@ -286,7 +286,7 @@ const defaultOptions: IEventCardOptions = {
|
|||||||
DateCalendarIcon,
|
DateCalendarIcon,
|
||||||
PopoverActorCard,
|
PopoverActorCard,
|
||||||
LazyImageWrapper,
|
LazyImageWrapper,
|
||||||
EventAddress,
|
InlineAddress,
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
currentActor: {
|
currentActor: {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
><br />
|
><br />
|
||||||
<small>{{ option.poiInfos.alternativeName }}</small>
|
<small>{{ option.poiInfos.alternativeName }}</small>
|
||||||
</template>
|
</template>
|
||||||
<template slot="empty">
|
<template #empty>
|
||||||
<span v-if="isFetching">{{ $t("Searching…") }}</span>
|
<span v-if="isFetching">{{ $t("Searching…") }}</span>
|
||||||
<div v-else-if="queryText.length >= 3" class="is-enabled">
|
<div v-else-if="queryText.length >= 3" class="is-enabled">
|
||||||
<span>{{
|
<span>{{
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="map column"
|
class="map column"
|
||||||
v-if="selected && selected.geom && selected.poiInfos"
|
v-if="!hideMap && selected && selected.geom && selected.poiInfos"
|
||||||
>
|
>
|
||||||
<map-leaflet
|
<map-leaflet
|
||||||
:coords="selected.geom"
|
:coords="selected.geom"
|
||||||
@ -96,47 +96,6 @@
|
|||||||
:readOnly="false"
|
:readOnly="false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- <b-modal v-if="selected" :active.sync="addressModalActive" :width="640" has-modal-card scroll="keep">-->
|
|
||||||
<!-- <div class="modal-card" style="width: auto">-->
|
|
||||||
<!-- <header class="modal-card-head">-->
|
|
||||||
<!-- <p class="modal-card-title">{{ $t('Add an address') }}</p>-->
|
|
||||||
<!-- </header>-->
|
|
||||||
<!-- <section class="modal-card-body">-->
|
|
||||||
<!-- <form>-->
|
|
||||||
<!-- <b-field :label="$t('Name')">-->
|
|
||||||
<!-- <b-input aria-required="true" required v-model="selected.description" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
|
|
||||||
<!-- <b-field :label="$t('Street')">-->
|
|
||||||
<!-- <b-input v-model="selected.street" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
|
|
||||||
<!-- <b-field grouped>-->
|
|
||||||
<!-- <b-field :label="$t('Postal Code')">-->
|
|
||||||
<!-- <b-input v-model="selected.postalCode" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
|
|
||||||
<!-- <b-field :label="$t('Locality')">-->
|
|
||||||
<!-- <b-input v-model="selected.locality" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
|
|
||||||
<!-- <b-field grouped>-->
|
|
||||||
<!-- <b-field :label="$t('Region')">-->
|
|
||||||
<!-- <b-input v-model="selected.region" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
|
|
||||||
<!-- <b-field :label="$t('Country')">-->
|
|
||||||
<!-- <b-input v-model="selected.country" />-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
<!-- </b-field>-->
|
|
||||||
<!-- </form>-->
|
|
||||||
<!-- </section>-->
|
|
||||||
<!-- <footer class="modal-card-foot">-->
|
|
||||||
<!-- <button class="button" type="button" @click="resetPopup()">{{ $t('Clear') }}</button>-->
|
|
||||||
<!-- </footer>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </b-modal>-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -158,6 +117,7 @@ export default class FullAddressAutoComplete extends Mixins(
|
|||||||
@Prop({ required: false, default: "" }) label!: string;
|
@Prop({ required: false, default: "" }) label!: string;
|
||||||
@Prop({ required: false }) userTimezone!: string;
|
@Prop({ required: false }) userTimezone!: string;
|
||||||
@Prop({ required: false, default: false, type: Boolean }) disabled!: boolean;
|
@Prop({ required: false, default: false, type: Boolean }) disabled!: boolean;
|
||||||
|
@Prop({ required: false, default: false, type: Boolean }) hideMap!: boolean;
|
||||||
|
|
||||||
addressModalActive = false;
|
addressModalActive = false;
|
||||||
|
|
||||||
@ -175,10 +135,6 @@ export default class FullAddressAutoComplete extends Mixins(
|
|||||||
updateEditing(): void {
|
updateEditing(): void {
|
||||||
if (!(this.value && this.value.id)) return;
|
if (!(this.value && this.value.id)) return;
|
||||||
this.selected = this.value;
|
this.selected = this.value;
|
||||||
const address = new Address(this.selected);
|
|
||||||
if (address.poiInfos) {
|
|
||||||
this.queryText = `${address.poiInfos.name} ${address.poiInfos.alternativeName}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelected(option: IAddress): void {
|
updateSelected(option: IAddress): void {
|
||||||
@ -212,20 +168,6 @@ export default class FullAddressAutoComplete extends Mixins(
|
|||||||
get canShowLocateMeButton(): boolean {
|
get canShowLocateMeButton(): boolean {
|
||||||
return window.isSecureContext;
|
return window.isSecureContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch("queryText")
|
|
||||||
resetAddressOnEmptyField(queryText: string): void {
|
|
||||||
if (queryText === "" && this.selected?.id) {
|
|
||||||
console.log("doing reset");
|
|
||||||
this.resetAddress();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resetAddress(): void {
|
|
||||||
this.$emit("input", null);
|
|
||||||
this.queryText = "";
|
|
||||||
this.selected = new Address();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -29,14 +29,7 @@ export default class MultiCard extends Vue {
|
|||||||
grid-auto-rows: 1fr;
|
grid-auto-rows: 1fr;
|
||||||
grid-column-gap: 30px;
|
grid-column-gap: 30px;
|
||||||
grid-row-gap: 30px;
|
grid-row-gap: 30px;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||||
// @media (min-width: 400px) {
|
|
||||||
// grid-template-columns: repeat(2, 1fr);
|
|
||||||
// }
|
|
||||||
// @media (min-width: 800px) {
|
|
||||||
// grid-template-columns: repeat(4, 1fr);
|
|
||||||
// }
|
|
||||||
|
|
||||||
.event-card {
|
.event-card {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1,7 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card">
|
<router-link
|
||||||
|
:to="{
|
||||||
|
name: RouteName.GROUP,
|
||||||
|
params: { preferredUsername: usernameWithDomain(group) },
|
||||||
|
}"
|
||||||
|
class="card"
|
||||||
|
>
|
||||||
|
<div class="card-image">
|
||||||
|
<figure class="image is-16by9">
|
||||||
|
<lazy-image-wrapper
|
||||||
|
:picture="group.banner"
|
||||||
|
style="height: 100%; position: absolute; top: 0; left: 0; width: 100%"
|
||||||
|
/>
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="media">
|
<div class="media mb-3">
|
||||||
<div class="media-left">
|
<div class="media-left">
|
||||||
<figure class="image is-48x48" v-if="group.avatar">
|
<figure class="image is-48x48" v-if="group.avatar">
|
||||||
<img class="is-rounded" :src="group.avatar.url" alt="" />
|
<img class="is-rounded" :src="group.avatar.url" alt="" />
|
||||||
@ -9,40 +23,108 @@
|
|||||||
<b-icon v-else size="is-large" icon="account-group" />
|
<b-icon v-else size="is-large" icon="account-group" />
|
||||||
</div>
|
</div>
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<router-link
|
<h3 class="is-size-5 group-title">{{ displayName(group) }}</h3>
|
||||||
:to="{
|
<span class="is-6 has-text-grey-dark">
|
||||||
name: RouteName.GROUP,
|
{{ `@${usernameWithDomain(group)}` }}
|
||||||
params: { preferredUsername: usernameWithDomain(group) },
|
</span>
|
||||||
}"
|
|
||||||
>
|
|
||||||
<h3>{{ group.name }}</h3>
|
|
||||||
<p class="is-6 has-text-grey">
|
|
||||||
<span v-if="group.domain">{{
|
|
||||||
`@${group.preferredUsername}@${group.domain}`
|
|
||||||
}}</span>
|
|
||||||
<span v-else>{{ `@${group.preferredUsername}` }}</span>
|
|
||||||
</p>
|
|
||||||
</router-link>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content" v-html="group.summary" />
|
||||||
<p>{{ group.summary }}</p>
|
<div class="card-custom-footer">
|
||||||
|
<inline-address
|
||||||
|
class="has-text-grey-dark"
|
||||||
|
v-if="group.physicalAddress"
|
||||||
|
:physicalAddress="group.physicalAddress"
|
||||||
|
/>
|
||||||
|
<p class="has-text-grey-dark">
|
||||||
|
{{
|
||||||
|
$tc(
|
||||||
|
"{count} members or followers",
|
||||||
|
group.members.total + group.followers.total,
|
||||||
|
{
|
||||||
|
count: group.members.total + group.followers.total,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||||
import { IGroup, usernameWithDomain } from "@/types/actor";
|
import { displayName, IGroup, usernameWithDomain } from "@/types/actor";
|
||||||
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
||||||
|
|
||||||
@Component
|
@Component({
|
||||||
|
components: {
|
||||||
|
LazyImageWrapper,
|
||||||
|
InlineAddress,
|
||||||
|
},
|
||||||
|
})
|
||||||
export default class GroupCard extends Vue {
|
export default class GroupCard extends Vue {
|
||||||
@Prop({ required: true }) group!: IGroup;
|
@Prop({ required: true }) group!: IGroup;
|
||||||
|
|
||||||
RouteName = RouteName;
|
RouteName = RouteName;
|
||||||
|
|
||||||
usernameWithDomain = usernameWithDomain;
|
usernameWithDomain = usernameWithDomain;
|
||||||
|
|
||||||
|
displayName = displayName;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card {
|
||||||
|
.card-content {
|
||||||
|
padding: 0.75rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .content {
|
||||||
|
& > *:first-child {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-weight: normal;
|
||||||
|
text-transform: none;
|
||||||
|
font-style: normal;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& > *:not(:first-child) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-left {
|
||||||
|
margin-right: inherit;
|
||||||
|
margin-inline-end: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-content {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
.group-title {
|
||||||
|
line-height: 1.75rem;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
39
js/src/components/Group/MultiGroupCard.vue
Normal file
39
js/src/components/Group/MultiGroupCard.vue
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<div class="multi-card-group">
|
||||||
|
<group-card
|
||||||
|
class="group-card"
|
||||||
|
v-for="group in groups"
|
||||||
|
:group="group"
|
||||||
|
:key="group.id"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { IGroup } from "@/types/actor";
|
||||||
|
import { PropType } from "vue";
|
||||||
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||||
|
import GroupCard from "./GroupCard.vue";
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
GroupCard,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class MultiGroupCard extends Vue {
|
||||||
|
@Prop({ type: Array as PropType<IGroup[]>, required: true })
|
||||||
|
groups!: IGroup[];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.multi-card-group {
|
||||||
|
display: grid;
|
||||||
|
grid-auto-rows: 1fr;
|
||||||
|
grid-column-gap: 30px;
|
||||||
|
grid-row-gap: 30px;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
|
.group-card {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -163,7 +163,7 @@ export default class Map extends Vue {
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
div.map-container {
|
div.map-container {
|
||||||
height: 100%;
|
height: 80vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.leaflet-map {
|
.leaflet-map {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
style="height: 120px"
|
style="height: 120px"
|
||||||
/>
|
/>
|
||||||
<div class="title-info-wrapper has-text-grey-dark">
|
<div class="title-info-wrapper has-text-grey-dark">
|
||||||
<p class="post-minimalist-title">{{ post.title }}</p>
|
<h3 class="post-minimalist-title">{{ post.title }}</h3>
|
||||||
<p class="post-publication-date">
|
<p class="post-publication-date">
|
||||||
<b-icon icon="clock" />
|
<b-icon icon="clock" />
|
||||||
<span class="has-text-grey-dark" v-if="isBeforeLastWeek">{{
|
<span class="has-text-grey-dark" v-if="isBeforeLastWeek">{{
|
||||||
|
@ -466,44 +466,6 @@ export const FETCH_GROUP_EVENTS = gql`
|
|||||||
${ADDRESS_FRAGMENT}
|
${ADDRESS_FRAGMENT}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const CLOSE_EVENTS = gql`
|
|
||||||
query CloseEvents($location: String, $radius: Float) {
|
|
||||||
searchEvents(location: $location, radius: $radius, page: 1, limit: 10) {
|
|
||||||
total
|
|
||||||
elements {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
uuid
|
|
||||||
beginsOn
|
|
||||||
picture {
|
|
||||||
id
|
|
||||||
url
|
|
||||||
}
|
|
||||||
tags {
|
|
||||||
...TagFragment
|
|
||||||
}
|
|
||||||
options {
|
|
||||||
...EventOptions
|
|
||||||
}
|
|
||||||
physicalAddress {
|
|
||||||
...AdressFragment
|
|
||||||
}
|
|
||||||
attributedTo {
|
|
||||||
...ActorFragment
|
|
||||||
}
|
|
||||||
organizerActor {
|
|
||||||
...ActorFragment
|
|
||||||
}
|
|
||||||
__typename
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
${ADDRESS_FRAGMENT}
|
|
||||||
${TAG_FRAGMENT}
|
|
||||||
${EVENT_OPTIONS_FRAGMENT}
|
|
||||||
${ACTOR_FRAGMENT}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const EXPORT_EVENT_PARTICIPATIONS = gql`
|
export const EXPORT_EVENT_PARTICIPATIONS = gql`
|
||||||
mutation ExportEventParticipants(
|
mutation ExportEventParticipants(
|
||||||
$eventId: ID!
|
$eventId: ID!
|
||||||
|
@ -408,3 +408,19 @@ export const GROUP_TIMELINE = gql`
|
|||||||
}
|
}
|
||||||
${ACTOR_FRAGMENT}
|
${ACTOR_FRAGMENT}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const CLOSE_GROUPS = gql`
|
||||||
|
query CloseGroups($location: String, $radius: Float) {
|
||||||
|
searchGroups(location: $location, radius: $radius, page: 1, limit: 10) {
|
||||||
|
total
|
||||||
|
elements {
|
||||||
|
...ActorFragment
|
||||||
|
physicalAddress {
|
||||||
|
...AdressFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${ACTOR_FRAGMENT}
|
||||||
|
${ADDRESS_FRAGMENT}
|
||||||
|
`;
|
||||||
|
@ -105,3 +105,51 @@ export const HOME_USER_QUERIES = gql`
|
|||||||
${EVENT_OPTIONS_FRAGMENT}
|
${EVENT_OPTIONS_FRAGMENT}
|
||||||
${ACTOR_FRAGMENT}
|
${ACTOR_FRAGMENT}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const CLOSE_CONTENT = gql`
|
||||||
|
query CloseContent(
|
||||||
|
$location: String!
|
||||||
|
$radius: Float
|
||||||
|
$page: Int
|
||||||
|
$limit: Int
|
||||||
|
) {
|
||||||
|
searchEvents(
|
||||||
|
location: $location
|
||||||
|
radius: $radius
|
||||||
|
page: $page
|
||||||
|
limit: $limit
|
||||||
|
) {
|
||||||
|
total
|
||||||
|
elements {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
uuid
|
||||||
|
beginsOn
|
||||||
|
picture {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
tags {
|
||||||
|
...TagFragment
|
||||||
|
}
|
||||||
|
options {
|
||||||
|
...EventOptions
|
||||||
|
}
|
||||||
|
physicalAddress {
|
||||||
|
...AdressFragment
|
||||||
|
}
|
||||||
|
attributedTo {
|
||||||
|
...ActorFragment
|
||||||
|
}
|
||||||
|
organizerActor {
|
||||||
|
...ActorFragment
|
||||||
|
}
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${ADDRESS_FRAGMENT}
|
||||||
|
${TAG_FRAGMENT}
|
||||||
|
${EVENT_OPTIONS_FRAGMENT}
|
||||||
|
${ACTOR_FRAGMENT}
|
||||||
|
`;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
import { ACTOR_FRAGMENT } from "./actor";
|
import { ACTOR_FRAGMENT } from "./actor";
|
||||||
|
import { ADDRESS_FRAGMENT } from "./address";
|
||||||
|
import { TAG_FRAGMENT } from "./tags";
|
||||||
|
|
||||||
export const SEARCH_EVENTS = gql`
|
export const SEARCH_EVENTS_AND_GROUPS = gql`
|
||||||
query SearchEvents(
|
query SearchEventsAndGroups(
|
||||||
$location: String
|
$location: String
|
||||||
$radius: Float
|
$radius: Float
|
||||||
$tags: String
|
$tags: String
|
||||||
@ -33,23 +35,20 @@ export const SEARCH_EVENTS = gql`
|
|||||||
url
|
url
|
||||||
}
|
}
|
||||||
tags {
|
tags {
|
||||||
slug
|
...TagFragment
|
||||||
title
|
}
|
||||||
|
physicalAddress {
|
||||||
|
...AdressFragment
|
||||||
|
}
|
||||||
|
organizerActor {
|
||||||
|
...ActorFragment
|
||||||
|
}
|
||||||
|
attributedTo {
|
||||||
|
...ActorFragment
|
||||||
}
|
}
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const SEARCH_GROUPS = gql`
|
|
||||||
query SearchGroups(
|
|
||||||
$term: String
|
|
||||||
$location: String
|
|
||||||
$radius: Float
|
|
||||||
$page: Int
|
|
||||||
$limit: Int
|
|
||||||
) {
|
|
||||||
searchGroups(
|
searchGroups(
|
||||||
term: $term
|
term: $term
|
||||||
location: $location
|
location: $location
|
||||||
@ -60,9 +59,24 @@ export const SEARCH_GROUPS = gql`
|
|||||||
total
|
total
|
||||||
elements {
|
elements {
|
||||||
...ActorFragment
|
...ActorFragment
|
||||||
|
banner {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
members(roles: "member,moderator,administrator,creator") {
|
||||||
|
total
|
||||||
|
}
|
||||||
|
followers(approved: true) {
|
||||||
|
total
|
||||||
|
}
|
||||||
|
physicalAddress {
|
||||||
|
...AdressFragment
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
${TAG_FRAGMENT}
|
||||||
|
${ADDRESS_FRAGMENT}
|
||||||
${ACTOR_FRAGMENT}
|
${ACTOR_FRAGMENT}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -1226,5 +1226,9 @@
|
|||||||
"Post {eventTitle} reported": "Post {eventTitle} reported",
|
"Post {eventTitle} reported": "Post {eventTitle} reported",
|
||||||
"You have attended {count} events in the past.": "You have not attended any events in the past.|You have attended one event in the past.|You have attended {count} events in the past.",
|
"You have attended {count} events in the past.": "You have not attended any events in the past.|You have attended one event in the past.|You have attended {count} events in the past.",
|
||||||
"Showing events starting on": "Showing events starting on",
|
"Showing events starting on": "Showing events starting on",
|
||||||
"Showing events before": "Showing events before"
|
"Showing events before": "Showing events before",
|
||||||
|
"Clear date filter field": "Clear date filter field",
|
||||||
|
"{count} members or followers": "No members or followers|One member or follower|{count} members or followers",
|
||||||
|
"This profile is from another instance, the informations shown here may be incomplete.": "This profile is from another instance, the informations shown here may be incomplete.",
|
||||||
|
"View full profile": "View full profile"
|
||||||
}
|
}
|
||||||
|
@ -1330,5 +1330,9 @@
|
|||||||
"Post {eventTitle} reported": "Billet {eventTitle} signalé",
|
"Post {eventTitle} reported": "Billet {eventTitle} signalé",
|
||||||
"You have attended {count} events in the past.": "Vous n'avez participé à aucun événement par le passé.|Vous avez participé à un événement par le passé.|Vous avez participé à {count} événements par le passé.",
|
"You have attended {count} events in the past.": "Vous n'avez participé à aucun événement par le passé.|Vous avez participé à un événement par le passé.|Vous avez participé à {count} événements par le passé.",
|
||||||
"Showing events starting on": "Afficher les événements à partir de",
|
"Showing events starting on": "Afficher les événements à partir de",
|
||||||
"Showing events before": "Afficher les événements avant"
|
"Showing events before": "Afficher les événements avant",
|
||||||
|
"Clear date filter field": "Vider le champ de filtre de la date",
|
||||||
|
"{count} members or followers": "Aucun⋅e membre ou abonné⋅e|Un⋅e membre ou abonné⋅e|{count} membres ou abonné⋅es",
|
||||||
|
"This profile is from another instance, the informations shown here may be incomplete.": "Ce profil provient d'une autre instance, les informations montrées ici peuvent être incomplètes.",
|
||||||
|
"View full profile": "Voir le profil complet"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { mixins } from "vue-class-component";
|
|
||||||
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
||||||
import { LatLng } from "leaflet";
|
import { LatLng } from "leaflet";
|
||||||
import { Address, IAddress } from "../types/address.model";
|
import { Address, IAddress } from "../types/address.model";
|
||||||
@ -7,6 +6,7 @@ import { CONFIG } from "../graphql/config";
|
|||||||
import { IConfig } from "../types/config.model";
|
import { IConfig } from "../types/config.model";
|
||||||
import debounce from "lodash/debounce";
|
import debounce from "lodash/debounce";
|
||||||
import { DebouncedFunc } from "lodash";
|
import { DebouncedFunc } from "lodash";
|
||||||
|
import { PropType } from "vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@ -17,8 +17,9 @@ import { DebouncedFunc } from "lodash";
|
|||||||
config: CONFIG,
|
config: CONFIG,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class AddressAutoCompleteMixin extends mixins(Vue) {
|
export default class AddressAutoCompleteMixin extends Vue {
|
||||||
@Prop({ required: true }) value!: IAddress;
|
@Prop({ required: true, type: Object as PropType<IAddress> })
|
||||||
|
value!: IAddress;
|
||||||
gettingLocationError: string | null = null;
|
gettingLocationError: string | null = null;
|
||||||
|
|
||||||
gettingLocation = false;
|
gettingLocation = false;
|
||||||
@ -29,8 +30,6 @@ export default class AddressAutoCompleteMixin extends mixins(Vue) {
|
|||||||
|
|
||||||
selected: IAddress = new Address();
|
selected: IAddress = new Address();
|
||||||
|
|
||||||
queryText: string = (this.value && new Address(this.value).fullName) || "";
|
|
||||||
|
|
||||||
config!: IConfig;
|
config!: IConfig;
|
||||||
|
|
||||||
isFetching = false;
|
isFetching = false;
|
||||||
@ -85,6 +84,22 @@ export default class AddressAutoCompleteMixin extends mixins(Vue) {
|
|||||||
this.isFetching = false;
|
this.isFetching = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get queryText(): string {
|
||||||
|
return (this.value && new Address(this.value).fullName) || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
set queryText(text: string) {
|
||||||
|
if (text === "" && this.selected?.id) {
|
||||||
|
console.log("doing reset");
|
||||||
|
this.resetAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetAddress(): void {
|
||||||
|
this.$emit("input", null);
|
||||||
|
this.selected = new Address();
|
||||||
|
}
|
||||||
|
|
||||||
async locateMe(): Promise<void> {
|
async locateMe(): Promise<void> {
|
||||||
this.gettingLocation = true;
|
this.gettingLocation = true;
|
||||||
this.gettingLocationError = null;
|
this.gettingLocationError = null;
|
||||||
@ -124,7 +139,6 @@ export default class AddressAutoCompleteMixin extends mixins(Vue) {
|
|||||||
const defaultAddress = new Address(this.addressData[0]);
|
const defaultAddress = new Address(this.addressData[0]);
|
||||||
this.selected = defaultAddress;
|
this.selected = defaultAddress;
|
||||||
this.$emit("input", this.selected);
|
this.$emit("input", this.selected);
|
||||||
this.queryText = `${defaultAddress.poiInfos.name} ${defaultAddress.poiInfos.alternativeName}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,6 +473,16 @@
|
|||||||
<div v-else-if="group" class="public-container">
|
<div v-else-if="group" class="public-container">
|
||||||
<aside class="group-metadata">
|
<aside class="group-metadata">
|
||||||
<div class="sticky">
|
<div class="sticky">
|
||||||
|
<b-message v-if="group.domain && !isCurrentActorAGroupMember">
|
||||||
|
{{
|
||||||
|
$t(
|
||||||
|
"This profile is from another instance, the informations shown here may be incomplete."
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
<a :href="group.url" rel="noopener noreferrer external">{{
|
||||||
|
$t("View full profile")
|
||||||
|
}}</a>
|
||||||
|
</b-message>
|
||||||
<event-metadata-block :title="$t('Members')" icon="account-group">
|
<event-metadata-block :title="$t('Members')" icon="account-group">
|
||||||
{{
|
{{
|
||||||
$tc("{count} members", group.members.total, {
|
$tc("{count} members", group.members.total, {
|
||||||
@ -505,13 +515,15 @@
|
|||||||
</p>
|
</p>
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<b-button
|
||||||
class="map-show-button"
|
class="map-show-button"
|
||||||
|
type="is-text"
|
||||||
@click="showMap = !showMap"
|
@click="showMap = !showMap"
|
||||||
@keyup.enter="showMap = !showMap"
|
@keyup.enter="showMap = !showMap"
|
||||||
v-if="physicalAddress.geom"
|
v-if="physicalAddress.geom"
|
||||||
>{{ $t("Show map") }}</span
|
|
||||||
>
|
>
|
||||||
|
{{ $t("Show map") }}
|
||||||
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</event-metadata-block>
|
</event-metadata-block>
|
||||||
|
@ -153,8 +153,8 @@
|
|||||||
|
|
||||||
<full-address-auto-complete
|
<full-address-auto-complete
|
||||||
:label="$t('Group address')"
|
:label="$t('Group address')"
|
||||||
v-model="editableGroup.physicalAddress"
|
v-model="currentAddress"
|
||||||
:value="currentAddress"
|
:hideMap="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
@ -184,7 +184,7 @@ import { mixins } from "vue-class-component";
|
|||||||
import GroupMixin from "@/mixins/group";
|
import GroupMixin from "@/mixins/group";
|
||||||
import { GroupVisibility, Openness } from "@/types/enums";
|
import { GroupVisibility, Openness } from "@/types/enums";
|
||||||
import { UPDATE_GROUP } from "../../graphql/group";
|
import { UPDATE_GROUP } from "../../graphql/group";
|
||||||
import { IGroup, usernameWithDomain } from "../../types/actor";
|
import { Group, IGroup, usernameWithDomain } from "../../types/actor";
|
||||||
import { Address, IAddress } from "../../types/address.model";
|
import { Address, IAddress } from "../../types/address.model";
|
||||||
import { CONFIG } from "@/graphql/config";
|
import { CONFIG } from "@/graphql/config";
|
||||||
import { IConfig } from "@/types/config.model";
|
import { IConfig } from "@/types/config.model";
|
||||||
@ -209,14 +209,10 @@ import { buildFileFromIMedia } from "@/utils/image";
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class GroupSettings extends mixins(GroupMixin) {
|
export default class GroupSettings extends mixins(GroupMixin) {
|
||||||
loading = true;
|
|
||||||
|
|
||||||
RouteName = RouteName;
|
RouteName = RouteName;
|
||||||
|
|
||||||
config!: IConfig;
|
config!: IConfig;
|
||||||
|
|
||||||
newMemberUsername = "";
|
|
||||||
|
|
||||||
errors: string[] = [];
|
errors: string[] = [];
|
||||||
|
|
||||||
avatarFile: File | null = null;
|
avatarFile: File | null = null;
|
||||||
@ -231,12 +227,11 @@ export default class GroupSettings extends mixins(GroupMixin) {
|
|||||||
|
|
||||||
showCopiedTooltip = false;
|
showCopiedTooltip = false;
|
||||||
|
|
||||||
editableGroup!: IGroup;
|
editableGroup: IGroup = new Group();
|
||||||
|
|
||||||
async updateGroup(): Promise<void> {
|
async updateGroup(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const variables = this.buildVariables();
|
const variables = this.buildVariables();
|
||||||
console.log(variables);
|
|
||||||
await this.$apollo.mutate<{ updateGroup: IGroup }>({
|
await this.$apollo.mutate<{ updateGroup: IGroup }>({
|
||||||
mutation: UPDATE_GROUP,
|
mutation: UPDATE_GROUP,
|
||||||
variables,
|
variables,
|
||||||
@ -275,14 +270,23 @@ export default class GroupSettings extends mixins(GroupMixin) {
|
|||||||
let avatarObj = {};
|
let avatarObj = {};
|
||||||
let bannerObj = {};
|
let bannerObj = {};
|
||||||
const variables = { ...this.editableGroup };
|
const variables = { ...this.editableGroup };
|
||||||
const physicalAddress = {
|
let physicalAddress;
|
||||||
...variables.physicalAddress,
|
if (variables.physicalAddress) {
|
||||||
};
|
physicalAddress = { ...variables.physicalAddress };
|
||||||
|
} else {
|
||||||
|
physicalAddress = variables.physicalAddress;
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
delete variables.__typename;
|
if (variables.__typename) {
|
||||||
if (physicalAddress) {
|
// eslint-disable-next-line
|
||||||
|
// @ts-ignore
|
||||||
|
delete variables.__typename;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line
|
||||||
|
// @ts-ignore
|
||||||
|
if (physicalAddress && physicalAddress.__typename) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
delete physicalAddress.__typename;
|
delete physicalAddress.__typename;
|
||||||
@ -335,6 +339,10 @@ export default class GroupSettings extends mixins(GroupMixin) {
|
|||||||
return new Address(this.editableGroup.physicalAddress);
|
return new Address(this.editableGroup.physicalAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set currentAddress(address: IAddress) {
|
||||||
|
this.editableGroup.physicalAddress = address;
|
||||||
|
}
|
||||||
|
|
||||||
get avatarMaxSize(): number | undefined {
|
get avatarMaxSize(): number | undefined {
|
||||||
return this?.config?.uploadLimits?.avatar;
|
return this?.config?.uploadLimits?.avatar;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ import { EventSortField, ParticipantRole, SortDirection } from "@/types/enums";
|
|||||||
import { Paginate } from "@/types/paginate";
|
import { Paginate } from "@/types/paginate";
|
||||||
import { supportsWebPFormat } from "@/utils/support";
|
import { supportsWebPFormat } from "@/utils/support";
|
||||||
import { IParticipant, Participant } from "../types/participant.model";
|
import { IParticipant, Participant } from "../types/participant.model";
|
||||||
import { CLOSE_EVENTS, FETCH_EVENTS } from "../graphql/event";
|
import { FETCH_EVENTS } from "../graphql/event";
|
||||||
import EventParticipationCard from "../components/Event/EventParticipationCard.vue";
|
import EventParticipationCard from "../components/Event/EventParticipationCard.vue";
|
||||||
import MultiCard from "../components/Event/MultiCard.vue";
|
import MultiCard from "../components/Event/MultiCard.vue";
|
||||||
import { CURRENT_ACTOR_CLIENT } from "../graphql/actor";
|
import { CURRENT_ACTOR_CLIENT } from "../graphql/actor";
|
||||||
@ -339,7 +339,7 @@ import {
|
|||||||
IUserSettings,
|
IUserSettings,
|
||||||
} from "../types/current-user.model";
|
} from "../types/current-user.model";
|
||||||
import { CURRENT_USER_CLIENT } from "../graphql/user";
|
import { CURRENT_USER_CLIENT } from "../graphql/user";
|
||||||
import { HOME_USER_QUERIES } from "../graphql/home";
|
import { CLOSE_CONTENT, HOME_USER_QUERIES } from "../graphql/home";
|
||||||
import RouteName from "../router/name";
|
import RouteName from "../router/name";
|
||||||
import { IEvent } from "../types/event.model";
|
import { IEvent } from "../types/event.model";
|
||||||
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
||||||
@ -363,15 +363,17 @@ import Subtitle from "../components/Utils/Subtitle.vue";
|
|||||||
},
|
},
|
||||||
currentUser: CURRENT_USER_CLIENT,
|
currentUser: CURRENT_USER_CLIENT,
|
||||||
config: CONFIG,
|
config: CONFIG,
|
||||||
closeEvents: {
|
closeContent: {
|
||||||
query: CLOSE_EVENTS,
|
query: CLOSE_CONTENT,
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
location: this.loggedUser?.settings?.location?.geohash,
|
location: this.loggedUser?.settings?.location?.geohash,
|
||||||
radius: this.loggedUser?.settings?.location?.range,
|
radius: this.loggedUser?.settings?.location?.range,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
update: (data) => data.searchEvents,
|
update(data) {
|
||||||
|
this.closeEvents = data.searchEvents;
|
||||||
|
},
|
||||||
skip() {
|
skip() {
|
||||||
return (
|
return (
|
||||||
!this.currentUser?.isLoggedIn ||
|
!this.currentUser?.isLoggedIn ||
|
||||||
|
@ -70,15 +70,7 @@
|
|||||||
<b-loading :active.sync="$apollo.loading"></b-loading>
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
||||||
<h2 class="title">{{ $t("Featured events") }}</h2>
|
<h2 class="title">{{ $t("Featured events") }}</h2>
|
||||||
<div v-if="events.elements.length > 0">
|
<div v-if="events.elements.length > 0">
|
||||||
<div class="columns is-multiline">
|
<multi-card :events="events.elements" />
|
||||||
<div
|
|
||||||
class="column is-one-third-desktop"
|
|
||||||
v-for="event in events.elements"
|
|
||||||
:key="event.uuid"
|
|
||||||
>
|
|
||||||
<EventCard :event="event" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pagination" v-if="events.total > EVENT_PAGE_LIMIT">
|
<div class="pagination" v-if="events.total > EVENT_PAGE_LIMIT">
|
||||||
<b-pagination
|
<b-pagination
|
||||||
:total="events.total"
|
:total="events.total"
|
||||||
@ -98,7 +90,7 @@
|
|||||||
>{{ $t("No events found") }}</b-message
|
>{{ $t("No events found") }}</b-message
|
||||||
>
|
>
|
||||||
</section>
|
</section>
|
||||||
<b-tabs v-else v-model="activeTab" type="is-boxed" class="searchTabs">
|
<b-tabs v-else v-model="activeTab" type="is-boxed" class="mt-3 searchTabs">
|
||||||
<b-loading :active.sync="$apollo.loading"></b-loading>
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
||||||
<b-tab-item>
|
<b-tab-item>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
@ -109,15 +101,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="searchEvents.total > 0">
|
<div v-if="searchEvents.total > 0">
|
||||||
<div class="columns is-multiline">
|
<multi-card class="my-4" :events="searchEvents.elements" />
|
||||||
<div
|
|
||||||
class="column is-one-third-desktop"
|
|
||||||
v-for="event in searchEvents.elements"
|
|
||||||
:key="event.uuid"
|
|
||||||
>
|
|
||||||
<EventCard :event="event" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pagination" v-if="searchEvents.total > EVENT_PAGE_LIMIT">
|
<div class="pagination" v-if="searchEvents.total > EVENT_PAGE_LIMIT">
|
||||||
<b-pagination
|
<b-pagination
|
||||||
:total="searchEvents.total"
|
:total="searchEvents.total"
|
||||||
@ -146,15 +130,7 @@
|
|||||||
{{ $t("Groups are not enabled on this instance.") }}
|
{{ $t("Groups are not enabled on this instance.") }}
|
||||||
</b-message>
|
</b-message>
|
||||||
<div v-else-if="searchGroups.total > 0">
|
<div v-else-if="searchGroups.total > 0">
|
||||||
<div class="columns is-multiline">
|
<multi-group-card class="my-4" :groups="searchGroups.elements" />
|
||||||
<div
|
|
||||||
class="column is-one-third-desktop"
|
|
||||||
v-for="group in searchGroups.elements"
|
|
||||||
:key="group.uuid"
|
|
||||||
>
|
|
||||||
<group-card :group="group" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<b-pagination
|
<b-pagination
|
||||||
:total="searchGroups.total"
|
:total="searchGroups.total"
|
||||||
@ -193,16 +169,16 @@ import {
|
|||||||
eachWeekendOfInterval,
|
eachWeekendOfInterval,
|
||||||
} from "date-fns";
|
} from "date-fns";
|
||||||
import { SearchTabs } from "@/types/enums";
|
import { SearchTabs } from "@/types/enums";
|
||||||
import EventCard from "../components/Event/EventCard.vue";
|
import MultiCard from "../components/Event/MultiCard.vue";
|
||||||
import { FETCH_EVENTS } from "../graphql/event";
|
import { FETCH_EVENTS } from "../graphql/event";
|
||||||
import { IEvent } from "../types/event.model";
|
import { IEvent } from "../types/event.model";
|
||||||
import RouteName from "../router/name";
|
import RouteName from "../router/name";
|
||||||
import { IAddress, Address } from "../types/address.model";
|
import { IAddress, Address } from "../types/address.model";
|
||||||
import AddressAutoComplete from "../components/Event/AddressAutoComplete.vue";
|
import AddressAutoComplete from "../components/Event/AddressAutoComplete.vue";
|
||||||
import { SEARCH_EVENTS, SEARCH_GROUPS } from "../graphql/search";
|
import { SEARCH_EVENTS_AND_GROUPS } from "../graphql/search";
|
||||||
import { Paginate } from "../types/paginate";
|
import { Paginate } from "../types/paginate";
|
||||||
import { IGroup } from "../types/actor";
|
import { IGroup } from "../types/actor";
|
||||||
import GroupCard from "../components/Group/GroupCard.vue";
|
import MultiGroupCard from "../components/Group/MultiGroupCard.vue";
|
||||||
import { CONFIG } from "../graphql/config";
|
import { CONFIG } from "../graphql/config";
|
||||||
import { REVERSE_GEOCODE } from "../graphql/address";
|
import { REVERSE_GEOCODE } from "../graphql/address";
|
||||||
|
|
||||||
@ -226,9 +202,9 @@ const THROTTLE = 2000; // minimum interval in ms between two requests
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
EventCard,
|
MultiCard,
|
||||||
AddressAutoComplete,
|
AddressAutoComplete,
|
||||||
GroupCard,
|
MultiGroupCard,
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
config: CONFIG,
|
config: CONFIG,
|
||||||
@ -241,8 +217,8 @@ const THROTTLE = 2000; // minimum interval in ms between two requests
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
searchEvents: {
|
search: {
|
||||||
query: SEARCH_EVENTS,
|
query: SEARCH_EVENTS_AND_GROUPS,
|
||||||
fetchPolicy: "cache-and-network",
|
fetchPolicy: "cache-and-network",
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
@ -256,27 +232,11 @@ const THROTTLE = 2000; // minimum interval in ms between two requests
|
|||||||
limit: EVENT_PAGE_LIMIT,
|
limit: EVENT_PAGE_LIMIT,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
throttle: THROTTLE,
|
update(data) {
|
||||||
skip() {
|
this.searchEvents = data.searchEvents;
|
||||||
return !this.canSearchEvents;
|
this.searchGroups = data.searchGroups;
|
||||||
},
|
|
||||||
},
|
|
||||||
searchGroups: {
|
|
||||||
query: SEARCH_GROUPS,
|
|
||||||
fetchPolicy: "cache-and-network",
|
|
||||||
variables() {
|
|
||||||
return {
|
|
||||||
term: this.search,
|
|
||||||
location: this.geohash,
|
|
||||||
radius: this.radius,
|
|
||||||
page: this.groupPage,
|
|
||||||
limit: GROUP_PAGE_LIMIT,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
throttle: THROTTLE,
|
throttle: THROTTLE,
|
||||||
skip() {
|
|
||||||
return !this.canSearchGroups;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
metaInfo() {
|
metaInfo() {
|
||||||
|
@ -4,7 +4,7 @@ exports[`PostListItem renders post list item with basic informations 1`] = `
|
|||||||
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
||||||
<!---->
|
<!---->
|
||||||
<div class="title-info-wrapper has-text-grey-dark">
|
<div class="title-info-wrapper has-text-grey-dark">
|
||||||
<p class="post-minimalist-title">My Blog Post</p>
|
<h3 class="post-minimalist-title">My Blog Post</h3>
|
||||||
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
||||||
<!---->
|
<!---->
|
||||||
<!---->
|
<!---->
|
||||||
@ -16,7 +16,7 @@ exports[`PostListItem renders post list item with publisher name 1`] = `
|
|||||||
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
||||||
<!---->
|
<!---->
|
||||||
<div class="title-info-wrapper has-text-grey-dark">
|
<div class="title-info-wrapper has-text-grey-dark">
|
||||||
<p class="post-minimalist-title">My Blog Post</p>
|
<h3 class="post-minimalist-title">My Blog Post</h3>
|
||||||
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
||||||
<!---->
|
<!---->
|
||||||
<p class="post-publisher has-text-grey-dark"><span class="icon"><i class="mdi mdi-account-edit mdi-24px"></i></span> <span>Published by <b class="has-text-weight-medium">An author</b></span></p>
|
<p class="post-publisher has-text-grey-dark"><span class="icon"><i class="mdi mdi-account-edit mdi-24px"></i></span> <span>Published by <b class="has-text-weight-medium">An author</b></span></p>
|
||||||
@ -28,7 +28,7 @@ exports[`PostListItem renders post list item with tags 1`] = `
|
|||||||
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
<a href="/p/my-blog-post-some-uuid" class="post-minimalist-card-wrapper">
|
||||||
<!---->
|
<!---->
|
||||||
<div class="title-info-wrapper has-text-grey-dark">
|
<div class="title-info-wrapper has-text-grey-dark">
|
||||||
<p class="post-minimalist-title">My Blog Post</p>
|
<h3 class="post-minimalist-title">My Blog Post</h3>
|
||||||
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
<p class="post-publication-date"><span class="icon"><i class="mdi mdi-clock mdi-24px"></i></span> <span class="has-text-grey-dark">Dec 2, 2020</span></p>
|
||||||
<div class="tags" style="display: inline;"><span class="icon"><i class="mdi mdi-tag mdi-24px"></i></span> <span class="tag"><!----><span class="">A tag</span>
|
<div class="tags" style="display: inline;"><span class="icon"><i class="mdi mdi-tag mdi-24px"></i></span> <span class="tag"><!----><span class="">A tag</span>
|
||||||
<!----></span>
|
<!----></span>
|
||||||
|
@ -8,12 +8,15 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||||||
|
|
||||||
alias Mobilizon.Actors.Actor, as: ActorModel
|
alias Mobilizon.Actors.Actor, as: ActorModel
|
||||||
|
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.Federation.ActivityPub.Utils
|
alias Mobilizon.Federation.ActivityPub.Utils
|
||||||
alias Mobilizon.Federation.ActivityStream.{Converter, Convertible}
|
alias Mobilizon.Federation.ActivityStream.{Converter, Convertible}
|
||||||
|
alias Mobilizon.Federation.ActivityStream.Converter.Address, as: AddressConverter
|
||||||
|
alias Mobilizon.Medias.File
|
||||||
alias Mobilizon.Service.HTTP.RemoteMediaDownloaderClient
|
alias Mobilizon.Service.HTTP.RemoteMediaDownloaderClient
|
||||||
alias Mobilizon.Service.RichMedia.Parser
|
alias Mobilizon.Service.RichMedia.Parser
|
||||||
alias Mobilizon.Web.Upload
|
alias Mobilizon.Web.Upload
|
||||||
|
import Mobilizon.Federation.ActivityStream.Converter.Utils, only: [get_address: 1]
|
||||||
|
|
||||||
@behaviour Converter
|
@behaviour Converter
|
||||||
|
|
||||||
@ -37,6 +40,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||||||
banner =
|
banner =
|
||||||
download_picture(get_in(data, ["image", "url"]), get_in(data, ["image", "name"]), "banner")
|
download_picture(get_in(data, ["image", "url"]), get_in(data, ["image", "name"]), "banner")
|
||||||
|
|
||||||
|
address = get_address(data["location"])
|
||||||
|
|
||||||
%{
|
%{
|
||||||
url: data["id"],
|
url: data["id"],
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
@ -60,7 +65,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||||||
manually_approves_followers: data["manuallyApprovesFollowers"],
|
manually_approves_followers: data["manuallyApprovesFollowers"],
|
||||||
type: data["type"],
|
type: data["type"],
|
||||||
visibility: if(Map.get(data, "discoverable", false) == true, do: :public, else: :unlisted),
|
visibility: if(Map.get(data, "discoverable", false) == true, do: :public, else: :unlisted),
|
||||||
openness: data["openness"]
|
openness: data["openness"],
|
||||||
|
physical_address_id: if(address, do: address.id, else: nil)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,33 +112,11 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actor_data =
|
actor_data
|
||||||
if actor.type == :Group do
|
|> maybe_add_members(actor)
|
||||||
Map.put(actor_data, "members", actor.members_url)
|
|> maybe_add_avatar_picture(actor)
|
||||||
else
|
|> maybe_add_banner_picture(actor)
|
||||||
actor_data
|
|> maybe_add_physical_address(actor)
|
||||||
end
|
|
||||||
|
|
||||||
actor_data =
|
|
||||||
if is_nil(actor.avatar) do
|
|
||||||
actor_data
|
|
||||||
else
|
|
||||||
Map.put(actor_data, "icon", %{
|
|
||||||
"type" => "Image",
|
|
||||||
"mediaType" => actor.avatar.content_type,
|
|
||||||
"url" => actor.avatar.url
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if is_nil(actor.banner) do
|
|
||||||
actor_data
|
|
||||||
else
|
|
||||||
Map.put(actor_data, "image", %{
|
|
||||||
"type" => "Image",
|
|
||||||
"mediaType" => actor.banner.content_type,
|
|
||||||
"url" => actor.banner.url
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec download_picture(String.t() | nil, String.t(), String.t()) :: map() | nil
|
@spec download_picture(String.t() | nil, String.t(), String.t()) :: map() | nil
|
||||||
@ -146,4 +130,41 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||||||
Map.take(file, [:content_type, :name, :url, :size])
|
Map.take(file, [:content_type, :name, :url, :size])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp maybe_add_members(actor_data, %ActorModel{type: :Group, members_url: members_url}) do
|
||||||
|
Map.put(actor_data, "members", members_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_add_members(actor_data, %ActorModel{}), do: actor_data
|
||||||
|
|
||||||
|
@spec maybe_add_avatar_picture(map(), ActorModel.t()) :: map()
|
||||||
|
defp maybe_add_avatar_picture(actor_data, %ActorModel{avatar: %File{} = avatar}) do
|
||||||
|
Map.put(actor_data, "image", %{
|
||||||
|
"type" => "Image",
|
||||||
|
"mediaType" => avatar.content_type,
|
||||||
|
"url" => avatar.url
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_add_avatar_picture(res, %ActorModel{avatar: _}), do: res
|
||||||
|
|
||||||
|
@spec maybe_add_banner_picture(map(), ActorModel.t()) :: map()
|
||||||
|
defp maybe_add_banner_picture(actor_data, %ActorModel{banner: %File{} = banner}) do
|
||||||
|
Map.put(actor_data, "image", %{
|
||||||
|
"type" => "Image",
|
||||||
|
"mediaType" => banner.content_type,
|
||||||
|
"url" => banner.url
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_add_banner_picture(res, %ActorModel{banner: _}), do: res
|
||||||
|
|
||||||
|
@spec maybe_add_physical_address(map(), ActorModel.t()) :: map()
|
||||||
|
defp maybe_add_physical_address(res, %ActorModel{
|
||||||
|
physical_address: %Address{} = physical_address
|
||||||
|
}) do
|
||||||
|
Map.put(res, "location", AddressConverter.model_to_as(physical_address))
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_add_physical_address(res, %ActorModel{physical_address: _}), do: res
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,6 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Mobilizon.Addresses
|
|
||||||
alias Mobilizon.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.Events.Event, as: EventModel
|
alias Mobilizon.Events.Event, as: EventModel
|
||||||
alias Mobilizon.Medias.Media
|
alias Mobilizon.Medias.Media
|
||||||
@ -25,7 +24,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
|||||||
fetch_mentions: 1,
|
fetch_mentions: 1,
|
||||||
build_tags: 1,
|
build_tags: 1,
|
||||||
maybe_fetch_actor_and_attributed_to_id: 1,
|
maybe_fetch_actor_and_attributed_to_id: 1,
|
||||||
process_pictures: 2
|
process_pictures: 2,
|
||||||
|
get_address: 1
|
||||||
]
|
]
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
@ -192,44 +192,6 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
|||||||
|
|
||||||
defp get_metdata(_), do: []
|
defp get_metdata(_), do: []
|
||||||
|
|
||||||
@spec get_address(map | binary | nil) :: Address.t() | nil
|
|
||||||
defp get_address(address_url) when is_binary(address_url) do
|
|
||||||
get_address(%{"id" => address_url})
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_address(%{"id" => url} = map) when is_map(map) and is_binary(url) do
|
|
||||||
Logger.debug("Address with an URL, let's check against our own database")
|
|
||||||
|
|
||||||
case Addresses.get_address_by_url(url) do
|
|
||||||
%Address{} = address ->
|
|
||||||
address
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
Logger.debug("not in our database, let's try to create it")
|
|
||||||
map = Map.put(map, "url", map["id"])
|
|
||||||
do_get_address(map)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_address(map) when is_map(map) do
|
|
||||||
do_get_address(map)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_address(nil), do: nil
|
|
||||||
|
|
||||||
@spec do_get_address(map) :: Address.t() | nil
|
|
||||||
defp do_get_address(map) do
|
|
||||||
map = AddressConverter.as_to_model_data(map)
|
|
||||||
|
|
||||||
case Addresses.create_address(map) do
|
|
||||||
{:ok, %Address{} = address} ->
|
|
||||||
address
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_visibility(object), do: if(@ap_public in object["to"], do: :public, else: :unlisted)
|
defp get_visibility(object), do: if(@ap_public in object["to"], do: :public, else: :unlisted)
|
||||||
|
|
||||||
@spec date_to_string(DateTime.t() | nil) :: String.t()
|
@spec date_to_string(DateTime.t() | nil) :: String.t()
|
||||||
|
@ -3,14 +3,16 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Utils do
|
|||||||
Various utils for converters.
|
Various utils for converters.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Mobilizon.{Actors, Events}
|
alias Mobilizon.{Actors, Addresses, Events}
|
||||||
alias Mobilizon.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
alias Mobilizon.Addresses.Address
|
||||||
alias Mobilizon.Events.Tag
|
alias Mobilizon.Events.Tag
|
||||||
alias Mobilizon.Medias.Media
|
alias Mobilizon.Medias.Media
|
||||||
alias Mobilizon.Mention
|
alias Mobilizon.Mention
|
||||||
alias Mobilizon.Storage.Repo
|
alias Mobilizon.Storage.Repo
|
||||||
|
|
||||||
alias Mobilizon.Federation.ActivityPub.Actor, as: ActivityPubActor
|
alias Mobilizon.Federation.ActivityPub.Actor, as: ActivityPubActor
|
||||||
|
alias Mobilizon.Federation.ActivityStream.Converter.Address, as: AddressConverter
|
||||||
alias Mobilizon.Federation.ActivityStream.Converter.Media, as: MediaConverter
|
alias Mobilizon.Federation.ActivityStream.Converter.Media, as: MediaConverter
|
||||||
|
|
||||||
alias Mobilizon.Web.Endpoint
|
alias Mobilizon.Web.Endpoint
|
||||||
@ -252,4 +254,42 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Utils do
|
|||||||
defp get_banner_picture(attachments) do
|
defp get_banner_picture(attachments) do
|
||||||
Enum.find(attachments, &(&1["type"] == "Document" && &1["name"] == @banner_picture_name))
|
Enum.find(attachments, &(&1["type"] == "Document" && &1["name"] == @banner_picture_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec get_address(map | binary | nil) :: Address.t() | nil
|
||||||
|
def get_address(address_url) when is_binary(address_url) do
|
||||||
|
get_address(%{"id" => address_url})
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_address(%{"id" => url} = map) when is_map(map) and is_binary(url) do
|
||||||
|
Logger.debug("Address with an URL, let's check against our own database")
|
||||||
|
|
||||||
|
case Addresses.get_address_by_url(url) do
|
||||||
|
%Address{} = address ->
|
||||||
|
address
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Logger.debug("not in our database, let's try to create it")
|
||||||
|
map = Map.put(map, "url", map["id"])
|
||||||
|
do_get_address(map)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_address(map) when is_map(map) do
|
||||||
|
do_get_address(map)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_address(nil), do: nil
|
||||||
|
|
||||||
|
@spec do_get_address(map) :: Address.t() | nil
|
||||||
|
defp do_get_address(map) do
|
||||||
|
map = AddressConverter.as_to_model_data(map)
|
||||||
|
|
||||||
|
case Addresses.create_address(map) do
|
||||||
|
{:ok, %Address{} = address} ->
|
||||||
|
address
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,13 +40,15 @@ defmodule Mobilizon.GraphQL.API.Search do
|
|||||||
|
|
||||||
true ->
|
true ->
|
||||||
page =
|
page =
|
||||||
Actors.build_actors_by_username_or_name_page(
|
Actors.search_actors(
|
||||||
term,
|
term,
|
||||||
[
|
[
|
||||||
actor_type: [result_type],
|
actor_type: result_type,
|
||||||
radius: Map.get(args, :radius),
|
radius: Map.get(args, :radius),
|
||||||
location: Map.get(args, :location),
|
location: Map.get(args, :location),
|
||||||
minimum_visibility: Map.get(args, :minimum_visibility, :public)
|
minimum_visibility: Map.get(args, :minimum_visibility, :public),
|
||||||
|
current_actor_id: Map.get(args, :current_actor_id),
|
||||||
|
exclude_my_groups: Map.get(args, :exclude_my_groups, false)
|
||||||
],
|
],
|
||||||
page,
|
page,
|
||||||
limit
|
limit
|
||||||
|
@ -13,7 +13,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Followers do
|
|||||||
@spec find_followers_for_group(Actor.t(), map(), map()) :: {:ok, Page.t()}
|
@spec find_followers_for_group(Actor.t(), map(), map()) :: {:ok, Page.t()}
|
||||||
def find_followers_for_group(
|
def find_followers_for_group(
|
||||||
%Actor{id: group_id} = group,
|
%Actor{id: group_id} = group,
|
||||||
%{page: page, limit: limit} = args,
|
args,
|
||||||
%{
|
%{
|
||||||
context: %{
|
context: %{
|
||||||
current_user: %User{role: user_role},
|
current_user: %User{role: user_role},
|
||||||
@ -21,15 +21,23 @@ defmodule Mobilizon.GraphQL.Resolvers.Followers do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
) do
|
) do
|
||||||
|
followers = group_followers(group, args)
|
||||||
|
|
||||||
if Actors.is_moderator?(actor_id, group_id) or is_moderator(user_role) do
|
if Actors.is_moderator?(actor_id, group_id) or is_moderator(user_role) do
|
||||||
{:ok,
|
{:ok, followers}
|
||||||
Actors.list_paginated_followers_for_actor(group, Map.get(args, :approved), page, limit)}
|
|
||||||
else
|
else
|
||||||
{:error, :unauthorized}
|
{:ok, %Page{followers | elements: []}}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_followers_for_group(_, _, _), do: {:error, :unauthenticated}
|
def find_followers_for_group(%Actor{} = group, args, _) do
|
||||||
|
followers = group_followers(group, args)
|
||||||
|
{:ok, %Page{followers | elements: []}}
|
||||||
|
end
|
||||||
|
|
||||||
|
defp group_followers(group, %{page: page, limit: limit} = args) do
|
||||||
|
Actors.list_paginated_followers_for_actor(group, Map.get(args, :approved), page, limit)
|
||||||
|
end
|
||||||
|
|
||||||
@spec update_follower(any(), map(), map()) :: {:ok, Follower.t()} | {:error, any()}
|
@spec update_follower(any(), map(), map()) :: {:ok, Follower.t()} | {:error, any()}
|
||||||
def update_follower(_, %{id: follower_id, approved: approved}, %{
|
def update_follower(_, %{id: follower_id, approved: approved}, %{
|
||||||
|
@ -21,7 +21,14 @@ defmodule Mobilizon.GraphQL.Resolvers.Search do
|
|||||||
"""
|
"""
|
||||||
@spec search_groups(any(), map(), Absinthe.Resolution.t()) ::
|
@spec search_groups(any(), map(), Absinthe.Resolution.t()) ::
|
||||||
{:ok, Page.t(Actor.t())} | {:error, String.t()}
|
{:ok, Page.t(Actor.t())} | {:error, String.t()}
|
||||||
def search_groups(_parent, %{page: page, limit: limit} = args, _resolution) do
|
def search_groups(
|
||||||
|
_parent,
|
||||||
|
%{page: page, limit: limit} = args,
|
||||||
|
%{context: context} = _resolution
|
||||||
|
) do
|
||||||
|
current_actor = Map.get(context, :current_actor, nil)
|
||||||
|
current_actor_id = if current_actor, do: current_actor.id, else: nil
|
||||||
|
args = Map.put(args, :current_actor_id, current_actor_id)
|
||||||
Search.search_actors(args, page, limit, :Group)
|
Search.search_actors(args, page, limit, :Group)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,6 +59,14 @@ defmodule Mobilizon.GraphQL.Schema.SearchType do
|
|||||||
arg(:term, :string, default_value: "", description: "Search term")
|
arg(:term, :string, default_value: "", description: "Search term")
|
||||||
arg(:location, :string, description: "A geohash for coordinates")
|
arg(:location, :string, description: "A geohash for coordinates")
|
||||||
|
|
||||||
|
arg(:exclude_my_groups, :boolean,
|
||||||
|
description: "Whether to include the groups the current actor is member or follower"
|
||||||
|
)
|
||||||
|
|
||||||
|
arg(:minimum_visibility, :group_visibility,
|
||||||
|
description: "The minimum visibility the group must have"
|
||||||
|
)
|
||||||
|
|
||||||
arg(:radius, :float,
|
arg(:radius, :float,
|
||||||
default_value: 50,
|
default_value: 50,
|
||||||
description: "Radius around the location to search in"
|
description: "Radius around the location to search in"
|
||||||
|
@ -124,7 +124,8 @@ defmodule Mobilizon.Actors.Actor do
|
|||||||
:summary,
|
:summary,
|
||||||
:manually_approves_followers,
|
:manually_approves_followers,
|
||||||
:visibility,
|
:visibility,
|
||||||
:openness
|
:openness,
|
||||||
|
:physical_address_id
|
||||||
]
|
]
|
||||||
@remote_actor_creation_attrs @remote_actor_creation_required_attrs ++
|
@remote_actor_creation_attrs @remote_actor_creation_required_attrs ++
|
||||||
@remote_actor_creation_optional_attrs
|
@remote_actor_creation_optional_attrs
|
||||||
|
@ -450,29 +450,55 @@ defmodule Mobilizon.Actors do
|
|||||||
@doc """
|
@doc """
|
||||||
Builds a page struct for actors by their name or displayed name.
|
Builds a page struct for actors by their name or displayed name.
|
||||||
"""
|
"""
|
||||||
@spec build_actors_by_username_or_name_page(
|
@spec search_actors(
|
||||||
String.t(),
|
String.t(),
|
||||||
Keyword.t(),
|
Keyword.t(),
|
||||||
integer | nil,
|
integer | nil,
|
||||||
integer | nil
|
integer | nil
|
||||||
) :: Page.t()
|
) :: Page.t()
|
||||||
def build_actors_by_username_or_name_page(
|
def search_actors(
|
||||||
term,
|
term,
|
||||||
options \\ [],
|
options \\ [],
|
||||||
page \\ nil,
|
page \\ nil,
|
||||||
limit \\ nil
|
limit \\ nil
|
||||||
) do
|
) do
|
||||||
|
term
|
||||||
|
|> build_actors_by_username_or_name_page_query(options)
|
||||||
|
|> maybe_exclude_my_groups(
|
||||||
|
Keyword.get(options, :exclude_my_groups, false),
|
||||||
|
Keyword.get(options, :current_actor_id)
|
||||||
|
)
|
||||||
|
|> Page.build_page(page, limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_exclude_my_groups(query, true, current_actor_id) when current_actor_id != nil do
|
||||||
|
query
|
||||||
|
|> join(:left, [a], m in Member, on: a.id == m.parent_id)
|
||||||
|
|> join(:left, [a], f in Follower, on: a.id == f.target_actor_id)
|
||||||
|
|> where([_a, ..., m, f], m.actor_id != ^current_actor_id and f.actor_id != ^current_actor_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_exclude_my_groups(query, _, _), do: query
|
||||||
|
|
||||||
|
@spec build_actors_by_username_or_name_page_query(
|
||||||
|
String.t(),
|
||||||
|
Keyword.t()
|
||||||
|
) :: Ecto.Query.t()
|
||||||
|
defp build_actors_by_username_or_name_page_query(
|
||||||
|
term,
|
||||||
|
options
|
||||||
|
) do
|
||||||
anonymous_actor_id = Mobilizon.Config.anonymous_actor_id()
|
anonymous_actor_id = Mobilizon.Config.anonymous_actor_id()
|
||||||
query = from(a in Actor)
|
query = from(a in Actor)
|
||||||
|
|
||||||
query
|
query
|
||||||
|
|> distinct([q], q.id)
|
||||||
|> actor_by_username_or_name_query(term)
|
|> actor_by_username_or_name_query(term)
|
||||||
|> actors_for_location(Keyword.get(options, :location), Keyword.get(options, :radius))
|
|> actors_for_location(Keyword.get(options, :location), Keyword.get(options, :radius))
|
||||||
|> filter_by_types(Keyword.get(options, :actor_type, :Group))
|
|> filter_by_type(Keyword.get(options, :actor_type, :Group))
|
||||||
|> filter_by_minimum_visibility(Keyword.get(options, :minimum_visibility, :public))
|
|> filter_by_minimum_visibility(Keyword.get(options, :minimum_visibility, :public))
|
||||||
|> filter_suspended(false)
|
|> filter_suspended(false)
|
||||||
|> filter_out_anonymous_actor_id(anonymous_actor_id)
|
|> filter_out_anonymous_actor_id(anonymous_actor_id)
|
||||||
|> Page.build_page(page, limit)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -1313,17 +1339,15 @@ defmodule Mobilizon.Actors do
|
|||||||
@spec actors_for_location(Ecto.Queryable.t(), String.t(), integer()) :: Ecto.Query.t()
|
@spec actors_for_location(Ecto.Queryable.t(), String.t(), integer()) :: Ecto.Query.t()
|
||||||
defp actors_for_location(query, location, radius)
|
defp actors_for_location(query, location, radius)
|
||||||
when is_valid_string(location) and not is_nil(radius) do
|
when is_valid_string(location) and not is_nil(radius) do
|
||||||
with {lon, lat} <- Geohax.decode(location),
|
{lon, lat} = Geohax.decode(location)
|
||||||
point <- Geo.WKT.decode!("SRID=4326;POINT(#{lon} #{lat})") do
|
point = Geo.WKT.decode!("SRID=4326;POINT(#{lon} #{lat})")
|
||||||
query
|
|
||||||
|> join(:inner, [q], a in Address, on: a.id == q.physical_address_id, as: :address)
|
query
|
||||||
|> where(
|
|> join(:inner, [q], a in Address, on: a.id == q.physical_address_id, as: :address)
|
||||||
[q],
|
|> where(
|
||||||
st_dwithin_in_meters(^point, as(:address).geom, ^(radius * 1000))
|
[q],
|
||||||
)
|
st_dwithin_in_meters(^point, as(:address).geom, ^(radius * 1000))
|
||||||
else
|
)
|
||||||
_ -> query
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp actors_for_location(query, _location, _radius), do: query
|
defp actors_for_location(query, _location, _radius), do: query
|
||||||
@ -1564,11 +1588,6 @@ defmodule Mobilizon.Actors do
|
|||||||
|
|
||||||
defp filter_by_type(query, _type), do: query
|
defp filter_by_type(query, _type), do: query
|
||||||
|
|
||||||
@spec filter_by_types(Ecto.Queryable.t(), [ActorType.t()]) :: Ecto.Query.t()
|
|
||||||
defp filter_by_types(query, types) do
|
|
||||||
from(a in query, where: a.type in ^types)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec filter_by_minimum_visibility(Ecto.Queryable.t(), atom()) :: Ecto.Query.t()
|
@spec filter_by_minimum_visibility(Ecto.Queryable.t(), atom()) :: Ecto.Query.t()
|
||||||
defp filter_by_minimum_visibility(query, :private), do: query
|
defp filter_by_minimum_visibility(query, :private), do: query
|
||||||
|
|
||||||
|
@ -38,16 +38,23 @@ defmodule Mobilizon.GraphQL.API.SearchTest do
|
|||||||
|
|
||||||
test "search actors" do
|
test "search actors" do
|
||||||
with_mock Actors,
|
with_mock Actors,
|
||||||
build_actors_by_username_or_name_page: fn "toto", _options, 1, 10 ->
|
search_actors: fn "toto", _options, 1, 10 ->
|
||||||
%Page{total: 1, elements: [%Actor{id: 42}]}
|
%Page{total: 1, elements: [%Actor{id: 42}]}
|
||||||
end do
|
end do
|
||||||
assert {:ok, %{total: 1, elements: [%Actor{id: 42}]}} =
|
assert {:ok, %{total: 1, elements: [%Actor{id: 42}]}} =
|
||||||
Search.search_actors(%{term: "toto"}, 1, 10, :Person)
|
Search.search_actors(%{term: "toto"}, 1, 10, :Person)
|
||||||
|
|
||||||
assert_called(
|
assert_called(
|
||||||
Actors.build_actors_by_username_or_name_page(
|
Actors.search_actors(
|
||||||
"toto",
|
"toto",
|
||||||
[actor_type: [:Person], radius: nil, location: nil, minimum_visibility: :public],
|
[
|
||||||
|
actor_type: :Person,
|
||||||
|
radius: nil,
|
||||||
|
location: nil,
|
||||||
|
minimum_visibility: :public,
|
||||||
|
current_actor_id: nil,
|
||||||
|
exclude_my_groups: false
|
||||||
|
],
|
||||||
1,
|
1,
|
||||||
10
|
10
|
||||||
)
|
)
|
||||||
|
@ -70,7 +70,9 @@ defmodule Mobilizon.Web.Resolvers.FollowerTest do
|
|||||||
variables: %{name: preferred_username}
|
variables: %{name: preferred_username}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert hd(res["errors"])["message"] == "unauthenticated"
|
assert res["errors"] == nil
|
||||||
|
assert res["data"]["group"]["followers"]["total"] == 1
|
||||||
|
assert res["data"]["group"]["followers"]["elements"] == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "without being a member", %{
|
test "without being a member", %{
|
||||||
@ -88,7 +90,9 @@ defmodule Mobilizon.Web.Resolvers.FollowerTest do
|
|||||||
variables: %{name: preferred_username}
|
variables: %{name: preferred_username}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert hd(res["errors"])["message"] == "unauthorized"
|
assert res["errors"] == nil
|
||||||
|
assert res["data"]["group"]["followers"]["total"] == 1
|
||||||
|
assert res["data"]["group"]["followers"]["elements"] == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "without being a moderator", %{
|
test "without being a moderator", %{
|
||||||
@ -107,7 +111,9 @@ defmodule Mobilizon.Web.Resolvers.FollowerTest do
|
|||||||
variables: %{name: preferred_username}
|
variables: %{name: preferred_username}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert hd(res["errors"])["message"] == "unauthorized"
|
assert res["errors"] == nil
|
||||||
|
assert res["data"]["group"]["followers"]["total"] == 1
|
||||||
|
assert res["data"]["group"]["followers"]["elements"] == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "while being a moderator", %{
|
test "while being a moderator", %{
|
||||||
|
@ -183,14 +183,14 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
assert MapSet.new([actor_found_id, actor2_found_id]) == MapSet.new([actor.id, actor2.id])
|
assert MapSet.new([actor_found_id, actor2_found_id]) == MapSet.new([actor.id, actor2.id])
|
||||||
end
|
end
|
||||||
|
|
||||||
test "test build_actors_by_username_or_name_page/4 returns actors with similar usernames",
|
test "test search_actors/4 returns actors with similar usernames",
|
||||||
%{actor: %Actor{id: actor_id}} do
|
%{actor: %Actor{id: actor_id}} do
|
||||||
use_cassette "actors/remote_actor_mastodon_tcit" do
|
use_cassette "actors/remote_actor_mastodon_tcit" do
|
||||||
with {:ok, %Actor{id: actor2_id}} <-
|
with {:ok, %Actor{id: actor2_id}} <-
|
||||||
ActivityPubActor.get_or_fetch_actor_by_url(@remote_account_url) do
|
ActivityPubActor.get_or_fetch_actor_by_url(@remote_account_url) do
|
||||||
%Page{total: 2, elements: actors} =
|
%Page{total: 2, elements: actors} =
|
||||||
Actors.build_actors_by_username_or_name_page("tcit",
|
Actors.search_actors("tcit",
|
||||||
actor_type: [:Person],
|
actor_type: :Person,
|
||||||
minimum_visibility: :private
|
minimum_visibility: :private
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -201,9 +201,8 @@ defmodule Mobilizon.ActorsTest do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "test build_actors_by_username_or_name_page/4 returns actors with similar names" do
|
test "test search_actors/4 returns actors with similar names" do
|
||||||
%{total: 0, elements: actors} =
|
%{total: 0, elements: actors} = Actors.search_actors("ohno", actor_type: :Person)
|
||||||
Actors.build_actors_by_username_or_name_page("ohno", actor_type: [:Person])
|
|
||||||
|
|
||||||
assert actors == []
|
assert actors == []
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user