mirror of https://github.com/zulip/zulip.git
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:
parent
bdf79f271d
commit
53891a9bed
|
@ -8,7 +8,7 @@ common.start_and_log_in();
|
||||||
|
|
||||||
// var form_sel = 'form[action^="/json/settings"]';
|
// var form_sel = 'form[action^="/json/settings"]';
|
||||||
var regex_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
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 () {
|
casper.then(function () {
|
||||||
var menu_selector = '#settings-dropdown';
|
var menu_selector = '#settings-dropdown';
|
||||||
|
|
|
@ -52,7 +52,7 @@ run_test('generate_flaskbotrc_content', () => {
|
||||||
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
|
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
|
||||||
};
|
};
|
||||||
var content = settings_bots.generate_flaskbotrc_content(user.email, user.api_key);
|
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" +
|
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
|
||||||
"site=https://chat.example.com\n";
|
"site=https://chat.example.com\n";
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,8 @@ exports.generate_zuliprc_content = function (email, api_key) {
|
||||||
"\n";
|
"\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
function bot_name_from_email(email) {
|
|
||||||
return email.substring(0, email.indexOf("-bot@"));
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.generate_flaskbotrc_content = function (email, api_key) {
|
exports.generate_flaskbotrc_content = function (email, api_key) {
|
||||||
return "[" + bot_name_from_email(email) + "]" +
|
return "[]" +
|
||||||
"\nemail=" + email +
|
"\nemail=" + email +
|
||||||
"\nkey=" + api_key +
|
"\nkey=" + api_key +
|
||||||
"\nsite=" + page_params.realm_uri +
|
"\nsite=" + page_params.realm_uri +
|
||||||
|
|
|
@ -62,7 +62,7 @@ pip install zulip_botserver
|
||||||
|
|
||||||
1. Open the `flaskbotrc`. It should contain one or more sections that look like this:
|
1. Open the `flaskbotrc`. It should contain one or more sections that look like this:
|
||||||
```
|
```
|
||||||
[foo]
|
[]
|
||||||
email=foo-bot@hostname
|
email=foo-bot@hostname
|
||||||
key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
|
key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
|
||||||
site=http://hostname
|
site=http://hostname
|
||||||
|
|
Loading…
Reference in New Issue