Change how release_time is edited. #412

Merged
infinite-persistence merged 2 commits from ip/release-time into master 2021-05-14 23:30:25 +02:00
infinite-persistence commented 2021-05-11 09:54:06 +02:00 (Migrated from github.com)

Issue

For lbry-desktop #5514 - Add release date field

Changes

Updates for UpdatePublishFormData:

  • releaseTime is now a number instead of a string, matching release_time. It was getting confusing what the units were between the app variable vs claim variable.
  • releaseTime will always match release_time for an edit. It will be used in the GUI to reset just the date to the original, instead of having to reset the entire form.
  • releaseTime will be undefined for new uploads.
  • releaseTimeEdited will be used by updatePublishForm in the GUI to represent the desired new release time. Set to undefined if we don't want to change the date.
## Issue For `lbry-desktop #5514 - Add release date field` ## Changes Updates for `UpdatePublishFormData`: - `releaseTime` is now a number instead of a string, matching `release_time`. It was getting confusing what the units were between the app variable vs claim variable. - `releaseTime` will always match `release_time` for an edit. It will be used in the GUI to reset just the date to the original, instead of having to reset the entire form. - `releaseTime` will be undefined for new uploads. - `releaseTimeEdited` will be used by `updatePublishForm` in the GUI to represent the desired new release time. Set to `undefined` if we don't want to change the date.
tzarebczan (Migrated from github.com) reviewed 2021-05-11 09:54:06 +02:00
tzarebczan commented 2021-05-12 16:22:38 +02:00 (Migrated from github.com)

Will give this a test soon, but this doesn't seem right as we always want to populate release time: "releaseTime will be undefined for new uploads."

Will give this a test soon, but this doesn't seem right as we always want to populate release time: "releaseTime will be undefined for new uploads."
infinite-persistence commented 2021-05-12 16:56:27 +02:00 (Migrated from github.com)

releaseTime and releaseTimeEdited is only used in the GUI side to differentiate the following cases:

  • creating new claim
  • editing claim
  • editing claim, and need to get back original/previous release time.
  • etc.

Ultimately, they get converted to the following when publishing:

  if (releaseTimeEdited) {
    publishPayload.release_time = releaseTimeEdited;
  } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
    publishPayload.release_time = Number(myClaimForUri.value.release_time);
  } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
    publishPayload.release_time = Number(myClaimForUriEditing.timestamp);
  } else {
    publishPayload.release_time = Number(Math.round(Date.now() / 1000));  // new claim
  }

So, release_time will always be populated.

`releaseTime` and `releaseTimeEdited` is only used in the GUI side to differentiate the following cases: - creating new claim - editing claim - editing claim, and need to get back original/previous release time. - etc. Ultimately, they get converted to the following when publishing: ``` if (releaseTimeEdited) { publishPayload.release_time = releaseTimeEdited; } else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) { publishPayload.release_time = Number(myClaimForUri.value.release_time); } else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) { publishPayload.release_time = Number(myClaimForUriEditing.timestamp); } else { publishPayload.release_time = Number(Math.round(Date.now() / 1000)); // new claim } ``` So, `release_time` will always be populated.
tzarebczan commented 2021-05-14 17:53:56 +02:00 (Migrated from github.com)

Gotcha...that makes more sense. Testing...

Gotcha...that makes more sense. Testing...
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#412
No description provided.