fix: disable resend button on resending, shorter timeout with UI

pull/3281/head
Audric Ackermann 4 months ago
parent 3a336e83c2
commit 099c9d2b0e
No known key found for this signature in database

@ -234,6 +234,7 @@ const GroupStatusContainer = ({
const ResendButton = ({ groupPk, pubkey }: { pubkey: PubkeyType; groupPk: GroupPubkeyType }) => { const ResendButton = ({ groupPk, pubkey }: { pubkey: PubkeyType; groupPk: GroupPubkeyType }) => {
const acceptedInvite = useMemberHasAcceptedInvite(pubkey, groupPk); const acceptedInvite = useMemberHasAcceptedInvite(pubkey, groupPk);
const nominatedAdmin = useMemberIsNominatedAdmin(pubkey, groupPk); const nominatedAdmin = useMemberIsNominatedAdmin(pubkey, groupPk);
const memberStatus = useMemberStatus(pubkey, groupPk);
// as soon as the `admin` flag is set in the group for that member, we should be able to resend a promote as we cannot remove an admin. // as soon as the `admin` flag is set in the group for that member, we should be able to resend a promote as we cannot remove an admin.
const canResendPromotion = hasClosedGroupV2QAButtons() && nominatedAdmin; const canResendPromotion = hasClosedGroupV2QAButtons() && nominatedAdmin;
@ -252,6 +253,7 @@ const ResendButton = ({ groupPk, pubkey }: { pubkey: PubkeyType; groupPk: GroupP
buttonShape={SessionButtonShape.Square} buttonShape={SessionButtonShape.Square}
buttonType={SessionButtonType.Solid} buttonType={SessionButtonType.Solid}
text={window.i18n('resend')} text={window.i18n('resend')}
disabled={memberStatus === 'INVITE_SENDING' || memberStatus === 'PROMOTION_SENDING'}
onClick={async () => { onClick={async () => {
const group = await UserGroupsWrapperActions.getGroup(groupPk); const group = await UserGroupsWrapperActions.getGroup(groupPk);
const member = await MetaGroupWrapperActions.memberGet(groupPk, pubkey); const member = await MetaGroupWrapperActions.memberGet(groupPk, pubkey);

@ -199,6 +199,7 @@ class GroupInviteJob extends PersistedJob<GroupInvitePersistedData> {
unrevokeSubRequest, unrevokeSubRequest,
extraStoreRequests: [], extraStoreRequests: [],
allow401s: false, allow401s: false,
timeoutMs: 10 * DURATION.SECONDS,
}); });
if (sequenceResult !== RunJobResult.Success) { if (sequenceResult !== RunJobResult.Success) {
await LibSessionUtil.saveDumpsToDb(groupPk); await LibSessionUtil.saveDumpsToDb(groupPk);
@ -236,7 +237,7 @@ class GroupInviteJob extends PersistedJob<GroupInvitePersistedData> {
message: rawMessage, message: rawMessage,
isSyncMessage: false, isSyncMessage: false,
}), }),
30 * DURATION.SECONDS, 10 * DURATION.SECONDS,
controller controller
); );

@ -37,6 +37,7 @@ import {
} from '../PersistedJob'; } from '../PersistedJob';
import { DURATION } from '../../../constants'; import { DURATION } from '../../../constants';
import { WithAllow401s } from '../../../types/with'; import { WithAllow401s } from '../../../types/with';
import type { WithTimeoutMs } from '../../../apis/snode_api/requestWith';
const defaultMsBetweenRetries = 15000; // a long time between retries, to avoid running multiple jobs at the same time, when one was postponed at the same time as one already planned (5s) const defaultMsBetweenRetries = 15000; // a long time between retries, to avoid running multiple jobs at the same time, when one was postponed at the same time as one already planned (5s)
const defaultMaxAttempts = 2; const defaultMaxAttempts = 2;
@ -91,9 +92,10 @@ async function pushChangesToGroupSwarmIfNeeded({
deleteAllMessagesSubRequest, deleteAllMessagesSubRequest,
extraStoreRequests, extraStoreRequests,
allow401s, allow401s,
timeoutMs
}: WithGroupPubkey & }: WithGroupPubkey &
WithAllow401s & WithAllow401s &
WithRevokeSubRequest & { WithRevokeSubRequest & Partial<WithTimeoutMs> & {
supplementalKeysSubRequest?: StoreGroupKeysSubRequest; supplementalKeysSubRequest?: StoreGroupKeysSubRequest;
deleteAllMessagesSubRequest?: DeleteAllFromGroupMsgNodeSubRequest; deleteAllMessagesSubRequest?: DeleteAllFromGroupMsgNodeSubRequest;
extraStoreRequests: Array<StoreGroupMessageSubRequest>; extraStoreRequests: Array<StoreGroupMessageSubRequest>;
@ -175,7 +177,7 @@ async function pushChangesToGroupSwarmIfNeeded({
abortSignal: controller.signal, abortSignal: controller.signal,
allow401s, allow401s,
}), }),
30 * DURATION.SECONDS, timeoutMs || 30 * DURATION.SECONDS,
controller controller
); );

Loading…
Cancel
Save