Skip to content

Commit 9fd622b

Browse files
authored
Merge pull request #54 from fbsamples/missing-fields
Add Some Missing Fields on Media Retrieval
2 parents a3b4573 + 5c37ed5 commit 9fd622b

File tree

7 files changed

+56
-24
lines changed

7 files changed

+56
-24
lines changed

src/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const FIELD__ID = 'id';
3333
const FIELD__ISSUED_AT = 'issued_at';
3434
const FIELD__IS_REPLY = 'is_reply';
3535
const FIELD__IS_VERIFIED = 'is_verified';
36+
const FIELD__IS_QUOTE_POST = 'is_quote_post';
3637
const FIELD__LIKES = 'likes';
3738
const FIELD__LINK_ATTACHMENT_URL = 'link_attachment_url';
3839
const FIELD__TOPIC_TAG = 'topic_tag';
@@ -43,8 +44,10 @@ const FIELD__PERMALINK = 'permalink';
4344
const FIELD__POLL_ATTACHMENT = 'poll_attachment';
4445
const FIELD__REPLIES = 'replies';
4546
const FIELD__REPOSTS = 'reposts';
47+
const FIELD__QUOTED_POST = 'quoted_post';
4648
const FIELD__QUOTES = 'quotes';
4749
const FIELD__REPLY_AUDIENCE = 'reply_audience';
50+
const FIELD__REPOSTED_POST = 'reposted_post';
4851
const FIELD__SCOPES = 'scopes';
4952
const FIELD__SHARES = 'shares';
5053
const FIELD__STATUS = 'status';
@@ -552,6 +555,9 @@ app.get('/threads/:threadId', loggedInUserChecker, async (req, res) => {
552555
FIELD__LINK_ATTACHMENT_URL,
553556
FIELD__TOPIC_TAG,
554557
FIELD__POLL_ATTACHMENT,
558+
FIELD__IS_QUOTE_POST,
559+
FIELD__QUOTED_POST,
560+
FIELD__REPOSTED_POST,
555561
].join(','),
556562
}, req.session.access_token);
557563

@@ -586,8 +592,7 @@ app.get('/threads', loggedInUserChecker, async (req, res) => {
586592
FIELD__MEDIA_URL,
587593
FIELD__PERMALINK,
588594
FIELD__TIMESTAMP,
589-
FIELD__REPLY_AUDIENCE,
590-
FIELD__ALT_TEXT,
595+
FIELD__USERNAME,
591596
].join(','),
592597
limit: limit ?? DEFAULT_THREADS_QUERY_LIMIT,
593598
};
@@ -638,7 +643,7 @@ app.get('/replies', loggedInUserChecker, async (req, res) => {
638643
FIELD__MEDIA_URL,
639644
FIELD__PERMALINK,
640645
FIELD__TIMESTAMP,
641-
FIELD__REPLY_AUDIENCE,
646+
FIELD__USERNAME,
642647
].join(','),
643648
limit: limit ?? DEFAULT_THREADS_QUERY_LIMIT,
644649
};
@@ -769,8 +774,6 @@ app.get('/mentions', loggedInUserChecker, async (req, res) => {
769774
FIELD__MEDIA_URL,
770775
FIELD__PERMALINK,
771776
FIELD__TIMESTAMP,
772-
FIELD__REPLY_AUDIENCE,
773-
FIELD__ALT_TEXT,
774777
].join(','),
775778
limit: limit ?? DEFAULT_THREADS_QUERY_LIMIT,
776779
};
@@ -862,7 +865,7 @@ app.get('/keywordSearch', loggedInUserChecker, async (req, res) => {
862865
FIELD__MEDIA_TYPE,
863866
FIELD__TEXT,
864867
FIELD__PERMALINK,
865-
FIELD__REPLY_AUDIENCE,
868+
FIELD__MEDIA_URL,
866869
].join(',')
867870
};
868871

views/keyword_search.pug

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ block content
2222
th Media Type
2323
th Text
2424
th Permalink
25-
th Reply Audience
25+
th Media URL
2626
tbody
2727
each thread in threads
2828
tr.threads-list-item
@@ -34,7 +34,9 @@ block content
3434
td.thread-text=thread.text
3535
td.thread-permalink
3636
a(href=thread.permalink target='_blank') View on Threads
37-
td.thread-reply-audience=thread.reply_audience
37+
td.thread-media-url
38+
if thread.media_url
39+
a(href=thread.media_url target='_blank') View Media File
3840

