mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
fix ReturnValueFromMap
This commit is contained in:
parent
7ff47419fb
commit
44b186c3af
@ -121,15 +121,14 @@ export function uploadFile(file) {
|
||||
* @return {string} Boolean value
|
||||
*/
|
||||
export function ReturnValueFromMap(payload) {
|
||||
if (!payload) {
|
||||
return false
|
||||
}
|
||||
if (!payload) return false
|
||||
const { data, key } = payload
|
||||
try {
|
||||
const Ite = payload.data.map(item => {
|
||||
return item.key === payload.key ? item.value : null
|
||||
const a = data.map(item => {
|
||||
return item.key === key ? item.value : null
|
||||
})
|
||||
const fr = Ite.filter(Boolean)
|
||||
return fr.toString()
|
||||
const b = a.filter(Boolean)
|
||||
return b.toString()
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
|
@ -172,7 +172,13 @@ class PostCreator extends React.PureComponent {
|
||||
return false
|
||||
}
|
||||
const id_temp_parse = JSON.parse(res)['data'].id
|
||||
if (ycore.ReturnValueFromMap({ data: post_options, key: 'pro_boost' })) {
|
||||
|
||||
const pro_boost_val = ycore.ReturnValueFromMap({ data: post_options, key: 'pro_boost' })
|
||||
const allow_comments_val = ycore.ReturnValueFromMap({ data: post_options, key: 'allow_comments' })
|
||||
|
||||
ycore.yconsole.log(`pro_boost => ${pro_boost_val} | allow_comments => ${allow_comments_val}`)
|
||||
|
||||
if (pro_boost_val) {
|
||||
ycore.yconsole.log(`Boosting post with ID => ${id_temp_parse}`)
|
||||
ycore.comty_post.__boost(
|
||||
(err, res) => {
|
||||
@ -182,7 +188,7 @@ class PostCreator extends React.PureComponent {
|
||||
)
|
||||
}
|
||||
if (
|
||||
ycore.ReturnValueFromMap({ data: post_options, key: 'allow_comments' })
|
||||
!allow_comments_val
|
||||
) {
|
||||
ycore.yconsole.log(`Disabling comments with ID => ${id_temp_parse}`)
|
||||
ycore.comty_post.__disableComments(
|
||||
|
Loading…
x
Reference in New Issue
Block a user