asap-feed-beta 12.1.7 → 12.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -852,12 +852,13 @@
852
852
  /** @type {?} */
853
853
  var postData = {
854
854
  post_id: item.id,
855
- title: item.title
855
+ title: item.title,
856
+ created_at: item.updated_at
856
857
  };
857
858
  /** @type {?} */
858
859
  var data = {
859
860
  post_id: item.id,
860
- create_at: Date.now(),
861
+ created_at: Date.now(),
861
862
  updated_at: Date.now(),
862
863
  user_info: {
863
864
  id: user.id,
@@ -879,13 +880,25 @@
879
880
  var documentID = "feed-view/" + item.id + "/views/" + user.id;
880
881
  /** @type {?} */
881
882
  var document = _this.db.doc(documentID);
882
- document.set(data).then((/**
883
- * @param {?} response
883
+ document.get().subscribe((/**
884
+ * @param {?} doc
884
885
  * @return {?}
885
886
  */
886
- function (response) {
887
- console.log("[sendVisible] marcado como visualizado", response);
887
+ function (doc) {
888
+ if (!doc.exists) {
889
+ doc.ref.set(data).then((/**
890
+ * @param {?} response
891
+ * @return {?}
892
+ */
893
+ function (response) {
894
+ console.log("[sendVisible] marcado como visualizado", response);
895
+ }));
896
+ }
897
+ else {
898
+ console.log("[sendVisible] já foi marcado como visualizado", doc);
899
+ }
888
900
  }));
901
+ _this.db.collection(documentID + "/history").add(data);
889
902
  }));
890
903
  };
891
904
  AsapFeedBetaComponent.decorators = [