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 author work #3257

Merged
merged 11 commits into from
Mar 15, 2024
Merged

Add author work #3257

merged 11 commits into from
Mar 15, 2024

Conversation

mlbrgl
Copy link
Member

@mlbrgl mlbrgl commented Feb 28, 2024

Screenshot 2024-03-08 at 11 30 45

staging preview, gdoc

  •  responsive styles
  • update hover / visited styles

👉 See this comment for some of the more structural decisions I made.

Only consider the "🌑 Dark launch" scope from the tracking issue

@mlbrgl mlbrgl mentioned this pull request Feb 28, 2024
1 task
@mlbrgl mlbrgl mentioned this pull request Feb 28, 2024
24 tasks
Comment on lines 32 to 55
_loadSubclassAttachments = async (): Promise<void> => {
if (!this.content.title) return
const knex = db.knexInstance()

this.latestWorkLinks = await getLatestWorkByAuthor(
knex,
this.content.title
)
if (!this.latestWorkLinks) return

// We want to load additional image filenames from the referenced
// latest work links. We're not relying here on the Link
// infrastructure as we don't yet have a good way of cleaning up
// obsolete links from the latest work section. Usually the links
// originating from a gdoc are cleaned up when updating/deleting it, but
// here the links from the latest section will change independently of a
// manual authoring and admin action, so they'll end up being stale
// until the author page is updated again.
const latestWorkImageFilenames = this.latestWorkLinks
.map((d) => d["featured-image"])
.filter(Boolean)

// Load the image metadata for the latest work images
return super.loadImageMetadata(latestWorkImageFilenames)
Copy link
Member Author

Choose a reason for hiding this comment

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

@ikesau I'd be curious to hear whether this adjustment to parsing images in a block, whose content is dynamically generated, fits your mental model of image handling.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this comment - can you give me a bit of context for this one? Is this a concern because of lightning baking? Why can we not just iterate over the latest work and collect the featured-images?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why can we not just iterate over the latest work and collect the featured-images?

@danyx23 I'm assuming you're referring to

get linkedImageFilenames(): string[] {
// The typing logic is a little strange here
// `featured-image` isn't guaranteed to be on all types of Gdoc (it's a GdocPost thing)
// but we try (and then filter nulls) because we need featured images if we're using prominent links
// even if this method is being called on a GdocFaq (for example)
const featuredImages = Object.values(this.linkedDocuments)
.map((d) => d["featured-image"])
.filter((filename?: string): filename is string => !!filename)
return [...this.filenames, ...featuredImages]
}

In this snippet this.linkedDocuments originate from this.links, which is populated in parallel to Link.createFromUrl calls, which create rows in the posts_gdocs_links table.

These links only get refreshed when updating/deleting a gdoc in the admin:

await Link.delete({
source: {
id: id,
},
})

The problem is that there won't be an admin action for every update to the latest work block, which is updated dynamically whenever a new article by a given author is published/unpublished. So the posts_gdocs_links table will gradually fall out of sync.

By contrast, the featured work block is manually updated from content in the gdoc itself, so modifying the block necessarily updates the posts_gdocs_links table.

@mlbrgl mlbrgl force-pushed the author-featured-work branch from 6c308b6 to c85a36d Compare March 2, 2024 18:45
@mlbrgl mlbrgl force-pushed the author-featured-work branch from c85a36d to 5ccd633 Compare March 3, 2024 09:05
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 5ccd633 to 0823eff Compare March 4, 2024 15:27
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 0823eff to 70ed774 Compare March 4, 2024 17:58
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 70ed774 to 510ce90 Compare March 6, 2024 15:31
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 510ce90 to ae3fbc5 Compare March 6, 2024 17:22
@mlbrgl mlbrgl force-pushed the author-featured-work branch from ae3fbc5 to 58e5748 Compare March 6, 2024 17:33
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 58e5748 to 8941b4e Compare March 8, 2024 10:13
@mlbrgl mlbrgl marked this pull request as ready for review March 8, 2024 10:34
@mlbrgl mlbrgl requested a review from danyx23 March 8, 2024 10:34
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 00184cc to 1512949 Compare March 8, 2024 11:32
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 1512949 to 97e902a Compare March 8, 2024 14:08
@mlbrgl mlbrgl force-pushed the author-featured-work branch 2 times, most recently from a09413d to 904b82c Compare March 13, 2024 14:08
@mlbrgl mlbrgl force-pushed the author-featured-work branch from 904b82c to ac52db5 Compare March 13, 2024 17:26
@mlbrgl
Copy link
Member Author

mlbrgl commented Mar 15, 2024

Merge activity

  • Mar 15, 4:42 AM EDT: @mlbrgl started a stack merge that includes this pull request via Graphite.
  • Mar 15, 4:43 AM EDT: Graphite rebased this pull request as part of a merge.
  • Mar 15, 4:44 AM EDT: @mlbrgl merged this pull request with Graphite.

Base automatically changed from author-header to master March 15, 2024 08:42
@mlbrgl mlbrgl force-pushed the author-featured-work branch from ac52db5 to 2e9fee4 Compare March 15, 2024 08:43
@mlbrgl mlbrgl merged commit 48a5359 into master Mar 15, 2024
16 of 19 checks passed
@mlbrgl mlbrgl deleted the author-featured-work branch March 15, 2024 08:44
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