mobile app themes
This commit is contained in:
19
app.py
19
app.py
@@ -3744,25 +3744,6 @@ def api_create_post_with_poll():
|
|||||||
def api_share_post(post_id):
|
def api_share_post(post_id):
|
||||||
return jsonify({'success': True})
|
return jsonify({'success': True})
|
||||||
|
|
||||||
@app.route('/api/posts/<int:post_id>/pin', methods=['POST'])
|
|
||||||
@login_required
|
|
||||||
def api_pin_post(post_id):
|
|
||||||
"""置顶/取消置顶帖子(仅管理员)"""
|
|
||||||
user = session.get('user')
|
|
||||||
if user.get('role') != 'admin':
|
|
||||||
return jsonify({'success': False, 'message': '只有管理员可以置顶帖子'}), 403
|
|
||||||
|
|
||||||
post = Post.query.get(post_id)
|
|
||||||
if not post:
|
|
||||||
return jsonify({'success': False, 'message': '帖子不存在'}), 404
|
|
||||||
|
|
||||||
# 切换置顶状态
|
|
||||||
post.pinned = not post.pinned
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
action = '置顶' if post.pinned else '取消置顶'
|
|
||||||
return jsonify({'success': True, 'message': f'帖子已{action}', 'pinned': post.pinned})
|
|
||||||
|
|
||||||
# ========== 聊天系统页面 ==========
|
# ========== 聊天系统页面 ==========
|
||||||
@app.route('/chat')
|
@app.route('/chat')
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
Reference in New Issue
Block a user