Updates comment-related redux code to support sdk version 0.53.0 #259

Merged
osilkin98 merged 18 commits from sdk-update into master 2020-01-23 21:50:02 +01:00
osilkin98 commented 2020-01-07 06:50:31 +01:00 (Migrated from github.com)

Adds support for LBRY SDK Version 0.53.0.

Adds

Three new functions are added to Lbry.js to communicate directly with the SDK:

  • comment_hide
  • comment_abandon
  • comment_update

Similarly, three new functions are added to src/redux/actions/comments.js:

  1. doCommentHide(comment_id: String)
  2. doCommentAbandon(comment_id: string)
  3. doCommentUpdate(comment_id: string, comment: string)

Changes:

state.comments.byId now maps a claim_id to a comment_id list
state.comments.commentById is added to map a comment_id to a Comment object
state.comments.commentsByUri maps a uri to a claim_id

type Comment is modified to be reflective of how the API retrieves comments

Adds support for LBRY SDK Version `0.53.0`. ### Adds Three new functions are added to `Lbry.js` to communicate directly with the SDK: - `comment_hide` - `comment_abandon` - `comment_update` Similarly, three new functions are added to `src/redux/actions/comments.js`: 1. `doCommentHide(comment_id: String)` 2. `doCommentAbandon(comment_id: string)` 3. `doCommentUpdate(comment_id: string, comment: string)` ### Changes: `state.comments.byId` now maps a `claim_id` to a `comment_id` list `state.comments.commentById` is added to map a `comment_id` to a `Comment` object `state.comments.commentsByUri` maps a `uri` to a `claim_id` `type Comment` is modified to be reflective of how the API retrieves comments
neb-b (Migrated from github.com) reviewed 2020-01-07 06:50:31 +01:00
neb-b (Migrated from github.com) requested changes 2020-01-16 17:23:40 +01:00
neb-b (Migrated from github.com) left a comment

Some comments and questions

Some comments and questions
neb-b (Migrated from github.com) commented 2020-01-16 17:09:11 +01:00

Users don't care about comment_id's. Maybe something like this:

"There was an error hiding this comment. Please try again later."

Users don't care about comment_id's. Maybe something like this: "There was an error hiding this comment. Please try again later."
neb-b (Migrated from github.com) commented 2020-01-16 17:09:46 +01:00

Same here.

Same here.
neb-b (Migrated from github.com) commented 2020-01-16 17:10:32 +01:00

Same here

Same here
@ -85,0 +180,4 @@
message: 'There was an error hiding this comment. Please try again later.',
isError: true,
})
);
neb-b (Migrated from github.com) commented 2020-01-16 17:10:20 +01:00

Nice. I like this pattern

Nice. I like this pattern
neb-b (Migrated from github.com) commented 2020-01-16 17:14:52 +01:00

I think this part can just be replaced with

delete commentById[comment_id]
I think this part can just be replaced with ``` delete commentById[comment_id] ```
neb-b (Migrated from github.com) commented 2020-01-16 17:15:03 +01:00

No need to loop through it.

No need to loop through it.
@ -11,0 +28,4 @@
return comments;
}
);
neb-b (Migrated from github.com) commented 2020-01-16 17:23:06 +01:00

Why do we need this new selector? (Not saying we don't, I'm just trying to understand the logic)

Is it that in you first get a list of the children comment ids, then for each child, get the actual comment?

It also helps to explain why you are doing something in a comment instead of what the code is doing, since that can usually be figured out.

ex: "map a new array of comments by the claimId"

I can see that's what this code is doing, but I don't know why it's doing that.

Why do we need this new selector? (Not saying we don't, I'm just trying to understand the logic) Is it that in you first get a list of the children comment ids, then for each child, get the actual comment? It also helps to explain why you are doing something in a comment instead of what the code is doing, since that can usually be figured out. ex: "map a new array of comments by the claimId" I can see that's what this code is doing, but I don't know why it's doing that.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-redux#259
No description provided.