From e0902e34fafc690fbb5e445575f0fd1ddfca6eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viterbo=20Rodr=C3=ADguez?= Date: Thu, 9 May 2024 11:05:02 -0300 Subject: [PATCH 1/2] try to extract list of links from description --- src/pages/trails/ballots/view/BallotView.vue | 29 ++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/pages/trails/ballots/view/BallotView.vue b/src/pages/trails/ballots/view/BallotView.vue index 080fc70..6ae5923 100644 --- a/src/pages/trails/ballots/view/BallotView.vue +++ b/src/pages/trails/ballots/view/BallotView.vue @@ -52,11 +52,15 @@ export default { return; } await this.fetchVotesForBallot({ - name: this.ballot.ballot_name, - limit: this.ballot.total_voters, + name: this.ballot.ballot_name, + limit: this.ballot.total_voters, }); window.addEventListener('scroll', this.updateScroll); this.loading = false; + console.log('Ballot:', this.ballot); // FIXME: remove + console.log('iframeUrl:', this.iframeUrl); // FIXME: remove + console.log('optionData:', this.optionData); // FIXME: remove + console.log('shapedDescription:', this.shapedDescription); // FIXME: remove } catch (e) { console.error(e); } @@ -103,11 +107,32 @@ export default { } }, shapedDescription() { + // first, try to parse the description as an url const urlRegex = /((http|https):\/\/[^\s]+)/g; const shaped = this.ballot.readableDescription.replace( urlRegex, '$1' ); + if (shaped === this.ballot.readableDescription) { + // if no urls were found, try something else + // "