Minor cleanup to reduce code. No functional change.
- Re-use available wrapper. - Don't fight the IDE in terms of doc-wrapping.
This commit is contained in:
parent
dcc66f211e
commit
794050c827
1 changed files with 13 additions and 23 deletions
|
@ -563,14 +563,6 @@ export function doCommentReact(commentId: string, type: string) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param uri
|
|
||||||
* @param livestream
|
|
||||||
* @param params the CommentSubmitParams needed for CommentCreateParams (not the same as they are dealt differently,
|
|
||||||
* like mentionedChannels which is selected after submission)
|
|
||||||
* @returns {(function(Dispatch, GetState): Promise<undefined|void|*>)|*}
|
|
||||||
*/
|
|
||||||
export function doCommentCreate(uri: string, livestream: boolean, params: CommentSubmitParams) {
|
export function doCommentCreate(uri: string, livestream: boolean, params: CommentSubmitParams) {
|
||||||
return async (dispatch: Dispatch, getState: GetState) => {
|
return async (dispatch: Dispatch, getState: GetState) => {
|
||||||
const { comment, claim_id, parent_id, txid, payment_intent_id, environment, sticker } = params;
|
const { comment, claim_id, parent_id, txid, payment_intent_id, environment, sticker } = params;
|
||||||
|
@ -623,19 +615,12 @@ export function doCommentCreate(uri: string, livestream: boolean, params: Commen
|
||||||
|
|
||||||
dispatch({ type: ACTIONS.COMMENT_CREATE_STARTED });
|
dispatch({ type: ACTIONS.COMMENT_CREATE_STARTED });
|
||||||
|
|
||||||
let signatureData;
|
const notification = parent_id && makeSelectNotificationForCommentId(parent_id)(state);
|
||||||
if (activeChannelClaim) {
|
if (notification && !notification.is_seen) {
|
||||||
try {
|
dispatch(doSeeNotifications([notification.id]));
|
||||||
signatureData = await Lbry.channel_sign({
|
|
||||||
channel_id: activeChannelClaim.claim_id,
|
|
||||||
hexdata: toHex(comment),
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const notification = parent_id && makeSelectNotificationForCommentId(parent_id)(state);
|
const signatureData = await channelSignData(activeChannelClaim.claim_id, comment);
|
||||||
if (notification && !notification.is_seen) dispatch(doSeeNotifications([notification.id]));
|
|
||||||
|
|
||||||
if (!signatureData) {
|
if (!signatureData) {
|
||||||
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
|
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
|
||||||
}
|
}
|
||||||
|
@ -732,9 +717,12 @@ export function doCommentPin(commentId: string, claimId: string, remove: boolean
|
||||||
* Deletes a comment in Commentron.
|
* Deletes a comment in Commentron.
|
||||||
*
|
*
|
||||||
* @param commentId The comment ID to delete.
|
* @param commentId The comment ID to delete.
|
||||||
* @param deleterClaim The channel-claim of the person doing the deletion. Defaults to the active channel if not provided.
|
* @param deleterClaim The channel-claim of the person doing the deletion.
|
||||||
|
* Defaults to the active channel if not provided.
|
||||||
* @param deleterIsModOrAdmin Is the deleter a mod or admin for the content?
|
* @param deleterIsModOrAdmin Is the deleter a mod or admin for the content?
|
||||||
* @param creatorClaim The channel-claim for the content where the comment resides. Not required if the deleter owns the comment (i.e. deleting own comment).
|
* @param creatorClaim The channel-claim for the content where the comment
|
||||||
|
* resides. Not required if the deleter owns the comment (i.e. deleting own
|
||||||
|
* comment).
|
||||||
* @returns {function(Dispatch): *}
|
* @returns {function(Dispatch): *}
|
||||||
*/
|
*/
|
||||||
export function doCommentAbandon(
|
export function doCommentAbandon(
|
||||||
|
@ -1119,7 +1107,8 @@ export function doCommentModBlock(
|
||||||
*
|
*
|
||||||
* @param commenterUri
|
* @param commenterUri
|
||||||
* @param offendingCommentId
|
* @param offendingCommentId
|
||||||
* @param blockerId Your specific channel ID to block with, or pass 'undefined' to block it for all of your channels.
|
* @param blockerId Your specific channel ID to block with, or pass 'undefined'
|
||||||
|
* to block it for all of your channels.
|
||||||
* @param timeoutSec
|
* @param timeoutSec
|
||||||
* @returns {function(Dispatch): *}
|
* @returns {function(Dispatch): *}
|
||||||
*/
|
*/
|
||||||
|
@ -1152,7 +1141,8 @@ export function doCommentModBlockAsAdmin(
|
||||||
* @param commenterUri
|
* @param commenterUri
|
||||||
* @param offendingCommentId
|
* @param offendingCommentId
|
||||||
* @param creatorUri
|
* @param creatorUri
|
||||||
* @param blockerId Your specific channel ID to block with, or pass 'undefined' to block it for all of your channels.
|
* @param blockerId Your specific channel ID to block with, or pass 'undefined'
|
||||||
|
* to block it for all of your channels.
|
||||||
* @param timeoutSec
|
* @param timeoutSec
|
||||||
* @returns {function(Dispatch): *}
|
* @returns {function(Dispatch): *}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue