bots: Don't name section headers in flaskbotrc.

The Botserver uses section headers in the flaskbotrc to
determine which bot to run. Silently setting the section
headers to a bot's username is confusing and makes it
harder for Botserver users to figure out how to get the
Botserver to run the bots they want. This commit empties
all flaskbotrc section headers and thus makes the assignment
of bots explicit and mandatory.
This commit is contained in:
Robert Hönig 2018-05-23 16:28:41 +02:00 committed by Tim Abbott
parent bdf79f271d
commit 53891a9bed
4 changed files with 4 additions and 8 deletions

View File

@ -8,7 +8,7 @@ common.start_and_log_in();
// var form_sel = 'form[action^="/json/settings"]';
var regex_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\n$/;
var regex_flaskbotrc = /^data:application\/octet-stream;charset=utf-8,\[.\]\nemail=.+\nkey=.+\nsite=.+\n$/;
var regex_flaskbotrc = /^data:application\/octet-stream;charset=utf-8,\[\]\nemail=.+\nkey=.+\nsite=.+\n$/;
casper.then(function () {
var menu_selector = '#settings-dropdown';

View File

@ -52,7 +52,7 @@ run_test('generate_flaskbotrc_content', () => {
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
};
var content = settings_bots.generate_flaskbotrc_content(user.email, user.api_key);
var expected = "[vabstest]\nemail=vabstest-bot@zulip.com\n" +
var expected = "[]\nemail=vabstest-bot@zulip.com\n" +
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
"site=https://chat.example.com\n";

View File

@ -110,12 +110,8 @@ exports.generate_zuliprc_content = function (email, api_key) {
"\n";
};
function bot_name_from_email(email) {
return email.substring(0, email.indexOf("-bot@"));
}
exports.generate_flaskbotrc_content = function (email, api_key) {
return "[" + bot_name_from_email(email) + "]" +
return "[]" +
"\nemail=" + email +
"\nkey=" + api_key +
"\nsite=" + page_params.realm_uri +

View File

@ -62,7 +62,7 @@ pip install zulip_botserver
1. Open the `flaskbotrc`. It should contain one or more sections that look like this:
```
[foo]
[]
email=foo-bot@hostname
key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
site=http://hostname