Reviewing View Components4:00
Yeah. We can see all of these new components here. All right. So, activities, a general convention, I would say for your own sanity, is make sure you name your view components as similar as possible to how you will create the tags. So, you can name these anything you want. But if this were called profileOutline or something like that and it corresponds to an activities component, it's annoying, right? You need to follow basic conventions here. So, in this case, without knowing anything about the PR, of course, I already know that's going to correspond to activities.view. Now, there's some basic formatting I would change here, but I'm not really worried about that for the initial review. This is mostly research for us. Okay. So, we have the user that we're displaying activities for and then we're passing that through. All right. And then we have items. So, when this is created, it's fetching the profiles. Okay. So, I guess,
Controller Data Flow4:43
the User that we're displaying activities for and then we're passing that through. All right. And then we have items. So, when this is created, it's fetching the profiles. Okay. So, I guess, are we no longer passing that through? I'm going to go to my ProfilesController. So, that is passing through the activity feed, but is that no longer being used at all? Refresh. Refresh. Yeah. These are things to think about. So, if we're passing that through and it's never being referenced, one, can we set the initial state to that or can we just get rid of it entirely and then make this responsible for fetching its own data? Anyways, the URL is profiles/{username}/activity. I think that's new. That will load ProfilesController at index. Okay. index should go on top. It doesn't have to, but as a general rule, I would always put index on top of show. Anyways, that's going to return activity paginated feed.
Fixing Paginated Feed Naming5:36
controller at index. Okay. Index should go on top. It doesn't have to, but as a general rule, I would always put index on top of show. Anyways, that's going to return activity paginated feed. This can be a little confusing to me because we have activity feed up there and then here, it's a paginated feed. Ideally, we would just merge those. So, if we could possibly do something like activity feed and then paginate or something like that, make that a query scope, that would be ideal versus having one method for feed and then another for the paginated version. Plus, we're paginating it after, which is confusing, right? You're expecting a paginated feed, but what's the point in calling it in that way if we call paginate after? Static, where are you? Yeah. So, in this case, you can see this is not the correct name. In no way is this fetching a paginated feed. All it's doing is returning the activities for the given user in descending order and eager loading the.
Debugging Missing Subject Path8:17
Okay. Here we go. If there are replies count greater than zero, only in that case do we render this. Okay. So, let's... Oh, I can't even click on that either. What's going on here? That should be clickable. Let's see at the top. All right. Here is the title, and I'm going to thread the Here is the title, and the href is activitySubjectPath. Okay. So, let's open up the view console. Something's up here, and I'm wondering if it's just a compilation issue. So, we have our activityThread and that activityLayout. So, it's all wrapped within activityLayout. What is that for? Okay. Just to reuse some HTML. Okay. So, what we want to figure out is the activitySubjectPath is obviously not working. As you can see there, it's not even rendering. Okay. So, once again, activity here. So, we need activity.subject, and there is no path there. This could be assuming maybe an older version.
As you can see there, it's not even rendering. Okay. So, once again, activity here. So, we need activity.subject, and there is no path there. This could be assuming maybe an older version of the code base. I have some memory of getting rid of something along the lines of this, or it could be based on... I don't know. Let's see. Here, I would definitely want a lot more spacing. I'll need to go through that to figure out what's going on there, but the subject... So, on an Activity model, the subject refers to the thing that created the activity. So, that will be a reply or a thread or something like that. So, we can see here if I fetch the subject on the view model. Let's see. We should be able to see. Yeah. The subject type is, in fact, a thread. So, this is all the information for the thread itself. So, in this case, if we switch back... Where were we? This is trying to get the path, but it looks like we're not making that available.
Verifying Activity Reply Badges11:43
we need to take a look at, and any of these are fine. So, we'll say if you created a Reply, that now loads ActivityReply. That has a section at the top, so that corresponds to this, and then we have the heading, which is this, and then we have the body, and that is this section right here, and then here are the badges. So, some of this looks a little scary. It's just SVG. SVG always gets a little tricky because you just kind of have to spit it out in your view components. Anyways, so I want to see here, all right, so this is the favorites that corresponds to that activity.subject.favoriteCount. Okay, so let's take a look at that just so I fully get it. So, console, whoops, view, activities, reply, subject, and then favoritesCount is grabbing that there. Okay, so if we close that out, that's all good, no problem there. Next here is whether it has been marked as best, and in this case, it hasn't. So, let's see. We're signed in as John Doe
Implementing XP Attribute12:38
that there. Okay, so if we close that out, that's all good, no problem there. Next here is whether it has been marked as best, and in this case, it hasn't. So, let's see. We're signed in as JohnDoe at the moment, so let's find that. Let's mark this as the best answer. All right, come back, give that a refresh. Okay, so let's find it. There it is. Okay, so best answer is now showing up there. That's good. I'm still confused about the xp, though. So, there's our next step, activity.subject.xp. So, I'm curious, is that the experience earned for that particular operation? That would be cool if it is. Let's take a look. Which one do we need? Here it is, activity, subject, but once again, I'm not seeing xp anywhere there. So, let's do this. He did say it's a work in progress, so this may be something that hasn't yet been implemented. I'm just going to look for xp. Okay, so on reply, there is this method called xp, and then here's
He did say it's a work in progress, so this may be something that hasn't yet been implemented. I'm just going to look for XP. Okay, so on reply, there is this method called getXpAttribute, and then here's XP, and then here's the section where you render the XP, but there's nothing that actually passes that experience to our view instance, at least from what I can see here. I don't see any reference to that. Yeah. Okay, so let's do this. Let's come back. We'll go to reply, get XP, and we could do XP attribute here, and then there is an append property we can use. We're already doing that. I think one refactor I'm going to do is just extract that to a simple toArray method, and that way you have a single place to override and declare exactly what you want the array form or the JSON form to look like. I think that will be a little more clear. What is it called? XP. Let's see. getXpAttribute. Let's change that, and then give it a refresh. Take a look now,
