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

Address #70, add template variable pocket-url #89

Merged
merged 3 commits into from
Apr 1, 2022

Conversation

ashlyn
Copy link
Contributor

@ashlyn ashlyn commented Apr 1, 2022

Relevant Changes

  • Adds a new template variable, {{pocket-url}} to open the Pocket item inside the Pocket UI. The URL is constructed using the item_id field and relies on the user being authenticated to Pocket in their browser. It also has the potential to break if Pocket updates the schema for item URLs.
  • Adds two links next to titles in the Pocket item list view, one to open the original, one to open in Pocket. The alt-click functionality to open the original URL when click on the title is preserved. See screenshot for an example.
  • I've updated the versions by one minor version (assuming semantic versioning) in the manifest.json and package.json as well as adding the new variable to the README.

With New Links

Screen Shot 2022-04-01 at 11 26 09 AM

Example with Long Titles/Narrow Screen Width

Screen Shot 2022-04-01 at 2 22 23 PM

Addresses #70.

Testing Steps

Basic Running Instructions

  • Clone this branch into the .obsidian/plugins directory in a vault. It may be easiest to use a test vault, especially if you also have the current version of this plugin installed.
  • Run the npm i command to install Node packages, then npm run dev to start a dev server with a build watch.
  • Enable this plugin in the Obsidian settings and make sure it is the only version installed in the vault: the version should read as 0.7.1
  • Configure the authentication either by using the Connect Your Pocket Account in the plugin settings or by copying an existing, valid .__pocket_access_info__ file into the root directory.
  • You may find this Obsidian Hot Reload plugin helpful for testing

Branch Specific Instructions

  1. If this vault doesn't have a Pocket list already, ensure your Pocket account has items to sync and use the Sync command to create a list. Open the Pocket list.
  2. See the two new links next to the title on each item.
    • Basic functionality works--clicking each link opens the expected URL in the browser.
    • Test with different screen widths to ensure the title and links break in acceptable positions.
    • Test with long titles to ensure the title and links break in acceptable positions. If needed, use the Chrome Dev Tools inside of Obsidian to mock this data (CTRL-SHIFT-I or option-cmd-i for Mac).
    • Regression case Ensure the existing alt-click functionality to open the original link when clicking on the item title works.
  3. Add the new {{pocket-url}} variable to the plugin's configured template. Click through the title from one of the Pocket items to see the newly-generated note.
    • Ensure the Pocket URL is included in the note and formatted as expected

@ashlyn ashlyn changed the title Address #70, add template variable pocket-url Partially address #70, add template variable pocket-url Apr 1, 2022
@ashlyn ashlyn marked this pull request as draft April 1, 2022 15:41
@ashlyn ashlyn marked this pull request as ready for review April 1, 2022 16:31
@nybbles
Copy link
Owner

nybbles commented Apr 1, 2022

woohoo! First contribution from the community! ❤️ Thanks for putting this together. I'm reviewing now.

BTW you have to also update version numbers in versions.json.

@nybbles
Copy link
Owner

nybbles commented Apr 1, 2022

Also, since (sadly) we do not have automated tests, can you describe how you went about testing this change?

Comment on lines 190 to 194
<PocketItemExternalLink
title="Open in Pocket"
url={getPocketItemPocketURL(item)}
/>
<PocketItemExternalLink title="Open Original" url={item.resolved_url} />
Copy link
Owner

Choose a reason for hiding this comment

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

I think it might be clearer to the user to do the following:

  1. Switch the order of these two links, so that the "Open Original comes first".
  2. Rename "Open original" to simply "Open".

So it ends up looking like "Open" and "Open in Pocket", where "Open" is understood to be the existing behavior of opening the saved URL, and "Open in Pocket" is simply a modifier on top of that behavior that opens in Pocket.

LMK what you think.. It seems to me that this would be the easiest to understand for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can make those changes.

.item > span {
display: block;
}

.header {
flex-grow: 1
Copy link
Owner

Choose a reason for hiding this comment

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

oops. I think a semicolon is missing here.

Copy link
Owner

Choose a reason for hiding this comment

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

yup that's the one.. I can build now that I added the semi-colon.

@nybbles
Copy link
Owner

nybbles commented Apr 1, 2022

I think it would be a good idea to ensure that when dealing with long titles (or narrow screen sizes), the two open links break onto the next line together, rather than how it is now (the break happens inside of the first link). LMK what you think about that.

Screen Shot 2022-04-01 at 10 50 23 AM

@ashlyn ashlyn changed the title Partially address #70, add template variable pocket-url Address #70, add template variable pocket-url Apr 1, 2022
@ashlyn
Copy link
Contributor Author

ashlyn commented Apr 1, 2022

woohoo! First contribution from the community! ❤️ Thanks for putting this together. I'm reviewing now.

BTW you have to also update version numbers in versions.json.

As far as the versions.json file goes--is that just limiting the oldest version of Obsidian this version of the plugin will be compatible with? Is there any reason to change the Obsidian version listed or would listing the following be okay?

  "0.7.1": "0.12.11"

@nybbles
Copy link
Owner

nybbles commented Apr 1, 2022

woohoo! First contribution from the community! ❤️ Thanks for putting this together. I'm reviewing now.
BTW you have to also update version numbers in versions.json.

As far as the versions.json file goes--is that just limiting the oldest version of Obsidian this version of the plugin will be compatible with? Is there any reason to change the Obsidian version listed or would listing the following be okay?

  "0.7.1": "0.12.11"

Yup what you posted is sufficient, you don't have to update the Obsidian version numbers. Here's a PR that shows how to bump the version numbers: https://github.com/nybbles/obsidian-pocket/pull/85/files.

@nybbles
Copy link
Owner

nybbles commented Apr 1, 2022

Thank you again for this patch!

@nybbles nybbles closed this Apr 1, 2022
@nybbles nybbles reopened this Apr 1, 2022
@nybbles nybbles merged commit 423ad7b into nybbles:master Apr 1, 2022
@ashlyn ashlyn deleted the add-pocket-url-variable branch April 5, 2022 16:48
@ashlyn ashlyn mentioned this pull request Apr 5, 2022
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.

2 participants