Compare commits
No commits in common. "298bae2e78d94f036cca5621b99ecb8b88904b50" and "a2b8f1a51c067c9e34c152965d65e2ae6c8c2c63" have entirely different histories.
298bae2e78
...
a2b8f1a51c
@ -1,2 +0,0 @@
|
|||||||
alter table users
|
|
||||||
add column shadowbanned boolean not null default false;
|
|
@ -1 +0,0 @@
|
|||||||
create index messages_territory_id_idx on messages (territory, id);
|
|
@ -67,7 +67,7 @@ async fn logic(state: Arc<State>, id: i64, location: u32, query: GetLocationQuer
|
|||||||
m.message,
|
m.message,
|
||||||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||||
coalesce(sum(case when v.user = ? then v.vote else 0 end), 0) as user_vote,
|
coalesce(v2.vote, 0) as user_vote,
|
||||||
m.glyph,
|
m.glyph,
|
||||||
m.emote as "emote: Json<Option<EmoteData>>",
|
m.emote as "emote: Json<Option<EmoteData>>",
|
||||||
m.created,
|
m.created,
|
||||||
@ -75,10 +75,10 @@ async fn logic(state: Arc<State>, id: i64, location: u32, query: GetLocationQuer
|
|||||||
coalesce(cast((julianday(current_timestamp) - julianday(u.last_seen)) * 1440 as int), 0) as last_seen_minutes
|
coalesce(cast((julianday(current_timestamp) - julianday(u.last_seen)) * 1440 as int), 0) as last_seen_minutes
|
||||||
from messages m
|
from messages m
|
||||||
left join votes v on m.id = v.message
|
left join votes v on m.id = v.message
|
||||||
|
left join votes v2 on m.id = v2.message and v2.user = ?
|
||||||
inner join users u on m.user = u.id
|
inner join users u on m.user = u.id
|
||||||
where m.territory = ? and not u.shadowbanned and m.world is ? and m.ward is ? and m.plot is ?
|
where m.territory = ? and m.world is ? and m.ward is ? and m.plot is ?
|
||||||
group by m.id
|
group by m.id"#,
|
||||||
"#,
|
|
||||||
id,
|
id,
|
||||||
location,
|
location,
|
||||||
world,
|
world,
|
||||||
@ -103,7 +103,7 @@ async fn logic(state: Arc<State>, id: i64, location: u32, query: GetLocationQuer
|
|||||||
m.message,
|
m.message,
|
||||||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||||
coalesce(sum(case when v.user = ? then v.vote else 0 end), 0) as user_vote,
|
coalesce(v2.vote, 0) as user_vote,
|
||||||
m.glyph,
|
m.glyph,
|
||||||
m.emote as "emote: Json<Option<EmoteData>>",
|
m.emote as "emote: Json<Option<EmoteData>>",
|
||||||
m.created,
|
m.created,
|
||||||
@ -111,10 +111,10 @@ async fn logic(state: Arc<State>, id: i64, location: u32, query: GetLocationQuer
|
|||||||
coalesce(cast((julianday(current_timestamp) - julianday(u.last_seen)) * 1440 as int), 0) as last_seen_minutes
|
coalesce(cast((julianday(current_timestamp) - julianday(u.last_seen)) * 1440 as int), 0) as last_seen_minutes
|
||||||
from messages m
|
from messages m
|
||||||
left join votes v on m.id = v.message
|
left join votes v on m.id = v.message
|
||||||
|
left join votes v2 on m.id = v2.message and v2.user = ?
|
||||||
inner join users u on m.user = u.id
|
inner join users u on m.user = u.id
|
||||||
where m.territory = ? and not u.shadowbanned
|
where m.territory = ?
|
||||||
group by m.id
|
group by m.id"#,
|
||||||
"#,
|
|
||||||
id,
|
id,
|
||||||
location,
|
location,
|
||||||
)
|
)
|
||||||
@ -182,6 +182,7 @@ fn filter_messages(messages: &mut Vec<RetrievedMessage>, id: i64, vote_threshold
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let time_since_creation = a.created.signed_duration_since(Utc::now().naive_utc());
|
let time_since_creation = a.created.signed_duration_since(Utc::now().naive_utc());
|
||||||
let brand_new = time_since_creation < Duration::minutes(30);
|
let brand_new = time_since_creation < Duration::minutes(30);
|
||||||
let new = time_since_creation < Duration::hours(2);
|
let new = time_since_creation < Duration::hours(2);
|
||||||
|
@ -38,12 +38,13 @@ async fn logic(state: Arc<State>, id: i64, message_id: Uuid) -> Result<impl Repl
|
|||||||
m.message,
|
m.message,
|
||||||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||||
coalesce(sum(case when v.user = ? then v.vote else 0 end), 0) as user_vote,
|
coalesce(v2.vote, 0) as user_vote,
|
||||||
m.glyph,
|
m.glyph,
|
||||||
m.emote as "emote: Json<Option<EmoteData>>",
|
m.emote as "emote: Json<Option<EmoteData>>",
|
||||||
m.created
|
m.created
|
||||||
from messages m
|
from messages m
|
||||||
left join votes v on m.id = v.message
|
left join votes v on m.id = v.message
|
||||||
|
left join votes v2 on m.id = v2.message and v2.user = ?
|
||||||
where m.id = ?
|
where m.id = ?
|
||||||
group by m.id"#,
|
group by m.id"#,
|
||||||
id,
|
id,
|
||||||
|
@ -42,13 +42,14 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, mut query: HashMap<String
|
|||||||
m.message,
|
m.message,
|
||||||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||||
coalesce(sum(case when v.user = ? then v.vote else 0 end), 0) as user_vote,
|
coalesce(v2.vote, 0) as user_vote,
|
||||||
m.glyph,
|
m.glyph,
|
||||||
m.created,
|
m.created,
|
||||||
m.emote as "emote: Json<Option<EmoteData>>",
|
m.emote as "emote: Json<Option<EmoteData>>",
|
||||||
0 as "is_hidden: bool"
|
0 as "is_hidden: bool"
|
||||||
from messages m
|
from messages m
|
||||||
left join votes v on m.id = v.message
|
left join votes v on m.id = v.message
|
||||||
|
left join votes v2 on m.id = v2.message and v2.user = ?
|
||||||
where m.user = ?
|
where m.user = ?
|
||||||
group by m.id"#,
|
group by m.id"#,
|
||||||
id,
|
id,
|
||||||
|
Loading…
Reference in New Issue
Block a user