mirror of
https://github.com/zkitter/ui.git
synced 2026-01-09 21:28:05 -05:00
fix: do not mirror post when posting with groups (#101)
This commit is contained in:
@@ -45,18 +45,19 @@
|
||||
"draft-js": "^0.11.7",
|
||||
"draft-js-table": "^0.3.0",
|
||||
"elliptic": "^6.5.4",
|
||||
"eth-json-rpc-middleware": "git+https://github.com/zkitter/eth-json-rpc-middleware.git#6.0.0-a",
|
||||
"ethereum-blockies-base64": "^1.0.2",
|
||||
"ethers": "^5.7.2",
|
||||
"eventemitter2": "^6.4.9",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"gun": "0.2020.1232",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"eth-json-rpc-middleware": "git+https://github.com/zkitter/eth-json-rpc-middleware.git#6.0.0-a",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"magnet-uri": "^6.2.0",
|
||||
"markdown-draft-js": "^2.4.0",
|
||||
"mime-types": "^2.1.35",
|
||||
"moment": "^2.29.4",
|
||||
"node-fetch": "^2.6.9",
|
||||
"pretty-bytes": "^6.0.0",
|
||||
"react": "~16",
|
||||
"react-dom": "~16",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { ducks, fetchReset, fetchStub, store } from '~/testUtils';
|
||||
import { createEditorStateWithText } from '@draft-js-plugins/editor';
|
||||
import { ZkIdentity } from '@zk-kit/identity';
|
||||
import { setPostingGroup } from '@ducks/worker';
|
||||
import { PostMessageSubType } from '~/message';
|
||||
|
||||
const {
|
||||
setMirror,
|
||||
@@ -49,6 +51,28 @@ describe('Drafts Duck', () => {
|
||||
method: 'POST',
|
||||
},
|
||||
]);
|
||||
fetchReset();
|
||||
});
|
||||
|
||||
it('should not mirror post when submitting group post', async () => {
|
||||
store.dispatch(
|
||||
setDraft({
|
||||
reference: '',
|
||||
editorState: createEditorStateWithText('hello world!'),
|
||||
})
|
||||
);
|
||||
store.dispatch(setMirror(true));
|
||||
store.dispatch(setPostingGroup('zksocial_all'));
|
||||
// @ts-ignore
|
||||
const post: any = await store.dispatch(submitPost(''));
|
||||
expect(post.payload).toStrictEqual({
|
||||
attachment: '',
|
||||
content: 'hello world!',
|
||||
reference: '',
|
||||
title: '',
|
||||
topic: 'ok',
|
||||
});
|
||||
expect(post.subtype).not.toStrictEqual(PostMessageSubType.MirrorPost);
|
||||
});
|
||||
|
||||
// FIXME ENOENT: no such file or directory, open 'http://127.0.0.1:3000/circuits/rln/wasm'
|
||||
|
||||
@@ -474,7 +474,7 @@ export const submitPost =
|
||||
let replyToTweetId;
|
||||
let replyToUsername;
|
||||
|
||||
if (shouldMirror) {
|
||||
if (selected?.type === 'gun' && !postingGroup && shouldMirror) {
|
||||
subtype = reference ? PostMessageSubType.MirrorReply : PostMessageSubType.MirrorPost;
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user