diff --git a/client/css/colors.styl b/client/css/colors.styl
index a37f7bbb..879be808 100644
--- a/client/css/colors.styl
+++ b/client/css/colors.styl
@@ -61,4 +61,4 @@ $safety-sketchy = #F3D75F
$safety-unsafe = #F3985F
$scrollbar-thumb-color = $main-color
$scrollbar-bg-color = $input-enabled-background-color
-$transparency-grid-square-color = #00000000
+$transparency-grid-square-color = #F0F0F0
\ No newline at end of file
diff --git a/client/html/post_main.tpl b/client/html/post_main.tpl
index 84e48b1c..6c1c05e0 100644
--- a/client/html/post_main.tpl
+++ b/client/html/post_main.tpl
@@ -53,6 +53,7 @@
+
<% if (ctx.canCreateComments) { %>
Add comment
diff --git a/client/js/controllers/post_main_controller.js b/client/js/controllers/post_main_controller.js
index bd338129..ff5ca5d1 100644
--- a/client/js/controllers/post_main_controller.js
+++ b/client/js/controllers/post_main_controller.js
@@ -187,6 +187,9 @@ class PostMainController extends BasePostController {
if (e.detail.source !== undefined && e.detail.source !== null) {
post.source = e.detail.source;
}
+ if (e.detail.desc !== undefined && e.detail.desc !== null) {
+ post.desc = e.detail.desc;
+ }
post.save().then(
() => {
this._view.sidebarControl.showSuccess("Post saved.");
diff --git a/client/js/models/post.js b/client/js/models/post.js
index 01f81bf1..673ebb00 100644
--- a/client/js/models/post.js
+++ b/client/js/models/post.js
@@ -114,6 +114,10 @@ class Post extends events.EventTarget {
return this._notes;
}
+ get desc() {
+ return this._desc;
+ }
+
get comments() {
return this._comments;
}
@@ -277,6 +281,9 @@ class Post extends events.EventTarget {
if (this._source !== this._orig._source) {
detail.source = this._source;
}
+ if (this._desc !== this._orig._desc) {
+ detail.desc = this._desc;
+ }
let apiPromise = this._id
? api.put(uri.formatApiLink("post", this.id), detail, files)
diff --git a/server/config.yaml.dist b/server/config.yaml.dist
index 193aac3a..7d5f075f 100644
--- a/server/config.yaml.dist
+++ b/server/config.yaml.dist
@@ -103,6 +103,7 @@ privileges:
'posts:edit:content': power
'posts:edit:flags': regular
'posts:edit:notes': regular
+ 'posts:edit:desc': regular
'posts:edit:relations': regular
'posts:edit:safety': power
'posts:edit:source': regular
diff --git a/server/szurubooru/api/post_api.py b/server/szurubooru/api/post_api.py
index daba7f7e..7ca1bc17 100644
--- a/server/szurubooru/api/post_api.py
+++ b/server/szurubooru/api/post_api.py
@@ -72,6 +72,7 @@ def create_post(
source = ctx.get_param_as_string("contentUrl", default="")
relations = ctx.get_param_as_int_list("relations", default=[])
notes = ctx.get_param_as_list("notes", default=[])
+ desc = ctx.get_param_as_string("desc", default="")
flags = ctx.get_param_as_string_list(
"flags", default=posts.get_default_flags(content)
)
@@ -85,6 +86,7 @@ def create_post(
posts.update_post_source(post, source)
posts.update_post_relations(post, relations)
posts.update_post_notes(post, notes)
+ posts.update_post_desc(post, desc)
posts.update_post_flags(post, flags)
if ctx.has_file("thumbnail"):
posts.update_post_thumbnail(post, ctx.get_file("thumbnail"))
@@ -159,6 +161,9 @@ def update_post(ctx: rest.Context, params: Dict[str, str]) -> rest.Response:
if ctx.has_param("notes"):
auth.verify_privilege(ctx.user, "posts:edit:notes")
posts.update_post_notes(post, ctx.get_param_as_list("notes"))
+ if ctx.has_param("desc"):
+ auth.verify_privilege(ctx.user, "posts:edit:desc")
+ posts.update_post_desc(post, ctx.get_param_as_string("desc"))
if ctx.has_param("flags"):
auth.verify_privilege(ctx.user, "posts:edit:flags")
posts.update_post_flags(post, ctx.get_param_as_string_list("flags"))
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index be2259cf..00a25446 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -197,6 +197,7 @@ class PostSerializer(serialization.BaseSerializer):
"favoritedBy": self.serialize_favorited_by,
"hasCustomThumbnail": self.serialize_has_custom_thumbnail,
"notes": self.serialize_notes,
+ "desc": self.serialize_desc,
"comments": self.serialize_comments,
"pools": self.serialize_pools,
}
@@ -328,6 +329,9 @@ class PostSerializer(serialization.BaseSerializer):
key=lambda x: x["polygon"],
)
+ def serialize_desc(self) -> Any:
+ return self.post.desc
+
def serialize_comments(self) -> Any:
return [
comments.serialize_comment(comment, self.auth_user)
@@ -779,6 +783,11 @@ def update_post_notes(post: model.Post, notes: Any) -> None:
)
+def update_post_desc(post: model.Post, desc: str) -> None:
+ assert post
+ post.desc = desc
+
+
def update_post_flags(post: model.Post, flags: List[str]) -> None:
assert post
target_flags = []
diff --git a/server/szurubooru/model/post.py b/server/szurubooru/model/post.py
index 49e748dc..bb9c6b0a 100644
--- a/server/szurubooru/model/post.py
+++ b/server/szurubooru/model/post.py
@@ -111,6 +111,22 @@ class PostNote(Base):
post = sa.orm.relationship("Post")
+class PostDesc(Base):
+ __tablename__ = "post_desc"
+
+ post_desc_id = sa.Column("id", sa.Integer, primary_key=True)
+ post_id = sa.Column(
+ "post_id",
+ sa.Integer,
+ sa.ForeignKey("post.id"),
+ nullable=False,
+ index=True,
+ )
+ text = sa.Column("text", sa.UnicodeText, nullable=False)
+
+ post = sa.orm.relationship("Post")
+
+
class PostRelation(Base):
__tablename__ = "post_relation"
@@ -252,6 +268,9 @@ class Post(Base):
notes = sa.orm.relationship(
"PostNote", cascade="all, delete-orphan", lazy="joined"
)
+ desc = sa.orm.relationship(
+ "PostDesc", cascade="all, delete-orphan", lazy="joined"
+ )
comments = sa.orm.relationship("Comment", cascade="all, delete-orphan")
_pools = sa.orm.relationship(
"PoolPost",