aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-01-13 09:12:55 +0100
committerGitHub <noreply@github.com>2021-01-13 09:12:55 +0100
commit1ea7da819e5bfae7b443ed722c18c4165d101439 (patch)
tree17cea3786dfb3a59a2ad5559de9ebf106a0440a2 /server/lib/activitypub
parent75dd1b641f987e1e09dbaa3329e08c6e98a858f3 (diff)
downloadPeerTube-1ea7da819e5bfae7b443ed722c18c4165d101439.tar.gz
PeerTube-1ea7da819e5bfae7b443ed722c18c4165d101439.tar.zst
PeerTube-1ea7da819e5bfae7b443ed722c18c4165d101439.zip
add ability to remove one's avatar for account and channels (#3467)
* add ability to remove one's avatar for account and channels * add ability to remove one's avatar for account and channels * only display avatar edition options after input change
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/actor.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 52547536c..086d656f9 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -199,6 +199,19 @@ async function updateActorAvatarInstance (actor: MActorDefault, info: AvatarInfo
199 return actor 199 return actor
200} 200}
201 201
202async function deleteActorAvatarInstance (actor: MActorDefault, t: Transaction) {
203 try {
204 await actor.Avatar.destroy({ transaction: t })
205 } catch (err) {
206 logger.error('Cannot remove old avatar of actor %s.', actor.url, { err })
207 }
208
209 actor.avatarId = null
210 actor.Avatar = null
211
212 return actor
213}
214
202async function fetchActorTotalItems (url: string) { 215async function fetchActorTotalItems (url: string) {
203 const options = { 216 const options = {
204 uri: url, 217 uri: url,
@@ -337,6 +350,7 @@ export {
337 fetchActorTotalItems, 350 fetchActorTotalItems,
338 getAvatarInfoIfExists, 351 getAvatarInfoIfExists,
339 updateActorInstance, 352 updateActorInstance,
353 deleteActorAvatarInstance,
340 refreshActorIfNeeded, 354 refreshActorIfNeeded,
341 updateActorAvatarInstance, 355 updateActorAvatarInstance,
342 addFetchOutboxJob 356 addFetchOutboxJob