Skip to content

Commit bc355fb

Browse files
committed
fixing some bugs the wife found ;)
1 parent 797421f commit bc355fb

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

lib/api/routes/jobRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobRouter.post('/', async (req, res) => {
173173
return;
174174
}
175175

176-
if (settings.demoMode && jobFromDb.name === DEMO_JOB_NAME) {
176+
if (settings.demoMode && jobFromDb && jobFromDb.name === DEMO_JOB_NAME) {
177177
res.send(new Error('Sorry, but you cannot change the Status of our Demo Job ;)'));
178178
return;
179179
}

lib/api/routes/listingsRouter.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { isAdmin as isAdminFn } from '../security.js';
1010
import logger from '../../services/logger.js';
1111
import { nullOrEmpty } from '../../utils.js';
1212
import { getJobs } from '../../services/storage/jobStorage.js';
13+
import { getSettings } from '../../services/storage/settingsStorage.js';
1314

1415
const service = restana();
1516

@@ -107,7 +108,13 @@ listingsRouter.post('/watch', async (req, res) => {
107108

108109
listingsRouter.delete('/job', async (req, res) => {
109110
const { jobId } = req.body;
111+
const settings = await getSettings();
110112
try {
113+
if (settings.demoMode) {
114+
res.send(new Error('Sorry, but you cannot remove listings in demo mode ;)'));
115+
return;
116+
}
117+
111118
listingStorage.deleteListingsByJobId(jobId);
112119
} catch (error) {
113120
res.send(new Error(error));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fredy",
3-
"version": "19.3.1",
3+
"version": "19.3.2",
44
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
55
"scripts": {
66
"prepare": "husky",

ui/src/views/listings/ListingDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export default function ListingDetail() {
315315
>
316316
{listing.isWatched === 1 ? 'Watched' : 'Watch'}
317317
</Button>
318-
<Text link={{ href: listing.link }} icon={<IconLink />} underline>
318+
<Text link={{ href: listing.link, target: '_blank' }} icon={<IconLink />} underline>
319319
Open listing
320320
</Text>
321321
</Space>

ui/src/views/login/Login.jsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ export default function Login() {
6262
<div className="login__logoWrapper">
6363
<Logo width={250} white />
6464
</div>
65+
66+
{demoMode && (
67+
<Banner
68+
fullMode={true}
69+
type="info"
70+
bordered
71+
closeIcon={null}
72+
description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in."
73+
style={{ marginBottom: '1.5rem' }}
74+
/>
75+
)}
76+
6577
<form onSubmit={(e) => e.preventDefault()}>
6678
{error && <Banner type="danger" closeIcon={null} description={error} style={{ marginBottom: '1rem' }} />}
6779
<div className="login__inputGroup">
@@ -100,17 +112,6 @@ export default function Login() {
100112
<Button block type="primary" onClick={tryLogin} theme="solid" style={{ marginTop: '1rem' }}>
101113
Login
102114
</Button>
103-
104-
{demoMode && (
105-
<Banner
106-
fullMode={true}
107-
type="info"
108-
bordered
109-
closeIcon={null}
110-
description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in."
111-
style={{ marginTop: '1.5rem' }}
112-
/>
113-
)}
114115
</form>
115116
</div>
116117
</div>

0 commit comments

Comments
 (0)