geeksforsocialchange / PlaceCal

Bring your community together
https://placecal.org
GNU Affero General Public License v3.0
16 stars 6 forks source link

[Bug]: api output should be markdown without classes #1540

Closed aaaaargZombies closed 1 year ago

aaaaargZombies commented 1 year ago

Description

An effected event

Steps to reproduce

visit the above link

What you expected to happen

No markup is visible by users

aaaaargZombies commented 1 year ago

classes are not being stripped from html elements before being passed to kramdown to be turned into markdown.

https://github.com/geeksforsocialchange/PlaceCal/blob/5ef17ab825a0bcab48acae7f4b60e129bdeba33a/app/jobs/calendar_importer/events/base.rb#L62

erbridge commented 1 year ago

It's correct that this is being served as Markdown (in my opinion). It just needs to be markdown without spurious attributes.

aaaaargZombies commented 1 year ago

I realised that this was all effecting the squarespace events from VFD that I wrote the importer for. after some poking around it looks like Ivans work to santise HTML #1534 happened after I wrote this and the events were imported.

on my local machine I checked the description from the console.

2.7.6 :008 > Event.find(312866).description
  Event Load (1.9ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT $2  [["id", 312866], ["LIMIT", 1]]
 => "**CIRCLE OF IDIOTS**\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n[**get tickets here**][1]\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n**Have you ever thought you\\'re a total idiot? Good news! You probably\nare.**\n{: class=\"\"}\n\nThere’s a whole world of beautiful performance to be made if we can get\nin touch with our magnificent inner idiot, take a risk, follow our\nimpulse and find the pleasure in playing from exactly who we are.\n{: class=\"\"}\n\nIn this workshop, we’ll play games, explore presence technique, laugh at\neach other, laugh at ourselves, perhaps cry a bit (hope not too much\ncrying) and get some great insight into who we are as performers and\npeople and the incredible potential to be found in working with what\nwe’ve got.\n{: class=\"\"}\n\nAnd we’ll work in the round! The circle is a powerful symbol of\ninfinity, inclusivity and completeness, a space where nothing is wrong\nand everything has meaning. As much as we want it to.\n{: class=\"\"}\n\nYou are cordially invited to join me in stepping into the ridiculous,\ninfinite unknown.\n{: class=\"\"}\n\nSuitable for: professional performers/directors, creatives of all kinds,\nanyone who interacts with humans.\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n**WHAT THEY SAY:**\n{: class=\"\"}\n\n« ...watching the other participants individual work was also\nilluminating, indeed quite amazing... » - Michael\n{: class=\"\"}\n\n« Lucy is an incredibly nurturing and wonderful teacher who will push\nyou to surprise yourself while diving in... » - Tatiana\n{: class=\"\"}\n\n« Lucy gives you no place to hide. You expose all your weaknesses and\nstrengths, while feeling completely safe » - Nikoletta\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n**LUCY HOPKINS:**\n{: class=\"\"}\n\nLucy Hopkins is a professional show-off and an award-winning clown,\ndirector and workshop leader, trained in corporal mime and a graduate of\nthe schools of Jacques Lecoq and Philippe Gaulier.\n{: class=\"\"}\n\nShe creates internationally touring performance which is both\nunconventional and wildly entertaining, and makes a magical living\ngrowing people’s pleasure (inc. her own) and helping them (and herself)\nto share it. She is also one of the creative directors of the BlundaBus,\na piano bar and performance space in a converted double-decker bus and\nVogrie Pogrie, a free community arts festival which happens each\nSeptember in Vogrie Country Park.\n{: class=\"\"}\n\nPrevious collaborators include The Actors Centre, Spymonkey, Dancing\nBrick, Caroline Horton, Spencer Jones, HiJinx, Splendid Productions,\nThéâtre Interface, The Women’s International Networking Conference, Söta\nSälta, Helvetes Underground and many more.\n{: class=\"\"}\n\nThe foundation of all of her work is her full-hearted belief that people\nare tremendous.\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n**HOW DO I JOIN?**\n{: class=\"\"}\n\nPay your £50 deposit (non-refundable) to secure your place. Remainder\npayable by bank transfer before the workshop.\n{: class=\"\"}\n\nThis workshop operates on a Pay What You Can model, £120-£180 depending\non your resources. \n{: class=\"\"}\n\nVF Dalston is a space that prioritises QTIPOC (queer, trans, intersex\nand people of colour) a principle with which this workshop happily\naligns.\n{: class=\"\"}\n\nhttps://www.facebook.com/events/5496149170462411\n{: class=\"\"}\n\n\n\n[1]: https://www.tickettailor.com/events/lucyhopkins/778067" 

re-ran the import from the admin UI and the issue seems to be resolved.

2.7.6 :005 > Event.find(312866).description
  Event Load (1.9ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT $2  [["id", 312866], ["LIMIT", 1]]
 => "**CIRCLE OF IDIOTS**\n\n\n\n[**get tickets here**][1]\n\n\n\n**Have you ever thought you\\'re a total idiot? Good news! You probably\nare.**\n\nThere’s a whole world of beautiful performance to be made if we can get\nin touch with our magnificent inner idiot, take a risk, follow our\nimpulse and find the pleasure in playing from exactly who we are.\n\nIn this workshop, we’ll play games, explore presence technique, laugh at\neach other, laugh at ourselves, perhaps cry a bit (hope not too much\ncrying) and get some great insight into who we are as performers and\npeople and the incredible potential to be found in working with what\nwe’ve got.\n\nAnd we’ll work in the round! The circle is a powerful symbol of\ninfinity, inclusivity and completeness, a space where nothing is wrong\nand everything has meaning. As much as we want it to.\n\nYou are cordially invited to join me in stepping into the ridiculous,\ninfinite unknown.\n\nSuitable for: professional performers/directors, creatives of all kinds,\nanyone who interacts with humans.\n\n\n\n**WHAT THEY SAY:**\n\n« ...watching the other participants individual work was also\nilluminating, indeed quite amazing... » - Michael\n\n« Lucy is an incredibly nurturing and wonderful teacher who will push\nyou to surprise yourself while diving in... » - Tatiana\n\n« Lucy gives you no place to hide. You expose all your weaknesses and\nstrengths, while feeling completely safe » - Nikoletta\n\n\n\n**LUCY HOPKINS:**\n\nLucy Hopkins is a professional show-off and an award-winning clown,\ndirector and workshop leader, trained in corporal mime and a graduate of\nthe schools of Jacques Lecoq and Philippe Gaulier.\n\nShe creates internationally touring performance which is both\nunconventional and wildly entertaining, and makes a magical living\ngrowing people’s pleasure (inc. her own) and helping them (and herself)\nto share it. She is also one of the creative directors of the BlundaBus,\na piano bar and performance space in a converted double-decker bus and\nVogrie Pogrie, a free community arts festival which happens each\nSeptember in Vogrie Country Park.\n\nPrevious collaborators include The Actors Centre, Spymonkey, Dancing\nBrick, Caroline Horton, Spencer Jones, HiJinx, Splendid Productions,\nThéâtre Interface, The Women’s International Networking Conference, Söta\nSälta, Helvetes Underground and many more.\n\nThe foundation of all of her work is her full-hearted belief that people\nare tremendous.\n\n\n\n**HOW DO I JOIN?**\n\nPay your £50 deposit (non-refundable) to secure your place. Remainder\npayable by bank transfer before the workshop.\n\nThis workshop operates on a Pay What You Can model, £120-£180 depending\non your resources. \n\nVF Dalston is a space that prioritises QTIPOC (queer, trans, intersex\nand people of colour) a principle with which this workshop happily\naligns.\n\nhttps://www.facebook.com/events/5496149170462411\n\n\n\n[1]: https://www.tickettailor.com/events/lucyhopkins/778067"

So I guess we need to queue stuff up to be imported again on production.

aaaaargZombies commented 1 year ago

I logged into admin.placecal.org and it said VFDalston was last imported 5 mins ago so perhaps it's cleared already. Is graphql caching stuff though. Ivans fix was 3 days ago and the last transDim build was a day ago but it's still showing markup in the description.

https://transdimension.uk/events/320755/

aaaaargZombies commented 1 year ago

yep, the site was rebuilt today and it still has the bad inputs.

aaaaargZombies commented 1 year ago

In production the content is still this so it's not a caching build issue for transDim

irb(main):001:0> Event.find(320755).description
D, [2022-11-11T11:57:35.952285 #9] DEBUG -- :   Event Load (1.6ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT $2  [["id", 320755], ["LIMIT", 1]]
=> "### [**TICKETS HERE**][1]\n\n\n{: class=\"\"}\n\n**Queer Svit x VFD**\n{: class=\"\"}\n\n\n{: class=\"\"}\n\nTo commemorate the launch of November\\'s exhibit at the Outsiders\nGallery, Queer Svit are curating a night at VFD!\n{: class=\"\"}\n\n \n{: class=\"\"}\n\n**A theatrical performance which consists of series of monologues of\nqueer people affected by war in Ukraine narrated by actors, followed by\na DJ-set. Also there is going to be a small exhibition of Queer Svit’s\nbeneficiaries who are taking part in the monologues.**\n{: class=\"\"}\n\n \n{: class=\"\"}\n\n[http://www.queersvit.org/en.html][2]\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n**The Lineup**\n{: class=\"\"}\n\n\n{: class=\"\"}\n\n[https://queersvit.taplink.ws/][3]\n{: class=\"\"}\n\n \n{: class=\"\"}\n\n[https://www.instagram.com/boldmelloncollective][4]\n{: class=\"\"}\n\n \n{: class=\"\"}\n\nPhotographer:  miliyollie he/she\n{: class=\"\"}\n\n \n{: class=\"\"}\n\n[https://miliyollieportfolio.tilda.ws/][5]\n{: class=\"\"}\n\n \n{: class=\"\"}\n\n[https://www.instagram.com/miliyollie/][6]\n{: class=\"\"}\n\n\n\n[1]: https://www.outsavvy.com/event/10923/the-queer-faces-of-war-stories-from-ukraine\n[2]: http://www.queersvit.org/en.html\n[3]: https://queersvit.taplink.ws/\n[4]: https://www.instagram.com/boldmelloncollective\n[5]: https://miliyollieportfolio.tilda.ws/\n[6]: https://www.instagram.com/miliyollie/"
aaaaargZombies commented 1 year ago

ah of course it wouldn't make a difference because Ivans PR hasn't made it to production.

aaaaargZombies commented 1 year ago

did a release, re-imported the calendar

irb(main):001:0> Event.find(320755).description
D, [2022-11-11T14:50:07.820629 #11] DEBUG -- :   Event Load (1.8ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT $2  [["id", 320755], ["LIMIT", 1]]
=> "### [**TICKETS HERE**][1]\n\n\n\n**Queer Svit x VFD**\n\n\n\nTo commemorate the launch of November\\'s exhibit at the Outsiders\nGallery, Queer Svit are curating a night at VFD!\n\n \n\n**A theatrical performance which consists of series of monologues of\nqueer people affected by war in Ukraine narrated by actors, followed by\na DJ-set. Also there is going to be a small exhibition of Queer Svit’s\nbeneficiaries who are taking part in the monologues.**\n\n \n\n[http://www.queersvit.org/en.html][2]\n\n\n\n**The Lineup**\n\n\n\n[https://queersvit.taplink.ws/][3]\n\n \n\n[https://www.instagram.com/boldmelloncollective][4]\n\n \n\nPhotographer:  miliyollie he/she\n\n \n\n[https://miliyollieportfolio.tilda.ws/][5]\n\n \n\n[https://www.instagram.com/miliyollie/][6]\n\n\n\n[1]: https://www.outsavvy.com/event/10923/the-queer-faces-of-war-stories-from-ukraine\n[2]: http://www.queersvit.org/en.html\n[3]: https://queersvit.taplink.ws/\n[4]: https://www.instagram.com/boldmelloncollective\n[5]: https://miliyollieportfolio.tilda.ws/\n[6]: https://www.instagram.com/miliyollie/"

Looks fixed to me