1 00:00:00,970 --> 00:00:03,600 Let's open up our ReACT application and make a little change. 2 00:00:03,600 --> 00:00:05,540 This list of comments right here. 3 00:00:05,770 --> 00:00:06,780 Get going to find my code. 4 00:00:06,790 --> 00:00:12,160 Editor of On the client directory inside there then our see and remember all the comments are being 5 00:00:12,160 --> 00:00:17,650 rendered inside of a comment list deer's comment list inside of comment list we iterate over all the 6 00:00:17,650 --> 00:00:20,530 different comments and produce an ally for each one. 7 00:00:20,720 --> 00:00:26,650 So we probably want to take a look at the status of every comment and if it is equal to rejected or 8 00:00:26,650 --> 00:00:28,680 pending we don't really want to show this ally. 9 00:00:28,690 --> 00:00:32,340 We probably want to show something else or please least change out the content inside of it. 10 00:00:33,020 --> 00:00:38,480 So let's try putting together just a simple series of IF statements I can declare a new variable up 11 00:00:38,480 --> 00:00:39,840 here called content. 12 00:00:40,100 --> 00:00:50,370 Let's then say if comment dot status is equal to approved then content can be the actual comments content 13 00:00:53,630 --> 00:01:02,080 if comment dot status is equal to ending lovely content be. 14 00:01:02,090 --> 00:01:13,550 This comment is awaiting moderation and then if comment dot status is rejected content can instead be 15 00:01:14,630 --> 00:01:21,840 this comment has been rejected and of course we could refactor these three statements into a switch 16 00:01:21,840 --> 00:01:22,560 statement instead. 17 00:01:22,560 --> 00:01:24,590 If you would like I'll leave that up to you. 18 00:01:25,430 --> 00:01:30,410 Then finally rather than showing come incontinence side of here I'll display whatever the value of content 19 00:01:30,410 --> 00:01:35,800 is well put in content like so let's save this. 20 00:01:35,860 --> 00:01:40,000 I'm gonna flip back over and you'll notice that the comment that had the word orange inside of it has 21 00:01:40,000 --> 00:01:41,080 now been replaced with. 22 00:01:41,080 --> 00:01:43,020 This comment has been rejected. 23 00:01:43,180 --> 00:01:45,440 Very good. 24 00:01:45,470 --> 00:01:50,270 I would like to also test out the case in which we do not undergo moderation immediately. 25 00:01:50,270 --> 00:01:55,160 So this will be a case in which maybe it takes a human intervention say something like five minutes 26 00:01:55,160 --> 00:01:59,170 10 minutes 20 minutes to actually come in and moderate any given comment. 27 00:01:59,210 --> 00:02:05,090 So if we do not get that status updated from pending over to rejected or approved then we should instead 28 00:02:05,090 --> 00:02:09,920 see this comment is a waiting moderation to simulate that case. 29 00:02:09,920 --> 00:02:14,790 We can go back over to our terminal and just shut down the moderation service entirely. 30 00:02:14,910 --> 00:02:16,260 I'll go back or my journal. 31 00:02:16,280 --> 00:02:19,590 I'm going to find a window that is running my moderation service. 32 00:02:19,780 --> 00:02:24,280 I'm going to stop that operation and I'll go and create a new comment 33 00:02:28,580 --> 00:02:29,970 I'll submit it. 34 00:02:30,080 --> 00:02:32,540 Now that comment is gonna be stuck in the pending state. 35 00:02:32,540 --> 00:02:37,670 There's nothing to actually approve it and move it forward so we can refresh and we should see this 36 00:02:37,670 --> 00:02:39,590 comment is awaiting moderation. 37 00:02:39,650 --> 00:02:41,520 Awesome OK. 38 00:02:41,580 --> 00:02:45,810 So this looks pretty good but I want to point out that there kind of is a downside to our application 39 00:02:45,810 --> 00:02:46,850 right now. 40 00:02:46,890 --> 00:02:49,440 We just turned off the app moderation service. 41 00:02:49,440 --> 00:02:54,450 If we start up the moderation service again so flip back over my terminal and start it back up. 42 00:02:54,480 --> 00:03:00,590 Well now the moderation service is running but the broker or event bus tried to send an event over. 43 00:03:00,600 --> 00:03:06,000 While the moderation service was down so we're now in a scenario where we had a temporary interruption 44 00:03:06,030 --> 00:03:11,400 to our moderation service but we lost events in that window and so now our entire application is kind 45 00:03:11,400 --> 00:03:12,970 of out of sync so to speak. 46 00:03:13,020 --> 00:03:17,700 We don't have any way to kind of fast forward and get those missing events back over to our moderation 47 00:03:17,700 --> 00:03:18,820 service. 48 00:03:18,820 --> 00:03:22,460 So maybe that's something we should try to at least think about and figure out some way to fix. 49 00:03:22,500 --> 00:03:25,560 Let's take a pause right here and see if we can't figure out some way of dealing with that in just a 50 00:03:25,560 --> 00:03:25,830 moment.