Corrected mentioned_channels parameter name (#719)

Commentron json params are usually underscored instead of camel-cased.

Double-checked commentron code:

```
// MentionedChannel channels mentioned in comment
type MentionedChannel struct {
	ChannelName string `json:"channel_name"`
	ChannelID   string `json:"channel_id"`
}
```

The parameter should probably also be skipped instead of sending empty array, but leaving as-is for now since that is minor.
This commit is contained in:
infinite-persistence 2022-01-17 05:44:45 -08:00 committed by GitHub
parent 2b9fd723f9
commit 7989020a04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -176,6 +176,11 @@ declare type CommentAbandonParams = {
mod_channel_name?: string, mod_channel_name?: string,
}; };
declare type MentionedChannel = {
channel_name: string,
channel_id: string,
};
declare type CommentCreateParams = { declare type CommentCreateParams = {
comment: string, comment: string,
claim_id: string, claim_id: string,
@ -183,6 +188,7 @@ declare type CommentCreateParams = {
signature: string, signature: string,
signing_ts: string, signing_ts: string,
support_tx_id?: string, support_tx_id?: string,
mentioned_channels?: Array<MentionedChannel>,
}; };
declare type SuperListParams = {}; declare type SuperListParams = {};

View file

@ -29,11 +29,6 @@ const PROMISE_FULFILLED = 'fulfilled';
const MENTION_REGEX = /(?:^| |\n)@[^\s=&#$@%?:;/"<>%{}|^~[]*(?::[\w]+)?/gm; const MENTION_REGEX = /(?:^| |\n)@[^\s=&#$@%?:;/"<>%{}|^~[]*(?::[\w]+)?/gm;
declare type MentionedChannel = {
channelName: string,
channelID: string,
};
function devToast(dispatch, msg) { function devToast(dispatch, msg) {
if (isDev) { if (isDev) {
console.error(msg); // eslint-disable-line console.error(msg); // eslint-disable-line
@ -521,10 +516,10 @@ export function doCommentCreate(
const claim = selectClaimForUri(state, mentionUri); const claim = selectClaimForUri(state, mentionUri);
if (claim) { if (claim) {
mentionedChannels.push({ channelName: claim.name, channelID: claim.claim_id }); mentionedChannels.push({ channel_name: claim.name, channel_id: claim.claim_id });
} else if (claim === undefined) { } else if (claim === undefined) {
dispatch(doResolveUri(mentionUri)) dispatch(doResolveUri(mentionUri))
.then((response) => mentionedChannels.push({ channelName: response.name, channelID: response.claim_id })) .then((response) => mentionedChannels.push({ channel_name: response.name, channel_id: response.claim_id }))
.catch((e) => {}); .catch((e) => {});
} }
}); });