User and note fetching fixes
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
This commit is contained in:
parent
69cb1c5220
commit
05469f68a8
|
@ -359,17 +359,17 @@ impl NoteResolver {
|
||||||
let mut select = note::Entity::find().add_aliased_columns(Some(USER), user::Entity);
|
let mut select = note::Entity::find().add_aliased_columns(Some(USER), user::Entity);
|
||||||
|
|
||||||
if let Some(pins_user) = options.only_pins_from.clone() {
|
if let Some(pins_user) = options.only_pins_from.clone() {
|
||||||
select = select.join_as(
|
select = select
|
||||||
|
.join_as(
|
||||||
JoinType::InnerJoin,
|
JoinType::InnerJoin,
|
||||||
note::Relation::UserNotePining
|
note::Relation::UserNotePining.def(),
|
||||||
.def()
|
|
||||||
.on_condition(move |left, _right| {
|
|
||||||
Expr::col((left, note::Column::UserId))
|
|
||||||
.eq(&pins_user)
|
|
||||||
.into_condition()
|
|
||||||
}),
|
|
||||||
ALIAS_PIN.clone(),
|
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 {
|
if let Some(user_id) = &options.with_interactions_from {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { host as localHost } from "@/config";
|
||||||
import { computed, defineAsyncComponent, watch } from "vue";
|
import { computed, defineAsyncComponent, watch } from "vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
|
@ -60,9 +61,10 @@ let tab = $ref(props.page);
|
||||||
let user = $ref<null | packed.PackUserSelfMaybeAll>(null);
|
let user = $ref<null | packed.PackUserSelfMaybeAll>(null);
|
||||||
let error = $ref<any>(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;
|
if (!props.acct) return;
|
||||||
user = null;
|
|
||||||
|
if (clear) user = null;
|
||||||
|
|
||||||
os.magApi(
|
os.magApi(
|
||||||
endpoints.GetUserByAcct,
|
endpoints.GetUserByAcct,
|
||||||
|
@ -78,11 +80,13 @@ function fetchUser(refetch: boolean = true): void {
|
||||||
new Date().getTime() -
|
new Date().getTime() -
|
||||||
new Date(user.last_fetched_at).getTime() >
|
new Date(user.last_fetched_at).getTime() >
|
||||||
dayMs) &&
|
dayMs) &&
|
||||||
|
user.host !== null &&
|
||||||
|
user.host !== localHost &&
|
||||||
refetch
|
refetch
|
||||||
) {
|
) {
|
||||||
os.api("users/show", Acct.parse(props.acct))
|
os.api("users/show", Acct.parse(props.acct))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
fetchUser(false);
|
fetchUser(false, false);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
error = e;
|
error = e;
|
||||||
|
|
|
@ -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> {
|
fn validate_tag_inner((name, host): (&str, Option<&str>)) -> Result<(), FediverseTagParseError> {
|
||||||
if name
|
if name
|
||||||
.chars()
|
.chars()
|
||||||
.any(|c| !c.is_alphanumeric() && c != '-' && c != '.')
|
.any(|c| !c.is_alphanumeric() && c != '-' && c != '_' && c != '.')
|
||||||
{
|
{
|
||||||
return Err(FediverseTagParseError::InvalidChar(name.to_owned()));
|
return Err(FediverseTagParseError::InvalidChar(name.to_owned()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue