samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

message: message_hide-0.1


From: boud
Subject: message: message_hide-0.1
Date: Wed, 6 Dec 2006 05:58:56 +0100 (CET)

hi again,

This is a patch to add extra html markup to hidden messages to make it
highly obvious to readers that the article is hidden (e.g. see an article
like  http://pl.indymedia.org/pl/2006/12/24918.shtml).

The problem is that people can externally link to a hidden article, and just the single word "hidden" in the header is quite easy to miss
by a casual reader. This leads to people externally linking to hidden
articles and thereby discrediting the site since readers don't realise
that the article has been hidden, what the nature of the whole site is,
etc.


The patch requires a config option to be turned on and the specific
markup is defined in that config option.

Question: should the config file instead point to a class which itself
is defined in (all) the css files?

Anyway, here it is:
(1) patch on engine/message.rb
(2) samizdat.yaml  config

cheers
boud



(1) engine/message.rb

--- /tmp/cvs/samizdat/lib/samizdat/engine/message.rb    2006-10-29 
11:58:23.000000000 +0100
+++ /usr/lib/ruby/1.8/samizdat/engine/message.rb        2006-12-04 
07:05:23.669897896 +0100
@@ -44,8 +44,15 @@
   # (running inside transaction is assumed)
   #
   def Message.update_html(id, content, format)
-    db.do 'UPDATE Message SET html_full = ? WHERE id = ?',
-      Template.format_inline_content(content, format), id
+    if rdf.get_property(id, 's::hidden') and (config['hidestyle'])
+      db.do 'UPDATE Message SET html_full = ? WHERE id = ?',
+ config['hidestyle']['prefix'] + + Template.format_inline_content(content, format) + + config['hidestyle']['suffix'], id
+    else
+      db.do 'UPDATE Message SET html_full = ? WHERE id = ?',
+        Template.format_inline_content(content, format), id
+    end

     full_size = content.size
     content = Template.limit_string(content, config['limit']['short'])


(2) add in samizdat.yaml:


hidestyle:
   prefix: '<div style="text-decoration: line-through">'
   suffix: '</div>'






reply via email to

[Prev in Thread] Current Thread [Next in Thread]