Allow to join an open group

Also:

* Refactor interacting with a remote event so that you can interact with
  a remote group as well
* Add a setting for group admins to pick between an open and invite-only
  group
* Fix new groups without posts/todos/resources/events/conversations URL
  set
* Repair local groups that haven't got their
  posts/todos/resources/events/conversations URL set
* Add a scheduled job to refresh remote groups every hour
* Add a user setting to pick when to receive notifications when there's
  new members to approve (will be used when this feature is available)
* Fix pagination for members

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-06 11:34:32 +01:00
parent 7baad7cafc
commit 7c11807c14
74 changed files with 1174 additions and 626 deletions

View File

@@ -1,9 +1,9 @@
<template>
<div class="container section">
<b-notification v-if="$apollo.queries.searchEvents.loading">
{{ $t("Redirecting to event") }}
<b-notification v-if="$apollo.queries.interact.loading">
{{ $t("Redirecting to content") }}
</b-notification>
<b-notification v-if="$apollo.queries.searchEvents.skip" type="is-danger">
<b-notification v-if="$apollo.queries.interact.skip" type="is-danger">
{{ $t("Resource provided is not an URL") }}
</b-notification>
</div>
@@ -11,48 +11,58 @@
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { SEARCH_EVENTS } from "@/graphql/search";
import { INTERACT } from "@/graphql/search";
import { IEvent } from "@/types/event.model";
import { IGroup, usernameWithDomain } from "@/types/actor";
import RouteName from "../router/name";
@Component({
apollo: {
searchEvents: {
query: SEARCH_EVENTS,
interact: {
query: INTERACT,
variables() {
return {
searchText: this.$route.query.url,
uri: this.$route.query.uri,
};
},
skip() {
try {
const url = this.$route.query.url as string;
const url = this.$route.query.uri as string;
const uri = new URL(url);
return !(uri instanceof URL);
} catch (e) {
return true;
}
},
async result({ data }) {
if (
data.searchEvents &&
data.searchEvents.total > 0 &&
data.searchEvents.elements.length > 0
) {
const event = data.searchEvents.elements[0];
await this.$router.replace({
name: RouteName.EVENT,
params: { uuid: event.uuid },
});
async result({ data: { interact } }) {
switch (interact.__typename) {
case "Group":
await this.$router.replace({
name: RouteName.GROUP,
params: { preferredUsername: usernameWithDomain(interact) },
});
break;
case "Event":
await this.$router.replace({
name: RouteName.EVENT,
params: { uuid: interact.uuid },
});
break;
default:
this.error = this.$t("This URL is not supported");
}
// await this.$router.replace({
// name: RouteName.EVENT,
// params: { uuid: event.uuid },
// });
},
},
},
})
export default class Interact extends Vue {
searchEvents!: IEvent[];
interact!: IEvent | IGroup;
RouteName = RouteName;
error!: string;
}
</script>
<style lang="scss">