@yrpri/api 9.0.178 → 9.0.179
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.
- package/app.js +2 -2
- package/controllers/communities.cjs +1 -0
- package/controllers/groups.cjs +69 -0
- package/package.json +2 -2
package/app.js
CHANGED
|
@@ -560,8 +560,8 @@ export class YourPrioritiesApi {
|
|
|
560
560
|
this.app.use(this.setupExpresLogger);
|
|
561
561
|
this.app.use(useragent.express());
|
|
562
562
|
this.app.use(requestIp.mw());
|
|
563
|
-
this.app.use(bodyParser.json({ limit: "
|
|
564
|
-
this.app.use(bodyParser.urlencoded({ limit: "
|
|
563
|
+
this.app.use(bodyParser.json({ limit: "150mb", strict: false }));
|
|
564
|
+
this.app.use(bodyParser.urlencoded({ limit: "150mb", extended: true }));
|
|
565
565
|
if (process.env.ALLOWED_ORIGINS) {
|
|
566
566
|
this.app.use(cors({
|
|
567
567
|
origin: process.env.ALLOWED_ORIGINS.split(","),
|
|
@@ -783,6 +783,7 @@ const updateCommunityConfigParameters = function (req, community) {
|
|
|
783
783
|
community.set("configuration.hideLogoBoxShadow", truthValueFromBody(req.body.hideLogoBoxShadow));
|
|
784
784
|
community.set("configuration.muteNotificationsForEndorsements", truthValueFromBody(req.body.muteNotificationsForEndorsements));
|
|
785
785
|
community.set("configuration.useTextOnlyInfoBox", truthValueFromBody(req.body.useTextOnlyInfoBox));
|
|
786
|
+
community.set("configuration.useInfoIconInsteadOfHelpIcon", truthValueFromBody(req.body.useInfoIconInsteadOfHelpIcon));
|
|
786
787
|
const ltpConfigText = req.body.ltp && req.body.ltp != "" ? req.body.ltp : null;
|
|
787
788
|
if (ltpConfigText) {
|
|
788
789
|
try {
|
package/controllers/groups.cjs
CHANGED
|
@@ -191,6 +191,7 @@ var updateGroupConfigParameters = function (req, group) {
|
|
|
191
191
|
group.set("configuration.hideNewPostOnPostPage", truthValueFromBody(req.body.hideNewPostOnPostPage));
|
|
192
192
|
group.set("configuration.newPointOptional", truthValueFromBody(req.body.newPointOptional));
|
|
193
193
|
group.set("configuration.hideHelpIcon", truthValueFromBody(req.body.hideHelpIcon));
|
|
194
|
+
group.set("configuration.useInfoIconInsteadOfHelpIcon", truthValueFromBody(req.body.useInfoIconInsteadOfHelpIcon));
|
|
194
195
|
group.set("configuration.hideEmoji", truthValueFromBody(req.body.hideEmoji));
|
|
195
196
|
group.set("configuration.hideGroupHeader", truthValueFromBody(req.body.hideGroupHeader));
|
|
196
197
|
group.set("configuration.hidePointAuthor", truthValueFromBody(req.body.hidePointAuthor));
|
|
@@ -2530,6 +2531,74 @@ router.post("/:id/clone", auth.can("edit group"), function (req, res) {
|
|
|
2530
2531
|
sendGroupOrError(res, null, "delete", req.user, error);
|
|
2531
2532
|
});
|
|
2532
2533
|
});
|
|
2534
|
+
router.post("/:id/cloneToCommunity/:communityId", auth.can("edit group"), auth.can("edit community"), function (req, res) {
|
|
2535
|
+
models.Group.findOne({
|
|
2536
|
+
attributes: ["id"],
|
|
2537
|
+
where: { id: req.params.id },
|
|
2538
|
+
})
|
|
2539
|
+
.then(function (group) {
|
|
2540
|
+
if (group) {
|
|
2541
|
+
models.Community.findOne({
|
|
2542
|
+
where: { id: req.params.communityId },
|
|
2543
|
+
attributes: ["id", "domain_id"],
|
|
2544
|
+
include: [
|
|
2545
|
+
{
|
|
2546
|
+
model: models.Domain,
|
|
2547
|
+
attributes: ["id"],
|
|
2548
|
+
},
|
|
2549
|
+
],
|
|
2550
|
+
})
|
|
2551
|
+
.then(function (community) {
|
|
2552
|
+
if (community) {
|
|
2553
|
+
community.hasCommunityAdmins(req.user).then(function (isAdmin) {
|
|
2554
|
+
if (isAdmin) {
|
|
2555
|
+
copyGroup(group.id, community, community.domain_id, { skipUsers: true, skipActivities: true }, (error, newGroup) => {
|
|
2556
|
+
if (error) {
|
|
2557
|
+
log.error("Group Clone To Community Failed", {
|
|
2558
|
+
error,
|
|
2559
|
+
groupId: req.params.id,
|
|
2560
|
+
communityId: req.params.communityId,
|
|
2561
|
+
});
|
|
2562
|
+
res.sendStatus(500);
|
|
2563
|
+
}
|
|
2564
|
+
else if (newGroup) {
|
|
2565
|
+
log.info("Group Cloned To Community", {
|
|
2566
|
+
groupId: req.params.id,
|
|
2567
|
+
newGroupId: newGroup.id,
|
|
2568
|
+
communityId: req.params.communityId,
|
|
2569
|
+
});
|
|
2570
|
+
res.send({ id: newGroup.id });
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
log.error("Group Clone To Community succeeded but newGroup is missing", {
|
|
2574
|
+
groupId: req.params.id,
|
|
2575
|
+
communityId: req.params.communityId,
|
|
2576
|
+
});
|
|
2577
|
+
res.sendStatus(500);
|
|
2578
|
+
}
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
else {
|
|
2582
|
+
sendGroupOrError(res, null, "cloneToCommunity", req.user, "Not community admin", 401);
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
else {
|
|
2587
|
+
sendGroupOrError(res, req.params.communityId, "cloneToCommunity", req.user, "Not found", 404);
|
|
2588
|
+
}
|
|
2589
|
+
})
|
|
2590
|
+
.catch(function (error) {
|
|
2591
|
+
sendGroupOrError(res, null, "cloneToCommunity", req.user, error);
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
else {
|
|
2595
|
+
sendGroupOrError(res, req.params.id, "cloneToCommunity", req.user, "Not found", 404);
|
|
2596
|
+
}
|
|
2597
|
+
})
|
|
2598
|
+
.catch(function (error) {
|
|
2599
|
+
sendGroupOrError(res, null, "cloneToCommunity", req.user, error);
|
|
2600
|
+
});
|
|
2601
|
+
});
|
|
2533
2602
|
router.get("/:id/checkNonOpenPosts", auth.can("view group"), (req, res) => {
|
|
2534
2603
|
var PostsByNotOpen = models.Post.scope("not_open");
|
|
2535
2604
|
PostsByNotOpen.count({ where: { group_id: req.params.id } })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yrpri/api",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.179",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Bjarnason & Citizens Foundation",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@google-cloud/vertexai": "^1.10.0",
|
|
26
26
|
"@google-cloud/vision": "^5.1.0",
|
|
27
27
|
"@node-saml/passport-saml": "^5.0.1",
|
|
28
|
-
"@policysynth/agents": "^1.3.
|
|
28
|
+
"@policysynth/agents": "^1.3.147",
|
|
29
29
|
"async": "^3.2.6",
|
|
30
30
|
"authorized": "^1.0.0",
|
|
31
31
|
"aws-sdk": "^2.1692.0",
|