Skip to content

Commit

Permalink
#92, add test config var set in Edit Config with server injestion
Browse files Browse the repository at this point in the history
  • Loading branch information
thrize committed Apr 14, 2018
1 parent 95aa2f8 commit 826aed2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions html/edit-config-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ <h2 class="sub-header">Configuration</h2>
</td>
<th><p><a class="btn btn-default" href="javascript:updateVar(18)" role="button">Update</a></p></th>
</tr>
<tr>
<td>COMMENT_ENABLED</td>
<td>Enables commenting on every posted voted for by bot. Comment text must be set in Edit Algo.</td>
<td>
<form class="form-add">
<input type="checkbox" name="input_field_19" id="input_field_19">
</form>
</td>
<th><p><a class="btn btn-default" href="javascript:updateVar(19)" role="button">Update</a></p></th>
</tr>
</tbody>
</table>
</div>
Expand Down
6 changes: 4 additions & 2 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ var defaultConfigVars = {
MIN_VOTING_POWER: 50,
VOTE_VOTING_POWER: 100,
POST_METADATA_MAX_RECORD_PER_RUN: 100,
POST_METADATA_MAX_RUNS_TO_KEEP: 5
POST_METADATA_MAX_RUNS_TO_KEEP: 5,
COMMENT_ENABLED: false
};

var configVars = {
Expand All @@ -223,7 +224,8 @@ var configVars = {
MIN_VOTING_POWER: 50,
VOTE_VOTING_POWER: 100,
POST_METADATA_MAX_RECORD_PER_RUN: 100,
POST_METADATA_MAX_RUNS_TO_KEEP: 5
POST_METADATA_MAX_RUNS_TO_KEEP: 5,
COMMENT_ENABLED: false
};

// MongoDB
Expand Down
3 changes: 2 additions & 1 deletion public/js/edit-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ var fieldNames = [
"MIN_VOTING_POWER",
"VOTE_VOTING_POWER",
"POST_METADATA_MAX_RECORD_PER_RUN",
"POST_METADATA_MAX_RUNS_TO_KEEP"
"POST_METADATA_MAX_RUNS_TO_KEEP",
"COMMENT_ENABLED"
];

function updateVar(index) {
Expand Down
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,11 @@ app.get("/edit-config", function(req, res) {
configVars.POST_METADATA_MAX_RUNS_TO_KEEP = Number(atob(req.query.POST_METADATA_MAX_RUNS_TO_KEEP));
change = true;
html_title += "Updated POST_METADATA_MAX_RUNS_TO_KEEP";
} else if (req.query.COMMENT_ENABLED) {
console.log('req.query.COMMENT_ENABLED = ' + req.query.COMMENT_ENABLED);
configVars.COMMENT_ENABLED = req.query.COMMENT_ENABLED.localeCompare('true');
change = true;
html_title += "Updated COMMENT_ENABLED";
}
html_title += "</h3>"
if (change) {
Expand Down

0 comments on commit 826aed2

Please sign in to comment.