mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge branch 'master' of https://github.com/Human-Connection/Human-Connection into 1455-fix-update-comment-list
This commit is contained in:
commit
abf408e3c6
@ -1,9 +1,12 @@
|
||||
import request from 'request'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
import isEmpty from 'lodash/isEmpty'
|
||||
import Debug from 'debug'
|
||||
import asyncForEach from '../../helpers/asyncForEach'
|
||||
import CONFIG from './../../config'
|
||||
|
||||
const debug = Debug('human-connection:location')
|
||||
|
||||
const fetch = url => {
|
||||
return new Promise((resolve, reject) => {
|
||||
request(url, function(error, response, body) {
|
||||
@ -59,6 +62,7 @@ const createOrUpdateLocations = async (userId, locationName, driver) => {
|
||||
if (isEmpty(locationName)) {
|
||||
return
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(
|
||||
locationName,
|
||||
@ -67,6 +71,8 @@ const createOrUpdateLocations = async (userId, locationName, driver) => {
|
||||
)}`,
|
||||
)
|
||||
|
||||
debug(res)
|
||||
|
||||
if (!res || !res.features || !res.features[0]) {
|
||||
throw new UserInputError('locationName is invalid')
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export default app => {
|
||||
return gql(`
|
||||
return gql`
|
||||
query {
|
||||
Report(first: 20, orderBy: createdAt_desc) {
|
||||
id
|
||||
@ -30,6 +30,7 @@ export default app => {
|
||||
}
|
||||
}
|
||||
comment {
|
||||
id
|
||||
contentExcerpt
|
||||
author {
|
||||
id
|
||||
@ -76,5 +77,5 @@ export default app => {
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
`
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<template>
|
||||
<ds-card space="small">
|
||||
<ds-heading tag="h3">
|
||||
{{ $t('moderation.reports.name') }}
|
||||
</ds-heading>
|
||||
<ds-heading tag="h3">{{ $t('moderation.reports.name') }}</ds-heading>
|
||||
<ds-table v-if="Report && Report.length" :data="Report" :fields="fields" condensed>
|
||||
<template slot="name" slot-scope="scope">
|
||||
<div v-if="scope.row.type === 'Post'">
|
||||
@ -15,23 +13,23 @@
|
||||
<b>{{ scope.row.post.title | truncate(50) }}</b>
|
||||
</nuxt-link>
|
||||
<br />
|
||||
<ds-text size="small" color="soft">
|
||||
{{ scope.row.post.author.name }}
|
||||
</ds-text>
|
||||
<ds-text size="small" color="soft">{{ scope.row.post.author.name }}</ds-text>
|
||||
</div>
|
||||
<div v-else-if="scope.row.type === 'Comment'">
|
||||
<nuxt-link
|
||||
:to="{
|
||||
name: 'post-id-slug',
|
||||
params: { id: scope.row.comment.post.id, slug: scope.row.comment.post.slug },
|
||||
params: {
|
||||
id: scope.row.comment.post.id,
|
||||
slug: scope.row.comment.post.slug,
|
||||
},
|
||||
hash: `#commentId-${scope.row.comment.id}`,
|
||||
}"
|
||||
>
|
||||
<b>{{ scope.row.comment.contentExcerpt | truncate(50) }}</b>
|
||||
<b>{{ scope.row.comment.contentExcerpt | removeHtml | truncate(50) }}</b>
|
||||
</nuxt-link>
|
||||
<br />
|
||||
<ds-text size="small" color="soft">
|
||||
{{ scope.row.comment.author.name }}
|
||||
</ds-text>
|
||||
<ds-text size="small" color="soft">{{ scope.row.comment.author.name }}</ds-text>
|
||||
</div>
|
||||
<div v-else>
|
||||
<nuxt-link
|
||||
|
||||
@ -101,7 +101,7 @@ export default {
|
||||
async submit() {
|
||||
this.loadingData = true
|
||||
const { name, about } = this.formData
|
||||
let { locationName } = this.formData
|
||||
let { locationName } = this.formData || this.currentUser
|
||||
locationName = locationName && (locationName['label'] || locationName)
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
@ -159,7 +159,6 @@ export default {
|
||||
this.cities = []
|
||||
return
|
||||
}
|
||||
|
||||
this.loadingGeo = true
|
||||
this.axiosSource = CancelToken.source()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user