updated rust version, minor fixes
This commit is contained in:
@@ -26,7 +26,8 @@ input {
|
||||
overflow-y: auto;
|
||||
margin: auto;
|
||||
padding: 20px 30px;
|
||||
background-color: #fff;
|
||||
background-color: var(--color-background-soft);
|
||||
color: var(--color-text);
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
|
||||
transition: all 0.3s ease;
|
||||
@@ -34,7 +35,7 @@ input {
|
||||
|
||||
.modal-header h3 {
|
||||
margin-top: 0;
|
||||
color: #42b983;
|
||||
color: var(--color-heading);
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
|
||||
@@ -73,9 +73,14 @@ const fetchData = async () => {
|
||||
'user-token': localStorage.getItem("user-token")
|
||||
}
|
||||
});
|
||||
const items = [];
|
||||
response.data.feeds.forEach(feed => {
|
||||
feed.items.forEach(item => feeds.value.push({ ...item, feedTitle: feed.title }));
|
||||
feed.items.forEach(item => items.push({ ...item, feedTitle: feed.title }));
|
||||
});
|
||||
// timestamps are zero-padded "YYYY-MM-DD HH:MM:SS" strings, so a plain
|
||||
// lexicographic comparison sorts them chronologically.
|
||||
items.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
||||
feeds.value = items;
|
||||
await nextTick();
|
||||
setupIntersectionObserver();
|
||||
} catch (error) {
|
||||
@@ -109,6 +114,10 @@ async function sync() {
|
||||
let observer; // Declare observer outside the setup function
|
||||
|
||||
function setupIntersectionObserver() {
|
||||
if (observer) {
|
||||
observer.disconnect();
|
||||
}
|
||||
|
||||
observer = new IntersectionObserver(handleIntersection, {
|
||||
root: null, // Use the viewport as the root
|
||||
rootMargin: '0px',
|
||||
|
||||
@@ -59,6 +59,45 @@ describe('RssFeeds', () => {
|
||||
expect(wrapper.text()).not.toContain('No unread articles.')
|
||||
})
|
||||
|
||||
it('sorts articles by date across feeds, newest first', async () => {
|
||||
axios.get.mockResolvedValueOnce({
|
||||
data: {
|
||||
feeds: [
|
||||
{
|
||||
title: 'Old Feed',
|
||||
items: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Older article',
|
||||
content: '<p>old</p>',
|
||||
url: 'https://example.test/1',
|
||||
timestamp: '2026-01-01 10:00:00',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'New Feed',
|
||||
items: [
|
||||
{
|
||||
id: 2,
|
||||
title: 'Newer article',
|
||||
content: '<p>new</p>',
|
||||
url: 'https://example.test/2',
|
||||
timestamp: '2026-02-01 10:00:00',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
const wrapper = mount(RssFeeds)
|
||||
await flushPromises()
|
||||
|
||||
const titles = wrapper.findAll('.feed-title').map(el => el.text())
|
||||
expect(titles).toEqual(['Newer article', 'Older article'])
|
||||
})
|
||||
|
||||
it('syncs feeds for the current user', async () => {
|
||||
axios.get.mockResolvedValue({ data: { feeds: [] } })
|
||||
axios.post.mockResolvedValueOnce({ status: 200 })
|
||||
|
||||
Reference in New Issue
Block a user