-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds mappings for ChannelAssetsDeletedByModerator
& VideoAssetsDeletedByModerator
events
#199
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { | |
ChannelRewardClaimedEventData, | ||
ChannelRewardClaimedAndWithdrawnEventData, | ||
ChannelFundsWithdrawnEventData, | ||
ChannelAssetsDeletedByModeratorEventData, | ||
} from '../../model' | ||
import { deserializeMetadata, genericEventFields, toAddress, u8aToBytes } from '../utils' | ||
import { | ||
|
@@ -26,6 +27,7 @@ import { processAppActionMetadata, deleteChannel, encodeAssets, parseContentActo | |
import { Flat } from '../../utils/overlay' | ||
import { DecodedMetadataObject } from '@joystream/metadata-protobuf/types' | ||
import { generateAppActionCommitment } from '@joystream/js/utils' | ||
import { ContentChannelAssetsDeletedByModeratorEvent } from '../../types/events' | ||
|
||
export async function processChannelCreatedEvent({ | ||
overlay, | ||
|
@@ -154,6 +156,28 @@ export async function processChannelDeletedByModeratorEvent({ | |
await deleteChannel(overlay, channelId) | ||
} | ||
|
||
export async function processChannelAssetsDeletedByModeratorEvent({ | ||
block, | ||
indexInBlock, | ||
extrinsicHash, | ||
overlay, | ||
event: { | ||
asV1000: [deletedBy, channelId, assetIds, rationale], | ||
}, | ||
}: EventHandlerContext<'Content.ChannelAssetsDeletedByModerator'>): Promise<void> { | ||
const channel = await overlay.getRepository(Channel).getByIdOrFail(channelId.toString()) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also here you should deleted relevant |
||
overlay.getRepository(Event).new({ | ||
...genericEventFields(overlay, block, indexInBlock, extrinsicHash), | ||
data: new ChannelAssetsDeletedByModeratorEventData({ | ||
channel: channel.id, | ||
assetIds, | ||
deletedBy: parseContentActor(deletedBy), | ||
rationale: rationale.toString(), | ||
}), | ||
}) | ||
} | ||
|
||
export async function processChannelVisibilitySetByModeratorEvent({ | ||
overlay, | ||
event: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,28 @@ import { | |
} from '@joystream/metadata-protobuf' | ||
import { DecodedMetadataObject } from '@joystream/metadata-protobuf/types' | ||
import { integrateMeta } from '@joystream/metadata-protobuf/utils' | ||
import { Channel, Video, VideoViewEvent } from '../../model' | ||
import { | ||
Channel, | ||
Event, | ||
Video, | ||
VideoAssetsDeletedByModeratorEventData, | ||
VideoViewEvent, | ||
} from '../../model' | ||
import { EventHandlerContext } from '../../utils/events' | ||
import { deserializeMetadata, u8aToBytes, videoRelevanceManager } from '../utils' | ||
import { | ||
deserializeMetadata, | ||
genericEventFields, | ||
u8aToBytes, | ||
videoRelevanceManager, | ||
} from '../utils' | ||
import { processVideoMetadata } from './metadata' | ||
import { deleteVideo, encodeAssets, processAppActionMetadata, processNft } from './utils' | ||
import { | ||
deleteVideo, | ||
encodeAssets, | ||
parseContentActor, | ||
processAppActionMetadata, | ||
processNft, | ||
} from './utils' | ||
import { generateAppActionCommitment } from '@joystream/js/utils' | ||
|
||
export async function processVideoCreatedEvent({ | ||
|
@@ -169,6 +186,28 @@ export async function processVideoDeletedByModeratorEvent({ | |
await deleteVideo(overlay, contentId) | ||
} | ||
|
||
export async function processVideoAssetsDeletedByModeratorEvent({ | ||
block, | ||
indexInBlock, | ||
extrinsicHash, | ||
overlay, | ||
event: { | ||
asV1000: [deletedBy, contentId, assetIds, rationale], | ||
}, | ||
}: EventHandlerContext<'Content.VideoAssetsDeletedByModerator'>): Promise<void> { | ||
const video = await overlay.getRepository(Video).getByIdOrFail(contentId.toString()) | ||
|
||
overlay.getRepository(Event).new({ | ||
...genericEventFields(overlay, block, indexInBlock, extrinsicHash), | ||
data: new VideoAssetsDeletedByModeratorEventData({ | ||
video: video.id, | ||
assetIds, | ||
deletedBy: parseContentActor(deletedBy), | ||
rationale: rationale.toString(), | ||
}), | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please check whether is it suitable to also remove the related |
||
} | ||
|
||
export async function processVideoVisibilitySetByModeratorEvent({ | ||
overlay, | ||
event: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used apparently