def do_topic_action(topics, user, action, reverse):
 from flaskbb.utils.requirements import IsAtleastModeratorInForum, CanDeleteTopic
 from flaskbb.user.models import User
 from flaskbb.forum.models import Post
 if (not Permission(IsAtleastModeratorInForum(forum=topics[0].forum))):
  flash(_('You do not have the permissions to execute this action.'), 'danger')
  return False
 modified_topics = 0
 if (action != 'delete'):
  for topic in topics:
   if (getattr(topic, action) and (not reverse)):
    continue
   setattr(topic, action, (not reverse))
   modified_topics += 1
   topic.save()
 elif (action == 'delete'):
  for topic in topics:
   if (not Permission(CanDeleteTopic)):
    flash(_('You do not have the permissions to delete this topic.'), 'danger')
    return False
   involved_users = User.query.filter((Post.topic_id == topic.id), (User.id == Post.user_id)).all()
   modified_topics += 1
   topic.delete(involved_users)
 return modified_topics

def do_topic_action ( topics , user , action , reverse ) : from flaskbb . utils . requirements import IsAtleastModeratorInForum , CanDeleteTopic from flaskbb . user . models import User from flaskbb . forum . models import Post if ( not Permission ( IsAtleastModeratorInForum ( forum = topics [ 0 ] . forum ) ) ) : flash ( _ ( 'You do not have the permissions to execute this action.' ) , 'danger' ) return False modified_topics = 0 if ( action != 'delete' ) : for topic in topics : if ( getattr ( topic , action ) and ( not reverse ) ) : continue setattr ( topic , action , ( not reverse ) ) modified_topics += 1 topic . save ( ) elif ( action == 'delete' ) : for topic in topics : if ( not Permission ( CanDeleteTopic ) ) : flash ( _ ( 'You do not have the permissions to delete this topic.' ) , 'danger' ) return False involved_users = User . query . filter ( ( Post . topic_id == topic . id ) , ( User . id == Post . user_id ) ) . all ( ) modified_topics += 1 topic . delete ( involved_users ) return modified_topics
executes a specific action for topics .