Built motion from commit 5b01f56.|0.0.106
[motion.git] / server / models / sms_room.js
index 4a7a8d3..e33304e 100644 (file)
@@ -15,10 +15,17 @@ module.exports = function(sequelize, DataTypes) {
     tags: {
       type: DataTypes.TEXT,
       get: function() {
-        return this.getDataValue('tags') ? this.getDataValue('tags').split(';') : [];
+        var tags;
+        if (this.getDataValue('tags')) {
+          tags = this.getDataValue('tags').split(';');
+          tags.pop();
+        } else {
+          tags = [];
+        }
+        return tags;
       },
       set: function(val) {
-        this.setDataValue('tags', val.join(';'));
+        this.setDataValue('tags', val && val.length ? val.join(';') + ';' : null);
       }
     },
     disposition: {