Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
74 stars 32 forks source link

Issues with the Email Forwarded Notifications PR #525

Open globalistas opened 1 year ago

globalistas commented 1 year ago
          I have tested this PR and found several issues:

1) PR is missing an updated example.config.yaml with the new config setting email_forwarded_notifications = False in it

2) When email_forwarded_notifications = True is specified in config.yaml, running poetry run ./throat.py migration apply gets stuck and then crashes with the following error:

INFO:migration:: :Starting migrations
DEBUG:app.sql_timing:: :(CREATE TABLE IF NOT EXISTS "migratehistory" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" TIMESTAMP NOT NULL), []) (executed in 3 ms)
DEBUG:app.sql_timing:: :(SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id", []) (executed in 1 ms)
INFO:migration:: :There is nothing to migrate
Process Process-1:
Traceback (most recent call last):
  File "/home/app/.pyenv/versions/3.9.16/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/app/.pyenv/versions/3.9.16/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/app/ceknito/app/email_manager.py", line 98, in _produce
    Notification.select(
  File "/home/app/.pyenv/versions/3.9.16/envs/app/lib/python3.9/site-packages/peewee.py", line 1960, in inner
    raise InterfaceError('Query must be bound to a database in order '
peewee.InterfaceError: Query must be bound to a database in order to call "execute".
Process Process-3:
Traceback (most recent call last):
  File "/home/app/.pyenv/versions/3.9.16/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/app/.pyenv/versions/3.9.16/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/app/ceknito/app/email_manager.py", line 98, in _produce
    Notification.select(
  File "/home/app/.pyenv/versions/3.9.16/envs/app/lib/python3.9/site-packages/peewee.py", line 1960, in inner
    raise InterfaceError('Query must be bound to a database in order '
peewee.InterfaceError: Query must be bound to a database in order to call "execute".

This error does not occur when False is specified.

3) When email_forwarded_notifications = True is specified in config.yaml, site user sees the following error when trying to open user preferences html:

  File "user/settings/preferences.html", line 39, in main
AttributeError: 'EditUserForm' object has no attribute 'email_forwarded_notifications'

Originally posted by @globalistas in https://github.com/Phuks-co/throat/issues/520#issuecomment-1467647931