mirror of https://gitlab.com/tildes/tildes.git
33 changed files with 520 additions and 23 deletions
-
7salt/salt/postgresql/site-db.sls
-
7salt/salt/postgresql/test-db.sls
-
4salt/salt/redis/modules/rebloom.sls
-
36tildes/alembic/versions/3fbddcba0e3b_add_comment_remove_and_comment_unremove_.py
-
35tildes/alembic/versions/6a635773de8f_add_comment_post_to_logeventtype.py
-
32tildes/alembic/versions/a1708d376252_drop_topics_removed_time_column.py
-
58tildes/alembic/versions/b3be50625592_add_log_comments_table.py
-
36tildes/alembic/versions/bcf1406bb6c5_add_admin_tool_for_removing_topics.py
-
1tildes/mypy.ini
-
1tildes/requirements-to-freeze.txt
-
1tildes/requirements.txt
-
5tildes/scripts/initialize_db.py
-
6tildes/scss/modules/_comment.scss
-
8tildes/scss/modules/_empty.scss
-
4tildes/scss/modules/_form.scss
-
16tildes/tests/test_topic.py
-
6tildes/tildes/enums.py
-
3tildes/tildes/models/comment/comment.py
-
2tildes/tildes/models/group/group.py
-
2tildes/tildes/models/log/__init__.py
-
58tildes/tildes/models/log/log.py
-
9tildes/tildes/models/topic/topic.py
-
5tildes/tildes/models/user/user.py
-
4tildes/tildes/routes.py
-
8tildes/tildes/schemas/fields.py
-
26tildes/tildes/templates/error_group_not_found.jinja2
-
28tildes/tildes/templates/macros/comments.jinja2
-
28tildes/tildes/templates/topic.jinja2
-
31tildes/tildes/views/api/web/comment.py
-
22tildes/tildes/views/api/web/topic.py
-
24tildes/tildes/views/exceptions.py
-
10tildes/tildes/views/topic.py
-
20tildes/tildes/views/user.py
@ -0,0 +1,36 @@ |
|||||
|
"""Add COMMENT_REMOVE and COMMENT_UNREMOVE to logeventtype |
||||
|
|
||||
|
Revision ID: 3fbddcba0e3b |
||||
|
Revises: 6a635773de8f |
||||
|
Create Date: 2018-08-26 04:34:51.741972 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
|
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "3fbddcba0e3b" |
||||
|
down_revision = "6a635773de8f" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
# ALTER TYPE doesn't work from inside a transaction, disable it |
||||
|
connection = None |
||||
|
if not op.get_context().as_sql: |
||||
|
connection = op.get_bind() |
||||
|
connection.execution_options(isolation_level="AUTOCOMMIT") |
||||
|
|
||||
|
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'COMMENT_REMOVE'") |
||||
|
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'COMMENT_UNREMOVE'") |
||||
|
|
||||
|
# re-activate the transaction for any future migrations |
||||
|
if connection is not None: |
||||
|
connection.execution_options(isolation_level="READ_COMMITTED") |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
# no way to remove enum values, just do nothing |
||||
|
pass |
||||
@ -0,0 +1,35 @@ |
|||||
|
"""Add COMMENT_POST to logeventtype |
||||
|
|
||||
|
Revision ID: 6a635773de8f |
||||
|
Revises: b3be50625592 |
||||
|
Create Date: 2018-08-26 01:56:13.511360 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
|
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "6a635773de8f" |
||||
|
down_revision = "b3be50625592" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
# ALTER TYPE doesn't work from inside a transaction, disable it |
||||
|
connection = None |
||||
|
if not op.get_context().as_sql: |
||||
|
connection = op.get_bind() |
||||
|
connection.execution_options(isolation_level="AUTOCOMMIT") |
||||
|
|
||||
|
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'COMMENT_POST'") |
||||
|
|
||||
|
# re-activate the transaction for any future migrations |
||||
|
if connection is not None: |
||||
|
connection.execution_options(isolation_level="READ_COMMITTED") |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
# can't remove from enums, do nothing |
||||
|
pass |
||||
@ -0,0 +1,32 @@ |
|||||
|
"""Drop topics.removed_time column |
||||
|
|
||||
|
Revision ID: a1708d376252 |
||||
|
Revises: bcf1406bb6c5 |
||||
|
Create Date: 2018-08-23 00:29:41.024890 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
from sqlalchemy.dialects import postgresql |
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "a1708d376252" |
||||
|
down_revision = "bcf1406bb6c5" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
op.drop_column("topics", "removed_time") |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
op.add_column( |
||||
|
"topics", |
||||
|
sa.Column( |
||||
|
"removed_time", |
||||
|
postgresql.TIMESTAMP(timezone=True), |
||||
|
autoincrement=False, |
||||
|
nullable=True, |
||||
|
), |
||||
|
) |
||||
@ -0,0 +1,58 @@ |
|||||
|
"""Add log_comments table |
||||
|
|
||||
|
Revision ID: b3be50625592 |
||||
|
Revises: a1708d376252 |
||||
|
Create Date: 2018-08-23 04:20:55.819209 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
|
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "b3be50625592" |
||||
|
down_revision = "a1708d376252" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
op.execute("CREATE TABLE log_comments (comment_id integer not null) INHERITS (log)") |
||||
|
op.create_foreign_key( |
||||
|
op.f("fk_log_comments_comment_id_comments"), |
||||
|
"log_comments", |
||||
|
"comments", |
||||
|
["comment_id"], |
||||
|
["comment_id"], |
||||
|
) |
||||
|
op.create_index( |
||||
|
op.f("ix_log_comments_comment_id"), "log_comments", ["comment_id"], unique=False |
||||
|
) |
||||
|
|
||||
|
# duplicate all the indexes/constraints from the base log table |
||||
|
op.create_primary_key(op.f("pk_log_comments"), "log_comments", ["log_id"]) |
||||
|
op.create_index( |
||||
|
op.f("ix_log_comments_event_time"), "log_comments", ["event_time"], unique=False |
||||
|
) |
||||
|
op.create_index( |
||||
|
op.f("ix_log_comments_event_type"), "log_comments", ["event_type"], unique=False |
||||
|
) |
||||
|
op.create_index( |
||||
|
op.f("ix_log_comments_ip_address"), "log_comments", ["ip_address"], unique=False |
||||
|
) |
||||
|
op.create_index( |
||||
|
op.f("ix_log_comments_user_id"), "log_comments", ["user_id"], unique=False |
||||
|
) |
||||
|
|
||||
|
op.create_foreign_key( |
||||
|
op.f("fk_log_comments_user_id_users"), |
||||
|
"log_comments", |
||||
|
"users", |
||||
|
["user_id"], |
||||
|
["user_id"], |
||||
|
) |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
op.drop_index(op.f("ix_log_comments_comment_id"), table_name="log_comments") |
||||
|
op.drop_table("log_comments") |
||||
@ -0,0 +1,36 @@ |
|||||
|
"""Add admin tool for removing topics |
||||
|
|
||||
|
Revision ID: bcf1406bb6c5 |
||||
|
Revises: 50c251c4a19c |
||||
|
Create Date: 2018-08-22 23:56:41.733065 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
|
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "bcf1406bb6c5" |
||||
|
down_revision = "50c251c4a19c" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
# ALTER TYPE doesn't work from inside a transaction, disable it |
||||
|
connection = None |
||||
|
if not op.get_context().as_sql: |
||||
|
connection = op.get_bind() |
||||
|
connection.execution_options(isolation_level="AUTOCOMMIT") |
||||
|
|
||||
|
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'TOPIC_REMOVE'") |
||||
|
op.execute("ALTER TYPE logeventtype ADD VALUE IF NOT EXISTS 'TOPIC_UNREMOVE'") |
||||
|
|
||||
|
# re-activate the transaction for any future migrations |
||||
|
if connection is not None: |
||||
|
connection.execution_options(isolation_level="READ_COMMITTED") |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
# no way to remove enum values, just do nothing |
||||
|
pass |
||||
@ -1,3 +1,3 @@ |
|||||
"""Contains models related to logs.""" |
"""Contains models related to logs.""" |
||||
|
|
||||
from .log import Log, LogTopic |
|
||||
|
from .log import Log, LogComment, LogTopic |
||||
@ -0,0 +1,26 @@ |
|||||
|
{% extends 'base_no_sidebar.jinja2' %} |
||||
|
|
||||
|
{% from 'macros/links.jinja2' import group_linked %} |
||||
|
|
||||
|
{% block title %} |
||||
|
Group not found |
||||
|
{% endblock %} |
||||
|
|
||||
|
{% block content %} |
||||
|
|
||||
|
<div class="empty"> |
||||
|
<h2 class="empty-title">No group named '{{ supplied_name }}'</h2> |
||||
|
{% if group_suggestions %} |
||||
|
<p class="empty-subtitle">Did you mean one of these groups instead?</p> |
||||
|
<ul class="empty-list"> |
||||
|
{% for group in group_suggestions %} |
||||
|
<li>{{ group_linked(group) }}</li> |
||||
|
{% endfor %} |
||||
|
</ul> |
||||
|
{% endif %} |
||||
|
<div class="empty-action"> |
||||
|
<a href="/groups" class="btn btn-primary">Browse the list of groups</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
{% endblock %} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue