forked from mirrors/akkoma
Enable user timelines.
This commit is contained in:
parent
a1cabeea4a
commit
eb18b9ebba
|
@ -33,6 +33,7 @@ def user_fetcher(username) do
|
|||
get "/statuses/public_and_external_timeline", TwitterAPI.Controller, :public_and_external_timeline
|
||||
get "/statuses/networkpublic_timeline", TwitterAPI.Controller, :public_and_external_timeline
|
||||
get "/statuses/user_timeline", TwitterAPI.Controller, :user_timeline
|
||||
get "/qvitter/statuses/user_timeline", TwitterAPI.Controller, :user_timeline
|
||||
|
||||
get "/statuses/show/:id", TwitterAPI.Controller, :fetch_status
|
||||
get "/statusnet/conversation/:id", TwitterAPI.Controller, :fetch_conversation
|
||||
|
|
|
@ -215,10 +215,18 @@ def register_user(params) do
|
|||
end
|
||||
end
|
||||
|
||||
def get_by_id_or_nickname(id_or_nickname) do
|
||||
if !is_integer(id_or_nickname) && :error == Integer.parse(id_or_nickname) do
|
||||
Repo.get_by(User, nickname: id_or_nickname)
|
||||
else
|
||||
Repo.get(User, id_or_nickname)
|
||||
end
|
||||
end
|
||||
|
||||
def get_user(user \\ nil, params) do
|
||||
case params do
|
||||
%{"user_id" => user_id} ->
|
||||
case target = Repo.get(User, user_id) do
|
||||
case target = get_by_id_or_nickname(user_id) do
|
||||
nil ->
|
||||
{:error, "No user with such user_id"}
|
||||
_ ->
|
||||
|
|
|
@ -1 +1 @@
|
|||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pleroma</title><link rel=stylesheet href=/static/font/css/fontello.css><link rel=stylesheet href=/static/font/css/animation.css><link href=/static/css/app.3662cf7b10084635d2b09041a8340797.css rel=stylesheet></head><body style="display: none"><div id=app></div><script type=text/javascript src=/static/js/manifest.f77f8e3098770cd89c4f.js></script><script type=text/javascript src=/static/js/vendor.bcbf57bfdffb555a1e28.js></script><script type=text/javascript src=/static/js/app.cb2a631521680466b348.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pleroma</title><link rel=stylesheet href=/static/font/css/fontello.css><link rel=stylesheet href=/static/font/css/animation.css><link href=/static/css/app.3662cf7b10084635d2b09041a8340797.css rel=stylesheet></head><body style="display: none"><div id=app></div><script type=text/javascript src=/static/js/manifest.43d2fa23b3a57580d990.js></script><script type=text/javascript src=/static/js/vendor.7b75d360647f8aca9a27.js></script><script type=text/javascript src=/static/js/app.21c841e6c909dfcf6600.js></script></body></html>
|
4
priv/static/static/js/app.21c841e6c909dfcf6600.js
Normal file
4
priv/static/static/js/app.21c841e6c909dfcf6600.js
Normal file
File diff suppressed because one or more lines are too long
1
priv/static/static/js/app.21c841e6c909dfcf6600.js.map
Normal file
1
priv/static/static/js/app.21c841e6c909dfcf6600.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
priv/static/static/js/manifest.43d2fa23b3a57580d990.js
Normal file
2
priv/static/static/js/manifest.43d2fa23b3a57580d990.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
!function(e){function t(n){if(a[n])return a[n].exports;var r=a[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var p,s,l=0,i=[];l<c.length;l++)s=c[l],r[s]&&i.push.apply(i,r[s]),r[s]=0;for(p in o)e[p]=o[p];for(n&&n(c,o);i.length;)i.shift().call(null,t);if(o[0])return a[0]=0,t(0)};var a={},r={0:0};t.e=function(e,n){if(0===r[e])return n.call(null,t);if(void 0!==r[e])r[e].push(n);else{r[e]=[n];var a=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+"static/js/"+e+"."+{1:"7b75d360647f8aca9a27",2:"21c841e6c909dfcf6600"}[e]+".js",a.appendChild(c)}},t.m=e,t.c=a,t.p="/"}([]);
|
||||
//# sourceMappingURL=manifest.43d2fa23b3a57580d990.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
|||
!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n=window.webpackJsonp;window.webpackJsonp=function(c,o){for(var p,s,l=0,i=[];l<c.length;l++)s=c[l],a[s]&&i.push.apply(i,a[s]),a[s]=0;for(p in o)e[p]=o[p];for(n&&n(c,o);i.length;)i.shift().call(null,t);if(o[0])return r[0]=0,t(0)};var r={},a={0:0};t.e=function(e,n){if(0===a[e])return n.call(null,t);if(void 0!==a[e])a[e].push(n);else{a[e]=[n];var r=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.src=t.p+"static/js/"+e+"."+{1:"bcbf57bfdffb555a1e28",2:"cb2a631521680466b348"}[e]+".js",r.appendChild(c)}},t.m=e,t.c=r,t.p="/"}([]);
|
||||
//# sourceMappingURL=manifest.f77f8e3098770cd89c4f.js.map
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/vendor.7b75d360647f8aca9a27.js.map
Normal file
1
priv/static/static/js/vendor.7b75d360647f8aca9a27.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -133,6 +133,7 @@ test "get a user by params" do
|
|||
|
||||
assert {:error, "You need to specify screen_name or user_id"} == TwitterAPI.get_user(nil, nil)
|
||||
assert user1_result == TwitterAPI.get_user(nil, %{"user_id" => user1.id})
|
||||
assert user1_result == TwitterAPI.get_user(nil, %{"user_id" => user1.nickname})
|
||||
assert user1_result == TwitterAPI.get_user(nil, %{"screen_name" => user1.nickname})
|
||||
assert user1_result == TwitterAPI.get_user(user1, nil)
|
||||
assert user1_result == TwitterAPI.get_user(user2, %{"user_id" => user1.id})
|
||||
|
|
Loading…
Reference in a new issue