Tried to fix a broke filter.
Build LinkLog Development Image / development-image (push) Successful in 10s
Build LinkLog Development Image / development-image (push) Successful in 10s
This commit is contained in:
@@ -6,7 +6,6 @@ from fastapi import APIRouter, Depends, Header, HTTPException, Response, status
|
||||
import logging
|
||||
from pydantic import BaseModel
|
||||
|
||||
from backend.app.api.dependencies import get_optional_current_user
|
||||
from backend.app.services.link_service import create_link, delete_link, find_owned_link_by_title_url, get_link_tags, get_owned_link, list_public_links, list_tags, mark_mastodon_posted, update_link
|
||||
from backend.app.database import get_connection
|
||||
from backend.app.services.plugin_manager import plugin_manager
|
||||
@@ -35,9 +34,8 @@ class LinkUpdate(BaseModel):
|
||||
|
||||
|
||||
@router.get('/tags')
|
||||
def available_tags(user: dict | None = Depends(get_optional_current_user)):
|
||||
user_id = user['id'] if user else None
|
||||
return list_tags(user_id=user_id)
|
||||
def available_tags():
|
||||
return list_tags()
|
||||
|
||||
|
||||
@router.get('/scrape')
|
||||
|
||||
@@ -227,32 +227,9 @@ def list_public_users():
|
||||
return [row['username'] for row in rows]
|
||||
|
||||
|
||||
def list_tags(user_id: str | None = None):
|
||||
def list_tags():
|
||||
with get_connection() as conn:
|
||||
if user_id:
|
||||
rows = conn.execute(
|
||||
'''
|
||||
SELECT tags.name
|
||||
FROM tags
|
||||
LEFT JOIN users ON users.id = tags.created_by
|
||||
WHERE tags.created_by IS NULL
|
||||
OR tags.created_by = ?
|
||||
OR users.is_admin = 1
|
||||
ORDER BY tags.name
|
||||
''',
|
||||
(user_id,),
|
||||
).fetchall()
|
||||
else:
|
||||
rows = conn.execute(
|
||||
'''
|
||||
SELECT tags.name
|
||||
FROM tags
|
||||
LEFT JOIN users ON users.id = tags.created_by
|
||||
WHERE tags.created_by IS NULL
|
||||
OR users.is_admin = 1
|
||||
ORDER BY tags.name
|
||||
''',
|
||||
).fetchall()
|
||||
rows = conn.execute('SELECT name FROM tags ORDER BY name').fetchall()
|
||||
tags = []
|
||||
seen = set()
|
||||
for row in rows:
|
||||
|
||||
Reference in New Issue
Block a user