User and note fetching fixes
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2023-12-27 04:40:13 +01:00
parent 69cb1c5220
commit 05469f68a8
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
3 changed files with 19 additions and 15 deletions

View File

@ -359,17 +359,17 @@ impl NoteResolver {
let mut select = note::Entity::find().add_aliased_columns(Some(USER), user::Entity);
if let Some(pins_user) = options.only_pins_from.clone() {
select = select.join_as(
JoinType::InnerJoin,
note::Relation::UserNotePining
.def()
.on_condition(move |left, _right| {
Expr::col((left, note::Column::UserId))
.eq(&pins_user)
.into_condition()
}),
ALIAS_PIN.clone(),
)
select = select
.join_as(
JoinType::InnerJoin,
note::Relation::UserNotePining.def(),
ALIAS_PIN.clone(),
)
.filter(
Expr::col((ALIAS_PIN.clone(), user_note_pining::Column::UserId))
.eq(&pins_user)
.into_condition(),
)
}
if let Some(user_id) = &options.with_interactions_from {

View File

@ -29,6 +29,7 @@
</template>
<script lang="ts" setup>
import { host as localHost } from "@/config";
import { computed, defineAsyncComponent, watch } from "vue";
import * as os from "@/os";
import { useRouter } from "@/router";
@ -60,9 +61,10 @@ let tab = $ref(props.page);
let user = $ref<null | packed.PackUserSelfMaybeAll>(null);
let error = $ref<any>(null);
function fetchUser(refetch: boolean = true): void {
function fetchUser(refetch: boolean = true, clear: boolean = true): void {
if (!props.acct) return;
user = null;
if (clear) user = null;
os.magApi(
endpoints.GetUserByAcct,
@ -78,11 +80,13 @@ function fetchUser(refetch: boolean = true): void {
new Date().getTime() -
new Date(user.last_fetched_at).getTime() >
dayMs) &&
user.host !== null &&
user.host !== localHost &&
refetch
) {
os.api("users/show", Acct.parse(props.acct))
.then(() => {
fetchUser(false);
fetchUser(false, false);
})
.catch((e) => {
error = e;

View File

@ -68,7 +68,7 @@ fn split_tag_inner(tag: impl AsRef<str>) -> (String, Option<String>) {
fn validate_tag_inner((name, host): (&str, Option<&str>)) -> Result<(), FediverseTagParseError> {
if name
.chars()
.any(|c| !c.is_alphanumeric() && c != '-' && c != '.')
.any(|c| !c.is_alphanumeric() && c != '-' && c != '_' && c != '.')
{
return Err(FediverseTagParseError::InvalidChar(name.to_owned()));
}