mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 09:33:44 +01:00
Fix crash on sending notification
This commit is contained in:
parent
078765fe44
commit
000259fc88
@ -22,7 +22,6 @@ from .models import *
|
|||||||
from . import app
|
from . import app
|
||||||
import random, string, os, imghdr
|
import random, string, os, imghdr
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
from collections.abc import Iterable
|
|
||||||
|
|
||||||
def abs_url_for(path, **kwargs):
|
def abs_url_for(path, **kwargs):
|
||||||
scheme = "https" if app.config["BASE_URL"][:5] == "https" else "http"
|
scheme = "https" if app.config["BASE_URL"][:5] == "https" else "http"
|
||||||
@ -191,10 +190,13 @@ def is_package_page(f):
|
|||||||
|
|
||||||
|
|
||||||
def addNotification(target, causer, title, url):
|
def addNotification(target, causer, title, url):
|
||||||
if isinstance(target, Iterable):
|
try:
|
||||||
|
iter(target)
|
||||||
for x in target:
|
for x in target:
|
||||||
addNotification(x, causer, title, url)
|
addNotification(x, causer, title, url)
|
||||||
return
|
return
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
if target.rank.atLeast(UserRank.NEW_MEMBER) and target != causer:
|
if target.rank.atLeast(UserRank.NEW_MEMBER) and target != causer:
|
||||||
Notification.query.filter_by(user=target, causer=causer, title=title, url=url).delete()
|
Notification.query.filter_by(user=target, causer=causer, title=title, url=url).delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user