Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generic timeline #525

Merged
merged 58 commits into from
Oct 7, 2019
Merged

Add support for generic timeline #525

merged 58 commits into from
Oct 7, 2019

Conversation

trinity-1686a
Copy link
Contributor

@trinity-1686a trinity-1686a commented Apr 11, 2019

fix #450
Query example : lang in [fr, en] and license in [cc] or followed or title contains "Plume"

todolist

  • design a query language for timeline definition
  • make a parser for it
  • make the parser return meaning-full syntax error
  • add tests for parser
  • make a query executor for it
  • make the query executor return meaning-full runtime error (list not found...)
  • add a keyword to show/hide boosts/likes
  • add tests for query executor
  • define timeline in sql model
  • implement timeline in rust
  • add tests for timeline
  • define list in sql model
  • implement lists in rust
  • add tests for lists
  • create migration for pgsql
  • create migration for sqlite
  • modify circleci config to run migration before compilling
  • make a gui to manage timelines for user
  • make a gui to manage timelines for instance
  • make a gui to manage lists for user&instance
  • replace old timeline system with this one
  • add tests for front end??

Abstract syntax for query language

S -> A or S | A
A -> B and A | B
B -> ( S ) | C
C -> not D | D
D -> E in L | F contains W | G
E -> blog | author | license | tags | lang
F -> title | subtitle | content
G -> followed H | has_cover | local | all
H -> include I H | exclude I H | ε
I -> boosts | boost | likes | like
L -> [ M ] | W
M -> W, M | W
W -> <char+>

@trinity-1686a trinity-1686a added A: Front-End Related to the front-end C: Feature This is a new feature S: Incomplete This PR is not complete yet A: Backend Code running on the server labels Apr 11, 2019
@codecov
Copy link

codecov bot commented Apr 11, 2019

Codecov Report

Merging #525 into master will increase coverage by 5.48%.
The diff coverage is 69.63%.

@@            Coverage Diff             @@
##           master     #525      +/-   ##
==========================================
+ Coverage   34.35%   39.83%   +5.48%     
==========================================
  Files          68       72       +4     
  Lines        8104     9368    +1264     
  Branches     1923     2219     +296     
==========================================
+ Hits         2784     3732     +948     
- Misses       4538     4580      +42     
- Partials      782     1056     +274

@trinity-1686a trinity-1686a force-pushed the timeline branch 2 times, most recently from 051bb5c to f938ae6 Compare April 12, 2019 08:40
@trinity-1686a trinity-1686a force-pushed the timeline branch 2 times, most recently from b89b07b to a01341d Compare April 13, 2019 20:38
also run migration before compiling, so schema.rs is up to date
and refactor other tests to use begin_transaction
Copy link
Contributor Author

@trinity-1686a trinity-1686a left a comment

Choose a reason for hiding this comment

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

at first glance this looks good. I'll run some tests when I get the time, to make sure all is ok

src/routes/timelines.rs Show resolved Hide resolved
Copy link
Contributor Author

@trinity-1686a trinity-1686a left a comment

Choose a reason for hiding this comment

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

I think you are not calling the query parser when handling local like/reshare

plume-models/src/likes.rs Outdated Show resolved Hide resolved
plume-models/src/reshares.rs Outdated Show resolved Hide resolved
@elegaanz
Copy link
Member

elegaanz commented Jul 7, 2019

Thanks for the review, everything is fixed now.

But… I think posts are correctly removed from timelines when deleted, but not when un-liked or un-boosted (but this can probably be fixed later?).

@trinity-1686a
Copy link
Contributor Author

they are remove because of cascading remove from sql. The easiest way to have the same comportment might be to add a reference to the like/reshare in 2 optional (and useless) columns, that cascade remove too

Copy link
Contributor Author

@trinity-1686a trinity-1686a left a comment

Choose a reason for hiding this comment

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

I can't approve this myself as it's my pr, so if someone could review it that would be nice
we should also do a little todolist of things yet missing.
What come to mind is :

  • boost/like deletion doesn't remove from tl
  • new tl are not automatically filled (make a magic sql query that does this?)
  • related to the above, modifying the query of a tl should clear the tl and rebuild it
  • having an actual way to modify a tl, else they are not really custom
  • I believe query parsing errors are not translated

src/routes/timelines.rs Show resolved Hide resolved
@elegaanz
Copy link
Member

I can't approve this myself as it's my pr, so if someone could review it that would be nice

I seems OK for me (excepted for the things you listed), but I worked on it too, maybe you want to review it, @igalic ? (don't feel forced to do it, I think we can safely merge it if someone else approves the few commits I pushed).

And for the issue you listed, maybe it could be handled in another PR ? The basics are here, and this branch is already pretty big…

@igalic
Copy link
Contributor

igalic commented Jul 23, 2019

I'll see what i can do tonight.

@trinity-1686a
Copy link
Contributor Author

What I listed was just to have a small todolist of things to add later, not now. This should end in an issue to not get forgotten

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

weak 👀 very tired, not finished this review sorry

plume-models/src/instance.rs Show resolved Hide resolved
plume-models/src/lists.rs Show resolved Hide resolved
plume-models/src/lists.rs Outdated Show resolved Hide resolved
plume-models/src/lists.rs Outdated Show resolved Hide resolved
igalic
igalic previously requested changes Jul 26, 2019
Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

slightly less tired, more comments, would love to hear your feedback

plume-models/src/blogs.rs Show resolved Hide resolved
build.rs Show resolved Hide resolved
plume-models/src/lists.rs Outdated Show resolved Hide resolved
plume-models/src/lists.rs Show resolved Hide resolved
plume-models/src/timeline/query.rs Outdated Show resolved Hide resolved
plume-models/src/migrations.rs Outdated Show resolved Hide resolved
plume-models/src/lists.rs Outdated Show resolved Hide resolved
plume-models/src/timeline/mod.rs Show resolved Hide resolved
.map_err(Error::from)
} else {
timeline_definition::table
.filter(timeline_definition::user_id.is_null())
Copy link
Contributor

Choose a reason for hiding this comment

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

again, this duplication begs to be solved generically

@trinity-1686a
Copy link
Contributor Author

and I failed my merge >_<

igalic
igalic previously approved these changes Sep 13, 2019
Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

👍

}
})
{
Err(err)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

That is 21 lines of error handling

}
})
{
Err(err)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

that's another 21 lines of error handling

Copy link
Contributor

Choose a reason for hiding this comment

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

there should be a better way to do that …
(I'm not saying you have to find that now)

/*
#[test]
fn test_matches_lists_saved() {
let r = &rockets();
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this one commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea

plume-models/src/timeline/mod.rs Show resolved Hide resolved
 Conflicts:
	plume-models/src/instance.rs
	src/routes/instance.rs
Copy link
Member

@elegaanz elegaanz left a comment

Choose a reason for hiding this comment

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

LGTM, this great PR have been waiting for too long!

@elegaanz elegaanz merged commit 006b44f into master Oct 7, 2019
@elegaanz elegaanz deleted the timeline branch October 7, 2019 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Backend Code running on the server A: Front-End Related to the front-end C: Feature This is a new feature S: Ready for review This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic timelines
3 participants