Revert "Added events system"

This reverts commit f00d569db3.
This commit is contained in:
2025-05-29 14:45:52 +02:00
parent f00d569db3
commit 6d959ac253
24 changed files with 114 additions and 1186 deletions

View File

@@ -1,9 +1,8 @@
from flask import Blueprint, render_template, redirect, url_for, flash, request, jsonify, send_file
from flask_login import login_required, current_user
from models import db, Conversation, User, Message, MessageAttachment, EventType
from models import db, Conversation, User, Message, MessageAttachment
from forms import ConversationForm
from routes.auth import require_password_change
from utils.event_logger import log_event
import os
from werkzeug.utils import secure_filename
from datetime import datetime
@@ -85,17 +84,6 @@ def create_conversation():
db.session.add(conversation)
db.session.commit()
# Log conversation creation
log_event(
event_type=EventType.CONVERSATION_CREATE,
user_id=current_user.id,
details={
'conversation_id': conversation.id,
'conversation_name': conversation.name,
'member_count': len(conversation.members)
}
)
flash('Conversation created successfully!', 'success')
return redirect(url_for('conversations.conversations'))
return render_template('conversations/create_conversation.html', form=form)
@@ -239,18 +227,6 @@ def delete_conversation(conversation_id):
conversation = Conversation.query.get_or_404(conversation_id)
# Log conversation deletion before deleting
log_event(
event_type=EventType.CONVERSATION_DELETE,
user_id=current_user.id,
details={
'conversation_id': conversation_id,
'conversation_name': conversation.name,
'message_count': len(conversation.messages),
'member_count': len(conversation.members)
}
)
# Delete all messages in the conversation
Message.query.filter_by(conversation_id=conversation_id).delete()
@@ -348,18 +324,6 @@ def send_message(conversation_id):
db.session.commit()
# Log message sent
log_event(
event_type=EventType.MESSAGE_SENT,
user_id=current_user.id,
details={
'conversation_id': conversation_id,
'message_id': message.id,
'has_attachments': len(attachments) > 0,
'attachment_count': len(attachments)
}
)
# Prepare message data for response
message_data = {
'id': message.id,
@@ -394,19 +358,6 @@ def download_attachment(message_id, attachment_index):
try:
attachment = message.attachments[attachment_index]
# Log attachment download
log_event(
event_type=EventType.ATTACHMENT_DOWNLOAD,
user_id=current_user.id,
details={
'conversation_id': conversation.id,
'message_id': message_id,
'attachment_name': attachment.name,
'attachment_size': attachment.size
}
)
return send_file(
attachment.path,
as_attachment=True,