Rework and feature parity to existing site
[oweals/finalsclub.git] / models.js
index 31a41714a4564e4738b614f1dba93bcbe80cb703..87d427e960bc5703b81cc310df5c175bf15c52ef 100644 (file)
--- a/models.js
+++ b/models.js
@@ -415,7 +415,7 @@ var ArchivedNote = new Schema({
 ArchivedNote.virtual( 'sanitized' ).get(function() {
   var note = {
     _id: this._id,
-    topic: this.topic
+    topic: this.topic === '' ? (this.text.replace(/(<(.|\n)*?>)|[\r\n\t]*/g, '')).substr(0, 15) + '...' : this.topic
   }
   return note;
 })