mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
[feat] manage unboost
This commit is contained in:
parent
dc903d4500
commit
bda72f1559
2 changed files with 10 additions and 1 deletions
|
@ -13,6 +13,15 @@ module.exports = {
|
||||||
res.sendStatus(201)
|
res.sendStatus(201)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async unboost (req, res) {
|
||||||
|
const match = req.body.object.match*`${config.baseurl}/federation/m/(.*)`)
|
||||||
|
if (!match || match.length < 2) return res.status(404).send('Event not found!')
|
||||||
|
debug('unboost %s', match[1])
|
||||||
|
const event = await Event.findByPk(Number(match[1]))
|
||||||
|
if (!event) return res.status(404).send('Event not found!')
|
||||||
|
await event.update({ boost: [...event.boost.filter(actor => actor !== body.actor )]})
|
||||||
|
},
|
||||||
|
|
||||||
async bookmark (req, res) {
|
async bookmark (req, res) {
|
||||||
const match = req.body.object.match(`${config.baseurl}/federation/m/(.*)`)
|
const match = req.body.object.match(`${config.baseurl}/federation/m/(.*)`)
|
||||||
if (!match || match.length < 2) { return res.status(404).send('Event not found!') }
|
if (!match || match.length < 2) { return res.status(404).send('Event not found!') }
|
||||||
|
|
|
@ -50,7 +50,7 @@ router.post('/u/:name/inbox', Helpers.verifySignature, async (req, res) => {
|
||||||
} else if (b.object.type === 'Like') {
|
} else if (b.object.type === 'Like') {
|
||||||
Ego.unbookmark(req, res)
|
Ego.unbookmark(req, res)
|
||||||
} else if (b.object.type === 'Announce') {
|
} else if (b.object.type === 'Announce') {
|
||||||
console.error('Unboost')
|
Ego.unboost(req, res)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'Announce':
|
case 'Announce':
|
||||||
|
|
Loading…
Reference in a new issue