feat: post details page viewable from feed
This commit is contained in:
Binary file not shown.
@@ -874,9 +874,14 @@ def api_delete_post(post_id: int):
|
|||||||
delete_rights(post_id)
|
delete_rights(post_id)
|
||||||
delete_audio_post(post_id)
|
delete_audio_post(post_id)
|
||||||
|
|
||||||
# ❌ Skip audit log for now
|
add_audit_log({
|
||||||
|
"post_id": post_id,
|
||||||
|
"user_id": user_id,
|
||||||
|
"action": "post.deleted",
|
||||||
|
"details": json.dumps({"title": post.get("title")})
|
||||||
|
})
|
||||||
|
|
||||||
return jsonify({"message": "Post and all related data deleted successfully", "post_id": post_id})
|
return jsonify({"message": "Post deleted successfully", "post_id": post_id})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return _error(f"Failed to delete post: {str(e)}", 500)
|
return _error(f"Failed to delete post: {str(e)}", 500)
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export default function AudioPostCard({ post, onViewPost }) {
|
|||||||
|
|
||||||
const handleView = (postId) => {
|
const handleView = (postId) => {
|
||||||
if (onViewPost) {
|
if (onViewPost) {
|
||||||
onViewPost(post.postId)
|
onViewPost(postId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ export default function AudioPostCard({ post, onViewPost }) {
|
|||||||
)}
|
)}
|
||||||
{post.status === 'ready' && (
|
{post.status === 'ready' && (
|
||||||
<button
|
<button
|
||||||
onClick={handleView}
|
onClick={() => handleView(post.post_id)}
|
||||||
className="flex items-center gap-1 text-sm text-[#f4b840] hover:text-[#e5a930]"
|
className="flex items-center gap-1 text-sm text-[#f4b840] hover:text-[#e5a930]"
|
||||||
>
|
>
|
||||||
<span>View Post</span>
|
<span>View Post</span>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'
|
|||||||
import AudioPostCard from '../components/AudioPostCard'
|
import AudioPostCard from '../components/AudioPostCard'
|
||||||
import { api } from '../api'
|
import { api } from '../api'
|
||||||
|
|
||||||
export default function Feed({ user }) {
|
export default function Feed({ user, onViewPost}) {
|
||||||
const [posts, setPosts] = useState([])
|
const [posts, setPosts] = useState([])
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
@@ -119,7 +119,7 @@ export default function Feed({ user }) {
|
|||||||
<AudioPostCard
|
<AudioPostCard
|
||||||
key={post.post_id}
|
key={post.post_id}
|
||||||
post={post}
|
post={post}
|
||||||
onPlay={handlePlay}
|
onViewPost={onViewPost} // pass down
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user