mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Adds Reading time functionality to Link texts, and adds a setting to update user bio to adjust their reading speed. New column was added to the database for words_per_minute. By default, this value will be set to 0 and only after a user updates their reading speed will reading time be displayed in the link information box.:
merge-requests/138/head
Adds Reading time functionality to Link texts, and adds a setting to update user bio to adjust their reading speed. New column was added to the database for words_per_minute. By default, this value will be set to 0 and only after a user updates their reading speed will reading time be displayed in the link information box.:
merge-requests/138/head
18 changed files with 236 additions and 31 deletions
-
34tildes/a
-
24tildes/alembic/versions/132ed4b3e988_words_per_minute.py
-
1tildes/consumers/topic_metadata_generator.py
-
1tildes/development.ini
-
1tildes/scripts/clean_private_data.py
-
63tildes/select user
-
6tildes/static/js/scripts.js
-
8tildes/tildes/enums.py
-
3tildes/tildes/models/user/user.py
-
5tildes/tildes/routes.py
-
5tildes/tildes/schemas/user.py
-
4tildes/tildes/templates/settings.jinja2
-
32tildes/tildes/templates/settings_wpm.jinja2
-
43tildes/tildes/templates/topic.jinja2
-
4tildes/tildes/views/api/web/exceptions.py
-
21tildes/tildes/views/api/web/user.py
-
6tildes/tildes/views/settings.py
-
6tildes/tildes/views/topic.py
@ -0,0 +1,34 @@ |
|||||
|
List of relations |
||||
|
Schema | Name | Type | Owner |
||||
|
--------+-----------------------+-------+-------- |
||||
|
public | alembic_version | table | tildes |
||||
|
public | comment_bookmarks | table | tildes |
||||
|
public | comment_labels | table | tildes |
||||
|
public | comment_notifications | table | tildes |
||||
|
public | comment_votes | table | tildes |
||||
|
public | comments | table | tildes |
||||
|
public | financials | table | tildes |
||||
|
public | group_scripts | table | tildes |
||||
|
public | group_stats | table | tildes |
||||
|
public | group_subscriptions | table | tildes |
||||
|
public | group_wiki_pages | table | tildes |
||||
|
public | groups | table | tildes |
||||
|
public | log | table | tildes |
||||
|
public | log_comments | table | tildes |
||||
|
public | log_topics | table | tildes |
||||
|
public | message_conversations | table | tildes |
||||
|
public | message_replies | table | tildes |
||||
|
public | scraper_results | table | tildes |
||||
|
public | topic_bookmarks | table | tildes |
||||
|
public | topic_ignores | table | tildes |
||||
|
public | topic_schedule | table | tildes |
||||
|
public | topic_visits | table | tildes |
||||
|
public | topic_votes | table | tildes |
||||
|
public | topics | table | tildes |
||||
|
public | user_group_settings | table | tildes |
||||
|
public | user_invite_codes | table | tildes |
||||
|
public | user_permissions | table | tildes |
||||
|
public | user_rate_limit | table | tildes |
||||
|
public | users | table | tildes |
||||
|
(29 rows) |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
"""Words per Minute |
||||
|
|
||||
|
Revision ID: 132ed4b3e988 |
||||
|
Revises: 55f4c1f951d5 |
||||
|
Create Date: 2023-06-07 23:44:32.533936 |
||||
|
|
||||
|
""" |
||||
|
from alembic import op |
||||
|
import sqlalchemy as sa |
||||
|
|
||||
|
|
||||
|
# revision identifiers, used by Alembic. |
||||
|
revision = "132ed4b3e988" |
||||
|
down_revision = "55f4c1f951d5" |
||||
|
branch_labels = None |
||||
|
depends_on = None |
||||
|
|
||||
|
|
||||
|
def upgrade(): |
||||
|
op.add_column("users", sa.Column("words_per_minute", sa.Integer(), nullable=True)) |
||||
|
|
||||
|
|
||||
|
def downgrade(): |
||||
|
op.drop_column("users", "words_per_minute") |
@ -0,0 +1,63 @@ |
|||||
|
Available help: |
||||
|
ABORT CREATE FOREIGN DATA WRAPPER DROP ROUTINE |
||||
|
ALTER AGGREGATE CREATE FOREIGN TABLE DROP RULE |
||||
|
ALTER COLLATION CREATE FUNCTION DROP SCHEMA |
||||
|
ALTER CONVERSION CREATE GROUP DROP SEQUENCE |
||||
|
ALTER DATABASE CREATE INDEX DROP SERVER |
||||
|
ALTER DEFAULT PRIVILEGES CREATE LANGUAGE DROP STATISTICS |
||||
|
ALTER DOMAIN CREATE MATERIALIZED VIEW DROP SUBSCRIPTION |
||||
|
ALTER EVENT TRIGGER CREATE OPERATOR DROP TABLE |
||||
|
ALTER EXTENSION CREATE OPERATOR CLASS DROP TABLESPACE |
||||
|
ALTER FOREIGN DATA WRAPPER CREATE OPERATOR FAMILY DROP TEXT SEARCH CONFIGURATION |
||||
|
ALTER FOREIGN TABLE CREATE POLICY DROP TEXT SEARCH DICTIONARY |
||||
|
ALTER FUNCTION CREATE PROCEDURE DROP TEXT SEARCH PARSER |
||||
|
ALTER GROUP CREATE PUBLICATION DROP TEXT SEARCH TEMPLATE |
||||
|
ALTER INDEX CREATE ROLE DROP TRANSFORM |
||||
|
ALTER LANGUAGE CREATE RULE DROP TRIGGER |
||||
|
ALTER LARGE OBJECT CREATE SCHEMA DROP TYPE |
||||
|
ALTER MATERIALIZED VIEW CREATE SEQUENCE DROP USER |
||||
|
ALTER OPERATOR CREATE SERVER DROP USER MAPPING |
||||
|
ALTER OPERATOR CLASS CREATE STATISTICS DROP VIEW |
||||
|
ALTER OPERATOR FAMILY CREATE SUBSCRIPTION END |
||||
|
ALTER POLICY CREATE TABLE EXECUTE |
||||
|
ALTER PROCEDURE CREATE TABLE AS EXPLAIN |
||||
|
ALTER PUBLICATION CREATE TABLESPACE FETCH |
||||
|
ALTER ROLE CREATE TEXT SEARCH CONFIGURATION GRANT |
||||
|
ALTER ROUTINE CREATE TEXT SEARCH DICTIONARY IMPORT FOREIGN SCHEMA |
||||
|
ALTER RULE CREATE TEXT SEARCH PARSER INSERT |
||||
|
ALTER SCHEMA CREATE TEXT SEARCH TEMPLATE LISTEN |
||||
|
ALTER SEQUENCE CREATE TRANSFORM LOAD |
||||
|
ALTER SERVER CREATE TRIGGER LOCK |
||||
|
ALTER STATISTICS CREATE TYPE MOVE |
||||
|
ALTER SUBSCRIPTION CREATE USER NOTIFY |
||||
|
ALTER SYSTEM CREATE USER MAPPING PREPARE |
||||
|
ALTER TABLE CREATE VIEW PREPARE TRANSACTION |
||||
|
ALTER TABLESPACE DEALLOCATE REASSIGN OWNED |
||||
|
ALTER TEXT SEARCH CONFIGURATION DECLARE REFRESH MATERIALIZED VIEW |
||||
|
ALTER TEXT SEARCH DICTIONARY DELETE REINDEX |
||||
|
ALTER TEXT SEARCH PARSER DISCARD RELEASE SAVEPOINT |
||||
|
ALTER TEXT SEARCH TEMPLATE DO RESET |
||||
|
ALTER TRIGGER DROP ACCESS METHOD REVOKE |
||||
|
ALTER TYPE DROP AGGREGATE ROLLBACK |
||||
|
ALTER USER DROP CAST ROLLBACK PREPARED |
||||
|
ALTER USER MAPPING DROP COLLATION ROLLBACK TO SAVEPOINT |
||||
|
ALTER VIEW DROP CONVERSION SAVEPOINT |
||||
|
ANALYZE DROP DATABASE SECURITY LABEL |
||||
|
BEGIN DROP DOMAIN SELECT |
||||
|
CALL DROP EVENT TRIGGER SELECT INTO |
||||
|
CHECKPOINT DROP EXTENSION SET |
||||
|
CLOSE DROP FOREIGN DATA WRAPPER SET CONSTRAINTS |
||||
|
CLUSTER DROP FOREIGN TABLE SET ROLE |
||||
|
COMMENT DROP FUNCTION SET SESSION AUTHORIZATION |
||||
|
COMMIT DROP GROUP SET TRANSACTION |
||||
|
COMMIT PREPARED DROP INDEX SHOW |
||||
|
COPY DROP LANGUAGE START TRANSACTION |
||||
|
CREATE ACCESS METHOD DROP MATERIALIZED VIEW TABLE |
||||
|
CREATE AGGREGATE DROP OPERATOR TRUNCATE |
||||
|
CREATE CAST DROP OPERATOR CLASS UNLISTEN |
||||
|
CREATE COLLATION DROP OPERATOR FAMILY UPDATE |
||||
|
CREATE CONVERSION DROP OWNED VACUUM |
||||
|
CREATE DATABASE DROP POLICY VALUES |
||||
|
CREATE DOMAIN DROP PROCEDURE WITH |
||||
|
CREATE EVENT TRIGGER DROP PUBLICATION |
||||
|
CREATE EXTENSION DROP ROLE |
@ -0,0 +1,32 @@ |
|||||
|
{# Copyright (c) 2023 Tildes contributors <code@tildes.net> #} |
||||
|
{# SPDX-License-Identifier: AGPL-3.0-or-later #} |
||||
|
|
||||
|
{% extends 'base_settings.jinja2' %} |
||||
|
|
||||
|
{% block title %}Edit your reading speed{% endblock %} |
||||
|
|
||||
|
{% block main_heading %}Edit your reading speed{% endblock %} |
||||
|
|
||||
|
{% block settings %} |
||||
|
<p>Enter your estimated reading speed in words per minute (WPM). This will be used to calculate estimated reading times for posts. To disable reading time from displaying on Link topics, enter a value of 0.</p> |
||||
|
|
||||
|
<div class="divider"></div> |
||||
|
|
||||
|
<form |
||||
|
method="post" |
||||
|
name="wpm-change" |
||||
|
autocomplete="off" |
||||
|
data-ic-patch-to="{{ request.route_url('ic_user', username=request.user.username) }}" |
||||
|
data-ic-trigger-name="user-wpm" |
||||
|
data-js-confirm-leave-page-unsaved |
||||
|
> |
||||
|
<div class="form-group"> |
||||
|
<label class="form-label" for="wordsPerMinute">Words Per Minute (WPM)</label> |
||||
|
<input type="number" class="form-input" id="wordsPerMinute" name="words_per_minute" value="{{ request.user.words_per_minute }}" min="0" max="9999" required> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-buttons"> |
||||
|
<button type="submit" class="btn btn-primary">Save WPM</button> |
||||
|
</div> |
||||
|
</form> |
||||
|
{% endblock %} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue