Fix first load (publish) shortId's with daemon and chainquery
This commit is contained in:
parent
f424c9b6ef
commit
7415ec87d1
2 changed files with 7 additions and 4 deletions
|
@ -10,9 +10,12 @@ const publish = (publishParams, fileName, fileType) => {
|
||||||
let publishResults, certificateId, channelName;
|
let publishResults, certificateId, channelName;
|
||||||
// publish the file
|
// publish the file
|
||||||
return publishClaim(publishParams)
|
return publishClaim(publishParams)
|
||||||
.then(tx => {
|
.then(result => {
|
||||||
logger.info(`Successfully published ${publishParams.name} ${fileName}`, tx);
|
logger.info(`Successfully published ${publishParams.name} ${fileName}`, result);
|
||||||
publishResults = tx;
|
|
||||||
|
// Support new daemon, TODO: remove
|
||||||
|
publishResults = result.output && result.output.claim_id ? result.output : result;
|
||||||
|
|
||||||
// get the channel information
|
// get the channel information
|
||||||
if (publishParams.channel_name) {
|
if (publishParams.channel_name) {
|
||||||
logger.debug(`this claim was published in channel: ${publishParams.channel_name}`);
|
logger.debug(`this claim was published in channel: ${publishParams.channel_name}`);
|
||||||
|
|
|
@ -12,7 +12,7 @@ const claimShortId = async ({ ip, originalUrl, body, params }, res) => {
|
||||||
try {
|
try {
|
||||||
let shortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(params.longId, params.name).catch(() => {});
|
let shortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(params.longId, params.name).catch(() => {});
|
||||||
|
|
||||||
if(shortId === null) {
|
if(!shortId) {
|
||||||
shortId = await db.Claim.getShortClaimIdFromLongClaimId(params.longId, params.name);
|
shortId = await db.Claim.getShortClaimIdFromLongClaimId(params.longId, params.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue