mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Attempt fixing join logic if already banned
This commit is contained in:
parent
16f9cc40aa
commit
e0665fa1b8
|
|
@ -159,7 +159,6 @@ func MakeJoin(
|
||||||
BuildEventTemplate: createJoinTemplate,
|
BuildEventTemplate: createJoinTemplate,
|
||||||
}
|
}
|
||||||
response, internalErr := gomatrixserverlib.HandleMakeJoin(input)
|
response, internalErr := gomatrixserverlib.HandleMakeJoin(input)
|
||||||
if internalErr != nil {
|
|
||||||
switch e := internalErr.(type) {
|
switch e := internalErr.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
case spec.InternalServerError:
|
case spec.InternalServerError:
|
||||||
|
|
@ -199,7 +198,6 @@ func MakeJoin(
|
||||||
JSON: spec.Unknown("unknown error"),
|
JSON: spec.Unknown("unknown error"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if response == nil {
|
if response == nil {
|
||||||
util.GetLogger(httpReq.Context()).Error("gmsl.HandleMakeJoin returned invalid response")
|
util.GetLogger(httpReq.Context()).Error("gmsl.HandleMakeJoin returned invalid response")
|
||||||
|
|
@ -253,19 +251,17 @@ func SendJoin(
|
||||||
Verifier: keys,
|
Verifier: keys,
|
||||||
StateQuerier: &JoinRoomQuerier{roomserver: rsAPI},
|
StateQuerier: &JoinRoomQuerier{roomserver: rsAPI},
|
||||||
}
|
}
|
||||||
response, err := gomatrixserverlib.HandleSendJoin(input)
|
response, joinErr := gomatrixserverlib.HandleSendJoin(input)
|
||||||
if err != nil {
|
switch e := joinErr.(type) {
|
||||||
// TODO: Double check this reflects old logic
|
|
||||||
switch e := err.(type) {
|
|
||||||
case nil:
|
case nil:
|
||||||
case spec.InternalServerError:
|
case spec.InternalServerError:
|
||||||
util.GetLogger(httpReq.Context()).WithError(err)
|
util.GetLogger(httpReq.Context()).WithError(joinErr)
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusInternalServerError,
|
Code: http.StatusInternalServerError,
|
||||||
JSON: spec.InternalServerError{},
|
JSON: spec.InternalServerError{},
|
||||||
}
|
}
|
||||||
case spec.MatrixError:
|
case spec.MatrixError:
|
||||||
util.GetLogger(httpReq.Context()).WithError(err)
|
util.GetLogger(httpReq.Context()).WithError(joinErr)
|
||||||
code := http.StatusInternalServerError
|
code := http.StatusInternalServerError
|
||||||
switch e.ErrCode {
|
switch e.ErrCode {
|
||||||
case spec.ErrorForbidden:
|
case spec.ErrorForbidden:
|
||||||
|
|
@ -283,13 +279,12 @@ func SendJoin(
|
||||||
JSON: e,
|
JSON: e,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
util.GetLogger(httpReq.Context()).WithError(err)
|
util.GetLogger(httpReq.Context()).WithError(joinErr)
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: spec.Unknown("unknown error"),
|
JSON: spec.Unknown("unknown error"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if response == nil {
|
if response == nil {
|
||||||
util.GetLogger(httpReq.Context()).Error("gmsl.HandleMakeJoin returned invalid response")
|
util.GetLogger(httpReq.Context()).Error("gmsl.HandleMakeJoin returned invalid response")
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -22,7 +22,7 @@ require (
|
||||||
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
|
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
|
||||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
|
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
|
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230518221530-f41738532873
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20230519022133-034dde7ceade
|
||||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
|
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
|
||||||
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
|
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
|
||||||
github.com/mattn/go-sqlite3 v1.14.16
|
github.com/mattn/go-sqlite3 v1.14.16
|
||||||
|
|
|
||||||
6
go.sum
6
go.sum
|
|
@ -323,10 +323,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
|
||||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
|
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
|
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
|
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230518202814-d3404175a985 h1:PNGINQ/Gb4VG1ict/9Iq6SyaFm3a0Q2+gu4kcfKMKAw=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20230519022133-034dde7ceade h1:53MMZAg6mtFkP5LJd3S3rzvrri0huELoq8gaRePpHv8=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230518202814-d3404175a985/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20230519022133-034dde7ceade/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230518221530-f41738532873 h1:c6JhZasD3Ma7A+eIP14gfZTHDR8SKEJ8VCKHmByCHpg=
|
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20230518221530-f41738532873/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
|
|
||||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
|
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
|
||||||
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
|
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
|
||||||
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=
|
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue