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
b2105a31
Commit
b2105a31
authored
Nov 06, 2018
by
kaniini
Browse files
twitterapi: add notification read endpoint
parent
50bf1746
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/router.ex
View file @
b2105a31
...
...
@@ -272,6 +272,10 @@ defmodule Pleroma.Web.Router do
get
(
"/statuses/mentions_timeline"
,
TwitterAPI
.
Controller
,
:mentions_timeline
)
get
(
"/qvitter/statuses/notifications"
,
TwitterAPI
.
Controller
,
:notifications
)
# XXX: this is really a pleroma API, but we want to keep the pleroma namespace clean
# for now.
post
(
"/qvitter/statuses/notifications/read"
,
TwitterAPI
.
Controller
,
:notifications_read
)
post
(
"/statuses/update"
,
TwitterAPI
.
Controller
,
:status_update
)
post
(
"/statuses/retweet/:id"
,
TwitterAPI
.
Controller
,
:retweet
)
post
(
"/statuses/unretweet/:id"
,
TwitterAPI
.
Controller
,
:unretweet
)
...
...
lib/pleroma/web/twitter_api/twitter_api_controller.ex
View file @
b2105a31
...
...
@@ -133,6 +133,19 @@ def notifications(%{assigns: %{user: user}} = conn, params) do
|>
render
(
NotificationView
,
"notification.json"
,
%{
notifications:
notifications
,
for:
user
})
end
def
notifications_read
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"latest_id"
=>
latest_id
}
=
params
)
do
Notification
.
set_read_up_to
(
user
,
latest_id
)
notifications
=
Notification
.
for_user
(
user
,
params
)
conn
|>
render
(
NotificationView
,
"notification.json"
,
%{
notifications:
notifications
,
for:
user
})
end
def
notifications_read
(%{
assigns:
%{
user:
user
}}
=
conn
,
_
)
do
bad_request_reply
(
conn
,
"You need to specify latest_id"
)
end
def
follow
(%{
assigns:
%{
user:
user
}}
=
conn
,
params
)
do
case
TwitterAPI
.
follow
(
user
,
params
)
do
{
:ok
,
user
,
followed
,
_activity
}
->
...
...
Write
Preview
Supports
Markdown
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