Fixed some things

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-11-07 16:09:28 +01:00
parent 74bc21fa2c
commit 0585b9e6d5
7 changed files with 43 additions and 20 deletions

View File

@@ -22,6 +22,7 @@
class="hidden-sm-and-down"
:items="items"
:search-input.sync="searchText"
@keyup.enter="enter"
v-model="model"
return-object
>
@@ -139,7 +140,7 @@ export default {
return this.search.map(searchEntry => {
switch (searchEntry.__typename) {
case 'Actor':
searchEntry.label = searchEntry.preferredUsername;
searchEntry.label = searchEntry.preferredUsername + (searchEntry.domain === null ? '' : `@${searchEntry.domain}`);
break;
case 'Event':
searchEntry.label = searchEntry.title;
@@ -148,17 +149,15 @@ export default {
return searchEntry;
});
},
displayed_name() {
console.log('displayed name', this.actor);
if (this.actor) {
return this.actor.display_name === null ? this.actor.username : this.actor.display_name;
}
},
},
methods: {
username_with_domain(actor) {
return actor.preferredUsername + (actor.domain === undefined ? '' : `@${actor.domain}`);
return actor.preferredUsername + (actor.domain === null ? '' : `@${actor.domain}`);
},
enter() {
console.log('enter');
this.$apollo.queries.search.refetch();
}
},
};
</script>

View File

@@ -88,9 +88,17 @@ export const CREATE_EVENT = gql`
$categoryId: Int!,
$beginsOn: DateTime!,
$addressType: AddressType!,
) {
createEvent(title: $title, description: $description, beginsOn: $beginsOn, organizerActorId: $organizerActorId, categoryId: $categoryId, addressType: $addressType) {
uuid
) {
createEvent(
title: $title,
description: $description,
beginsOn: $beginsOn,
organizerActorId: $organizerActorId,
categoryId: $categoryId,
addressType: $addressType) {
uuid,
title,
description,
}
}
`;

View File

@@ -9,6 +9,8 @@ query SearchEvents($searchText: String!) {
__typename
},
...on Actor {
avatarUrl,
domain,
preferredUsername,
__typename
}