Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

feat(client, db): event url - #423

Merged
allella merged 6 commits into
freeCodeCamp:masterfrom
gh-23378:feat/event-url
Nov 1, 2020
Merged

allella merged 6 commits into
freeCodeCamp:masterfrom
gh-23378:feat/event-url

Conversation

@gh-23378

Copy link
Copy Markdown
Contributor
  • I have read Chapter's contributing guidelines.
  • My pull request has a descriptive title (not a vague title like Update README.md).
  • My pull request targets the master branch of Chapter.

Closes #381

Added URL field to event model, created migration for new column to be added to event table, updated seeders to generate fake URLs, updated UI to allow read and update on URL.

While working on this I noticed that the form to edit events is creating new events.

@gh-23378 gh-23378 changed the title Feat/event url feat(client, db): event url Oct 25, 2020

@timmyichen timmyichen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do any tests need updating? Do we even have tests for this? 🤔

Comment thread server/controllers/Events/resolver.ts Resolved
@gh-23378

Copy link
Copy Markdown
Contributor Author

The only tests I saw were for the mailer

@allella

allella commented Oct 26, 2020

Copy link
Copy Markdown
Contributor

I'm no good on the technical end, but this does appear to add an event.url as we discussed in #378 and which became #381 so I'm good with it.

@KatieN it sounded like @timmyichen and @Ryuno-Ki were suggesting adding logic to validate the value passed in is actually a valid URL. Could that be added to this PR?

@gh-23378

Copy link
Copy Markdown
Contributor Author

Validation is in there :)

Comment thread server/controllers/Events/resolver.ts Resolved
Comment thread server/controllers/Events/resolver.ts Resolved
@gh-23378 gh-23378 mentioned this pull request Oct 26, 2020
3 tasks done
@allella
allella self-requested a review October 29, 2020 21:13

@allella allella left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm good with this from the business logic. If @timmyichen and @Ryuno-Ki are good then holler and one of us can merge it.

@allella

allella commented Oct 30, 2020

Copy link
Copy Markdown
Contributor

@Ryuno-Ki if you give the formal approval, then we'll merge this in.

@Ryuno-Ki

Copy link
Copy Markdown
Contributor

Sorry, I was busy the last days. Lemme take a look!

@Ryuno-Ki Ryuno-Ki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm worried about the lack of validation on URL input.
For example, this could lead to a persistent XSS via javascript: protocol.
But this could be also adressed in a followup-PR.

So I'm approving with comments.

{ __typename?: 'Event' } & Pick<
Event,
'id' | 'name' | 'canceled' | 'description' | 'capacity'
'id' | 'name' | 'canceled' | 'description' | 'url' | 'capacity'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have these ordered alphabetically?
(The OCD in me. Would not block a merge IMHO).

| 'id'
| 'name'
| 'description'
| 'url'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to sort these alphabetically?
(Not blocking a merge IMHO).

<Typography variant="body2" color="textSecondary" component="p">
{event.description}
</Typography>
{event.url && <a href={event.url}>{event.url}</a>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps worth to wrap in a p, too?

<Typography variant="body2" color="textSecondary" component="p">
{data.event.description}
</Typography>
<a href={data.event.url}>{data.event.url}</a>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps worth to wrap in a <p>, too?

@gh-23378

Copy link
Copy Markdown
Contributor Author

@Ryuno-Ki agreed on sanitization being important, @timmyichen and I were going back and forth on how to handle this here since the suggested new URL() wasn't doing what we wanted (new URL("javascript:alert('foo')") would pass, for example). FYI URL validation has also been removed from my other PR with the assumption it would be handled in a later issue

@Ryuno-Ki

Copy link
Copy Markdown
Contributor

Could we at least have an issue for that?
It would be handy if it would link to those discussions here and your other PR.

@allella

allella commented Nov 1, 2020

Copy link
Copy Markdown
Contributor

We can continue the conversation on URL validation on #430. If there are no final points, then we'll merge #423 and #424.

@allella

allella commented Nov 1, 2020

Copy link
Copy Markdown
Contributor

@Ryuno-Ki agreed to proceed on Discord

Looked at #423. Fine with me, but make sure to fill some issues / followup-PRs, @allella
Yes, sanitizing is important. Input validation as well. Those are the two cornerstones of web security.

@allella
allella merged commit ff65c21 into freeCodeCamp:master Nov 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add event URL for each event

4 participants