Make search available on public links

fixes #1698

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2022-12-12 23:02:03 +01:00
parent 655ebaf5cf
commit 8d37cc1edd
2 changed files with 25 additions and 3 deletions

View File

@ -603,6 +603,7 @@ class BookmarkMapper extends QBMapper {
[$cte, $params, $paramTypes] = $this->_generateCTE($folder->getId());
$qb = $this->db->getQueryBuilder();
$qb->automaticTablePrefix(false);
$bookmark_cols = array_map(static function ($c) {
return 'b.' . $c;
}, Bookmark::$columns);
@ -616,7 +617,7 @@ class BookmarkMapper extends QBMapper {
}
$qb
->from('bookmarks', 'b')
->from('*PREFIX*bookmarks', 'b')
->join('b', 'folder_tree', 'tree', 'tree.item_id = b.id AND tree.type = '.$qb->createPositionalParameter(TreeMapper::TYPE_BOOKMARK));
@ -782,7 +783,7 @@ class BookmarkMapper extends QBMapper {
* @param IQueryBuilder $qb
*/
private function _selectFolders(IQueryBuilder $qb): void {
$qb->leftJoin('b', 'bookmarks_tree', 'tr2', 'b.id = tr2.id AND tr2.type = '.$qb->createPositionalParameter(TreeMapper::TYPE_BOOKMARK));
$qb->leftJoin('b', '*PREFIX*bookmarks_tree', 'tr2', 'b.id = tr2.id AND tr2.type = '.$qb->createPositionalParameter(TreeMapper::TYPE_BOOKMARK));
if ($this->getDbType() === 'pgsql') {
$folders = $qb->createFunction('array_to_string(array_agg(' . $qb->getColumnName('tr2.parent_folder') . "), ',')");
} else {

View File

@ -100,11 +100,20 @@
{{ !$store.state.public? t('bookmarks', 'The RSS feed requires authentication with your Nextcloud credentials') : '' }}
</NcActionButton>
</NcActions>
<NcTextField v-if="isPublic"
:value.sync="search"
:label="t('bookmarks','Search')"
:placeholder="t('bookmarks','Search')"
class="inline-search"
@update:value="onSearch($event)">
<MagnifyIcon />
</NcTextField>
</div>
</div>
</template>
<script>
import { NcMultiselect, NcActions, NcActionButton, NcActionInput, NcActionRouter } from '@nextcloud/vue'
import { NcMultiselect, NcActions, NcActionButton, NcActionInput, NcActionRouter, NcTextField } from '@nextcloud/vue'
import MagnifyIcon from 'vue-material-design-icons/Magnify.vue'
import EarthIcon from 'vue-material-design-icons/Earth.vue'
import ViewGridIcon from 'vue-material-design-icons/ViewGrid.vue'
import ViewListIcon from 'vue-material-design-icons/ViewList.vue'
@ -147,6 +156,8 @@ export default {
EarthIcon,
ShareVariantIcon,
TagIcon,
NcTextField,
MagnifyIcon,
},
props: {},
data() {
@ -271,6 +282,10 @@ export default {
})
},
onSearch(query) {
this.$router.push({ name: this.routes.SEARCH, params: { search: query } })
},
copyRssUrl() {
copy(this.rssURL)
this.$store.commit(mutations.SET_NOTIFICATION, t('bookmarks', 'RSS feed copied'))
@ -349,4 +364,10 @@ export default {
.controls__right > * {
min-width: 30px;
}
.controls__right .inline-search {
max-width: 150px !important;
position: relative;
top: 4px;
}
</style>