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
MariagraziaAlastra committed Mar 18, 2015
2 parents bd09db6 + f140980 commit f8e40e9
Show file tree
Hide file tree
Showing 28 changed files with 535 additions and 48 deletions.
5 changes: 5 additions & 0 deletions lib/DDGC/DB/Result/InstantAnswer/Issues.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ column is_pr => {
is_nullable => 1,
};

column date => {
data_type => 'text',
is_nullable => 1,
};

primary_key (qw/issue_id repo/);

belongs_to 'instant_answer', 'DDGC::DB::Result::InstantAnswer', 'instant_answer_id', {on_delete => 'cascade'};
Expand Down
65 changes: 55 additions & 10 deletions lib/DDGC/Web/Controller/InstantAnswer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,13 @@ sub ia_json :Chained('ia_base') :PathPart('json') :Args(0) {
other_queries => $edited->{other_queries}->{value},
topic => $edited->{topic},
dev_milestone => $edited->{dev_milestone},
tab => $edited->{tab}
tab => $edited->{tab},
producer => $edited->{producer},
designer => $edited->{designer},
developer => $edited->{developer},
perl_module => $edited->{perl_module},
template => $edited->{template},
repo => $edited->{repo}
};
}
}
Expand Down Expand Up @@ -477,7 +483,14 @@ sub commit_json :Chained('commit_base') :PathPart('json') :Args(0) {
topic => \@topics,
example_query => $ia->example_query,
other_queries => $ia->other_queries? from_json($ia->other_queries) : undef,
dev_milestone => $ia->dev_milestone
dev_milestone => $ia->dev_milestone,
perl_module => $ia->perl_module,
producer => $ia->producer,
designer => $ia->designer,
developer => $ia->developer,
template => $ia->template,
tab => $ia->tab,
repo => $ia->repo
);

$edited->{original} = \%original;
Expand Down Expand Up @@ -620,15 +633,33 @@ sub save_edit :Chained('base') :PathPart('save') :Args(0) {
};
}
} else {
my $edits = add_edit($ia, $field, $value);
my $can_add = 0;
if ($field eq "producer" || $field eq "designer" || $field eq "developer") {
my $complat_user = $c->d->rs('User')->find({username => $value});

if ($complat_user || $value eq '') {
my $complat_user_admin = $complat_user? $complat_user->admin : '';

try {
$ia->update({updates => $edits});
$result = {$field => $value, is_admin => $is_admin};
if ((($field eq "producer" || $field eq "designer") && ($complat_user_admin || $value eq ''))
|| ($field eq "developer")) {
$can_add = 1;
}
}
} else {
$can_add = 1;
}

if ($can_add) {
my $edits = add_edit($ia, $field, $value);

try {
$ia->update({updates => $edits});
$result = {$field => $value, is_admin => $is_admin};
}
catch {
$c->d->errorlog("Error updating the database");
};
}
catch {
$c->d->errorlog("Error updating the database");
};
}
}
}
Expand Down Expand Up @@ -692,6 +723,13 @@ sub current_ia {
my @example_query = $edits->{'example_query'};
my @other_queries = $edits->{'other_queries'};
my @dev_milestone = $edits->{'dev_milestone'};
my @producer = $edits->{'producer'};
my @designer = $edits->{'designer'};
my @developer = $edits->{'developer'};
my @tab = $edits->{'tab'};
my @template = $edits->{'template'};
my @perl_module = $edits->{'perl_module'};
my @repo = $edits->{'repo'};
my %x;

if (ref $edits eq 'HASH') {
Expand All @@ -716,7 +754,14 @@ sub current_ia {
topic => $topic_val? from_json($topic_val) : undef,
example_query => $example_query[0][@example_query]{'value'},
other_queries => \%other_q,
dev_milestone => $dev_milestone[0][@dev_milestone]{'value'}
dev_milestone => $dev_milestone[0][@dev_milestone]{'value'},
producer => $producer[0][@producer]{'value'},
designer => $designer[0][@designer]{'value'},
developer => $developer[0][@developer]{'value'},
tab => $tab[0][@tab]{'value'},
template => $template[0][@template]{'value'},
perl_module => $perl_module[0][@perl_module]{'value'},
repo => $repo[0][@repo]{'value'}
);
}

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.64.0",
"version": "0.65.0",
"engines": {
"node": ">=0.10.0"
},
Expand Down
1 change: 1 addition & 0 deletions root/static/css/ddgc0.64.0.css

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions root/static/js/ddgc0.64.0.js

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

5 changes: 5 additions & 0 deletions root/static/js/ia0.64.0.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion script/ghIssues.pl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sub getIssues{
title => decode_utf8($issue->{'title'}) || '',
body => decode_utf8($issue->{'body'}) || '',
tags => $issue->{'labels'} || '',
created => $issue->{'created_at'} || '',
date => $issue->{'created_at'} || '',
is_pr => $is_pr,
);
push(@results, \%entry);
Expand All @@ -92,6 +92,7 @@ sub getIssues{
body => $result->{body},
tags => $result->{tags},
is_pr => $result->{is_pr},
date => $result->{date}
});

}
Expand Down
3 changes: 3 additions & 0 deletions sql/1.020/issue_dates.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BEGIN;
ALTER TABLE instant_answer_issues ADD COLUMN date text;
COMMIT;
Loading

0 comments on commit f8e40e9

Please sign in to comment.