mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 11:47:28 +01:00
Fix crash on mentioning user
This commit is contained in:
parent
8fcbdd0666
commit
0689565ded
@ -240,7 +240,7 @@ def view(id):
|
|||||||
thread.watchers.append(current_user)
|
thread.watchers.append(current_user)
|
||||||
|
|
||||||
for mentioned_username in get_user_mentions(render_markdown(comment)):
|
for mentioned_username in get_user_mentions(render_markdown(comment)):
|
||||||
mentioned = User.query.filter_by(username=mentioned_username)
|
mentioned = User.query.filter_by(username=mentioned_username).first()
|
||||||
if mentioned is None:
|
if mentioned is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ def new():
|
|||||||
package.review_thread = thread
|
package.review_thread = thread
|
||||||
|
|
||||||
for mentioned_username in get_user_mentions(render_markdown(form.comment.data)):
|
for mentioned_username in get_user_mentions(render_markdown(form.comment.data)):
|
||||||
mentioned = User.query.filter_by(username=mentioned_username)
|
mentioned = User.query.filter_by(username=mentioned_username).first()
|
||||||
if mentioned is None:
|
if mentioned is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ class Medal:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make_locked(cls, description: str, progress: Tuple[int, int]):
|
def make_locked(cls, description: str, progress: Tuple[int, int]):
|
||||||
|
if progress[0] is None or progress[1] is None:
|
||||||
|
raise Exception("Invalid progress")
|
||||||
|
|
||||||
return Medal(description=description, progress=progress)
|
return Medal(description=description, progress=progress)
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +130,7 @@ def get_user_medals(user: User) -> Tuple[List[Medal], List[Medal]]:
|
|||||||
|
|
||||||
unlocked.append(Medal.make_unlocked(
|
unlocked.append(Medal.make_unlocked(
|
||||||
place_to_color(review_idx + 1), "fa-star-half-alt", title, description))
|
place_to_color(review_idx + 1), "fa-star-half-alt", title, description))
|
||||||
else:
|
elif review_boundary is not None:
|
||||||
description = gettext(u"Consider writing more helpful reviews to get a medal.")
|
description = gettext(u"Consider writing more helpful reviews to get a medal.")
|
||||||
if review_idx:
|
if review_idx:
|
||||||
description += " " + gettext(u"You are in place %(place)s.", place=review_idx + 1)
|
description += " " + gettext(u"You are in place %(place)s.", place=review_idx + 1)
|
||||||
|
@ -162,6 +162,11 @@
|
|||||||
<input class="btn btn-primary" type="submit" value="Comment" />
|
<input class="btn btn-primary" type="submit" value="Comment" />
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if thread.private %}
|
||||||
|
<p class="text-muted card-body my-0 pt-0">
|
||||||
|
{{ _("You can add someone to a private thread by writing @username.") }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user