mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
@@ -89,7 +89,7 @@ func (suite *ListsTestSuite) getLists(targetAccountID string, expectedHTTPStatus
|
||||
|
||||
func (suite *ListsTestSuite) TestGetListsHit() {
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
suite.getLists(targetAccount.ID, http.StatusOK, `[{"id":"01H0G8E4Q2J3FE3JDWJVWEDCD1","title":"Cool Ass Posters From This Instance","replies_policy":"followed"}]`)
|
||||
suite.getLists(targetAccount.ID, http.StatusOK, `[{"id":"01H0G8E4Q2J3FE3JDWJVWEDCD1","title":"Cool Ass Posters From This Instance","replies_policy":"followed","exclusive":false}]`)
|
||||
}
|
||||
|
||||
func (suite *ListsTestSuite) TestGetListsNoHit() {
|
||||
|
@@ -46,6 +46,35 @@ import (
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// parameters:
|
||||
// -
|
||||
// name: title
|
||||
// type: string
|
||||
// description: |-
|
||||
// Title of this list.
|
||||
// Sample: Cool People
|
||||
// in: formData
|
||||
// -
|
||||
// name: replies_policy
|
||||
// type: string
|
||||
// description: |-
|
||||
// RepliesPolicy for this list.
|
||||
// followed = Show replies to any followed user
|
||||
// list = Show replies to members of the list
|
||||
// none = Show replies to no one
|
||||
// Sample: list
|
||||
// enum:
|
||||
// - followed
|
||||
// - list
|
||||
// - none
|
||||
// in: formData
|
||||
// -
|
||||
// name: exclusive
|
||||
// in: formData
|
||||
// description: Hide posts from members of this list from your home timeline.
|
||||
// type: boolean
|
||||
// default: false
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - write:lists
|
||||
@@ -101,7 +130,13 @@ func (m *Module) ListCreatePOSTHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
apiList, errWithCode := m.processor.List().Create(c.Request.Context(), authed.Account, form.Title, repliesPolicy)
|
||||
apiList, errWithCode := m.processor.List().Create(
|
||||
c.Request.Context(),
|
||||
authed.Account,
|
||||
form.Title,
|
||||
repliesPolicy,
|
||||
form.Exclusive,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -75,6 +75,11 @@ import (
|
||||
// - list
|
||||
// - none
|
||||
// in: formData
|
||||
// -
|
||||
// name: exclusive
|
||||
// in: formData
|
||||
// description: Hide posts from members of this list from your home timeline.
|
||||
// type: boolean
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
@@ -146,13 +151,20 @@ func (m *Module) ListUpdatePUTHandler(c *gin.Context) {
|
||||
repliesPolicy = &rp
|
||||
}
|
||||
|
||||
if form.Title == nil && repliesPolicy == nil {
|
||||
err = errors.New("neither title nor replies_policy was set; nothing to update")
|
||||
if form.Title == nil && repliesPolicy == nil && form.Exclusive == nil {
|
||||
err = errors.New("neither title nor replies_policy nor exclusive was set; nothing to update")
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
apiList, errWithCode := m.processor.List().Update(c.Request.Context(), authed.Account, targetListID, form.Title, repliesPolicy)
|
||||
apiList, errWithCode := m.processor.List().Update(
|
||||
c.Request.Context(),
|
||||
authed.Account,
|
||||
targetListID,
|
||||
form.Title,
|
||||
repliesPolicy,
|
||||
form.Exclusive,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -30,6 +30,9 @@ type List struct {
|
||||
// list = Show replies to members of the list
|
||||
// none = Show replies to no one
|
||||
RepliesPolicy string `json:"replies_policy"`
|
||||
// Exclusive setting for this list.
|
||||
// If true, hide posts from members of this list from your home timeline.
|
||||
Exclusive bool `json:"exclusive"`
|
||||
}
|
||||
|
||||
// ListCreateRequest models list creation parameters.
|
||||
@@ -53,6 +56,11 @@ type ListCreateRequest struct {
|
||||
// - list
|
||||
// - none
|
||||
RepliesPolicy string `form:"replies_policy" json:"replies_policy" xml:"replies_policy"`
|
||||
// Exclusive setting for this list.
|
||||
// If true, hide posts from members of this list from your home timeline.
|
||||
// default: false
|
||||
// in: formData
|
||||
Exclusive bool `form:"exclusive" json:"exclusive" xml:"exclusive"`
|
||||
}
|
||||
|
||||
// ListUpdateRequest models list update parameters.
|
||||
@@ -70,6 +78,10 @@ type ListUpdateRequest struct {
|
||||
// Sample: list
|
||||
// in: formData
|
||||
RepliesPolicy *string `form:"replies_policy" json:"replies_policy" xml:"replies_policy"`
|
||||
// Exclusive setting for this list.
|
||||
// If true, hide posts from members of this list from your home timeline.
|
||||
// in: formData
|
||||
Exclusive *bool `form:"exclusive" json:"exclusive" xml:"exclusive"`
|
||||
}
|
||||
|
||||
// ListAccountsChangeRequest is a list of account IDs to add to or remove from a list.
|
||||
|
Reference in New Issue
Block a user