Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
825
Merge Requests
51
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
76664e6cf6e9a1bec8a32b3522834144a0fc04d9...36f954353a8bc003e6dc2d5761163fca241d8706
Source
36f954353a8bc003e6dc2d5761163fca241d8706
...
Target
76664e6cf6e9a1bec8a32b3522834144a0fc04d9
Compare
Commits (2)
Blogs working correctly
· f91890c3
Ben Hayward
authored
1 hour ago
f91890c3
spec test fix
· 36f95435
Ben Hayward
authored
just now
36f95435
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
14 deletions
+40
-14
src/app/common/components/nsfw-selector/nsfw-selector.component.ts
View file @
36f95435
...
...
@@ -23,6 +23,7 @@ export class NSFWSelectorComponent {
@
Input
(
'
consumer
'
)
consumer
:
false
;
@
Input
(
'
expanded
'
)
expanded
:
false
;
@
Output
(
'
selectedChange
'
)
onSelected
:
EventEmitter
<
any
>
=
new
EventEmitter
();
@
Output
(
'
onInit
'
)
onInit
:
EventEmitter
<
any
>
=
new
EventEmitter
();
constructor
(
public
creatorService
:
NSFWSelectorCreatorService
,
...
...
@@ -32,10 +33,11 @@ export class NSFWSelectorComponent {
)
{}
ngOnInit
()
{
if
(
this
.
service
.
reasons
)
{
if
(
!
this
.
selected
&&
this
.
service
.
reasons
)
{
for
(
const
reason
of
this
.
service
.
reasons
)
{
this
.
toggle
(
reason
.
value
,
false
);
}
this
.
onInit
.
emit
(
this
.
service
.
reasons
.
filter
(
r
=>
r
.
selected
));
}
}
...
...
@@ -51,6 +53,10 @@ export class NSFWSelectorComponent {
}
@
Input
(
'
selected
'
)
set
selected
(
selected
:
Array
<
number
>
)
{
if
(
!
selected
)
{
return
;
}
this
.
service
.
override
=
true
;
for
(
let
i
in
this
.
service
.
reasons
)
{
this
.
service
.
reasons
[
i
].
selected
=
selected
.
indexOf
(
this
.
service
.
reasons
[
i
].
value
)
>
-
1
;
...
...
This diff is collapsed.
src/app/common/components/nsfw-selector/nsfw-selector.service.ts
View file @
36f95435
...
...
@@ -2,6 +2,7 @@ import { Storage } from '../../../services/storage';
export
class
NSFWSelectorService
{
cacheKey
:
string
=
''
;
override
:
boolean
=
false
;
reasons
:
Array
<
any
>
=
[
{
value
:
1
,
label
:
'
Nudity
'
,
selected
:
false
,
locked
:
false
},
...
...
@@ -17,9 +18,11 @@ export class NSFWSelectorService {
onInit
()
{}
build
():
NSFWSelectorService
{
let
reasons
=
this
.
storage
.
get
(
`nsfw:
${
this
.
cacheKey
}
`
)
||
[];
for
(
let
reason
of
this
.
reasons
)
{
reason
.
selected
=
reasons
.
indexOf
(
reason
.
value
)
>
-
1
;
if
(
!
this
.
override
)
{
let
reasons
=
this
.
storage
.
get
(
`nsfw:
${
this
.
cacheKey
}
`
)
||
[];
for
(
let
reason
of
this
.
reasons
)
{
reason
.
selected
=
reasons
.
indexOf
(
reason
.
value
)
>
-
1
;
}
}
return
this
;
}
...
...
@@ -31,10 +34,12 @@ export class NSFWSelectorService {
for
(
let
r
of
this
.
reasons
)
{
if
(
r
.
value
===
reason
.
value
)
r
.
selected
=
!
r
.
selected
;
}
this
.
storage
.
set
(
`nsfw:
${
this
.
cacheKey
}
`
,
this
.
reasons
.
filter
(
r
=>
r
.
selected
).
map
(
r
=>
r
.
value
)
);
if
(
!
this
.
override
)
{
this
.
storage
.
set
(
`nsfw:
${
this
.
cacheKey
}
`
,
this
.
reasons
.
filter
(
r
=>
r
.
selected
).
map
(
r
=>
r
.
value
)
);
}
}
}
...
...
This diff is collapsed.
src/app/modules/blogs/edit/edit.html
View file @
36f95435
...
...
@@ -155,7 +155,12 @@
</select>
</div>
<m-nsfw-selector
(selected)=
"onNSWFSelections($event)"
>
</m-nsfw-selector>
<m-nsfw-selector
(selectedChange)=
"onNSFWSelections($event)"
(onInit)=
"onNSFWSelections($event)"
[selected]=
"editing && blog.nsfw != [] ? blog.nsfw : null"
>
</m-nsfw-selector>
<m-wire-threshold-input
[(threshold)]=
"blog.wire_threshold"
...
...
This diff is collapsed.
src/app/modules/blogs/edit/edit.spec.ts
View file @
36f95435
...
...
@@ -247,7 +247,8 @@ describe('BlogEdit', () => {
}),
MockComponent
({
selector
:
'
m-nsfw-selector
'
,
outputs
:
[
'
selected
'
],
outputs
:
[
'
selectedChanged
'
],
inputs
:
[
'
selected
'
],
}),
MockDirective
({
selector
:
'
[mIfFeature]
'
,
...
...
This diff is collapsed.
src/app/modules/blogs/edit/edit.ts
View file @
36f95435
...
...
@@ -33,6 +33,7 @@ export class BlogEdit {
time_created
:
Math
.
floor
(
Date
.
now
()
/
1000
),
access_id
:
2
,
tags
:
[],
nsfw
:
[],
license
:
'
attribution-sharealike-cc
'
,
fileKey
:
'
header
'
,
mature
:
0
,
...
...
@@ -123,6 +124,7 @@ export class BlogEdit {
license
:
''
,
fileKey
:
'
header
'
,
mature
:
0
,
nsfw
:
[],
monetized
:
0
,
published
:
0
,
wire_threshold
:
null
,
...
...
@@ -143,8 +145,10 @@ export class BlogEdit {
this
.
existingBanner
=
false
;
if
(
this
.
guid
!==
'
new
'
)
{
this
.
editing
=
true
;
this
.
load
();
}
else
{
this
.
editing
=
false
;
const
description
:
string
=
this
.
inMemoryStorageService
.
once
(
'
newBlogContent
'
);
...
...
@@ -254,6 +258,7 @@ export class BlogEdit {
const
blog
=
Object
.
assign
({},
this
.
blog
);
// only allowed props
blog
.
nsfw
=
this
.
blog
.
nsfw
;
blog
.
mature
=
blog
.
mature
?
1
:
0
;
blog
.
monetization
=
blog
.
monetization
?
1
:
0
;
blog
.
monetized
=
blog
.
monetized
?
1
:
0
;
...
...
@@ -363,7 +368,7 @@ export class BlogEdit {
* Sets this blog NSFW
* @param { array } nsfw - Numerical indexes for reasons in an array e.g. [1, 2].
*/
onNS
WF
Selections
(
nsfw
)
{
onNS
FW
Selections
(
nsfw
)
{
this
.
blog
.
nsfw
=
nsfw
.
map
(
reason
=>
reason
.
value
);
}
}
This diff is collapsed.
src/app/modules/media/edit/edit.component.html
View file @
36f95435
...
...
@@ -71,6 +71,7 @@
<option
*ngFor=
"let a of access"
[value]=
"a.value"
>
{{ a.text }}
</option>
</select>
</div>
<m-nsfw-selector
(selected)=
"onNSWFSelections($event)"
>
</m-nsfw-selector>
<m-nsfw-selector
(selectedChange)=
"onNSWFSelections($event)"
>
</m-nsfw-selector>
</div>
</form>
This diff is collapsed.
src/app/modules/newsfeed/poster/poster.component.html
View file @
36f95435
...
...
@@ -60,7 +60,10 @@
</label>
<ng-container
*mIfFeature=
"'top-feeds'; else oldNSFW"
>
<m-nsfw-selector
(selectedChange)=
"onNSWFSelections($event)"
>
<m-nsfw-selector
(selectedChange)=
"onNSFWSelections($event)"
(onInit)=
"onNSFWSelections($event)"
>
</m-nsfw-selector>
</ng-container>
...
...
This diff is collapsed.
src/app/modules/newsfeed/poster/poster.component.ts
View file @
36f95435
...
...
@@ -286,7 +286,7 @@ export class PosterComponent {
this
.
router
.
navigate
([
'
/blog/edit/new
'
]);
}
onNS
WF
Selections
(
reasons
:
Array
<
{
value
;
label
;
selected
}
>
)
{
onNS
FW
Selections
(
reasons
:
Array
<
{
value
;
label
;
selected
}
>
)
{
this
.
attachment
.
setNSFW
(
reasons
);
}
...
...
This diff is collapsed.