Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
284
Merge Requests
39
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 Backend - Engine
Commits
4f78a38e
Commit
4f78a38e
authored
22 minutes ago
by
Ben Hayward
Browse files
Options
Download
Updated to support old-style mature flagged blogs
parent
d888d9c9
fix/blog-media-nsfw-update-1936
1 merge request
!384
[Sprint/QuietQuail](fix): Blog & media edit updated to new nsfw system #1936
Pipeline
#97721529
passed with stages
in 6 minutes and 45 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
3 deletions
+19
-3
Controllers/api/v1/blog.php
View file @
4f78a38e
...
...
@@ -271,7 +271,7 @@ class blog implements Interfaces\Api
}
if
(
$blog
->
isMonetized
())
{
if
(
$blog
->
getNsfw
())
{
if
(
$blog
->
getNsfw
()
||
$blog
->
isMature
()
)
{
return
Factory
::
response
([
'status'
=>
'error'
,
'message'
=>
'Cannot monetize an explicit blog'
...
...
@@ -288,7 +288,8 @@ class blog implements Interfaces\Api
}
}
if
(
isset
(
$_POST
[
'nsfw'
])
&&
$_POST
[
'nsfw'
])
{
if
((
isset
(
$_POST
[
'nsfw'
])
&&
$_POST
[
'nsfw'
])
||
(
isset
(
$_POST
[
'mature'
])
&&
$_POST
[
'mature'
]))
{
$user
=
Core\Session
::
getLoggedInUser
();
if
(
!
$user
->
getMatureContent
())
{
...
...
This diff is collapsed.
Controllers/api/v1/media.php
View file @
4f78a38e
...
...
@@ -266,6 +266,7 @@ class media implements Interfaces\Api, Interfaces\ApiIgnorePam
$entity
->
patch
([
'title'
=>
isset
(
$data
[
'name'
])
?
$data
[
'name'
]
:
''
,
'mature'
=>
isset
(
$data
[
'mature'
])
&&
!!
$data
[
'mature'
],
'nsfw'
=>
!
is_array
(
$_POST
[
'nsfw'
])
?
json_decode
(
$_POST
[
'nsfw'
])
:
$_POST
[
'nsfw'
],
'batch_guid'
=>
0
,
'access_id'
=>
0
,
...
...
This diff is collapsed.
Core/Blogs/Delegates/CreateActivity.php
View file @
4f78a38e
...
...
@@ -58,6 +58,7 @@ class CreateActivity
->
setURL
(
$blog
->
getURL
())
->
setThumbnail
(
$blog
->
getIconUrl
())
->
setFromEntity
(
$blog
)
->
setMature
(
$blog
->
isMature
())
->
setNsfw
(
$blog
->
getNsfw
())
->
setOwner
(
$owner
->
export
())
->
setWireThreshold
(
$blog
->
getWireThreshold
())
...
...
This diff is collapsed.
Entities/Image.php
View file @
4f78a38e
...
...
@@ -189,6 +189,7 @@ class Image extends File
'thumbnail'
,
'cinemr_guid'
,
'license'
,
'mature'
,
'nsfw'
,
'boost_rejection_reason'
,
'rating'
,
...
...
@@ -221,6 +222,7 @@ class Image extends File
$export
[
'thumbs:up:count'
]
=
Helpers\Counters
::
get
(
$this
->
guid
,
'thumbs:up'
);
$export
[
'thumbs:down:count'
]
=
Helpers\Counters
::
get
(
$this
->
guid
,
'thumbs:down'
);
$export
[
'description'
]
=
$this
->
description
;
//videos need to be able to export html.. sanitize soon!
$export
[
'mature'
]
=
$this
->
mature
?:
$this
->
getFlag
(
'mature'
);
$export
[
'nsfw'
]
=
$this
->
nsfw
?:
[];
$export
[
'rating'
]
=
$this
->
getRating
();
$export
[
'width'
]
=
$this
->
width
?:
0
;
...
...
@@ -264,6 +266,7 @@ class Image extends File
'title'
=>
null
,
'description'
=>
null
,
'license'
=>
null
,
'mature'
=>
null
,
'nsfw'
=>
null
,
'boost_rejection_reason'
=>
null
,
'hidden'
=>
null
,
...
...
@@ -282,6 +285,7 @@ class Image extends File
'batch_guid'
,
'access_id'
,
'container_guid'
,
'mature'
,
'nsfw'
,
'boost_rejection_reason'
,
'rating'
,
...
...
@@ -298,6 +302,8 @@ class Image extends File
}
elseif
(
$field
==
'nsfw'
)
{
$this
->
nsfw
=
!
is_array
(
$data
[
'nsfw'
])
?
json_decode
(
$data
[
'nsfw'
])
:
$data
[
'nsfw'
];
continue
;
}
elseif
(
$field
==
'mature'
)
{
$this
->
setFlag
(
'mature'
,
!!
$data
[
'mature'
]);
}
$this
->
$field
=
$data
[
$field
];
...
...
@@ -343,6 +349,7 @@ class Image extends File
[[
'src'
=>
\elgg_get_site_url
()
.
'fs/v1/thumbnail/'
.
$this
->
guid
,
'href'
=>
\elgg_get_site_url
()
.
'media/'
.
(
$this
->
container_guid
?
$this
->
container_guid
.
'/'
:
''
)
.
$this
->
guid
,
'mature'
=>
$this
->
getFlag
(
'mature'
),
'nsfw'
=>
$this
->
getFlag
(
'nsfw'
),
'width'
=>
$this
->
width
??
0
,
'height'
=>
$this
->
height
??
0
,
...
...
This diff is collapsed.
Entities/Video.php
View file @
4f78a38e
...
...
@@ -187,6 +187,7 @@ class Video extends MindsObject
'title'
=>
null
,
'description'
=>
null
,
'license'
=>
null
,
'mature'
=>
null
,
'nsfw'
=>
null
,
'boost_rejection_reason'
=>
null
,
'hidden'
=>
null
,
...
...
@@ -204,6 +205,7 @@ class Video extends MindsObject
'hidden'
,
'access_id'
,
'container_guid'
,
'mature'
,
'nsfw'
,
'boost_rejection_reason'
,
'rating'
,
...
...
@@ -218,7 +220,7 @@ class Video extends MindsObject
if
(
$field
==
'access_id'
)
{
$data
[
$field
]
=
(
int
)
$data
[
$field
];
}
elseif
(
in_array
(
$field
,
[
'full_hd'
],
true
))
{
}
elseif
(
(
in_array
(
$field
,
[
'full_hd'
],
true
))
||
(
in_array
(
$field
,
[
'mature'
,
'full_hd'
],
true
)
))
{
$this
->
setFlag
(
$field
,
!!
$data
[
$field
]);
continue
;
}
...
...
This diff is collapsed.
Spec/Core/Blogs/Delegates/CreateActivitySpec.php
View file @
4f78a38e
...
...
@@ -55,6 +55,10 @@ class CreateActivitySpec extends ObjectBehavior
$blog
->
getIconUrl
()
->
shouldBeCalled
()
->
willReturn
(
'http://phpspec/icon.spec.ext'
);
$blog
->
isMature
()
->
shouldBeCalled
()
->
willReturn
(
false
);
$blog
->
getNsfw
()
->
shouldBeCalled
()
...
...
This diff is collapsed.
Please
register
or
sign in
to comment