Skip to content

Commit

Permalink
fix: Handle URLs with "&" correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Aug 12, 2022
1 parent f81136c commit 85935bb
Showing 8 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -2,13 +2,17 @@ import { Controller } from '@hotwired/stimulus';

export default class extends Controller {
static get targets () {
return ['input', 'message', 'suggestion'];
return ['input', 'message'];
}

static values = {
url: String,
}

change (event) {
event.preventDefault();

this.inputTarget.value = this.suggestionTarget.innerHTML;
this.inputTarget.value = this.urlValue;
this.messageTarget.hidden = true;
this.inputTarget.focus();
}
8 changes: 4 additions & 4 deletions src/views/collections/shares/index.phtml
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@

<?= $this->include('collections/shares/_index.phtml', [
'collection' => $collection,
'type' => $type,
'user_id' => $user_id,
'from' => $from,
'type' => $this->safe('type'),
'user_id' => $this->safe('user_id'),
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
8 changes: 4 additions & 4 deletions src/views/collections/shares/index.turbo_stream.phtml
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@
<template>
<?= $this->include('collections/shares/_index.phtml', [
'collection' => $collection,
'type' => $type,
'user_id' => $user_id,
'from' => $from,
'type' => $this->safe('type'),
'user_id' => $this->safe('user_id'),
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
</template>
</turbo-stream>
6 changes: 3 additions & 3 deletions src/views/feeds/new.phtml
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
?>

<?= $this->include('feeds/_new.phtml', [
'url' => $url,
'from' => $from,
'url' => $this->safe('url'),
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
6 changes: 3 additions & 3 deletions src/views/feeds/new.turbo_stream.phtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<turbo-stream action="replace" target="modal-feeds-new">
<template>
<?= $this->include('feeds/_new.phtml', [
'url' => $url,
'from' => $from,
'url' => $this->safe('url'),
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
</template>
</turbo-stream>
5 changes: 2 additions & 3 deletions src/views/links/repairing/_new.phtml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
<div
class="form-group <?= isset($errors['url']) ? 'form-group--invalid' : '' ?>"
data-controller="link-suggestion"
data-link-suggestion-url-value="<?= $this->safe('url_cleared') ?>"
>
<label for="url">
<?= _('What’s the address of the link?') ?>
@@ -47,9 +48,7 @@
<p class="form-group__error" data-link-suggestion-target="message">
<?= _f('%s has detected trackers in this <abbr>URL</abbr>. Suggestion:', $brand) ?>

<span data-link-suggestion-target="suggestion">
<?= $url_cleared ?>
</span>
<?= $url_cleared ?>

<button
class="button--small"
8 changes: 4 additions & 4 deletions src/views/links/repairing/new.phtml
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@

<?= $this->include('links/repairing/_new.phtml', [
'link' => $link,
'url' => $url,
'url_cleared' => $url_cleared,
'url' => $this->safe('url'),
'url_cleared' => $this->safe('url_cleared'),
'ask_sync' => $ask_sync,
'from' => $from,
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
8 changes: 4 additions & 4 deletions src/views/links/repairing/new.turbo_stream.phtml
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@
<template>
<?= $this->include('links/repairing/_new.phtml', [
'link' => $link,
'url' => $url,
'url_cleared' => $url_cleared,
'url' => $this->safe('url'),
'url_cleared' => $this->safe('url_cleared'),
'ask_sync' => $ask_sync,
'from' => $from,
'from' => $this->safe('from'),
'errors' => $errors,
'error' => $error,
'error' => $this->safe('error'),
]); ?>
</template>
</turbo-stream>

0 comments on commit 85935bb

Please sign in to comment.