Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions app/javascript/notifications/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,17 @@ export function convert(resource) {
}

export function load(useLimit) {
const promises = [];
const limitFragment = useLimit ? `&limit=${maxNotifications}` : '';

promises.push(API.get(`/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc${limitFragment}`)
return API.get(`/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc${limitFragment}`)
.then((data) => {
const notifications = data.resources.map(convert);

return {
notifications,
subcount: data.subcount,
subcount: data.count
Copy link
Member Author

@Fryguy Fryguy Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to rename this key to count also, but that feels like a much more invasive change, so I left it for now.

};
}));

if (useLimit) {
// get real subcount
promises.push(API.get('/api/notifications'));
}

return Promise.all(promises).then(([{ notifications, subcount }, meta]) => ({
notifications,
subcount: meta ? meta.subcount : subcount,
}));
});
}

const bulkAction = (action) => (notifications) => API.post(`/api/notifications/`, {
Expand Down
Loading