Sourcecode in Story/objectFunctions.js:
1: function evalComment(param, creator) {
2: // collect content
3: var content = extractContent(param);
4: if (!content.exists)
5: throw new Exception("textMissing");
6: var c = new Comment(this.site, creator, param.http_remotehost);
7: c.setContent(content.value);
8: // let's keep the title property:
9: c.title = content.value.title;
10: this.add(c);
11: // also add to story.comments since it has
12: // cachemode set to aggressive and wouldn't refetch
13: // its child collection index otherwise
14: if (this._prototype == "Story")
15: this.comments.add(c);
16: else
17: this.story.comments.add(c);
18: this.site.lastupdate = new Date();
19: // send e-mail notification
20: if (this.site.isNotificationEnabled())
21: this.site.sendNotification("create", c);
22: var result = new Message("commentCreate");
23: result.id = c._id;
24: return result;
25: }
|