do this https://watchpeopledie.tv/h/meta/post/61549/megathread-for-bugs-and-suggestions/2715484#context
parent
fad0f736f3
commit
6c7eb8a3b2
|
@ -16,6 +16,7 @@ class Group(Base):
|
||||||
created_utc = Column(Integer)
|
created_utc = Column(Integer)
|
||||||
owner_id = Column(Integer, ForeignKey("users.id"))
|
owner_id = Column(Integer, ForeignKey("users.id"))
|
||||||
description = Column(String)
|
description = Column(String)
|
||||||
|
description_html = Column(String)
|
||||||
|
|
||||||
memberships = relationship("GroupMembership", primaryjoin="GroupMembership.group_name==Group.name", order_by="GroupMembership.approved_utc")
|
memberships = relationship("GroupMembership", primaryjoin="GroupMembership.group_name==Group.name", order_by="GroupMembership.approved_utc")
|
||||||
owner = relationship("User", primaryjoin="Group.owner_id==User.id")
|
owner = relationship("User", primaryjoin="Group.owner_id==User.id")
|
||||||
|
|
|
@ -353,10 +353,18 @@ def group_change_description(v, group_name):
|
||||||
|
|
||||||
if description:
|
if description:
|
||||||
description = description.strip()
|
description = description.strip()
|
||||||
|
if len(description) > 100:
|
||||||
|
abort(400, "New description is too long (max 100 characters)")
|
||||||
|
|
||||||
|
description_html = filter_emojis_only(description)
|
||||||
|
if len(description_html) > 500:
|
||||||
|
abort(400, "Rendered description is too long!")
|
||||||
else:
|
else:
|
||||||
description = None
|
description = None
|
||||||
|
description_html = None
|
||||||
|
|
||||||
group.description = description
|
group.description = description
|
||||||
|
group.description_html = description_html
|
||||||
g.db.add(group)
|
g.db.add(group)
|
||||||
|
|
||||||
return {"message": 'Description changed successfully!'}
|
return {"message": 'Description changed successfully!'}
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% elif group.description %}
|
{% elif group.description_html %}
|
||||||
<h5 class="mt-5">!{{group}} Description</h3>
|
<h5 class="mt-5">!{{group}} Description</h3>
|
||||||
<p class="mb-2">{{group.description}}</p>
|
<p class="mb-2">{{group.description_html | safe}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if group.description %}
|
{% if group.description_html %}
|
||||||
{{group.description}}
|
{{group.description_html | safe}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td data-time="{{group.created_utc}}"></td>
|
<td data-time="{{group.created_utc}}"></td>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
alter table groups add column description_html varchar(500);
|
||||||
|
update groups set description_html=description;
|
Loading…
Reference in New Issue