Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: copy link to clipboard when adding to ipfs #1221

Merged
merged 2 commits into from
Oct 29, 2019

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Oct 28, 2019

With this PR, we get back the feature of copying a shareable link to the clipboard when adding files to our node via the IPFS icon that sits on the menubar on macOS or to the shortcut of the app on Windows.

In addition, I cleaned up the locale messages, removing some that are not used anymore and updating the ones we have for this notification in particular. I will create a separate PR organizing the translation file a bit more.

We now add all files at once and give only one notification. If the user drops multiple files, we create an object linking to all of them, which is used for the shareable link and when clicking on the notification.

Closes #1218.

License: MIT
Signed-off-by: Henrique Dias [email protected]

License: MIT
Signed-off-by: Henrique Dias <[email protected]>
@hacdias hacdias requested review from autonome and lidel October 28, 2019 21:11
@hacdias hacdias self-assigned this Oct 28, 2019
Copy link
Contributor

@autonome autonome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor things noted, but LGTM otherwise!

Separate thought about the PR structure - it bundled up two distinct changes: adding multiple files, and the clipboard change. This makes it a little bit slower to review and also reduces our ability to see clearly where problems are if some tests or something fail down the line and need to revert a change. For those reasons, generally I recommend separating features out into multiple PRs if possible. Sometimes the code is just too tangled to do that easily and I don't know the Desktop code very well, so ignore me if that's the case here!

src/add-to-ipfs.js Show resolved Hide resolved
}

const cidAndPath = await makeObject(ipfsd.api, successes)
sendNotification(failures, successes, launchWebUI, cidAndPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, I think it would be nice to pull out cidAndPath into separate variables passed to sendNotification.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

src/add-to-ipfs.js Outdated Show resolved Hide resolved
@hacdias
Copy link
Member Author

hacdias commented Oct 29, 2019

Thanks for your review @autonome! 😃

it bundled up two distinct changes: adding multiple files, and the clipboard change.

We already added multiple files, but not inside this function. We'd just call the function multiple times and get the same number of notifications as files, which would be annoying.

But yeah, I agree it could be separated into two PRs.

Sometimes the code is just too tangled to do that easily and I don't know the Desktop code very well, so ignore me if that's the case here!

Definitely, IPFS Desktop's code is too... not complex... but "well together"? 😆 There are a couple of things I'd like to adjust actually, but that's another matter.

@hacdias hacdias merged commit c12e18b into master Oct 29, 2019
@hacdias hacdias deleted the feat/clipboard-link-add branch October 29, 2019 14:46
@hacdias hacdias mentioned this pull request Nov 5, 2019
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drag-n-drop doesn't auto c&p the ipfs cid to my clipboard
2 participants