flaskbb-plugin-conversations 2.0.1__tar.gz → 2.1.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/PKG-INFO +3 -3
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/__init__.py +21 -3
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/migrations/201802171929_0625bc75ab77_add_conversations.py +1 -6
- flaskbb_plugin_conversations-2.1.0.dev0/conversations/migrations/202607311750_1785520254_move_message_quota_setting.py +54 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/conversation_list.html +1 -1
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/views.py +16 -15
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/pyproject.toml +2 -2
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/.gitignore +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/LICENSE +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/README.md +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/forms.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/migrations/202602062122_1770409336_update_sqlalchemy_2.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/migrations/__init__.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/models.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/_inject_navlink.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/_inject_new_message_button.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/_inject_new_message_link.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/conversation.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/drafts.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/inbox.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/message_form.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/message_layout.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/sent.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/templates/trash.html +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/translations/en/LC_MESSAGES/messages.po +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/conversations/utils.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/tests/conftest.py +0 -0
- {flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/tests/test_message_models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: flaskbb-plugin-conversations
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.1.0.dev0
|
|
4
4
|
Summary: A private messaging plugin for FlaskBB
|
|
5
5
|
Project-URL: Homepage, https://github.com/flaskbb/flaskbb-plugin-conversations
|
|
6
6
|
Project-URL: Repository, https://github.com/flaskbb/flaskbb-plugin-conversations
|
|
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
23
23
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
25
|
Requires-Python: >=3.12
|
|
26
|
-
Requires-Dist: flaskbb>=
|
|
26
|
+
Requires-Dist: flaskbb>=3.0.0
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
|
|
29
29
|
Conversations
|
|
@@ -13,6 +13,7 @@ import os
|
|
|
13
13
|
|
|
14
14
|
from flask import Flask
|
|
15
15
|
from flask_login import current_user
|
|
16
|
+
from flaskbb.core.settings.definitions import IntSetting, SettingGroup
|
|
16
17
|
from flaskbb.forum.models import Post
|
|
17
18
|
from flaskbb.user.models import User
|
|
18
19
|
from flaskbb.utils.helpers import real, render_template
|
|
@@ -21,11 +22,28 @@ from pluggy import HookimplMarker
|
|
|
21
22
|
from .utils import get_latest_messages, get_message_count, get_unread_count
|
|
22
23
|
from .views import conversations_bp
|
|
23
24
|
|
|
24
|
-
# Temp fix until https://github.com/flaskbb/flaskbb/pull/509 is merged
|
|
25
|
-
SETTINGS = None
|
|
26
|
-
|
|
27
25
|
hookimpl = HookimplMarker("flaskbb")
|
|
28
26
|
|
|
27
|
+
SETTINGS = SettingGroup(
|
|
28
|
+
key="conversations",
|
|
29
|
+
name="Conversations Settings",
|
|
30
|
+
description="Settings for the conversations plugin.",
|
|
31
|
+
settings=(
|
|
32
|
+
IntSetting(
|
|
33
|
+
key="MESSAGE_QUOTA",
|
|
34
|
+
value=50,
|
|
35
|
+
min=0,
|
|
36
|
+
name="Private Message Quota",
|
|
37
|
+
description="The amount of messages a user can have.",
|
|
38
|
+
),
|
|
39
|
+
),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@hookimpl
|
|
44
|
+
def flaskbb_load_setting_groups():
|
|
45
|
+
return SETTINGS
|
|
46
|
+
|
|
29
47
|
|
|
30
48
|
# connect the hooks
|
|
31
49
|
@hookimpl
|
|
@@ -8,7 +8,6 @@ Create Date: 2018-02-17 19:29:12.376395
|
|
|
8
8
|
|
|
9
9
|
import flaskbb
|
|
10
10
|
import sqlalchemy as sa
|
|
11
|
-
import sqlalchemy_utils
|
|
12
11
|
from alembic import op
|
|
13
12
|
|
|
14
13
|
# revision identifiers, used by Alembic.
|
|
@@ -29,11 +28,7 @@ def upgrade():
|
|
|
29
28
|
sa.Column("user_id", sa.Integer(), nullable=False),
|
|
30
29
|
sa.Column("from_user_id", sa.Integer(), nullable=True),
|
|
31
30
|
sa.Column("to_user_id", sa.Integer(), nullable=True),
|
|
32
|
-
sa.Column(
|
|
33
|
-
"shared_id",
|
|
34
|
-
sqlalchemy_utils.types.uuid.UUIDType(binary=16),
|
|
35
|
-
nullable=False,
|
|
36
|
-
),
|
|
31
|
+
sa.Column("shared_id", sa.Uuid(), nullable=False),
|
|
37
32
|
sa.Column("subject", sa.String(length=255), nullable=True),
|
|
38
33
|
sa.Column(
|
|
39
34
|
"date_created",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""move message quota setting
|
|
2
|
+
|
|
3
|
+
Revision ID: 1785520254
|
|
4
|
+
Revises: 1770409336
|
|
5
|
+
Create Date: 2026-07-31 17:50:54.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
from alembic import op
|
|
11
|
+
|
|
12
|
+
# revision identifiers, used by Alembic.
|
|
13
|
+
revision = "1785520254"
|
|
14
|
+
down_revision = "1770409336"
|
|
15
|
+
branch_labels = ()
|
|
16
|
+
depends_on = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade():
|
|
20
|
+
conn = op.get_bind()
|
|
21
|
+
|
|
22
|
+
settings_table = sa.table(
|
|
23
|
+
"settings",
|
|
24
|
+
sa.column("key", sa.String),
|
|
25
|
+
sa.column("group_key", sa.String),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
conn.execute(
|
|
29
|
+
settings_table.update()
|
|
30
|
+
.where(
|
|
31
|
+
sa.func.lower(settings_table.c.key) == "message_quota",
|
|
32
|
+
settings_table.c.group_key == "misc",
|
|
33
|
+
)
|
|
34
|
+
.values(group_key="conversations")
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def downgrade():
|
|
39
|
+
conn = op.get_bind()
|
|
40
|
+
|
|
41
|
+
settings_table = sa.table(
|
|
42
|
+
"settings",
|
|
43
|
+
sa.column("key", sa.String),
|
|
44
|
+
sa.column("group_key", sa.String),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
conn.execute(
|
|
48
|
+
settings_table.update()
|
|
49
|
+
.where(
|
|
50
|
+
sa.func.lower(settings_table.c.key) == "message_quota",
|
|
51
|
+
settings_table.c.group_key == "conversations",
|
|
52
|
+
)
|
|
53
|
+
.values(group_key="misc")
|
|
54
|
+
)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<div class="col-auto">
|
|
10
10
|
<span class="badge bg-info" title="The amount of all conversations" data-bs-toggle="tooltip">
|
|
11
|
-
{{ current_user.message_count or 0 }}/{{ flaskbb_config["
|
|
11
|
+
{{ current_user.message_count or 0 }}/{{ flaskbb_config["CONVERSATIONS_MESSAGE_QUOTA"] }}
|
|
12
12
|
</span>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
@@ -48,7 +48,8 @@ def check_message_box_space(redirect_to: str | None = None):
|
|
|
48
48
|
will redirect to the ``conversations_bp.inbox``
|
|
49
49
|
endpoint.
|
|
50
50
|
"""
|
|
51
|
-
|
|
51
|
+
quota = flaskbb_config["CONVERSATIONS_MESSAGE_QUOTA"]
|
|
52
|
+
if get_message_count(real(current_user).id) >= quota:
|
|
52
53
|
flash(
|
|
53
54
|
_(
|
|
54
55
|
"You cannot send any messages anymore because you have "
|
|
@@ -78,18 +79,18 @@ class Inbox(MethodView):
|
|
|
78
79
|
def get(self):
|
|
79
80
|
page = request.args.get("page", 1, type=int)
|
|
80
81
|
# the inbox will display both, the recieved and the sent messages
|
|
81
|
-
|
|
82
|
-
Conversation
|
|
82
|
+
stmt = (
|
|
83
|
+
select(Conversation)
|
|
84
|
+
.where(
|
|
83
85
|
Conversation.user_id == current_user.id,
|
|
84
|
-
Conversation.draft
|
|
85
|
-
Conversation.trash
|
|
86
|
+
Conversation.draft.is_(False),
|
|
87
|
+
Conversation.trash.is_(False),
|
|
86
88
|
)
|
|
87
89
|
.order_by(Conversation.date_modified.desc())
|
|
88
|
-
.paginate(
|
|
89
|
-
page=page, per_page=flaskbb_config["TOPICS_PER_PAGE"], error_out=False
|
|
90
|
-
)
|
|
91
90
|
)
|
|
92
|
-
|
|
91
|
+
conversations = db.paginate(
|
|
92
|
+
stmt, page=page, per_page=flaskbb_config["TOPICS_PER_PAGE"], error_out=False
|
|
93
|
+
)
|
|
93
94
|
return render_template("inbox.html", conversations=conversations)
|
|
94
95
|
|
|
95
96
|
|
|
@@ -347,9 +348,9 @@ class RestoreConversation(MethodView):
|
|
|
347
348
|
decorators = [login_required]
|
|
348
349
|
|
|
349
350
|
def post(self, conversation_id: int):
|
|
350
|
-
conversation = Conversation.
|
|
351
|
-
id
|
|
352
|
-
)
|
|
351
|
+
conversation = Conversation.get_or_404(
|
|
352
|
+
Conversation.id == conversation_id, Conversation.user_id == current_user.id
|
|
353
|
+
)
|
|
353
354
|
|
|
354
355
|
conversation.trash = False
|
|
355
356
|
conversation.save()
|
|
@@ -360,9 +361,9 @@ class DeleteConversation(MethodView):
|
|
|
360
361
|
decorators = [login_required]
|
|
361
362
|
|
|
362
363
|
def post(self, conversation_id: int):
|
|
363
|
-
conversation = Conversation.
|
|
364
|
-
id
|
|
365
|
-
)
|
|
364
|
+
conversation = Conversation.get_or_404(
|
|
365
|
+
Conversation.id == conversation_id, Conversation.user_id == current_user.id
|
|
366
|
+
)
|
|
366
367
|
|
|
367
368
|
conversation.delete()
|
|
368
369
|
invalidate_cache(real(current_user).id)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flaskbb_plugin_conversations-2.0.1 → flaskbb_plugin_conversations-2.1.0.dev0}/tests/conftest.py
RENAMED
|
File without changes
|
|
File without changes
|