Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
b4f055b6
Commit
b4f055b6
authored
Oct 05, 2017
by
lain
Browse files
Don't reject already accepted subscriptions.
parent
2b980dea
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/websub/websub.ex
View file @
b4f055b6
...
...
@@ -31,9 +31,9 @@ def verify(subscription, getter \\ &@httpoison.get/3) do
do
changeset
=
Changeset
.
change
(
subscription
,
%{
state:
"active"
})
Repo
.
update
(
changeset
)
else
_
e
->
changeset
=
Changeset
.
change
(
subscription
,
%{
state:
"rejected"
}
)
{
:ok
,
subscription
}
=
Repo
.
update
(
changeset
)
else
e
->
Logger
.
debug
(
"Couldn't verify subscription"
)
Logger
.
debug
(
inspect
(
e
)
)
{
:error
,
subscription
}
end
end
...
...
test/web/websub/websub_test.exs
View file @
b4f055b6
...
...
@@ -46,7 +46,8 @@ test "a verification of a request that doesn't return 200" do
end
{
:error
,
sub
}
=
Websub
.
verify
(
sub
,
getter
)
assert
sub
.
state
==
"rejected"
# Keep the current state.
assert
sub
.
state
==
"requested"
end
test
"an incoming subscription request"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment