summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-27 16:51:08 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-27 16:51:08 +0900
commit9ac9ff1800d85b33abb83973bf29ed3f64b27c97 (patch)
tree0854f94bcc37daeaa2eea2c37fead6bd676a39ab /src/api
parentUpdate README.md (diff)
downloadmisskey-9ac9ff1800d85b33abb83973bf29ed3f64b27c97.tar.gz
misskey-9ac9ff1800d85b33abb83973bf29ed3f64b27c97.tar.bz2
misskey-9ac9ff1800d85b33abb83973bf29ed3f64b27c97.zip
良い感じに
Diffstat (limited to 'src/api')
-rw-r--r--src/api/endpoints.ts1
-rw-r--r--src/api/endpoints/posts.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/api/endpoints.ts b/src/api/endpoints.ts
index 37e3348b86..0ce51e9a51 100644
--- a/src/api/endpoints.ts
+++ b/src/api/endpoints.ts
@@ -81,6 +81,7 @@ export default [
{ name: 'following/create', shouldBeSignin: true, limitDuration: hour, limitMax: 100, kind: 'following-write' },
{ name: 'following/delete', shouldBeSignin: true, limitDuration: hour, limitMax: 100, kind: 'following-write' },
+ { name: 'posts', shouldBeSignin: false },
{ name: 'posts/show', shouldBeSignin: false },
{ name: 'posts/replies', shouldBeSignin: false },
{ name: 'posts/context', shouldBeSignin: false },
diff --git a/src/api/endpoints/posts.js b/src/api/endpoints/posts.js
index 9bc25315a7..59cfb8a441 100644
--- a/src/api/endpoints/posts.js
+++ b/src/api/endpoints/posts.js
@@ -15,6 +15,22 @@ import serialize from '../serializers/post';
module.exports = (params) =>
new Promise(async (res, rej) =>
{
+ // Get 'include_replies' parameter
+ let includeReplies = params.include_replies;
+ if (includeReplies === true) {
+ includeReplies = true;
+ } else {
+ includeReplies = false;
+ }
+
+ // Get 'include_reposts' parameter
+ let includeReposts = params.include_reposts;
+ if (includeReposts === true) {
+ includeReposts = true;
+ } else {
+ includeReposts = false;
+ }
+
// Get 'limit' parameter
let limit = params.limit;
if (limit !== undefined && limit !== null) {
@@ -52,6 +68,14 @@ module.exports = (params) =>
};
}
+ if (!includeReplies) {
+ query.reply_to_id = null;
+ }
+
+ if (!includeReposts) {
+ query.repost_id = null;
+ }
+
// Issue query
const posts = await Post
.find(query, {