add whats new creation and refactored closed need filtering (also filter out whatsnew needs)
@@ -184,9 +184,11 @@ function genComponentConf() {
const isPost = showCreateView && !isSearch;
return {
- existingWhatsAroundNeeds: state
+ existingAutoGeneratedNeeds: state
.get("needs")
- .filter(need => need.get("isWhatsAround")),
+ .filter(
+ need => need.get("isWhatsAround") || need.get("isWhatsNew")
+ ),
showCreateView,
isSearch,
isPost,
@@ -297,7 +299,7 @@ function genComponentConf() {
matchingContext: this.tempMatchingContext,
};
- this.existingWhatsAroundNeeds
+ this.existingAutoGeneratedNeeds
.filter(need => need.get("state") == "won:Active")
.map(need => this.needs__close(need.get("uri")));
@@ -331,6 +333,34 @@ function genComponentConf() {
}
}
}
+
+ createWhatsNew() {
+ if (!this.pendingPublishing) {
+ this.pendingPublishing = true;
+ let whatsAround = {
+ title: "What's New?",
+ type: "http://purl.org/webofneeds/model#DoTogether",
+ description:
+ "Automatically created post to see what's happening recently",
+ tags: undefined,
+ thumbnail: undefined,
+ whatsNew: true,
+ matchingContext: this.tempMatchingContext,
+ };
+
+ this.existingAutoGeneratedNeeds
+ .filter(need => need.get("state") == "won:Active")
+ .map(need => this.needs__close(need.get("uri")));
+
+ //TODO: Point to same DataSet instead of double it
+ this.draftObject.is = whatsAround;
+ this.draftObject.seeks = this.draftObject.is;
+ this.needs__create(
+ this.draftObject,
+ this.$ngRedux.getState().getIn(["config", "defaultNodeUri"])
+ );
+ }
+ }
}
Controller.$inject = serviceDependencies;
