Commit b80f0e79 authored by les's avatar les
Browse files

Merge branch 'dev'

parents 8581d47c 298b0342
All notable changes to this project will be documented in this file.
### unreleased
### 0.17.11
- [refactor] s/fed_user/ap_user
- [fedi] admin moderation
### 0.17.10
- [refactor] s/comment/resource/
- [refactor] remove `username` field
- [doc] about and federation
......
......@@ -65,19 +65,24 @@
:type='data.row.blocked?"danger":"warning"'
@click='toggleUserBlock(data.row)') {{data.row.blocked?$t('admin.unblock'):$t('admin.block')}}
div(v-show='enable_federation')
//- div(v-show='enable_federation')
el-divider {{$t('common.resources')}}
el-table(:data='paginatedResources' small)
el-table(:data='paginatedResources' small :row-style='resourceStyle')
el-table-column(:label="$t('common.event')")
template(slot-scope='data')
span {{data.row.event}}
el-table-column(:label="$t('common.resources')")
template(slot-scope='data')
span(:class='{disabled: data.row.hidden}' v-html='data.row.data.content')
el-table-column(:label="$t('common.actions')" width="150")
template(slot-scope='data')
el-button-group
el-button(size='mini'
:type='data.row.hidden?"danger":"warning"'
@click='toggleHideResource(data.row)') {{data.row.hidden?$t('common.show'):$t('common.hide')}}
el-dropdown
el-button(type="primary" icon="el-icon-arrow-down" size='mini') {{$t('common.moderation')}}
el-dropdown-menu(slot='dropdown')
el-dropdown-item(v-if='!data.row.hidden' icon='el-icon-remove' @click.native='toggleHideResource(data.row)') {{$t('admin.hide_resource')}}
el-dropdown-item(v-else icon='el-icon-success' @click.native='toggleHideResource(data.row)') {{$t('admin.show_resource')}}
el-dropdown-item(icon='el-icon-delete' @click.native='deleteResource(data.row)') {{$t('admin.delete_resource')}}
el-dropdown-item(icon='el-icon-lock' @click.native='blockUser(data.row)') {{$t('admin.block_user')}}
</template>
<script>
......@@ -107,6 +112,9 @@ export default {
},
methods: {
...mapActions(['setSetting']),
// resourceStyle ({ row }) {
// if (row.hidden) return 'opacity: 0.5'
// },
async instanceSelected (instance) {
this.users = await this.$axios.$get(`/instances/${instance.domain}`)
},
......
......@@ -150,7 +150,7 @@
"select_instance_timezone": "Select instance timezone",
"enable_resources": "Enable resources",
"enable_resources_help": "Allows you to add resources to the event from the fediverse",
"hide_boost_bookmark": "Hides boost/bookmark numbers",
"hide_boost_bookmark": "Hides boost/bookmarks",
"hide_boost_bookmark_help": "Hides the small icons that show the number of boosts / bookmarks coming from the fediverse",
"block": "Block",
"unblock": "Unblock",
......@@ -160,7 +160,9 @@
"hide_resource": "Hide resource",
"delete_resource": "Delete resource",
"delete_resource_confirm": "Are you sure to delete this resource?",
"block_user": "Block user"
"block_user": "Block user",
"filter_instances": "Filter instances",
"filter_users": "Filter users"
},
"auth": {
"not_confirmed": "Not confirmed yet",
......
{
"name": "gancio",
"version": "0.17.9",
"version": "0.17.11",
"description": "A shared agenda for local communities",
"author": "lesion",
"scripts": {
......
const { ap_users: APUsers } = require('../models')
const { ap_user: APUser } = require('../models')
const apUserController = {
async toggleBlock (req, res) {
const user_id = req.body.user_id
const user = await APUsers.findByPk(user_id)
user.update({ blocked: !user.blocked })
const user = await APUser.findByPk(user_id)
await user.update({ blocked: !user.blocked })
res.json(user)
}
}
......
......@@ -17,8 +17,8 @@ const instancesController = {
* get instance users
*/
async get (req, res) {
const fedi_users = await APUser.findAll({ where: { instanceDomain: req.params.instance_domain }, include: [Resource] })
return res.json(fedi_users)
const ap_users = await APUser.findAll({ where: { instanceDomain: req.params.instance_domain }, include: [Resource] })
return res.json(ap_users)
},
async toggleBlock (req, res) {
......
......@@ -4,7 +4,7 @@ const crypto = require('crypto')
const config = require('config')
const httpSignature = require('http-signature')
const debug = require('debug')('federation:helpers')
const { APUser, Instance } = require('../api/models')
const { ap_user: APUser, instance: Instance } = require('../api/models')
const url = require('url')
const settingsController = require('../api/controller/settings')
......@@ -55,7 +55,7 @@ const Helpers = {
return
}
const followers = await APUser.findAll({ where: { follow: true } })
const followers = await APUser.findAll({ where: { follower: true } })
const recipients = {}
followers.forEach(follower => {
const sharedInbox = follower.object.endpoints.sharedInbox
......
const express = require('express')
const router = express.Router()
const { event: Event, user: User, comment: Comment } = require('../api/models')
const { event: Event, user: User, resource: Resource } = require('../api/models')
const cors = require('cors')
const settingsController = require('../api/controller/settings')
const version = require('../../package.json').version
......@@ -50,6 +50,8 @@ router.get('/webfinger', (req, res) => {
router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
const usersCount = (await User.findAndCountAll()).count
const eventsCount = (await Event.findAndCountAll()).count
const resourcesCount = (await Resource.findAndCountAll()).count
const ret = {
metadata: {
nodeDescription: req.settings.description,
......@@ -64,7 +66,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
},
version: req.params.nodeinfo_version,
usage: {
localComments: 0,
localComments: resourcesCount,
localPosts: eventsCount,
users: {
total: usersCount
......@@ -81,7 +83,7 @@ router.get('/nodeinfo/:nodeinfo_version', async (req, res) => {
router.get('/x-nodeinfo2', async (req, res) => {
const usersCount = (await User.findAndCountAll()).count
const eventsCount = (await Event.findAndCountAll()).count
const commentsCount = (await Comment.findAndCountAll()).count
const resourcesCount = (await Resource.findAndCountAll()).count
const ret = {
version: '1.0',
......@@ -98,7 +100,7 @@ router.get('/x-nodeinfo2', async (req, res) => {
total: usersCount
},
localPosts: eventsCount,
localComments: commentsCount
localComments: resourcesCount
}
}
res.json(ret)
......
......@@ -28,7 +28,7 @@ const notifier = {
},
async notifyEvent (action, eventId) {
const event = await Event.findByPk(eventId, {
include: [ Tag, Place, Notification, { model: User, include: { model: APUser, as: 'followers' } } ]
include: [ Tag, Place, Notification, { model: User } ]
})
debug('%s -> %s', action, event.title)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment