Skip to content

Commit 1450069

Browse files
authored
Merge pull request #4752 from thematters/feat/remove-iscn
feat(iscn): remove iscn logic in publication
2 parents bcab2c9 + 0d112e1 commit 1450069

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

src/connectors/article/ipfsPublicationService.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {
22
Connections,
33
ArticleVersion,
44
Article,
5-
UserOAuthLikeCoin,
65
} from '#definitions/index.js'
76
import type { Knex } from 'knex'
87

@@ -24,7 +23,6 @@ import { PinataSDK } from 'pinata-web3'
2423

2524
import { AtomService } from '../atomService.js'
2625
import { aws } from '../aws/index.js'
27-
import { LikeCoin } from '../likecoin/index.js'
2826

2927
const logger = getLogger('service-ipfs-publication')
3028

@@ -36,15 +34,13 @@ export class IPFSPublicationService {
3634
private knexRO: Knex
3735
private models: AtomService
3836
private aws: typeof aws
39-
private likecoin: LikeCoin
4037

4138
public constructor(connections: Connections) {
4239
this.connections = connections
4340
this.models = new AtomService(connections)
4441
this.knex = connections.knex
4542
this.knexRO = connections.knexRO
4643
this.aws = aws
47-
this.likecoin = new LikeCoin(connections)
4844
}
4945

5046
private async initStorachaClient() {
@@ -352,54 +348,6 @@ export class IPFSPublicationService {
352348
}
353349
})
354350

355-
// publish to ISCN
356-
try {
357-
const draft = await this.models.findFirst({
358-
table: 'draft',
359-
where: { articleId },
360-
})
361-
362-
if (article && draft && draft.iscnPublish) {
363-
const author = await this.models.findFirst({
364-
table: 'user',
365-
where: { id: draft.authorId },
366-
})
367-
368-
let liker: UserOAuthLikeCoin | undefined
369-
if (author?.likerId) {
370-
liker = await this.models.findFirst({
371-
table: 'user_oauth_likecoin',
372-
where: { likerId: author.likerId },
373-
})
374-
}
375-
376-
if (liker && author) {
377-
const cosmosWallet = await this.likecoin.getCosmosWallet({ liker })
378-
379-
const { displayName, userName } = author
380-
const iscnId = await this.likecoin.iscnPublish({
381-
mediaHash: `hash://sha256/${mediaHash}`,
382-
ipfsHash: `ipfs://${dataHash}`,
383-
cosmosWallet,
384-
userName: `${displayName} (@${userName})`,
385-
title: articleVersion.title,
386-
description: articleVersion.summary,
387-
datePublished: article.createdAt?.toISOString().substring(0, 10),
388-
url: `https://${environment.siteDomain}/a/${article.shortHash}`,
389-
tags: articleVersion.tags,
390-
liker,
391-
})
392-
393-
await this.knex('article_version')
394-
.where({ id: articleVersionId })
395-
.update({ iscnId })
396-
}
397-
}
398-
} catch (err) {
399-
console.log('Failed to publish to ISCN')
400-
console.error(err)
401-
}
402-
403351
// invalidate cache
404352
await invalidateFQC({
405353
node: { type: NODE_TYPES.Article, id: articleId },

0 commit comments

Comments
 (0)