Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarrett committed Jan 16, 2015
2 parents c71d71d + d47cde1 commit 9f45264
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 116 deletions.
25 changes: 18 additions & 7 deletions lib/DDGC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,16 @@ sub delete_user {
});
die "Deleted user account doesn't exist!" unless $deleted_user;
die "You can't delete the deleted account!" if $deleted_user->username eq $user->username;
my $prosody_user_rs;
if ($self->config->prosody_running) {
$prosody_user_rs = $self->xmpp->_prosody->_db->resultset('Prosody')->search({
host => $self->config->prosody_userhost,
user => lc($username),
});
if (!$prosody_user_rs) {
croak('Unable to find user in Prosody store - bailing out!');
}
}
my $guard = $self->db->txn_scope_guard;
my @translations = $user->token_language_translations->search({})->all;
for (@translations) {
Expand All @@ -739,15 +749,16 @@ sub delete_user {
for (@comments) {
$_->content("This user account has been deleted.");
$_->users_id($deleted_user->id);
$_->update;
$_->update({ 'updated' => $_->created });
}
$guard->commit;
if ($self->config->prosody_running) {
$self->xmpp->_prosody->_db->resultset('Prosody')->search({
host => $self->config->prosody_userhost,
user => $username,
})->delete;
my @threads = $user->threads->search({})->all;
for (@threads) {
$_->users_id($deleted_user->id);
$_->ghosted(1);
$_->update({ 'updated' => $_->created });
}
$guard->commit;
($prosody_user_rs) && $prosody_user_rs->delete;
}
return 1;
}
Expand Down
14 changes: 12 additions & 2 deletions lib/DDGC/Web/Controller/My.pm
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,22 @@ sub delete :Chained('logged_in') :Args(0) {

if (!$c->user->check_password($c->req->params->{password})) {
$c->stash->{wrong_password} = 1;
return;
return $c->detach;
}

if ($c->req->params->{delete_profile}) {
my $username = $c->user->username;
$c->d->delete_user($username);
my $delete_error = 0;
try {
$c->d->delete_user($username);
}
catch {
$delete_error = 1;
};
if ($delete_error) {
$c->stash->{delete_error} = 1;
return $c->detach;
}
$c->logout;
$c->response->redirect($c->chained_uri('Root','index'));
return $c->detach;
Expand Down
3 changes: 1 addition & 2 deletions lib/DDGC/Web/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use Moose;
use Path::Class;
use DateTime;
use DateTime::Duration;
use URL::Encode 'url_decode_utf8';

use namespace::autoclean;

Expand Down Expand Up @@ -215,7 +214,7 @@ sub redirect_duckco :Chained('base') :PathPart('topic') :Args(1) {
sub redir :Chained('base') :PathPart('redir') :Args(0) {
my ( $self, $c ) = @_;
$c->stash->{not_last_url} = 1;
$c->session->{r_url} = url_decode_utf8($c->req->param('u'));
$c->session->{r_url} = $c->req->param('u');
$c->session->{r_referer_validated} = (index($c->req->headers->referer, $c->req->base->as_string) == 0) ? 1 : 0;
$c->response->redirect($c->chained_uri('Root','r'));
return $c->detach;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ddg_community_platform",
"version": "0.52.0",
"version": "0.53.0",
"engines": {
"node": ">=0.10.0"
},
Expand Down
1 change: 1 addition & 0 deletions root/static/css/ddgc0.52.0.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions root/static/css/ia0.52.0.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f45264

Please sign in to comment.