add claim_id to myClaims if resolved claim is mine

This commit is contained in:
Sean Yesmunt 2020-07-22 15:23:11 -04:00
parent 3ce73c6646
commit 5547f53f48
2 changed files with 13 additions and 1 deletions
dist
src/redux/reducers

8
dist/bundle.es.js vendored
View file

@ -5163,6 +5163,7 @@ function handleClaimAction(state, action) {
const channelClaimCounts = Object.assign({}, state.channelClaimCounts); const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
const pendingIds = state.pendingIds; const pendingIds = state.pendingIds;
let newResolvingUrls = new Set(state.resolvingUris); let newResolvingUrls = new Set(state.resolvingUris);
let myClaimIds = new Set(state.myClaims);
Object.entries(resolveInfo).forEach(([url, resolveResponse]) => { Object.entries(resolveInfo).forEach(([url, resolveResponse]) => {
// $FlowFixMe // $FlowFixMe
@ -5183,6 +5184,10 @@ function handleClaimAction(state, action) {
byUri[stream.permanent_url] = stream.claim_id; byUri[stream.permanent_url] = stream.claim_id;
newResolvingUrls.delete(stream.canonical_url); newResolvingUrls.delete(stream.canonical_url);
newResolvingUrls.delete(stream.permanent_url); newResolvingUrls.delete(stream.permanent_url);
if (stream.is_my_output) {
myClaimIds.add(stream.claim_id);
}
} }
if (channel && channel.claim_id) { if (channel && channel.claim_id) {
@ -5217,7 +5222,8 @@ function handleClaimAction(state, action) {
byId, byId,
claimsByUri: byUri, claimsByUri: byUri,
channelClaimCounts, channelClaimCounts,
resolvingUris: Array.from(newResolvingUrls) resolvingUris: Array.from(newResolvingUrls),
myClaims: Array.from(myClaimIds)
}); });
} }

View file

@ -115,6 +115,7 @@ function handleClaimAction(state: State, action: any): State {
const channelClaimCounts = Object.assign({}, state.channelClaimCounts); const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
const pendingIds = state.pendingIds; const pendingIds = state.pendingIds;
let newResolvingUrls = new Set(state.resolvingUris); let newResolvingUrls = new Set(state.resolvingUris);
let myClaimIds = new Set(state.myClaims);
Object.entries(resolveInfo).forEach(([url: string, resolveResponse: ResolveResponse]) => { Object.entries(resolveInfo).forEach(([url: string, resolveResponse: ResolveResponse]) => {
// $FlowFixMe // $FlowFixMe
@ -135,6 +136,10 @@ function handleClaimAction(state: State, action: any): State {
byUri[stream.permanent_url] = stream.claim_id; byUri[stream.permanent_url] = stream.claim_id;
newResolvingUrls.delete(stream.canonical_url); newResolvingUrls.delete(stream.canonical_url);
newResolvingUrls.delete(stream.permanent_url); newResolvingUrls.delete(stream.permanent_url);
if (stream.is_my_output) {
myClaimIds.add(stream.claim_id);
}
} }
if (channel && channel.claim_id) { if (channel && channel.claim_id) {
@ -170,6 +175,7 @@ function handleClaimAction(state: State, action: any): State {
claimsByUri: byUri, claimsByUri: byUri,
channelClaimCounts, channelClaimCounts,
resolvingUris: Array.from(newResolvingUrls), resolvingUris: Array.from(newResolvingUrls),
myClaims: Array.from(myClaimIds),
}); });
} }