support comment pinning

This commit is contained in:
jessop 2020-10-14 14:07:00 -04:00 committed by Sean Yesmunt
parent 7fbb87d38f
commit a13ddadba4
5 changed files with 62 additions and 9 deletions

19
dist/bundle.es.js vendored

File diff suppressed because one or more lines are too long

View file

@ -158,6 +158,11 @@ declare type CommentHideResponse = {
[string]: { hidden: boolean },
};
declare type CommentPinResponse = {
// keyed by the CommentIds entered
items: Comment,
};
declare type CommentAbandonResponse = {
// keyed by the CommentId given
abandoned: boolean,

5
flow-typed/Lbry.js vendored
View file

@ -158,6 +158,11 @@ declare type CommentHideResponse = {
[string]: { hidden: boolean },
};
declare type CommentPinResponse = {
// keyed by the CommentIds entered
items: Comment,
};
declare type CommentAbandonResponse = {
// keyed by the CommentId given
abandoned: boolean,

View file

@ -170,6 +170,8 @@ export {
makeSelectOmittedCountForChannel,
makeSelectClaimIsNsfw,
makeSelectChannelForClaimUri,
makeSelectChannelPermUrlForClaimUri,
makeSelectMyChannelPermUrlForName,
makeSelectClaimIsPending,
makeSelectReflectingClaimForUri,
makeSelectClaimsInChannelForCurrentPageState,

View file

@ -160,10 +160,11 @@ export const selectAbandoningIds = createSelector(
state => Object.keys(state.abandoningById || {})
);
export const makeSelectAbandoningClaimById = (claimId: string) => createSelector(
export const makeSelectAbandoningClaimById = (claimId: string) =>
createSelector(
selectAbandoningIds,
ids => ids.includes(claimId)
);
);
export const makeSelectIsAbandoningClaimForUri = (uri: string) =>
createSelector(
@ -648,6 +649,29 @@ export const makeSelectChannelForClaimUri = (uri: string, includePrefix: boolean
}
);
export const makeSelectChannelPermUrlForClaimUri = (uri: string, includePrefix: boolean = false) =>
createSelector(
makeSelectClaimForUri(uri),
(claim: ?Claim) => {
if (claim && claim.value_type === 'channel') {
return claim.permanent_url;
}
if (!claim || !claim.signing_channel || !claim.is_channel_signature_valid) {
return null;
}
return claim.signing_channel.permanent_url;
}
);
export const makeSelectMyChannelPermUrlForName = (name: string) =>
createSelector(
selectMyChannelClaims,
claims => {
const matchingClaim = claims.find(claim => claim.name === name);
return matchingClaim ? matchingClaim.permanent_url : null;
}
);
export const makeSelectTagsForUri = (uri: string) =>
createSelector(
makeSelectMetadataForUri(uri),