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

Add first-class link support to Related Resources #271

Merged
merged 16 commits into from
Aug 9, 2023

Conversation

jeffdaley
Copy link
Contributor

@jeffdaley jeffdaley commented Jul 25, 2023

Add support for first-class Hermes links in the Related Resources input.

  • Full URLs trigger a getObject query based on the :document_id
  • Short links trigger a docType- and docNumber-filtered search
  • Links that appear first-class but return no results are treated as external links (e.g., [validShortLink]/[validDocType]/[invalidDocNumber])
  • Duplicates are detected

@jeffdaley jeffdaley changed the title Jeffdaley/recognize first class links Add first-class link support to Related Resources Jul 25, 2023
@jeffdaley jeffdaley added the enhancement New feature or request label Jul 25, 2023
@jeffdaley jeffdaley marked this pull request as ready for review July 25, 2023 17:45
@jeffdaley jeffdaley requested a review from a team as a code owner July 25, 2023 17:45
Comment on lines 467 to 468
if (docID.includes("?draft=false")) {
docID = docID.replace("?draft=false", "");
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be more resilient to check with endsWith() and then trim with slice() or something? It's an edge case, but the current code would execute on ?draft=false in the middle of the string.

void this.args.search(this.dd, this.query);
break;
case RelatedResourceQueryType.AlgoliaGetObject:
let docID = this.query.split("/document/").pop();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this assume that any URL with /document/ in it is a Google Docs URL? We might want to check for the full https://docs.google.com/document/d/ prefix instead?

@jeffdaley jeffdaley force-pushed the jeffdaley/recognize-first-class-links branch from f4e71e1 to fb4439b Compare August 9, 2023 14:32
@jeffdaley jeffdaley force-pushed the jeffdaley/recognize-first-class-links branch from fb4439b to 69214d0 Compare August 9, 2023 14:37
@jeffdaley jeffdaley merged commit 4ce80e8 into main Aug 9, 2023
2 checks passed
@jeffdaley jeffdaley deleted the jeffdaley/recognize-first-class-links branch August 9, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants