summaryrefslogtreecommitdiff
path: root/server/szurubooru/func/posts.py
diff options
context:
space:
mode:
authorIlya Tetin <ilya.tetin@agoda.com>2019-04-25 13:48:37 +0700
committerIlya Tetin <ilya.tetin@agoda.com>2019-04-25 13:48:37 +0700
commitdad805d89aab1e54eb3edea32cf810e53d8a1419 (patch)
tree2322e8a79d8644e8adecc259c4e17ec0f483c4ec /server/szurubooru/func/posts.py
parent0616dabe801d160b495af0dcaa1ef5d0ba8b2531 (diff)
parent4117f63375c681a800068b56beb201699807801a (diff)
Merge branch 'master' into hunternif
Diffstat (limited to 'server/szurubooru/func/posts.py')
-rw-r--r--server/szurubooru/func/posts.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index edd911e..b6816b0 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -224,7 +224,7 @@ class PostSerializer(serialization.BaseSerializer):
return get_post_thumbnail_url(self.post)
def serialize_flags(self) -> Any:
- return [x for x in self.post.flags.split(',') if x]
+ return self.post.flags
def serialize_tags(self) -> Any:
return [
@@ -376,7 +376,7 @@ def create_post(
post.safety = model.Post.SAFETY_SAFE
post.user = user
post.creation_time = datetime.utcnow()
- post.flags = ''
+ post.flags = []
post.type = ''
post.checksum = ''
@@ -497,7 +497,7 @@ def test_sound(post: model.Post, content: bytes) -> None:
assert content
if mime.is_video(mime.get_mime_type(content)):
if images.Image(content).check_for_sound():
- flags = [x for x in post.flags.split(',') if x]
+ flags = post.flags
if model.Post.FLAG_SOUND not in flags:
flags.append(model.Post.FLAG_SOUND)
update_post_flags(post, flags)
@@ -657,7 +657,7 @@ def update_post_flags(post: model.Post, flags: List[str]) -> None:
raise InvalidPostFlagError(
'Flag must be one of %r.' % list(FLAG_MAP.values()))
target_flags.append(flag)
- post.flags = ','.join(target_flags)
+ post.flags = target_flags
def feature_post(post: model.Post, user: Optional[model.User]) -> None: