This commit is contained in:
@@ -731,8 +731,8 @@ async def admin_get_reactions(
|
||||
"deleted_at": shout.deleted_at,
|
||||
},
|
||||
"stat": {
|
||||
"comments_count": stats.comments_count or 0,
|
||||
"rating": stats.rating or 0,
|
||||
"comments_count": stats.comments_count if stats else 0,
|
||||
"rating": stats.rating if stats else 0,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
@@ -609,22 +609,7 @@ def create_author(**kwargs) -> Author:
|
||||
# Получаем сообщество для назначения дефолтных ролей
|
||||
community = session.query(Community).filter(Community.id == target_community_id).first()
|
||||
if community:
|
||||
# Инициализируем права сообщества если нужно
|
||||
try:
|
||||
import asyncio
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(community.initialize_role_permissions())
|
||||
except Exception as e:
|
||||
logger.warning(f"Не удалось инициализировать права сообщества {target_community_id}: {e}")
|
||||
|
||||
# Получаем дефолтные роли сообщества или используем стандартные
|
||||
try:
|
||||
default_roles = community.get_default_roles()
|
||||
if not default_roles:
|
||||
default_roles = ["reader", "author"]
|
||||
except AttributeError:
|
||||
default_roles = ["reader", "author"]
|
||||
default_roles = community.get_default_roles()
|
||||
|
||||
# Создаем CommunityAuthor с дефолтными ролями
|
||||
community_author = CommunityAuthor(
|
||||
|
Reference in New Issue
Block a user