3941
div.paging
4042
if paging.nextUrl

views/mentions.pug

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ block content
1010
th Media Type
1111
th Text
1212
th Permalink
13-
th Reply Audience
13+
th Media URL
1414
tbody
1515
each thread in threads
1616
tr.threads-list-item
@@ -22,7 +22,9 @@ block content
2222
td.thread-text=thread.text
2323
td.thread-permalink
2424
a(href=thread.permalink target='_blank') View on Threads
25-
td.thread-reply-audience=thread.reply_audience
25+
td.thread-media-url
26+
if thread.media_url
27+
a(href=thread.media_url target='_blank') View Media File
2628

2729
div.paging
2830
if paging.nextUrl

views/profile_lookup.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extends layout
1+
extends layout_with_account
22

33
block content
44
style(type="text/css").

views/thread.pug

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,27 @@ block content
88
th Value
99
tbody
1010
tr
11-
td Media Type
12-
td #{media_type}
11+
td Thread ID
12+
td #{threadId}
1313
tr
14-
td Text
15-
td #{text}
14+
td Author
15+
td #{username}
1616
tr
1717
td Created On
1818
td #{timestamp}
19+
tr
20+
td Permalink
21+
td
22+
a(href=permalink target='_blank') #{permalink}
23+
tr
24+
td Text
25+
td #{text}
26+
tr
27+
td Topic Tag
28+
td #{topic_tag}
29+
tr
30+
td Media Type
31+
td #{media_type}
1932
tr
2033
td Media URL
2134
td
@@ -30,9 +43,6 @@ block content
3043
tr
3144
td Link Attachment URL
3245
td #{link_attachment_url}
33-
tr
34-
td Topic Tag
35-
td #{topic_tag}
3646
tr
3747
td Poll
3848
td
@@ -50,10 +60,6 @@ block content
5060
tr
5161
td Option D
5262
td #{option_d}
53-
tr
54-
td Permalink
55-
td
56-
a(href=permalink target='_blank') #{permalink}
5763
tr
5864
td Replies
5965
td
@@ -64,6 +70,19 @@ block content
6470
tr
6571
td Reply Audience
6672
td #{reply_audience}
73+
tr
74+
td Is Quote Post
75+
td #{is_quote_post}
76+
tr
77+
td Quoted Post
78+
td
79+
if (quoted_post)
80+
a(href=`/threads/${quoted_post.id}`) View Quoted Post
81+
tr
82+
td Reposted Post
83+
td
84+
if (reposted_post)
85+
a(href=`/threads/${reposted_post.id}`) View Reposted Post
6786
tr
6887
td Insights
6988
td

views/thread_replies_layout.pug

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ table.thread-replies
22
thead
33
tr
44
th ID
5+
th Username
56
th Created On
67
th Media Type
78
th Text
@@ -14,6 +15,7 @@ table.thread-replies
1415
tr.thread-replies-list-item
1516
td.reply-id
1617
a(href=`/threads/${reply.id}`)=reply.id
18+
td.reply-username=reply.username
1719
td.reply-timestamp=reply.timestamp
1820
td.reply-type=reply.media_type
1921
td.reply-text=reply.text

views/threads.pug

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@ block content
66
tr
77
th ID
88
th Created On
9+
th Author
910
th Media Type
1011
th Text
1112
th Permalink
12-
th Reply Audience
13+
th Media URL
1314
tbody
1415
each thread in threads
1516
tr.threads-list-item
1617
td.thread-id
1718
a(href=`/threads/${thread.id}`)=thread.id
1819
td.thread-timestamp=thread.timestamp
20+
td.thread-author=thread.username
1921
td.thread-type=thread.media_type
2022
td.thread-text=thread.text
2123
td.thread-permalink
2224
a(href=thread.permalink target='_blank') View on Threads
23-
td.thread-reply-audience=thread.reply_audience
25+
td.thread-media-url
26+
if thread.media_url
27+
a(href=thread.media_url target='_blank') View Media File
2428

2529
div.paging
2630
if paging.nextUrl

0 commit comments

Comments
 (0)