Add Contributions Mockup and fix email notifications on job status change

This commit is contained in:
Patrick Jentsch 2022-07-11 12:14:01 +02:00
parent 018f9e752c
commit 42ad6e27e2
6 changed files with 28 additions and 5 deletions

View File

@ -57,8 +57,8 @@ def create_app(config: Config = Config) -> Flask:
from .auth import bp as auth_blueprint from .auth import bp as auth_blueprint
app.register_blueprint(auth_blueprint, url_prefix='/auth') app.register_blueprint(auth_blueprint, url_prefix='/auth')
from .contribute import bp as contribute_blueprint from .contributions import bp as contributions_blueprint
app.register_blueprint(contribute_blueprint, url_prefix='/contribute') app.register_blueprint(contributions_blueprint, url_prefix='/contributions')
from .corpora import bp as corpora_blueprint from .corpora import bp as corpora_blueprint
app.register_blueprint(corpora_blueprint, url_prefix='/corpora') app.register_blueprint(corpora_blueprint, url_prefix='/corpora')

View File

@ -1,5 +1,5 @@
from flask import Blueprint from flask import Blueprint
bp = Blueprint('contribute', __name__) bp = Blueprint('contributions', __name__)
from . import routes from . import routes

View File

@ -0,0 +1,15 @@
from app.models import User
from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
PasswordField,
StringField,
SubmitField,
ValidationError
)
from wtforms.validators import DataRequired, InputRequired, Email, EqualTo, Length, Regexp
from . import USERNAME_REGEX
class ContributeTesseractOCRModel(FlaskForm):
pass

View File

@ -1,3 +1,4 @@
from ast import Pass
from app import db from app import db
from app.decorators import permission_required from app.decorators import permission_required
from app.models import Permission, Role, User from app.models import Permission, Role, User
@ -14,6 +15,11 @@ def before_request():
pass pass
@bp.route('/') @bp.route('')
def index(): def index():
pass pass
@bp.route('/tesseract_ocr_model', methods=['GET', 'POST'])
def tesseract_ocr_model():
pass

View File

@ -1088,6 +1088,8 @@ def job_after_update_handler(mapper, connection, job):
for attr in db.inspect(job).attrs: for attr in db.inspect(job).attrs:
if attr.key != 'status': if attr.key != 'status':
continue continue
if not attr.load_history().has_changes():
return
if job.user.setting_job_status_mail_notification_level == UserSettingJobStatusMailNotificationLevel.NONE: if job.user.setting_job_status_mail_notification_level == UserSettingJobStatusMailNotificationLevel.NONE:
return return
if job.user.setting_job_status_mail_notification_level == UserSettingJobStatusMailNotificationLevel.END: if job.user.setting_job_status_mail_notification_level == UserSettingJobStatusMailNotificationLevel.END:

View File

@ -32,7 +32,7 @@
<li><a href="{{ url_for('admin.index') }}"><i class="material-icons">admin_panel_settings</i>Administration</a></li> <li><a href="{{ url_for('admin.index') }}"><i class="material-icons">admin_panel_settings</i>Administration</a></li>
{% endif %} {% endif %}
{% if current_user.can(Permission.CONTRIBUTE) %} {% if current_user.can(Permission.CONTRIBUTE) %}
<li><a href="{{ url_for('contribute.index') }}"><i class="material-icons">new_label</i>Contribute</a></li> <li><a href="{{ url_for('contributions.index') }}"><i class="material-icons">new_label</i>Contribute</a></li>
{% endif %} {% endif %}
{% if current_user.can(Permission.USE_API) %} {% if current_user.can(Permission.USE_API) %}
<li><a href="{{ url_for('api.doc') }}"><i class="material-icons">api</i>API</a></li> <li><a href="{{ url_for('api.doc') }}"><i class="material-icons">api</i>API</a></li>