about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/javascript/flavours/glitch/styles/monsterpit.scss8
-rw-r--r--app/lib/bangtags.rb4
-rw-r--r--app/lib/formatter.rb4
-rw-r--r--app/models/status.rb2
4 files changed, 14 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/styles/monsterpit.scss b/app/javascript/flavours/glitch/styles/monsterpit.scss
index 6c9e30d47..1a53002b3 100644
--- a/app/javascript/flavours/glitch/styles/monsterpit.scss
+++ b/app/javascript/flavours/glitch/styles/monsterpit.scss
@@ -19,6 +19,10 @@
       color: darken($secondary-text-color, 20%);
     }
   }
+  h1.draft {
+    color: lighten($dark-text-color, 20%);
+    text-align: center;
+  }
   span.cursor {
     color: lighten($dark-text-color, 20%);
     font-family: $font-monospace, monospace;
@@ -38,6 +42,10 @@
       color: darken($secondary-text-color, 50%);
     }
   }
+  h1.draft {
+    color: $dark-text-color;
+    text-align: center;
+  }
 }
 
 div.media-caption {
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index e1fcc307d..1b27f712e 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -77,7 +77,7 @@ class Bangtags
     status.text.gsub!('#!!', "#\ufdd6!")
 
     status.text.split(/(#!(?:.*:!#|{.*?}|[^\s#]+))/).each do |chunk|
-      if @vore_stack.last == '_draft' || (@chunks.present? && @chunks.first.include?('#!draft'))
+      if @vore_stack.last == '_draft' || (@chunks.present? && status.draft?)
         chunk.gsub("#\ufdd6!", '#!')
         @chunks << chunk
       elsif chunk.starts_with?("#!")
@@ -543,10 +543,8 @@ class Bangtags
           end
         when 'draft'
           chunk = nil
-          @chunks.insert(0, "[center]`#!draft!#`[/center]\n") unless @chunks.present? && @chunks.first.include?('#!draft')
           @status.visibility = :direct
           @status.local_only = true
-          @status.content_type = 'text/x-bbcode+markdown'
           @vore_stack.push('_draft')
           @component_stack.push(:var)
           add_tags(status, 'self.draft')
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index 31cfc8220..5a1572c05 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -240,6 +240,10 @@ class Formatter
       html = "#{html.strip}\n<p class=\"signature\">— #{footer}</p>"
     end
 
+    if status.draft?
+      html = "<h1 class=\"draft\">Draft</h1>\n#{html}"
+    end
+
     html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify]
     html.html_safe # rubocop:disable Rails/OutputSafety
   end
diff --git a/app/models/status.rb b/app/models/status.rb
index 60040b6cf..8fdfd0737 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -227,7 +227,7 @@ class Status < ApplicationRecord
   end
 
   def draft?
-    local? && text.present? && text.include?('#!draft')
+    local? && text.present? && self.tags.where(name: 'self.draft').exists?
   end
 
   def target