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) =>
selectAbandoningIds, createSelector(
ids => ids.includes(claimId) selectAbandoningIds,
); ids => ids.includes(claimId)
);
export const makeSelectIsAbandoningClaimForUri = (uri: string) => export const makeSelectIsAbandoningClaimForUri = (uri: string) =>
createSelector( createSelector(
@ -257,8 +258,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
const end = Number(page) * Number(PAGE_SIZE); const end = Number(page) * Number(PAGE_SIZE);
return matchingFileInfos && matchingFileInfos.length return matchingFileInfos && matchingFileInfos.length
? matchingFileInfos ? matchingFileInfos
.slice(start, end) .slice(start, end)
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url) .map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
: []; : [];
} }
); );
@ -364,8 +365,8 @@ export const makeSelectDateForUri = (uri: string) =>
(claim.value.release_time (claim.value.release_time
? claim.value.release_time * 1000 ? claim.value.release_time * 1000
: claim.meta && claim.meta.creation_timestamp : claim.meta && claim.meta.creation_timestamp
? claim.meta.creation_timestamp * 1000 ? claim.meta.creation_timestamp * 1000
: null); : null);
if (!timestamp) { if (!timestamp) {
return undefined; return undefined;
} }
@ -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),