mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
allow editable author (#936)
This commit is contained in:
parent
c4aea91373
commit
9925cc9d95
@ -3,6 +3,7 @@ import { Status } from './Status'
|
||||
|
||||
export interface EditableMetadata {
|
||||
description?: string
|
||||
author?: string
|
||||
title?: string
|
||||
links?: EditableMetadataLinks[]
|
||||
status?: Status
|
||||
|
@ -268,6 +268,7 @@ export class Assets extends Instantiable {
|
||||
for (let i = 0; i < ddo.service.length; i++) {
|
||||
if (ddo.service[i].type !== 'metadata') continue
|
||||
if (newMetadata.title) ddo.service[i].attributes.main.name = newMetadata.title
|
||||
if (newMetadata.author) ddo.service[i].attributes.main.author = newMetadata.author
|
||||
if (!ddo.service[i].attributes.additionalInformation)
|
||||
ddo.service[i].attributes.additionalInformation = Object()
|
||||
if (newMetadata.description)
|
||||
|
@ -554,6 +554,19 @@ describe('Marketplace flow', () => {
|
||||
assert.deepEqual(metaData.attributes.additionalInformation.links, [])
|
||||
})
|
||||
|
||||
it('Alice updates the author', async () => {
|
||||
const newMetaData: EditableMetadata = {
|
||||
author: 'SuperAlice'
|
||||
}
|
||||
const newDdo = await ocean.assets.editMetadata(ddo, newMetaData)
|
||||
assert(newDdo !== null)
|
||||
const txid = await ocean.onChainMetadata.update(newDdo.id, newDdo, alice.getId())
|
||||
assert(txid !== null)
|
||||
await sleep(60000)
|
||||
const metaData = await ocean.assets.getServiceByType(ddo.id, 'metadata')
|
||||
assert(metaData.attributes.main.author, newMetaData.author)
|
||||
})
|
||||
|
||||
it('Alice updates metadata and removes sample links with encrypted ddo', async () => {
|
||||
const newMetaData: EditableMetadata = {
|
||||
description: 'new description no links',
|
||||
|
Loading…
x
Reference in New Issue
Block a user