@bitsocial/bitsocial-react-hooks 0.1.47 → 0.1.48
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/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/dist/hooks/authors/author-avatars.d.ts.map +1 -1
- package/dist/hooks/authors/author-avatars.js +2 -1
- package/dist/hooks/authors/author-avatars.js.map +1 -1
- package/dist/lib/chain/chain.d.ts +1 -0
- package/dist/lib/chain/chain.d.ts.map +1 -1
- package/dist/lib/chain/chain.js +22 -2
- package/dist/lib/chain/chain.js.map +1 -1
- package/dist/lib/pkc-compat.d.ts +1 -1
- package/dist/lib/pkc-compat.d.ts.map +1 -1
- package/dist/lib/pkc-compat.js +17 -9
- package/dist/lib/pkc-compat.js.map +1 -1
- package/dist/stores/accounts/account-generator.js +1 -1
- package/dist/stores/accounts/account-generator.js.map +1 -1
- package/dist/stores/accounts/accounts-actions.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-actions.js +9 -21
- package/dist/stores/accounts/accounts-actions.js.map +1 -1
- package/dist/stores/accounts/accounts-database.js +2 -2
- package/dist/stores/accounts/accounts-database.js.map +1 -1
- package/dist/stores/accounts/accounts-store.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-store.js +2 -0
- package/dist/stores/accounts/accounts-store.js.map +1 -1
- package/dist/stores/comments/comments-store.d.ts.map +1 -1
- package/dist/stores/comments/comments-store.js +5 -2
- package/dist/stores/comments/comments-store.js.map +1 -1
- package/package.json +11 -9
|
@@ -160,22 +160,11 @@ const syncCommentClientsSnapshot = (publishSessionId, accountId, publication) =>
|
|
|
160
160
|
ac[session.currentIndex] = updatedAccountComment;
|
|
161
161
|
}));
|
|
162
162
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
const storedCommunity = communitiesStore.getState().communities[communityAddress];
|
|
170
|
-
if (((_b = (_a = storedCommunity === null || storedCommunity === void 0 ? void 0 : storedCommunity.roles) === null || _a === void 0 ? void 0 : _a[account.author.address]) === null || _b === void 0 ? void 0 : _b.role) === "owner") {
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
if (((_c = storedCommunity === null || storedCommunity === void 0 ? void 0 : storedCommunity.signer) === null || _c === void 0 ? void 0 : _c.address) &&
|
|
174
|
-
storedCommunity.signer.address === ((_d = account.signer) === null || _d === void 0 ? void 0 : _d.address)) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
return ((_g = (_f = (_e = account.communities) === null || _e === void 0 ? void 0 : _e[communityAddress]) === null || _f === void 0 ? void 0 : _f.role) === null || _g === void 0 ? void 0 : _g.role) === "owner";
|
|
178
|
-
};
|
|
163
|
+
// only a community hosted by the connected pkc instance can be edited with community.edit(), for any
|
|
164
|
+
// other community pkc.createCommunity() returns a remote instance whose edit() throws. owner roles and
|
|
165
|
+
// cached signers don't prove hosting, e.g. an owner using a client that doesn't host the community
|
|
166
|
+
// must publish a CommunityEdit over pubsub, which the hosting node accepts from owners
|
|
167
|
+
const pkcHostsCommunity = (account, communityAddress) => getPkcCommunityAddresses(account.pkc).includes(communityAddress);
|
|
179
168
|
const createPublishSession = (accountId, index) => {
|
|
180
169
|
const sessionId = uuid();
|
|
181
170
|
activePublishSessions.set(sessionId, {
|
|
@@ -1602,7 +1591,8 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
1602
1591
|
timestamp: Math.floor(Date.now() / 1000),
|
|
1603
1592
|
author: account.author,
|
|
1604
1593
|
signer: account.signer,
|
|
1605
|
-
//
|
|
1594
|
+
// the current address, a new address is in communityEdit.address, which the hosting node only
|
|
1595
|
+
// accepts from the owner
|
|
1606
1596
|
communityAddress,
|
|
1607
1597
|
communityEdit: communityEditOptions,
|
|
1608
1598
|
});
|
|
@@ -1632,8 +1622,8 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
1632
1622
|
return nextState;
|
|
1633
1623
|
});
|
|
1634
1624
|
});
|
|
1635
|
-
//
|
|
1636
|
-
if (
|
|
1625
|
+
// the connected pkc instance hosts the community and can edit it locally, no need to publish
|
|
1626
|
+
if (pkcHostsCommunity(account, communityAddress)) {
|
|
1637
1627
|
// use the wordfiltered edit so the applied community state matches the stored account edit
|
|
1638
1628
|
yield communitiesStore
|
|
1639
1629
|
.getState()
|
|
@@ -1644,8 +1634,6 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
1644
1634
|
(_a = publishCommunityEditOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommunityEditOptions, "succeeded");
|
|
1645
1635
|
return;
|
|
1646
1636
|
}
|
|
1647
|
-
assert(!publishCommunityEditOptions.address ||
|
|
1648
|
-
publishCommunityEditOptions.address === communityAddress, `accountsActions.publishCommunityEdit can't edit address of a remote community`);
|
|
1649
1637
|
let communityEdit = backfillPublicationCommunityAddress(yield createPkcCommunityEdit(account.pkc, createCommunityEditOptions), createCommunityEditOptions);
|
|
1650
1638
|
let lastChallenge;
|
|
1651
1639
|
const publishAndRetryFailedChallengeVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|