Skip to content

Commit 17b20a4

Browse files
Fix/debit edit and sepa (#421)
* fixes a console log error console error existed due to the value of const thread being undefined. This mark as read request should only be sent when having visited a thread. * fixes a debug log mistake prior to this change, the app would keep logging that users lack permissions during hasPermission calls, no matter if the user actually lacked the permissions * fixes model related issues: improper linkargument for debit.collection.sepa route record name in model hook for debit.collection.edit route * lint fix
1 parent f251577 commit 17b20a4

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

app/routes/debit/collections/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default class EditCollectionRoute extends AuthenticatedRoute {
88
}
99

1010
model(params) {
11-
return this.store.findRecord('debit/collections', params.id, params);
11+
return this.store.findRecord('debit/collection', params.id, params);
1212
}
1313

1414
deactivate() {

app/routes/debit/collections/show.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class CollectionsIndexRoute extends AuthenticatedRoute {
2828
link: 'debit.collections.sepa',
2929
title: 'SEPA bestand downloaden',
3030
icon: 'download',
31-
linkArgument: collection,
31+
linkArgument: collection.id,
3232
canAccess: this.abilities.can('download sepa debit/collections')
3333
}
3434
];

app/routes/forum/categories/category/threads/thread/posts/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ export default class PostIndexRoute extends AuthenticatedRoute {
5454

5555
this.router.on('routeDidChange', () => {
5656
const thread = this.modelFor('forum.categories.category.threads.thread');
57-
this.fetch.fetch(`/forum/threads/${thread.id}/mark_read`, { method: 'POST' });
57+
if (thread) { // only mark as read if we are in a thread
58+
this.fetch.fetch(`/forum/threads/${thread.id}/mark_read`, { method: 'POST' });
59+
}
5860
});
5961
}
6062
}

app/services/session.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@ export default class SessionService extends BaseSessionService {
3535
let user = await this.store.query('user', { me: true, include: 'user_permissions' });
3636
await user.firstObject.permissions; // Load the permissions
3737
this.currentUser = user.firstObject;
38-
3938
Sentry.setUser({ id: this.currentUser?.id });
4039
}
4140
}
4241

4342
hasPermission(permissionName) {
4443
const hasPermission = !isNone(this.currentUser) && this.currentUser.hasPermission(permissionName);
45-
debug(
46-
`Current user does not have permission '${permissionName}'`,
47-
!ENV.APP.LOG_ACCESS_CONTROL || hasPermission,
48-
{ id: 'alpha-amber.session.no-permission' }
49-
);
44+
if (!hasPermission) {
45+
debug(
46+
`Current user does not have permission '${permissionName}'`,
47+
!ENV.APP.LOG_ACCESS_CONTROL || hasPermission,
48+
{ id: 'alpha-amber.session.no-permission' }
49+
);
50+
}
51+
5052
return hasPermission;
5153
}
5254
}

0 commit comments

Comments
 (0)