From 6e20f8931721e977f3a71c332f0c6a39162ac482 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 6 Dec 2017 15:15:21 -0800 Subject: [PATCH] fixed bug in og meta tags --- helpers/serveHelpers.js | 6 ++---- models/claim.js | 17 ++++++++++------- routes/serve-routes.js | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/helpers/serveHelpers.js b/helpers/serveHelpers.js index a62e7d38..b6c79231 100644 --- a/helpers/serveHelpers.js +++ b/helpers/serveHelpers.js @@ -16,11 +16,9 @@ module.exports = { res.status(200).sendFile(filePath, options); }, showFile (claimInfo, shortId, res) { - const openGraphInfo = module.exports.createOpenGraphInfo(claimInfo); - res.status(200).render('show', { layout: 'show', claimInfo, shortId, openGraphInfo }); + res.status(200).render('show', { layout: 'show', claimInfo, shortId }); }, showFileLite (claimInfo, shortId, res) { - const openGraphInfo = module.exports.createOpenGraphInfo(claimInfo); - res.status(200).render('showLite', { layout: 'showlite', claimInfo, shortId, openGraphInfo }); + res.status(200).render('showLite', { layout: 'showlite', claimInfo, shortId }); }, }; diff --git a/models/claim.js b/models/claim.js index 2c0269ae..6e32e135 100644 --- a/models/claim.js +++ b/models/claim.js @@ -1,8 +1,8 @@ const logger = require('winston'); const { returnShortId } = require('../helpers/sequelizeHelpers.js'); const DEFAULT_THUMBNAIL = 'https://spee.ch/assets/img/video_thumb_default.png'; -const DEFAULT_TITLE = ''; -const DEFAULT_DESCRIPTION = ''; +const DEFAULT_TITLE = 'Spee { @@ -393,6 +395,7 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => { where: { name, claimId }, }) .then(claimArray => { + logger.debug('claims found on resolve:', claimArray.length); switch (claimArray.length) { case 0: return resolve(null); diff --git a/routes/serve-routes.js b/routes/serve-routes.js index c501c872..6cdcf0fd 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -184,9 +184,9 @@ function showAssetToClient (claimId, name, res) { }); } -function showPlainAssetToClient (claimId, name, res) { +function showLiteAssetToClient (claimId, name, res) { return Promise - .all([db.Claim.resolveClaim(claimId, name), db.Claim.getShortClaimIdFromLongClaimId(claimId, name)]) + .all([db.Claim.resolveClaim(name, claimId), db.Claim.getShortClaimIdFromLongClaimId(claimId, name)]) .then(([claimInfo, shortClaimId]) => { logger.debug('claimInfo:', claimInfo); logger.debug('shortClaimId:', shortClaimId); @@ -217,7 +217,7 @@ function showOrServeAsset (responseType, claimId, claimName, res) { case SHOW: return showAssetToClient(claimId, claimName, res); case SHOWLITE: - return showPlainAssetToClient(claimId, claimName, res); + return showLiteAssetToClient(claimId, claimName, res); case SERVE: return serveAssetToClient(claimId, claimName, res); default: