Add Favorites TL to user profile, add some initial support for MastoAPI #1734

Closed
hj wants to merge 0 commits from gitlab-mr-iid-462 into develop
Owner

Originally i wanted to just add Favorites timeline and add support for passing timeline object as is instead of using timelineName.
Turns out we also don't have QvitterAPI for it!

Currently this MR strives to change architecture a bit:

Instead of computing various stuff in modules/statuses.js (or users.js or any module, really) and such we instead convert incoming data to some middle format and resolve missing stuff in place. So for example instead of calling fileTypeService.fileType() for every attachment in templates we resolve it once for each attachment in each status when fetching the data. Another example is checking for #nsfw in status.text when adding statuses to timeline, instead check right after fetching.

This should decouple UI and logic code from specific API, light up several modules and allow for mixing and matching different APIs until we completely switch to MastoAPI and deprecate QvitterAPI.

Originally i wanted to just add Favorites timeline ~~and add support for passing timeline object as is instead of using timelineName.~~ Turns out we also don't have QvitterAPI for it! Currently this MR strives to change architecture a bit: Instead of computing various stuff in `modules/statuses.js` (or `users.js` or any module, really) and such we instead convert incoming data to some middle format and resolve missing stuff in place. So for example instead of calling `fileTypeService.fileType()` for every attachment in templates we resolve it once for each attachment in each status when fetching the data. Another example is checking for `#nsfw` in `status.text` when adding statuses to timeline, instead check right after fetching. This should decouple UI and logic code from specific API, light up several modules and allow for mixing and matching different APIs until we completely switch to MastoAPI and deprecate QvitterAPI.
Author
Owner

remove

remove
Author
Owner

ah for fucks sake

ah for fucks sake
Owner

Lots of changes and not sure about the reason for everything so hard to review, but at a quick read-through it all looks ok to me

Lots of changes and not sure about the reason for everything so hard to review, but at a quick read-through it all looks ok to me
Owner

should it be there according to the API or not? also is screen name the @ or the visible name?

should it be there according to the API or not? also is screen name the @ or the visible name?
Owner

I really think it would be beneficial to move all test files to the same dir with the source files. Not only will we get rid of ../../../../../../ and also easier to find the test files in a treeview, and it's harder to ignore them when they're right there.

I really think it would be beneficial to move all test files to the same dir with the source files. Not only will we get rid of ../../../../../../ and also easier to find the test files in a treeview, and it's harder to ignore them when they're right there.
Owner

I know there isn't any agreement for it, but what I like to do is have the highest level describe be the function name (nested inside module/functionality/some other arbitrary grouping), makes it super easy to figure out what the test is for.

I know there isn't any agreement for it, but what I like to do is have the highest level describe be the function name (nested inside module/functionality/some other arbitrary grouping), makes it super easy to figure out what the test is for.
Owner

Oh and of course doesn't have to be done here (I hate how all comments are "unresolved" automatically on gitlab), but I would rather use abs paths in the current format instead of ..

Oh and of course doesn't have to be done here (I hate how all comments are "unresolved" automatically on gitlab), but I would rather use abs paths in the current format instead of ..
Author
Owner

It's only ever used in this one particular place:
image
MastoAPI doesn't provide this and it's a very minor thing IMO, it could be worked around by changing UI to find user via id in usersObject instead of using the data. Not sure if I want to put it into this MR tho.

It's only ever used in this one particular place: ![image](/attachments/34125949-1f1f-4410-8fbb-7c29e5772e57) MastoAPI doesn't provide this and it's a very minor thing IMO, it could be worked around by changing UI to find user via id in `usersObject` instead of using the data. Not sure if I want to put it into this MR tho.
8.9 KiB
Author
Owner

Usually highest level is module, it makes it easier to use .only (which i forgot to remove) and .skip to speed tests up when developing/TDDing by only running relevant tests. I'll rename 'statuses' to 'parseStatus' tho.

Usually highest level is module, it makes it easier to use `.only` (which i forgot to remove) and `.skip` to speed tests up when developing/TDDing by only running relevant tests. I'll rename `'statuses'` to `'parseStatus'` tho.
Owner

err, highest and lowest mixed up

err, highest and lowest mixed up
Owner

yeah not crucial at all (considering it was completely missing from pleroma for ages), better to figure it out from the user object when actually redoing the status header later

yeah not crucial at all (considering it was completely missing from pleroma for ages), better to figure it out from the user object when actually redoing the status header later
Author
Owner

???

Highest is entity_normalizer ("API Entities normalizer")
Then come function parseStatus()
Lowest a bunch of tests that test one major branch in code that handles Qvitter-specific things (parseStatus and others deal with both MastoAPI and QvitterAPI, they all have "common" code for stuff that matches up and two big if branches for differences between APIs including different naming)
and finally, it that test specific things in context.

??? Highest is `entity_normalizer` ("API Entities normalizer") Then come function `parseStatus()` Lowest a bunch of tests that test one major branch in code that handles Qvitter-specific things (`parseStatus` and others deal with both MastoAPI and QvitterAPI, they all have "common" code for stuff that matches up and two big `if` branches for differences between APIs including different naming) and finally, `it` that test specific things in context.
Owner

yeah I got them mixed up don't worry, you got it right, I was thinking in terms of most nested => highest.

describe('module', () => { describe('function', () => { it('blows up', () => {}) }) })

yeah I got them mixed up don't worry, you got it right, I was thinking in terms of most nested => highest. `describe('module', () => { describe('function', () => { it('blows up', () => {}) }) })`

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe!1734
No description provided.