Skip to content

Commit 0c3e693

Browse files
committed
Improved no access error messages.
1 parent 204fdd6 commit 0c3e693

File tree

9 files changed

+19
-8
lines changed

9 files changed

+19
-8
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Dates should be in`YYYY-MM-DD` format and versions are in [semantic versioning](
88
### Fixed
99

1010
- No italics on tip bulb.
11+
- Improved no access error messages.
1112

1213
### Maintenance
1314

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adminima",
3-
"version": "0.8.5",
3+
"version": "0.8.6",
44
"private": true,
55
"scripts": {
66
"dev": "vite dev",

src/routes/org/[orgid]/change/[changeid]/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization.js';
2+
import { noAccess } from '$types/Locales.js';
23
import { error } from '@sveltejs/kit';
34

45
export async function load({ parent, params }) {
@@ -14,7 +15,7 @@ export async function load({ parent, params }) {
1415

1516
if (change === null || roles === null || profiles === null || processes === null)
1617
error(404, {
17-
message: "This change doesn't exist or isn't visible to you."
18+
message: noAccess('change')
1819
});
1920

2021
return {

src/routes/org/[orgid]/people/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization';
2+
import { noAccess } from '$types/Locales';
23
import { error } from '@sveltejs/kit';
34

45
export async function load({ parent }) {
@@ -14,7 +15,7 @@ export async function load({ parent }) {
1415

1516
if (roles === null || profiles === null || assignments === null || teams === null)
1617
error(404, {
17-
message: "This role doesn't exist or isn't visible to you."
18+
message: noAccess('person list')
1819
});
1920

2021
return {

src/routes/org/[orgid]/person/[profileid]/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization';
2+
import { noAccess } from '$types/Locales.js';
23
import { error } from '@sveltejs/kit';
34

45
export async function load({ parent, params }) {
@@ -29,7 +30,7 @@ export async function load({ parent, params }) {
2930
changes === null
3031
)
3132
error(404, {
32-
message: "This profile doesn't exist or isn't visible to you."
33+
message: noAccess('profile')
3334
});
3435

3536
return {

src/routes/org/[orgid]/process/[processid]/+page.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization';
2+
import { noAccess } from '$types/Locales.js';
23
import { error } from '@sveltejs/kit';
34
import { validate as isValidUUID } from 'uuid';
45

@@ -11,7 +12,7 @@ export async function load({ parent, params }) {
1112

1213
if (process === null)
1314
error(404, {
14-
message: "This process either isn't visible to you or doesn't exist."
15+
message: noAccess('process')
1516
});
1617

1718
const [
@@ -39,7 +40,7 @@ export async function load({ parent, params }) {
3940
profiles === null
4041
)
4142
error(404, {
42-
message: "This process either isn't visible to you or doesn't exist."
43+
message: noAccess('process')
4344
});
4445

4546
return {

src/routes/org/[orgid]/role/[roleid]/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization';
2+
import { noAccess } from '$types/Locales.js';
23
import { error } from '@sveltejs/kit';
34
import { validate as isValidUUID } from 'uuid';
45

@@ -35,7 +36,7 @@ export async function load({ parent, params }) {
3536
hows === null
3637
)
3738
error(404, {
38-
message: "This role doesn't exist or isn't visible to you."
39+
message: noAccess('role')
3940
});
4041

4142
return {

src/routes/org/[orgid]/team/[teamid]/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Organization from '$database/Organization';
2+
import { noAccess } from '$types/Locales.js';
23
import { error } from '@sveltejs/kit';
34

45
export async function load({ parent, params }) {
@@ -11,7 +12,7 @@ export async function load({ parent, params }) {
1112

1213
if (team === null || roles === null)
1314
error(404, {
14-
message: "This team doesn't exist or isn't visible to you."
15+
message: noAccess('team')
1516
});
1617

1718
return {

src/types/Locales.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ export type Locale = {
3535
noTeam: string;
3636
};
3737
};
38+
39+
export function noAccess(type: string) {
40+
return `This ${type} either isn't visible to you or doesn't exist. Expect to have access? Make sure you're logged in.`;
41+
}

0 commit comments

Comments
 (0)