mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Servers with more than one dot in title could not be handled
This commit is contained in:
parent
f400d7efe9
commit
fb6e731a81
@ -40,6 +40,10 @@ var Server = function (config, logs, options) {
|
||||
|
||||
Server.prototype = new events.EventEmitter();
|
||||
|
||||
Server.prototype.generateId = function () {
|
||||
return slugify(this.title).replace(/\./g, '-');
|
||||
};
|
||||
|
||||
Server.prototype.update = function (options) {
|
||||
this.admin_password = options.admin_password;
|
||||
this.auto_start = options.auto_start;
|
||||
@ -55,7 +59,7 @@ Server.prototype.update = function (options) {
|
||||
this.title = options.title;
|
||||
this.von = options.von;
|
||||
|
||||
this.id = slugify(this.title).replace('.', '-');
|
||||
this.id = this.generateId();
|
||||
this.port = parseInt(this.port, 10); // If port is a string then gamedig fails
|
||||
};
|
||||
|
||||
|
@ -3,6 +3,13 @@ var should = require('should');
|
||||
var Server = require('../../lib/server.js');
|
||||
|
||||
describe('Server', function() {
|
||||
describe('generateId()', function() {
|
||||
it('should include title', function() {
|
||||
var server = new Server(null, null, {title: 'title.with.lot.of.dots'});
|
||||
server.generateId().should.eql('title-with-lot-of-dots');
|
||||
});
|
||||
});
|
||||
|
||||
describe('toJSON()', function() {
|
||||
it('should include title', function() {
|
||||
var server = new Server(null, null, {title: 'test'});
|
||||
|
Loading…
Reference in New Issue
Block a user