feat: tag system for videos and channels
@zcesur this is still a work in progress. I want to start working on the controllers. I got the migrations to work. It was my fault after all.
But, please have a look and let me know if I'm on the right path.
/claim #70
So this is what I have currently, @zcesur.
Although, there's a slight issue. Whenever I press enter, It shows the "Settings updated" toast. So I guessed it was because I was updating the socket immediately like so:
send(self(), {:updated_tags, updated_tags})
I removed that line, and the same thing still happens.
I've only been able to do this for user (channel) via their settings. I don't know where to place the component for videos.
Hey @kaf-lamed-beyt, component looks great!
Whenever I press enter, It shows the "Settings updated" toast.
Sounds like it's triggering a form submission, why don't we use another key like Space instead of Enter?
I've only been able to do this for user (channel) via their settings. I don't know where to place the component for videos.
We don't need a separate input for videos, they should just inherit user's current tags when they're created
Hey @kaf-lamed-beyt, component looks great!
Ayy! Thanks!
Sounds like it's triggering a form submission, why don't we use another key like Space instead of Enter?
Oh okay, I'll adjust this.
We don't need a separate input for videos, they should just inherit user's current tags when they're created
Okay, great!
updated this too @zcesur
We'll need to clear the input after space, otherwise previous inputs are added into subsequent tags
ah! true! I tried setting the input value to an empty string after the add_tag event runs, I don't know it didn't work. I'll look at it again.
I had to go read up on elixirforum on why the input wasn't clearing. Apparently, it is a bit related to a LiveView issue since the field is not in a form. So, I had to use a hook to clear the field.
Screencast from 27-09-2024 19:55:41.webm
You can review again, @zcesur
Tag input works great! Video tags don't seem to inherit user tags though:
select id, tags from users where id = 2;
-- id | tags
-- ----+------------------
-- 2 | {elixir,typescript}
select id, user_id, tags from videos order by id desc limit 1;
-- id | user_id | tags
-- ----+---------+------
-- 42 | 2 | {}
Huh! Okay, I'll have a look at this now.
@zcesur, I've updated this. Kindly review.
I ran the query without the limit
id | user_id | tags
-----+---------+--------------------------------
127 | 1 | {typescript,zig,lua,sol,makin}
126 | 1 | {typescript,zig,lua,sol,makin}
125 | 2 |
124 | 2 |
123 | 2 |
122 | 2 |
121 | 2 |
120 | 2 |
119 | 1 | {typescript,zig,lua,sol,makin}
118 | 1 | {typescript,zig,lua,sol,makin}
117 | 1 | {typescript,zig,lua,sol,makin}
116 | 1 | {typescript,zig,lua,sol,makin}
115 | 1 | {typescript,zig,lua,sol,makin}
114 | 1 | {typescript,zig,lua,sol,makin}
113 | 1 | {typescript,zig,lua,sol,makin}
112 | 1 | {typescript,zig,lua,sol,makin}
111 | 1 | {typescript,zig,lua,sol,makin}
110 | 1 | {typescript,zig,lua,sol,makin}
109 | 1 | {typescript,zig,lua,sol,makin}
108 | 1 | {typescript,zig,lua,sol,makin
Hello @kaf-lamed-beyt! Sorry for the delay in reviewing this. Nice work! I have re-based your changes against the dev branch and also added some changes that de-duplicate Video#tags by coalescing the value with User#tags. This will allow us to have unique tags-per-video in the future and avoid updating every video for a user when they change their tags. I also added a couple of tag related helper functions.
This should get merged soon, once @zcesur gets a chance to take a look.
Thanks!
Thanks for taking a look @lastcanal!
I went through the improvements you made too. Fine work, ngl! 🍷
Looks great, thank you!
Thank you @zcesur!