Resolved conflict with master

pull/722/head
Lyra 2019-12-07 13:10:10 +01:00
commit 3123d308d0
5 changed files with 39 additions and 8 deletions

View File

@ -6,7 +6,7 @@ RATE_LIMIT_MESSAGE=30
RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_MESSAGE_PER_SECOND=60
RATE_LIMIT_POST=3 RATE_LIMIT_POST=3
RATE_LIMIT_POST_PER_SECOND=600 RATE_LIMIT_POST_PER_SECOND=600
RATE_LIMIT_REGISTER=1 RATE_LIMIT_REGISTER=3
RATE_LIMIT_REGISTER_PER_SECOND=3600 RATE_LIMIT_REGISTER_PER_SECOND=3600
SMTP_SERVER={{ smtp_server }} SMTP_SERVER={{ smtp_server }}
SMTP_LOGIN={{ smtp_login }} SMTP_LOGIN={{ smtp_login }}

2
docker/dev/.env vendored
View File

@ -7,7 +7,7 @@ RATE_LIMIT_MESSAGE=30
RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_MESSAGE_PER_SECOND=60
RATE_LIMIT_POST=6 RATE_LIMIT_POST=6
RATE_LIMIT_POST_PER_SECOND=600 RATE_LIMIT_POST_PER_SECOND=600
RATE_LIMIT_REGISTER=1 RATE_LIMIT_REGISTER=3
RATE_LIMIT_REGISTER_PER_SECOND=3600 RATE_LIMIT_REGISTER_PER_SECOND=3600
# Optional email fields # Optional email fields

2
docker/prod/.env vendored
View File

@ -7,7 +7,7 @@ RATE_LIMIT_MESSAGE=30
RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_MESSAGE_PER_SECOND=60
RATE_LIMIT_POST=6 RATE_LIMIT_POST=6
RATE_LIMIT_POST_PER_SECOND=600 RATE_LIMIT_POST_PER_SECOND=600
RATE_LIMIT_REGISTER=1 RATE_LIMIT_REGISTER=3
RATE_LIMIT_REGISTER_PER_SECOND=3600 RATE_LIMIT_REGISTER_PER_SECOND=3600
# Optional email fields # Optional email fields

25
docs/api.md vendored
View File

@ -1,11 +1,11 @@
# Lemmy WebSocket API # Lemmy API
*Note: this may lag behind the actual API endpoints [here](../server/src/api).* *Note: this may lag behind the actual API endpoints [here](../server/src/api).*
<!-- toc --> <!-- toc -->
- [Data types](#data-types) - [Data types](#data-types)
- [Basic usage](#basic-usage) - [Basic usage](#basic-usage)
* [Endpoint](#endpoint) * [WebSocket Endpoint](#websocket-endpoint)
* [Testing with Websocat](#testing-with-websocat) * [Testing with Websocat](#testing-with-websocat)
* [Testing with the WebSocket JavaScript API](#testing-with-the-websocket-javascript-api) * [Testing with the WebSocket JavaScript API](#testing-with-the-websocket-javascript-api)
- [Rate limits](#rate-limits) - [Rate limits](#rate-limits)
@ -125,6 +125,10 @@
+ [Create Comment Like](#create-comment-like) + [Create Comment Like](#create-comment-like)
- [Request](#request-35) - [Request](#request-35)
- [Response](#response-35) - [Response](#response-35)
* [RSS / Atom feeds](#rss--atom-feeds)
+ [All](#all)
+ [Community](#community-1)
+ [User](#user)
<!-- tocstop --> <!-- tocstop -->
@ -140,7 +144,7 @@
Request and response strings are in [JSON format](https://www.json.org). Request and response strings are in [JSON format](https://www.json.org).
### Endpoint ### WebSocket Endpoint
Connect to <code>ws://***host***/api/v1/ws</code> to get started. Connect to <code>ws://***host***/api/v1/ws</code> to get started.
@ -1010,3 +1014,18 @@ Mods and admins can remove a comment, creators can delete it.
comment: CommentView comment: CommentView
} }
``` ```
### RSS / Atom feeds
#### All
`/feeds/all.xml?sort=Hot`
#### Community
`/feeds/c/community-name.xml?sort=Hot`
#### User
`/feeds/u/user-name.xml?sort=Hot`

View File

@ -79,6 +79,7 @@ pub struct PostViewQuery<'a> {
conn: &'a PgConnection, conn: &'a PgConnection,
query: BoxedQuery<'a, Pg>, query: BoxedQuery<'a, Pg>,
my_user_id: Option<i32>, my_user_id: Option<i32>,
for_creator_id: Option<i32>,
page: Option<i64>, page: Option<i64>,
limit: Option<i64>, limit: Option<i64>,
} }
@ -142,6 +143,7 @@ impl<'a> PostViewQuery<'a> {
conn, conn,
query, query,
my_user_id: None, my_user_id: None,
for_creator_id: None,
page: None, page: None,
limit: None, limit: None,
} }
@ -162,8 +164,7 @@ impl<'a> PostViewQuery<'a> {
} }
pub fn for_creator_id(mut self, for_creator_id: i32) -> Self { pub fn for_creator_id(mut self, for_creator_id: i32) -> Self {
use super::post_view::post_view::dsl::*; self.for_creator_id = Some(for_creator_id);
self.query = self.query.filter(creator_id.eq(for_creator_id));
self self
} }
@ -239,6 +240,17 @@ impl<'a> PostViewQuery<'a> {
self.query.filter(user_id.is_null()) self.query.filter(user_id.is_null())
}; };
// If its for a specific user, show the removed / deleted
if let Some(for_creator_id) = self.for_creator_id {
self.query = self.query.filter(creator_id.eq(for_creator_id));
} else {
self.query = self.query
.filter(removed.eq(false))
.filter(deleted.eq(false))
.filter(community_removed.eq(false))
.filter(community_deleted.eq(false));
}
let (limit, offset) = limit_and_offset(self.page, self.limit); let (limit, offset) = limit_and_offset(self.page, self.limit);
let query = self let query = self
.query .query