cleanup
This commit is contained in:
parent
0fa9bc831e
commit
c75987ef9d
4 changed files with 18 additions and 11 deletions
|
@ -12,13 +12,14 @@ const mapStateToProps = ({ show, publish: { file, thumbnail, fileError, isUpdate
|
||||||
let asset, name, claimId, fileExt, outpoint, sourceUrl;
|
let asset, name, claimId, fileExt, outpoint, sourceUrl;
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
asset = selectAsset(show);
|
asset = selectAsset(show);
|
||||||
|
const { claimData } = asset;
|
||||||
if (asset) {
|
if (asset) {
|
||||||
obj.fileExt = asset.claimData.contentType.split('/')[1];
|
obj.fileExt = claimData.contentType.split('/')[1];
|
||||||
if (obj.fileExt === 'mp4') {
|
if (obj.fileExt === 'mp4') {
|
||||||
obj.sourceUrl = asset.claimData.thumbnail ? asset.claimData.thumbnail : defaultThumbnail;
|
obj.sourceUrl = claimData.thumbnail ? claimData.thumbnail : defaultThumbnail;
|
||||||
} else {
|
} else {
|
||||||
({claimData: {fileExt, outpoint}} = asset);
|
({fileExt, outpoint} = claimData);
|
||||||
obj.sourceUrl = `${createCanonicalLink({ asset: asset.claimData })}.${fileExt}?${outpoint}`;
|
obj.sourceUrl = `${createCanonicalLink({ asset: claimData })}.${fileExt}?${outpoint}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const db = require('../../../../models');
|
const db = require('server/models');
|
||||||
const { abandonClaim } = require('../../../../lbrynet');
|
const { abandonClaim } = require('server/lbrynet');
|
||||||
const deleteFile = require('../publish/deleteFile.js');
|
const deleteFile = require('../publish/deleteFile.js');
|
||||||
const authenticateUser = require('../publish/authentication.js');
|
const authenticateUser = require('../publish/authentication.js');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const db = require('../../../../models');
|
const db = require('server/models');
|
||||||
const { details, publishing: { disabled, disabledMessage, primaryClaimAddress } } = require('@config/siteConfig');
|
const { details, publishing: { disabled, disabledMessage, primaryClaimAddress } } = require('@config/siteConfig');
|
||||||
const { resolveUri } = require('../../../../lbrynet');
|
const { resolveUri } = require('server/lbrynet');
|
||||||
const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js');
|
const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js');
|
||||||
const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
|
const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
|
||||||
const publish = require('../publish/publish.js');
|
const publish = require('../publish/publish.js');
|
||||||
|
|
|
@ -10,9 +10,15 @@ const fetchClaimData = async (params) => {
|
||||||
db.Claim.resolveClaim(name, claimId).catch(() => {}),
|
db.Claim.resolveClaim(name, claimId).catch(() => {}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!cq && !local) return null;
|
if (!cq && !local) {
|
||||||
if (cq && cq.name === name && !local) return cq;
|
return null;
|
||||||
if (local && local.name === name && !cq) return local;
|
}
|
||||||
|
if (cq && cq.name === name && !local) {
|
||||||
|
return cq;
|
||||||
|
}
|
||||||
|
if (local && local.name === name && !cq) {
|
||||||
|
return local;
|
||||||
|
}
|
||||||
return local.updatedAt > cq.modified_at ? local : cq;
|
return local.updatedAt > cq.modified_at ? local : cq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue