Fix order click on matches. Fix existing PGP on deleted robot rebuild.

This commit is contained in:
Reckless_Satoshi 2023-03-03 11:00:08 -08:00
parent 7f6b2bb79e
commit 09027deffc
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 54 additions and 28 deletions

View File

@ -97,6 +97,9 @@ class Logics:
# Try to import the public key
import_pub_result = gpg.import_keys(pub_key)
if not import_pub_result.imported == 1:
# If a robot is deleted and it is rebuilt with the same pubKey, the key will not be imported again
# so we assert that the import error is "Not actually changed"
if "Not actually changed" not in import_pub_result.results[0]["text"]:
return (
False,
{
@ -116,6 +119,7 @@ class Logics:
# Try to import the encrypted private key (without passphrase)
import_priv_result = gpg.import_keys(enc_priv_key)
if not import_priv_result.sec_imported == 1:
if "Not actually changed" not in import_priv_result.results[0]["text"]:
return (
False,
{

View File

@ -9,6 +9,7 @@ import MakerForm from '../../components/MakerForm';
import BookTable from '../../components/BookTable';
import { AppContext, AppContextProps } from '../../contexts/AppContext';
import { NoRobotDialog } from '../../components/Dialogs';
const MakerPage = (): JSX.Element => {
const {
@ -21,16 +22,19 @@ const MakerPage = (): JSX.Element => {
setCurrentOrder,
navbarHeight,
setPage,
setOrder,
setDelay,
} = useContext<AppContextProps>(AppContext);
const { t } = useTranslation();
const history = useHistory();
const maxHeight = (windowSize.height - navbarHeight) * 0.85 - 3;
const [showMatches, setShowMatches] = useState<boolean>(false);
const [openNoRobot, setOpenNoRobot] = useState<boolean>(false);
const matches = filterOrders({
orders: book.orders,
baseFilter: { currency: fav.currency === 0 ? 1 : fav.currency, type: fav.type },
baseFilter: { currency: fav.currency === 0 ? 1 : fav.currency, type: fav.type, mode: fav.mode },
paymentMethods: maker.paymentMethods,
amountFilter: {
amount: maker.amount,
@ -40,8 +44,25 @@ const MakerPage = (): JSX.Element => {
},
});
const onViewOrder = function () {
setOrder(undefined);
setDelay(10000);
};
const onOrderClicked = function (id: number) {
if (robot.avatarLoaded) {
history.push('/order/' + id);
setPage('order');
setCurrentOrder(id);
onViewOrder();
} else {
setOpenNoRobot(true);
}
};
return (
<Grid container direction='column' alignItems='center' spacing={1}>
<NoRobotDialog open={openNoRobot} onClose={() => setOpenNoRobot(false)} setPage={setPage} />
<Grid item>
<Collapse in={matches.length > 0 && showMatches}>
<Grid container direction='column' alignItems='center' spacing={1}>
@ -57,6 +78,7 @@ const MakerPage = (): JSX.Element => {
showControls={false}
showFooter={false}
showNoResults={false}
onOrderClicked={onOrderClicked}
/>
</Grid>
</Grid>

View File

@ -43,7 +43,7 @@ const RobotPage = (): JSX.Element => {
setInputToken(robot.token);
}
if (robot.nickname == null && robot.token) {
fetchRobot({ action: 'generate' });
fetchRobot({ action: 'generate', setBadRequest });
}
}, []);