forked from MarseyWorld/MarseyWorld
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)
|
||||
owner_id = Column(Integer, ForeignKey("users.id"))
|
||||
description = Column(String)
|
||||
description_html = Column(String)
|
||||
|
||||
memberships = relationship("GroupMembership", primaryjoin="GroupMembership.group_name==Group.name", order_by="GroupMembership.approved_utc")
|
||||
owner = relationship("User", primaryjoin="Group.owner_id==User.id")
|
||||
|
|
|
@ -353,10 +353,18 @@ def group_change_description(v, group_name):
|
|||
|
||||
if description:
|
||||
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:
|
||||
description = None
|
||||
description_html = None
|
||||
|
||||
group.description = description
|
||||
group.description_html = description_html
|
||||
g.db.add(group)
|
||||
|
||||
return {"message": 'Description changed successfully!'}
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% elif group.description %}
|
||||
{% elif group.description_html %}
|
||||
<h5 class="mt-5">!{{group}} Description</h3>
|
||||
<p class="mb-2">{{group.description}}</p>
|
||||
<p class="mb-2">{{group.description_html | safe}}</p>
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
|
|
|
@ -62,8 +62,8 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if group.description %}
|
||||
{{group.description}}
|
||||
{% if group.description_html %}
|
||||
{{group.description_html | safe}}
|
||||
{% endif %}
|
||||
</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