Uses metaquery instead of authorid for author filter. #330.

This commit is contained in:
Mateus Machado Luna 2019-11-06 16:57:39 -03:00
parent c2d4e1ff83
commit 56e7368262
2 changed files with 40 additions and 9 deletions

View File

@ -89,8 +89,9 @@
:open-on-focus="openOnFocus"
@typing="fetchUsersForFiltering"
@select="filterActivitiesByUser"
:loading="isFetchingUsers"
field="name"
icon="magnify">
icon="account">
<template slot-scope="props">
<div class="media">
<div
@ -445,7 +446,7 @@
moment(dateString[1], this.dateFormat).toDate()
];
},
fetchUsersForFiltering(search) {
fetchUsersForFiltering: _.debounce(function (search) {
this.isFetchingUsers = true;
this.fetchUsers({ search: search })
@ -457,7 +458,7 @@
this.$console.error(error);
this.isFetchingPages = false;
});
}
}, 500)
},
computed: {
activities(){

View File

@ -21,8 +21,18 @@ export const fetchActivities = ({ commit }, { page, activitiesPerPage, search, s
endpoint += '&' + qs.stringify(dateQuery);
}
if (authorId != undefined && authorId != null)
endpoint += `&authorid=${authorId}`;
if (authorId != undefined && authorId != null) {
let metaQuery = {
metaquery: [
{
value: authorId,
key: 'user_id',
compare: '='
}
]
};
endpoint += '&' + qs.stringify(metaQuery);
}
return new Promise((resolve, reject) => {
axios.tainacan.get(endpoint)
@ -60,8 +70,18 @@ export const fetchCollectionActivities = ({ commit }, { page, activitiesPerPage,
endpoint += '&' + qs.stringify(dateQuery);
}
if (authorId != undefined && authorId != null)
endpoint += `&authorid=${authorId}`;
if (authorId != undefined && authorId != null) {
let metaQuery = {
metaquery: [
{
value: authorId,
key: 'user_id',
compare: '='
}
]
};
endpoint += '&' + qs.stringify(metaQuery);
}
return new Promise((resolve, reject) => {
axios.tainacan.get(endpoint)
@ -86,8 +106,18 @@ export const fetchItemActivities = ({ commit }, { page, activitiesPerPage, itemI
if (search != undefined && search != '')
endpoint += `&search=${search}`;
if (authorId != undefined && authorId != null)
endpoint += `&authorid=${authorId}`;
if (authorId != undefined && authorId != null) {
let metaQuery = {
metaquery: [
{
value: authorId,
key: 'user_id',
compare: '='
}
]
};
endpoint += '&' + qs.stringify(metaQuery);
}
if (searchDates && searchDates[0] != null && searchDates[1] != null) {
let dateQuery = {