Pārlūkot izejas kodu

Fix instance-wide actor lookup

This skips the silenced-user check.

Ref T820
pull/439/head
Matt Baer pirms 3 gadiem
vecāks
revīzija
9b336dee8c
2 mainītis faili ar 17 papildinājumiem un 10 dzēšanām
  1. +11
    -9
      activitypub.go
  2. +6
    -1
      collections.go

+ 11
- 9
activitypub.go Parādīt failu

@@ -17,7 +17,6 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/writeas/writefreely/config"
"io/ioutil"
"net/http"
"net/http/httputil"
@@ -109,16 +108,19 @@ func handleFetchCollectionActivities(app *App, w http.ResponseWriter, r *http.Re
if err != nil {
return err
}
silenced, err := app.db.IsUserSilenced(c.OwnerID)
if err != nil {
log.Error("fetch collection activities: %v", err)
return ErrInternalGeneral
}
if silenced {
return ErrCollectionNotFound
}
c.hostName = app.cfg.App.Host

if !c.IsInstanceColl() {
silenced, err := app.db.IsUserSilenced(c.OwnerID)
if err != nil {
log.Error("fetch collection activities: %v", err)
return ErrInternalGeneral
}
if silenced {
return ErrCollectionNotFound
}
}

p := c.PersonObject()

setCacheControl(w, apCacheTime)


+ 6
- 1
collections.go Parādīt failu

@@ -1,5 +1,5 @@
/*
* Copyright © 2018-2020 A Bunch Tell LLC.
* Copyright © 2018-2021 A Bunch Tell LLC.
*
* This file is part of WriteFreely.
*
@@ -180,6 +180,11 @@ func (c *Collection) NewFormat() *CollectionFormat {
return cf
}

func (c *Collection) IsInstanceColl() bool {
ur, _ := url.Parse(c.hostName)
return c.Alias == ur.Host
}

func (c *Collection) IsUnlisted() bool {
return c.Visibility == 0
}


Notiek ielāde…
Atcelt
Saglabāt