fix: don't show replies in main timelines
fix: add ui debounce fix: make usernames case insensitive
This commit is contained in:
parent
9f4e8a4d25
commit
8a9394a06a
6 changed files with 14 additions and 8 deletions
|
@ -75,8 +75,9 @@
|
|||
</form>
|
||||
|
||||
<script>
|
||||
function register(e) {
|
||||
async function register(e) {
|
||||
e.preventDefault();
|
||||
await trigger("atto::debounce", ["users::create"]);
|
||||
fetch("/api/v1/auth/register", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
@ -65,8 +65,9 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
function create_post_from_form(e) {
|
||||
async function create_post_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger("atto::debounce", ["posts::create"]);
|
||||
fetch("/api/v1/posts", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
@ -58,8 +58,9 @@
|
|||
</main>
|
||||
|
||||
<script>
|
||||
function create_community_from_form(e) {
|
||||
async function create_community_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger("atto::debounce", ["communities::create"]);
|
||||
fetch("/api/v1/communities", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
@ -141,8 +141,9 @@
|
|||
</main>
|
||||
|
||||
<script>
|
||||
function create_reply_from_form(e) {
|
||||
async function create_reply_from_form(e) {
|
||||
e.preventDefault();
|
||||
await trigger("atto::debounce", ["posts::create"]);
|
||||
fetch("/api/v1/posts", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
@ -76,11 +76,13 @@ impl DataManager {
|
|||
///
|
||||
/// # Arguments
|
||||
/// * `data` - a mock [`User`] object to insert
|
||||
pub async fn create_user(&self, data: User) -> Result<()> {
|
||||
pub async fn create_user(&self, mut data: User) -> Result<()> {
|
||||
if self.0.security.registration_enabled == false {
|
||||
return Err(Error::RegistrationDisabled);
|
||||
}
|
||||
|
||||
data.username = data.username.to_lowercase();
|
||||
|
||||
// check values
|
||||
if data.username.len() < 2 {
|
||||
return Err(Error::DataTooShort("username".to_string()));
|
||||
|
|
|
@ -223,7 +223,7 @@ impl DataManager {
|
|||
|
||||
let res = query_rows!(
|
||||
&conn,
|
||||
"SELECT * FROM posts ORDER BY likes DESC, created ASC LIMIT $1 OFFSET $2",
|
||||
"SELECT * FROM posts WHERE replying_to = 0 ORDER BY likes DESC, created ASC LIMIT $1 OFFSET $2",
|
||||
&[&(batch as i64), &((page * batch) as i64)],
|
||||
|x| { Self::get_post_from_row(x) }
|
||||
);
|
||||
|
@ -268,7 +268,7 @@ impl DataManager {
|
|||
let res = query_rows!(
|
||||
&conn,
|
||||
&format!(
|
||||
"SELECT * FROM posts WHERE community = {} {query_string} ORDER BY created DESC LIMIT $1 OFFSET $2",
|
||||
"SELECT * FROM posts WHERE (community = {} {query_string}) AND replying_to = 0 ORDER BY created DESC LIMIT $1 OFFSET $2",
|
||||
first.community
|
||||
),
|
||||
&[&(batch as i64), &((page * batch) as i64)],
|
||||
|
@ -423,7 +423,7 @@ impl DataManager {
|
|||
|
||||
// send notification
|
||||
if data.owner != rt.owner {
|
||||
let owner = self.get_user_by_id(rt.owner).await?;
|
||||
let owner = self.get_user_by_id(data.owner).await?;
|
||||
self.create_notification(Notification::new(
|
||||
"Your post has received a new comment!".to_string(),
|
||||
format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue