diff --git a/server/api/models/place.js b/server/api/models/place.js index 0726d4d0..0bd8e6b9 100644 --- a/server/api/models/place.js +++ b/server/api/models/place.js @@ -19,7 +19,7 @@ module.exports = (sequelize, DataTypes) => { /** * @description WIP -> https://codeberg.org/fediverse/fep/src/commit/4a75a1bc50bc6d19fc1e6112f02c52621bc178fe/fep/8a8e/fep-8a8e.md#location - * @todo support PlaceAddress type + * @todo support PostalAddress type * @returns ActivityStream location representation */ Place.prototype.toAP = function () { @@ -28,8 +28,7 @@ module.exports = (sequelize, DataTypes) => { type: 'Place', name: this.name, address: this.address, - latitude: this.latitude, - longitude: this.longitude + ...( this.latitude && this.longitude && ({ latitude: this.latitude, longitude: this.longitude})) } } diff --git a/server/federation/helpers.js b/server/federation/helpers.js index d913e2b9..baa14079 100644 --- a/server/federation/helpers.js +++ b/server/federation/helpers.js @@ -178,6 +178,7 @@ const Helpers = { async parsePlace (APEvent) { const eventController = require('../api/controller/event') let place + if (APEvent?.location) { place = { place_name: APEvent.location?.name, @@ -233,7 +234,7 @@ const Helpers = { const APEvent = message.object - // validate coming events + // validate incoming events const required_fields = ['name', 'startTime', 'id'] let missing_field = required_fields.find(required_field => !APEvent[required_field]) if (missing_field) {