[Sprint/QuietQuail](fix): Blog & media edit updated to new nsfw system #1936
Depends on engine!384
Summary
This changes first part encompasses a fix to the NSFW system, wherein even though the selector shows as blue, it does not respect the values in it without clicking it, so a user may believe they are posting something as NSFW, but in actuality the post would be untagged.
The other change, moves the future blogs to the mature blog system, to the NSFW blog system. When creating a new blog, values must also be respected as in the first part of this upgrade, however, when editing, existing values must be shown.
Testing
Blog
Example testing video - https://streamable.com/ps39o
- Post NSFW Post, give it a few random reasons, remember them.
- Post a blog - do not touch the selector
- Edit blog, check the selector - it should be the same as your last post.
- Change the NSFW tags
- Edit again and ensure the change stuck
- Check the changes are respected on the channel sidebar
- Post a non-NSFW blog post
- Edit it to be NSFW, enter edit mode again to check it 3. worked
- Make a normal post with different tags.
- Edit blog and check it ignores those tags, and has the correct ones for the blog.
- In one of the NSFW blogs activity posts on the feed, mark it as non-nsfw
- Check change propegates by clicking the blog, editing, checking nothing is checked
- Ensure the sidebar of the blog does not have the explicit overlay now.
- Edit it back to be NSFW in the activity.
- Check the change propegated in the same fashion.
- Ensure blogs in sidebar are flagged appropriately
Poster
Example testing video - https://streamable.com/3r8d2
- Make a non-nsfw post.
- Edit to be nsfw.
- Edit again to make sure the tags stuck.
- Remove NSFW from the activity, check the activity is no longer nsfw.
- Make a new NSFW post, remember the nsfw tags you placed on it.
- Nav to another page like wallet and back.
- Post, it should be NSFW.
- Make another post with a different config to change the nsfw selectors defaults.
- On the post in step 7, edit and check the nsfw values are correct.
Media
Example testing video - https://streamable.com/qokw4
- Post NSFW media (remember which nsfw reasons you selected).
- Make another random post with another configuration of NSFW reasons.
- Check the activity, edit it, it should show the reasons correctly, and not show the values of your last post.
- Edit it to not be NSFW, this should be respected
- Edit it back to being NSFW.
- Go to the media page for the activity (if you are seeing media modals, just reload the url in the url box).
- NSFW values should be respected (check via edit)
- Edit away the changes
- Check changes apply to the activity on the newsfeed.
- Go back onto the media page.
- Make it NSFW again.
- Check changes propagate.
Admin
Example testing video - https://streamable.com/v8hye
- Watch XHRs
- Visit channel
- Ensure no spam calls are made to moderation endpoints
- Ensure an admin can set a post on another user as NSFW
- Ensure an NSFW post shows the correct reasons initially, regardless of what the current state of the admins NSFW post box is.
Issues I'm aware of
-
Live update of NSFW in sidebar widgets - I would prefer to leave this out of this, and add that in at a later date. With the amount of testing involved change-detection fixes are not something I want to add into the mix.
-
Image posts are not propagating to sidebar widget; handled here engine#1150 Blogs and Video should be
added scoped labels
changed the description
marked as a Work In Progress
added scoped label and automatically removed label
mentioned in merge request engine!384
changed the description
added 2 commits
added scoped label and automatically removed label
unmarked as a Work In Progress
added 90 commits
-
be7434a2...a0d1737e - 87 commits from branch
master
- 7cb030ad - Merge branch 'master' of gitlab.com:minds/front into fix/blog-media-nsfw-update-1936
- aaf95d86 - Merge branch 'master' of gitlab.com:minds/front into fix/blog-media-nsfw-update-1936
- 76664e6c - Merge branch 'master' of gitlab.com:minds/front into fix/blog-media-nsfw-update-1936
Toggle commit list-
be7434a2...a0d1737e - 87 commits from branch
added scoped label and automatically removed label
marked as a Work In Progress
changed the description
changed the description
added 2 commits
changed the description
- Developer
This definitely needs testing with live data, so we can see how old blogs marked as mature will react to the changes.
changed the description
added scoped label and automatically removed label
unmarked as a Work In Progress
approved this merge request
approved this merge request
added scoped label
23 23 @Input('consumer') consumer: false; 24 24 @Input('expanded') expanded: false; 25 25 @Output('selectedChange') onSelected: EventEmitter<any> = new EventEmitter(); 26 @Output('onInit') onInit: EventEmitter<any> = new EventEmitter(); - Owner
angulars
(output)
brackets assume the workon
as they are events. So this is translating asonOnInit
but it should just be(init)
. However, I am not even sure why we have this init event emitter, all the uses of it that I see do the exact same thing as selectedChange.
51 53 } 52 54 53 55 @Input('selected') set selected(selected: Array<number>) { 56 if (!selected) { 57 return; 58 } 59 this.service.override = true; - Owner
what is this overriding?
51 53 } 52 54 53 55 @Input('selected') set selected(selected: Array<number>) { 56 if (!selected) { - Owner
Are you anticipating that null would be sent? The typings assume an array.
2 2 3 3 export class NSFWSelectorService { 4 4 cacheKey: string = ''; 5 override: boolean = false; - Owner
overriding what?
17 18 onInit() {} 18 19 19 20 build(): NSFWSelectorService { 20 let reasons = this.storage.get(`nsfw:${this.cacheKey}`) || []; 21 for (let reason of this.reasons) { 22 reason.selected = reasons.indexOf(reason.value) > -1; 21 if (!this.override) { - Owner
perhaps build should never have been called? This function doesn't do anything if
override
is set.
- Last updated by Ben Hayward
162 <i 163 class="material-icons" 164 [ngClass]="{ 'mdl-color-text--red-500': blog.mature }" 165 title="Mature content" 166 i18n-title="@@M__COMMON__MATURE_CONTENT" 167 >explicit</i 168 > 169 <span [ngClass]="{ 'mdl-color-text--red-500': blog.mature }" 170 >{{ blog.mature ? 'Mature content' : 'Anyone' }}</span 171 > 172 </a> 173 </div> 157 158 <m-nsfw-selector 159 (selectedChange)="onNSFWSelections($event)" 160 (onInit)="onNSFWSelections($event)" - Owner
same function called. Why do we have two emitters?
- Developer
- Last updated by Ben Hayward
86 87 <span [ngClass]="{ 'mdl-color-text--red-500': entity.mature }"> 88 <ng-container *ngIf="entity.mature" i18n="@@M__COMMON__MATURE_CONTENT" 89 >Mature Content</ng-container 90 > 91 <ng-container 92 *ngIf="!entity.mature" 93 i18n="@@MINDS__MEDIA__ANYONE_LABEL" 94 >Anyone</ng-container 95 > 96 </span> 97 </a> 98 </div> 74 <m-nsfw-selector 75 (selectedChange)="onNSFWSelections($event)" 76 (onInit)="onNSFWSelections($event)" - Owner
calling the same function so why two?
- Developer
The reason there are two is that they are different events. Using
selectedChange
will mean that when the init is finished, it will trigger a selection change, regardless of whether we want this to happen. This is why we had the bug with the admin endpoint being spammed upon channel visit.I believe the location this was happening is here: https://gitlab.com/minds/front/blob/7af0e9d3aac71f97355df233a3c400b2d5fce65a/src/app/modules/newsfeed/dropdown/dropdown.component.ts#L50
added scoped label and automatically removed label