Change up redirects for mod actions
This commit is contained in:
parent
212521e905
commit
7f4f21c454
|
@ -58,8 +58,6 @@ Run the tests locally (against development environment):
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
1. Show `bump_tally` and `remark_count` in single thread view
|
|
||||||
1. Redirect mod/admin back to hidden/flagged where it makes sense
|
|
||||||
1. CSS
|
1. CSS
|
||||||
1. "All new posts flagged" mode (require approval for new posts)
|
1. "All new posts flagged" mode (require approval for new posts)
|
||||||
1. Tests for mod-only user?
|
1. Tests for mod-only user?
|
||||||
|
|
|
@ -88,7 +88,7 @@ sub logout($self) {
|
||||||
|
|
||||||
sub unflag_thread($self) {
|
sub unflag_thread($self) {
|
||||||
my $thread_id = $self->param('thread_id');
|
my $thread_id = $self->param('thread_id');
|
||||||
my $redirect_url = $self->url_for('threads_list')->fragment('info')->to_abs;
|
my $redirect_url = $self->url_for('flagged_list')->fragment('info')->to_abs;
|
||||||
|
|
||||||
$self->moderator->unflag_thread($thread_id);
|
$self->moderator->unflag_thread($thread_id);
|
||||||
$self->flash(info => "Thread #$thread_id has been unflagged. ◀️");
|
$self->flash(info => "Thread #$thread_id has been unflagged. ◀️");
|
||||||
|
@ -98,8 +98,7 @@ sub unflag_thread($self) {
|
||||||
|
|
||||||
sub hide_thread($self) {
|
sub hide_thread($self) {
|
||||||
my $thread_id = $self->param('thread_id');
|
my $thread_id = $self->param('thread_id');
|
||||||
my $redirect_url = $self->url_for(single_thread => thread_id => $thread_id)
|
my $redirect_url = $self->url_for('flagged_list')->fragment('info')->to_abs;
|
||||||
->fragment('info')->to_abs;
|
|
||||||
|
|
||||||
$self->moderator->hide_thread($thread_id);
|
$self->moderator->hide_thread($thread_id);
|
||||||
$self->flash(info => "Thread #$thread_id has been hidden. 🫥");
|
$self->flash(info => "Thread #$thread_id has been hidden. 🫥");
|
||||||
|
@ -109,7 +108,7 @@ sub hide_thread($self) {
|
||||||
|
|
||||||
sub unhide_thread($self) {
|
sub unhide_thread($self) {
|
||||||
my $thread_id = $self->param('thread_id');
|
my $thread_id = $self->param('thread_id');
|
||||||
my $redirect_url = $self->url_for('threads_list')->fragment('info')->to_abs;
|
my $redirect_url = $self->url_for('hidden_list')->fragment('info')->to_abs;
|
||||||
|
|
||||||
$self->moderator->unhide_thread($thread_id);
|
$self->moderator->unhide_thread($thread_id);
|
||||||
$self->flash(info => "Thread #$thread_id has been unhidden. ⏪");
|
$self->flash(info => "Thread #$thread_id has been unhidden. ⏪");
|
||||||
|
@ -120,8 +119,7 @@ sub unhide_thread($self) {
|
||||||
sub unflag_remark($self) {
|
sub unflag_remark($self) {
|
||||||
my $remark_id = $self->param('remark_id');
|
my $remark_id = $self->param('remark_id');
|
||||||
my $thread_id = $self->remark->thread_id_for($remark_id);
|
my $thread_id = $self->remark->thread_id_for($remark_id);
|
||||||
my $redirect_url = $self->url_for(single_thread => thread_id => $thread_id)
|
my $redirect_url = $self->url_for('flagged_list')->fragment('info')->to_abs;
|
||||||
->fragment('info')->to_abs;
|
|
||||||
|
|
||||||
$self->moderator->unflag_remark($remark_id);
|
$self->moderator->unflag_remark($remark_id);
|
||||||
$self->flash(info => "Remark #$remark_id has been unflagged. ◀️");
|
$self->flash(info => "Remark #$remark_id has been unflagged. ◀️");
|
||||||
|
@ -131,8 +129,7 @@ sub unflag_remark($self) {
|
||||||
|
|
||||||
sub hide_remark($self) {
|
sub hide_remark($self) {
|
||||||
my $remark_id = $self->param('remark_id');
|
my $remark_id = $self->param('remark_id');
|
||||||
my $redirect_url = $self->url_for(single_remark => remark_id => $remark_id)
|
my $redirect_url = $self->url_for('flagged_list')->fragment('info')->to_abs;
|
||||||
->fragment('info')->to_abs;
|
|
||||||
|
|
||||||
$self->moderator->hide_remark($remark_id);
|
$self->moderator->hide_remark($remark_id);
|
||||||
$self->flash(info => "Remark #$remark_id has been hidden. 🫥");
|
$self->flash(info => "Remark #$remark_id has been hidden. 🫥");
|
||||||
|
@ -143,8 +140,7 @@ sub hide_remark($self) {
|
||||||
sub unhide_remark($self) {
|
sub unhide_remark($self) {
|
||||||
my $remark_id = $self->param('remark_id');
|
my $remark_id = $self->param('remark_id');
|
||||||
my $thread_id = $self->remark->thread_id_for($remark_id);
|
my $thread_id = $self->remark->thread_id_for($remark_id);
|
||||||
my $redirect_url = $self->url_for(single_thread => thread_id => $thread_id)
|
my $redirect_url = $self->url_for('hidden_list')->fragment('info')->to_abs;
|
||||||
->fragment('info')->to_abs;
|
|
||||||
|
|
||||||
$self->moderator->unhide_remark($remark_id);
|
$self->moderator->unhide_remark($remark_id);
|
||||||
$self->flash(info => "Remark #$remark_id has been unhidden. ⏪");
|
$self->flash(info => "Remark #$remark_id has been unhidden. ⏪");
|
||||||
|
|
|
@ -39,27 +39,27 @@ subtest Login => sub {
|
||||||
subtest Flag => sub {
|
subtest Flag => sub {
|
||||||
$t->get_ok('/moderator/thread/unflag/1')
|
$t->get_ok('/moderator/thread/unflag/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{thread/list});
|
->header_like(Location => qr{moderator/flagged});
|
||||||
|
|
||||||
$t->get_ok('/moderator/remark/unflag/1')
|
$t->get_ok('/moderator/remark/unflag/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{thread/single});
|
->header_like(Location => qr{moderator/flagged});
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest Hide => sub {
|
subtest Hide => sub {
|
||||||
$t->get_ok('/moderator/thread/hide/1')
|
$t->get_ok('/moderator/thread/hide/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{thread/single});
|
->header_like(Location => qr{moderator/flagged});
|
||||||
$t->get_ok('/moderator/thread/unhide/1')
|
$t->get_ok('/moderator/thread/unhide/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{thread/list});
|
->header_like(Location => qr{moderator/hidden});
|
||||||
|
|
||||||
$t->get_ok('/moderator/remark/hide/1')
|
$t->get_ok('/moderator/remark/hide/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{remark/single});
|
->header_like(Location => qr{moderator/flagged});
|
||||||
$t->get_ok('/moderator/remark/unhide/1')
|
$t->get_ok('/moderator/remark/unhide/1')
|
||||||
->status_is(302)
|
->status_is(302)
|
||||||
->header_like(Location => qr{thread/single});
|
->header_like(Location => qr{moderator/hidden});
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest 'Buttons for mods', sub {
|
subtest 'Buttons for mods', sub {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user