Add author to room entry

This commit is contained in:
Ramon Wenger 2018-10-24 15:34:52 +02:00
parent 617d82f484
commit 4ad67a09b3
3 changed files with 5 additions and 10 deletions

View File

@ -52,7 +52,7 @@
const variables = {slug: this.room.slug};
const data = store.readQuery({query, variables});
if (data.room && data.room.roomEntries) {
data.room.roomEntries.edges.push({
data.room.roomEntries.edges.unshift({
node: roomEntry,
__typename: 'RoomEntryNode'
});

View File

@ -115,14 +115,8 @@
roomEntryCount() {
return (this.room && this.room.roomEntries) ? this.room.roomEntries.length : 0
},
roomAppearance: {
set(value) {
// todo: remove, this does nothing
this.$store.dispatch('setSpecialContainerClass', value);
},
get() {
return this.room ? this.room.appearance : ''
}
roomAppearance() {
return this.room ? this.room.appearance : ''
}
},

View File

@ -78,9 +78,10 @@ class AddRoomEntry(relay.ClientIDMutation):
errors = graphene.List(graphene.String)
@classmethod
def mutate_and_get_payload(cls, *args, **kwargs):
def mutate_and_get_payload(cls, root, info, **kwargs):
room_entry_data = kwargs.get('room_entry')
room_entry_data['room'] = get_object(Room, room_entry_data.get('room')).id
room_entry_data['author'] = info.context.user.pk
serializer = RoomEntrySerializer(data=room_entry_data)