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 }, [string]: { hidden: boolean },
}; };
declare type CommentPinResponse = {
// keyed by the CommentIds entered
items: Comment,
};
declare type CommentAbandonResponse = { declare type CommentAbandonResponse = {
// keyed by the CommentId given // keyed by the CommentId given
abandoned: boolean, abandoned: boolean,

5
flow-typed/Lbry.js vendored
View file

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

View file

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

View file

@ -160,10 +160,11 @@ export const selectAbandoningIds = createSelector(
state => Object.keys(state.abandoningById || {}) state => Object.keys(state.abandoningById || {})
); );
export const makeSelectAbandoningClaimById = (claimId: string) => createSelector( export const makeSelectAbandoningClaimById = (claimId: string) =>
createSelector(
selectAbandoningIds, selectAbandoningIds,
ids => ids.includes(claimId) ids => ids.includes(claimId)
); );
export const makeSelectIsAbandoningClaimForUri = (uri: string) => export const makeSelectIsAbandoningClaimForUri = (uri: string) =>
createSelector( 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) => export const makeSelectTagsForUri = (uri: string) =>
createSelector( createSelector(
makeSelectMetadataForUri(uri), makeSelectMetadataForUri(uri),