fix: Improvements in share feat (#2502)
* Make request only when popover is visible * Update policies required for shares.create shares.update * Create withCollection scope * Remove team share check from shares.create * Update tests
This commit is contained in:
@@ -44,6 +44,27 @@ Share.associate = (models) => {
|
||||
{ association: "team" },
|
||||
],
|
||||
});
|
||||
Share.addScope("withCollection", (userId) => {
|
||||
return {
|
||||
include: [
|
||||
{
|
||||
model: models.Document,
|
||||
paranoid: true,
|
||||
as: "document",
|
||||
include: [
|
||||
{
|
||||
model: models.Collection.scope({
|
||||
method: ["withMembership", userId],
|
||||
}),
|
||||
as: "collection",
|
||||
},
|
||||
],
|
||||
},
|
||||
{ association: "user", paranoid: false },
|
||||
{ association: "team" },
|
||||
],
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Share.prototype.revoke = function (userId) {
|
||||
|
||||
Reference in New Issue
Block a user