Publish by channel_id #1481

Merged
daovist merged 1 commit from publish-by-channel-id into master 2018-05-25 17:05:56 +02:00
daovist commented 2018-05-16 02:02:39 +02:00 (Migrated from github.com)

Issue #1433

Add channelId to PublishState and use it to replace channel in PublishParams. Store both in redux while editing but always use channel_id to publish.

Adds myChannels: selectMyChannelClaims(state) to PublishForm and uses it to get a channel's id from its name when saving form data.

@tzarebczan check this out. I am able to create a new channel and publish seconds later

lbry fast publish

Issue #1433 Add `channelId` to `PublishState` and use it to replace `channel` in `PublishParams`. Store both in redux while editing but always use `channel_id` to publish. Adds `myChannels: selectMyChannelClaims(state)` to PublishForm and uses it to get a channel's id from its name when saving form data. @tzarebczan check this out. I am able to create a new channel and publish seconds later ![lbry fast publish](https://user-images.githubusercontent.com/34498824/40089665-e138b1ae-587a-11e8-9a67-1971eeff338d.png)
neb-b (Migrated from github.com) requested changes 2018-05-16 04:06:08 +02:00
neb-b (Migrated from github.com) left a comment

It looks like you still need to change src/renderer/redux/actions/publish.js to look for channelId instead of channelName The file is being published without a channel currently. It just looks at the redux state on success to get the data for the modal.

It looks like you still need to change `src/renderer/redux/actions/publish.js` to look for `channelId` instead of `channelName` The file is being published without a channel currently. It just looks at the redux state on success to get the data for the modal.
neb-b (Migrated from github.com) commented 2018-05-16 02:06:08 +02:00

Can you add this to src/rendered/page/publish/index.js? I know it's weird. We should probably just copy that whole file into this one make that one an empty connect. Not sure.

Can you add this to `src/rendered/page/publish/index.js`? I know it's weird. We should probably just copy that whole file into this one make that one an empty connect. Not sure.
daovist commented 2018-05-16 16:25:13 +02:00 (Migrated from github.com)

I can't believe I missed that, it's the most important part.

I have made what should be the necessary changes to /redux/actions/publish.js and have published to new channels and anonymously. Now they stick around in My LBRY >> Publishes like they should.

When I go to the Publish page, I don't see channels I've created prior, my only options are anonymous and new channel, which seems wrong.

I can't believe I missed that, it's the most important part. I have made what should be the necessary changes to `/redux/actions/publish.js` and have published to new channels and anonymously. Now they stick around in `My LBRY >> Publishes` like they should. When I go to the Publish page, I don't see channels I've created prior, my only options are anonymous and new channel, which seems wrong.
tzarebczan commented 2018-05-16 16:31:37 +02:00 (Migrated from github.com)

@daovist - nice work! https://github.com/lbryio/lbry-redux/pull/26 should fix the channel selection issue. I'll test this out once that's merged into redux

@daovist - nice work! https://github.com/lbryio/lbry-redux/pull/26 should fix the channel selection issue. I'll test this out once that's merged into redux
neb-b (Migrated from github.com) requested changes 2018-05-16 17:06:33 +02:00
neb-b (Migrated from github.com) left a comment

One small thing

One small thing
neb-b (Migrated from github.com) commented 2018-05-16 17:06:18 +02:00

This should clear out the channel id if there is no namedChannelClaim

If I select a channel, then go back to anonymous, the same claim_id will be stored in redux

This should clear out the channel id if there is no `namedChannelClaim` If I select a channel, then go back to anonymous, the same `claim_id` will be stored in redux
tzarebczan commented 2018-05-17 00:25:13 +02:00 (Migrated from github.com)

@daovist Try editing a claim that has a channel, I get this: https://www.screencast.com/t/ubdCz0mx . It should say something like: "You are currently editing this claim". Not sure if this was a new bug introduced here, or if existed before.

@daovist Try editing a claim that has a channel, I get this: https://www.screencast.com/t/ubdCz0mx . It should say something like: "You are currently editing this claim". Not sure if this was a new bug introduced here, or if existed before.
daovist commented 2018-05-17 16:42:58 +02:00 (Migrated from github.com)

@tzarebczan interesting... This was already an issue so I will leave it out of this PR. But here is what I came across looking into this. uri and editingURI aren't going to match so even when you click edit you get that same message. I used normalizeURI and some logic to fix this so it says its an edit properly, but then if you're working on a new publish with the same name and channel it will give that same message. We need a better way to know when a user is in edit mode. Now, if a user clicks edit and leaves before re-publishing, editingURI won't be reset unless they click reset form.

The editingURI property is defined in the DO_PREPARE_EDIT reducer:

` [ACTIONS.DO_PREPARE_EDIT]: (state: PublishState, action) => {
const { ...publishData } = action.data;
const { channel, name } = publishData;

  const uri = buildURI({
    channelName: channel,
    contentName: name,
  });

  return {
    ...defaultState,
    editingURI: uri,
    ...publishData,
  };

`

The message displayed comes from this condition:

if (uri === editingURI)

@tzarebczan interesting... This was already an issue so I will leave it out of this PR. But here is what I came across looking into this. `uri` and `editingURI` aren't going to match so even when you click edit you get that same message. I used normalizeURI and some logic to fix this so it says its an edit properly, but then if you're working on a new publish with the same name and channel it will give that same message. We need a better way to know when a user is in edit mode. Now, if a user clicks edit and leaves before re-publishing, editingURI won't be reset unless they click reset form. The `editingURI` property is defined in the [`DO_PREPARE_EDIT` reducer](https://github.com/lbryio/lbry-app/blob/master/src/renderer/redux/reducers/publish.js#L160): ` [ACTIONS.DO_PREPARE_EDIT]: (state: PublishState, action) => { const { ...publishData } = action.data; const { channel, name } = publishData; const uri = buildURI({ channelName: channel, contentName: name, }); return { ...defaultState, editingURI: uri, ...publishData, }; ` The message displayed comes from [this condition](https://github.com/lbryio/lbry-app/blob/master/src/renderer/component/publishForm/internal/bid-help-text.jsx#L29): `if (uri === editingURI)`
neb-b commented 2018-05-17 18:15:54 +02:00 (Migrated from github.com)

Looks like this was already a bug. I thought I fixed it but I guess not.

Looks like this was already a bug. I thought I fixed it but I guess not.
neb-b commented 2018-05-17 18:19:07 +02:00 (Migrated from github.com)

Looks like channel isn't being correctly used to create uri in the publish reducer.

Looks like `channel` isn't being correctly used to create `uri` in the publish reducer.
skhameneh (Migrated from github.com) approved these changes 2018-05-22 05:47:46 +02:00
skhameneh (Migrated from github.com) left a comment

One minor suggestion

One minor suggestion
skhameneh (Migrated from github.com) commented 2018-05-22 05:47:08 +02:00

use Array.prototype.find()? (instead of filter)

use `Array.prototype.find()`? (instead of filter)
daovist (Migrated from github.com) reviewed 2018-05-22 14:02:25 +02:00
daovist (Migrated from github.com) commented 2018-05-22 14:02:25 +02:00

Good call @skhameneh

Good call @skhameneh
neb-b (Migrated from github.com) approved these changes 2018-05-24 22:07:07 +02:00
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-desktop#1481
No description provided.