Make Flags appear in more places and do more things.
- Search objects based on "Projects that I flagged", etc.
- Show flags in search results
- Show flags in hovercards?
avivey | |
Jul 1 2023, 09:15 |
F1402115: image.png | |
Feb 22 2024, 22:28 |
Make Flags appear in more places and do more things.
rP Phorge | |||
D25548 | rPea554af47649 Add (Advanced) Custom Fields to Item List |
Did some digging, and it looks like it would be more involved - it would require adding support code in the query engine (like Spaces), and making another DB call (Flags are their own objects), or re-implement Flags using Edges.
This is totally scarying but I'm quite interested in exploring the proposed solution :)
We don't allow cross-application table joins
Any insight into why this is the case? Also do you know if there’s any documentation to what at edge is, other examples of edge things?
We don't allow cross-application table joins
The logic is that each application's database might live in a different physical db cluster (for the really big installs), so it would be technically impossible to make such a join.
any documentation to what at edge is, other examples of edge things?
Existing things that are Edges are Subscriptions, Task Dependency relations, Task-Revision relations (There's a full list in https://we.phorge.it/config/module/edge/).
The docs are kinda short: https://we.phorge.it/book/contrib/article/using_edges/
The bird's-eye view for edges is that they are stored twice - once in each side of the edge, so they are always "local" to any application's DB. They have source phid, target phid, and metadata.
Each edge also has a "reverse edge" for the other direction (so "Revision in Task" edge has Task as a source and is stored in Differntial's DB, and it has a corresponding "Task has Revision" edge with Task as the source which is stored in Maniphest's DB).
Interestingly: https://secure.phabricator.com/T10574 argues for removal of the additional data from edges.
I looked into this again.
Instead of completely re-implementing, I'm thinking to add the Edges with only the Color (which I imagine is useful in the both use-cases described) in the edge-data, and have the rest of the data left where it is now.
The only unknown right now is "how to create an edge without the relevant transactions", and how to make the extra search operator.
btw, for the "search" use-case I'm describing, I'm imagining something like a Function on Users/project, so I can search, for example "Tasks that are assigned to users which I flagged with a green flag" or "Tasks that have a tag that I flagged with a blue flag".
And also, "Revisions that I flagged with any flag".
This was both harder and easier then I expected. I got to crash the IDE and hard-code a bunch of stuff, but this actually works. Didn't even start on the Edges implementation yet - I'm directly using the Flags table.
Searching for Tasks like that takes at 2 round trips to the DB - one to get the project PHIDs that are tagged, and one for Tasks. Adding edges won't actually make this better?
I changed my mind again. No need for edges (short story is, getting the "color" property from the edge is annoying).
Instead, here's the plan: