samizdat-devel
[Top][All Lists]
Advanced

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

070218 moderation.rb - bug for rendering of members (blocked/unblocked)


From: boud
Subject: 070218 moderation.rb - bug for rendering of members (blocked/unblocked)
Date: Mon, 30 Apr 2007 00:04:33 +0200 (CEST)

hi samizdat-devel,

i haven't yet had a chance to look at the Model-View-Controller version
of samizdat in cvs.

On the other hand, i found a bug which suggests that on existing
samizdat sites, either:

(1) no moderators have blocked any registered users; or

(2) moderators have blocked/unblocked one or more registered users, but
nobody checked the moderation log using  moderation.rb fast enough after
the blocking/unblocking action to notice the error; or

(3) moderators have blocked/unblocked one or more registered users, and
somebody checked the moderation log using moderation.rb and got a ResourceNotFound error, but failed to report it (possibly because s/he
is himself/herself a vandal who needed to be blocked...??)


VERSION: 070218 snapshot

THE BUG:
* As a moderator, block (and then, optionally, unblock :) a user
* Try /moderation.rb
* In my case, this reproducibly leads to a ResourceNotFound error in
the appropriate language.

DISCOVERY:
i noticed this on https://samizdat.axxs.org/moderation.rb (which has now been fixed with the hack below).


HYPOTHESIS:
From the hack i'm including below, it seems that there's some
interaction between moderation.rb and the rendering of a resource which is a member which leads to the resource/member being considered "not found",
even though that member still exists in the database and there's no
problem going directly to the member's resource.

i tried experimenting with engine/resource.rb, but i couldn't find the
exact point at where this happens. Maybe something like a problem between object vs variable or type of object?

In any case, i didn't want to spend too much time on this, since it
will probably be irrelevant after the MVC refactoring (i hope!), but
i think we do need at least a hack available for existing websites.

If someone is expecting to see a transparent record of the moderation
log and sees something like "This resource was not found on this site"
after clicking on "moderation log" from the front page, then s/he is
unlikely to realise that this is just a relatively subtle bug - it
looks more like the site admins have given up on transparency or turned
off the moderation log...


HACK:
This hack replaces the rendering done in Resource.new(session,
resource).render(:list) by a very simple rendering in every
case when the resource happens to be a member who got (un)blocked.

cheers
boud




--- 070218snapshot/cgi-bin/moderation.rb        2007-02-02 21:21:08.000000000 
+0100
+++ /usr/share/samizdat/cgi-bin/moderation.rb   2007-04-29 23:32:14.165741240 
+0200
@@ -23,12 +23,20 @@
     %{SELECT action_date, moderator, action, resource FROM moderation
     ORDER BY action_date DESC LIMIT #{limit_page} OFFSET #{limit_page * skip}}
   ).collect {|date, moderator, action, resource|
+ if('block'==action) # or 'unblock'==action) + r = '<a href="/' + resource.to_i.to_s + '">' + _('member') + + " " + resource.to_i.to_s + '</a>'
+      else
+          r =       Resource.new(session, resource).render(:list)
+      end
     [
       t.format_date(date),
       t.resource_href(moderator,
         Resource.new(session, moderator).render(:title)),
-      action,
-      Resource.new(session, resource).render(:list)
+#      action,
+       _(action.upcase),
+#      Resource.new(session, resource).render(:list)
+       r
     ]
   }
   page = t.table([[_('Date'), _('Moderator'), _('Action'), _('Resource')]] +




reply via email to

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