Only pass valid subject parameters when commenting

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-12-20 10:36:56 +01:00
parent cf41665c0a
commit 5c0455ec56
3 changed files with 16 additions and 6 deletions

View File

@@ -51,7 +51,8 @@ class ActivityService {
for (let index in this.toEnhanceWithComments) {
if (this.toEnhanceWithComments.hasOwnProperty(index)) {
let item = this.toEnhanceWithComments[index];
item.commentModel = this.commentCollection.get(item.subject_rich[1].comment);
let commentId = Array.isArray(item.subject_rich[1].comment) ? item.subject_rich[1].comment.id : item.subject_rich[1].comment;
item.commentModel = this.commentCollection.get(commentId);
if (typeof item.commentModel !== 'undefined') {
this.toEnhanceWithComments = this.toEnhanceWithComments.filter((entry) => entry.activity_id !== item.activity_id);
}