Revert "Confirmation for bump_thread"

This reverts commit f4c9d25139.
This commit is contained in:
swagg boi 2023-06-17 18:22:22 -04:00
parent b7494337e8
commit 9ae401f86d
4 changed files with 6 additions and 39 deletions

View file

@ -140,24 +140,13 @@ sub feed($self) {
sub bump($self) {
my $thread_id = $self->param('thread_id');
my $v = $self->validation;
$v->optional(captcha => 'trim')->size(4, 4)->like(qr/bump/i);
$self->thread->bump($thread_id);
$self->flash(info => "Thread #$thread_id has been bumped. 🔝");
if ($v->is_valid) {
my $redirect_url =
$self->url_for('threads_list')->fragment('info')->to_abs;
$self->thread->bump($thread_id);
$self->flash(info => "Thread #$thread_id has been bumped. 🔝");
return $self->redirect_to($redirect_url);
}
elsif ($v->has_error) {
$self->stash(status => 400)
}
$self->render;
$self->redirect_to(
$self->url_for('threads_list')->fragment('info')->to_abs
);
}
sub flag($self) {

View file

@ -87,10 +87,6 @@ subtest 'Bumping thread', sub {
$t->get_ok('/thread/bump/1')->status_is(200)
->element_exists('p[class="stash-with-info"]')
->text_like(p => qr/Thread #1 has been bumped/);
$t->get_ok('/thread/bump/1' )->status_is(200);
$t->get_ok('/thread/bump/65536')->status_is(404);
$t->get_ok('/thread/bump/1', form => {captcha => 'bump'})->status_is(400);
};
subtest 'Flagging thread', sub {
@ -104,7 +100,6 @@ subtest 'Flagging thread', sub {
$t->get_ok('/thread/flag/1' )->status_is(200);
$t->get_ok('/thread/flag/65536')->status_is(404);
$t->get_ok('/thread/flag/1', form => {captcha => 'flag'})->status_is(400);
};
done_testing;

View file

@ -1,17 +0,0 @@
% layout 'default';
% title $thread_id ? "Bump Thread #$thread_id" : '?';
<h2 class="page-title"><%= title %></h2>
<% if ($thread_id) { =%>
<form class="form-body">
<div class="form-field">
<% if (my $error = validation->error('captcha')) { =%>
<p class="field-with-error">Must be between <%= $error->[2] %>
and <%= $error->[3] %> characters.</p>
<% } =%>
<%= label_for captcha => "Enter the word 'bump' to confirm:" %>
<%= text_field captcha => id => 'captcha' %>
</div>
<button type="submit" class="form-button">Confirm</button>
</fieldset>
</form>
<% } =%>

View file

@ -11,7 +11,7 @@
<%= label_for captcha => "Enter the word 'flag' to confirm:" %>
<%= text_field captcha => id => 'captcha' %>
</div>
<button type="submit" class="form-button">Confirm</button>
<button type="submit" class="form-button">Flag</button>
</fieldset>
</form>
<% } =%>