From d15d07554b2c840e46fea212e2e04b537354ef8d Mon Sep 17 00:00:00 2001 From: fritz-c Date: Sat, 14 Oct 2017 19:01:54 +0900 Subject: [PATCH 1/2] fix: Make resources with blocked link previews get handled properly e.g., when the following url is added as a resource: https://github.com/align-capstone/align/blob/560b0db61d4650599cf80a5fc7dfc1b7401f0e87/public/logo-large.png the link information is blocked from retrieval by robots.txt, and none of the url info was being retained (not even the url). --- app/components/ResourceCard.jsx | 1 + app/components/ResourceForm.jsx | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/components/ResourceCard.jsx b/app/components/ResourceCard.jsx index ca4e573..8dd5788 100644 --- a/app/components/ResourceCard.jsx +++ b/app/components/ResourceCard.jsx @@ -127,6 +127,7 @@ export default class extends Component { title={this.state.title} actAsExpander={true} showExpandableButton={true} + className="resource-card-header" /> { - let key = resourcesRef.push().key + const key = resourcesRef.push().key if (this.props.milestoneRef) { // Add resource URL to parent goal's uploads: this.props.goalRef.child('resources').child(key).set({ - resourceURL: response.url, + resourceURL: target, milestoneId: this.props.milestoneId }) // Add resource URL to milestone: this.props.milestoneRef.child(key).set({ - resourceURL: response.url + resourceURL: target }) } else { // Otherwise, just add resource directly to goal this.props.goalRef.child(key).set({ - resourceURL: response.url + resourceURL: target + }) + } + + if (!response.error) { + resourcesRef.child(key).set(response) + } else { + resourcesRef.child(key).set({ + ...response, + url: response.url || target, + title: response.title || target, + description: '', }) } - resourcesRef.child(key).set(response) } }) this.setState({url: ''}) From 8febf4e34e0474882668c3aab6dcf88e6b4d67c4 Mon Sep 17 00:00:00 2001 From: fritz-c Date: Sat, 14 Oct 2017 19:04:22 +0900 Subject: [PATCH 2/2] fix: Prevent resource titles with long words from spilling out of the card --- public/style.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/style.css b/public/style.css index 7769dd2..37e0c86 100644 --- a/public/style.css +++ b/public/style.css @@ -41,6 +41,13 @@ h1, h2, h3, h4 { left: 50% !important; } +/* Make resource titles with long words break the +words rather than spill out */ +.resource-card-header > * { + max-width: 100%; + overflow-wrap: break-word; +} + .flexy-columns { display: flex; flex-wrap: wrap;