cbh123 / shlinked

An open-source satirical social network. shlinkedin.com
https://www.shlinkedin.com
GNU Affero General Public License v3.0
370 stars 42 forks source link

fix: converts all `\n` to `<br>` in user bio before rendering #134

Closed tshamz closed 2 years ago

tshamz commented 2 years ago

🖕🏻🖕🏻 the problem

User bios on the profile page don't render any included newlines. If a bio does have newlines, they show up pretty much everywhere else, just not on the front-end. Here are some screenshot:

👍🏻 in edit (good)

in-edit

You enter some content and make it look nice and organized

👍🏻 in database (good)

in-database

You click save, data gets written to the database, newlines are still there

👎🏻 on profile (bad)

bad

You get redirected back to your profile page and are met with hot garbage

👍🏻 in pull request (good)

good

Because the bio is stored with it's new lines as "\n", when it's rendered each "\n" need to be converted to a <br>

🔁 the changes

This was my first experience with elixir and erlang...and it will probably be my last. I'm too stupid to figure out how it's supposed to make my life easier. As such, I just copypasta'd the first thing that worked for me and didn't write any tests. If you want to solve this a different way, be my guest, it won't hurt my feelings.

Love this site and keep hustling everyone, we'll get there one day.

cbh123 commented 2 years ago

Awesome, thanks!!!