From 0205a2f08cdf61c67eec1c2571a768bbad054468 Mon Sep 17 00:00:00 2001 From: Gerry Gleason Date: Sat, 22 Sep 2012 19:42:11 -0500 Subject: [PATCH] remove userstamp gem --- Gemfile | 1 - Gemfile.lock | 2 -- app/models/card.rb | 11 +++-------- app/models/card/revision.rb | 4 ++-- lib/old_modules/notification.rb | 2 +- lib/wagn/model/permissions.rb | 4 ++-- spec/lib/wagn/renderer/xml_spec.rb | 5 +---- 7 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index d0fce4d21..4f63e0e84 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,6 @@ gem 'paperclip', '~> 2.4' gem 'rmagick', '~> 2.13' gem "recaptcha", "~> 0.3" -gem 'userstamp' #, '~> 2.0' gem 'xmlscan', '~> 0.3' gem 'warden' diff --git a/Gemfile.lock b/Gemfile.lock index 08a773507..9444b4685 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -202,7 +202,6 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - userstamp (2.0.1) uuid (2.3.5) macaddr (~> 1.0) warden (1.2.1) @@ -245,7 +244,6 @@ DEPENDENCIES tinymce-rails (~> 3.4) turn (~> 0.8.3) uglifier - userstamp uuid (~> 2.3) warden win32-process (~> 0.6) diff --git a/app/models/card.rb b/app/models/card.rb index 08ac064a5..c58698a3a 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -10,10 +10,6 @@ class Card < ActiveRecord::Base cattr_accessor :cache - # userstamp methods - model_stamper # Card is both stamped and stamper - stampable :stamper_class_name => :card - has_many :revisions, :order => :id #, :foreign_key=>'card_id' attr_accessor :comment, :comment_author, :selected_rev_id, @@ -25,6 +21,9 @@ class Card < ActiveRecord::Base attr_writer :update_read_rule_list attr_reader :type_args, :broken_type + belongs_to :card, :class_name => 'Card', :foreign_key => :creator_id + belongs_to :card, :class_name => 'Card', :foreign_key => :updater_id + before_save :set_stamper, :base_before_save, :set_read_rule, :set_tracked_attributes after_save :base_after_save, :update_ruled_cards, :update_queue, :expire_related @@ -565,10 +564,6 @@ def after_save_hooks # don't move unless you know what you're doing, see above. Wagn::Hook.call :after_save, self end - #bail out when not recording userstamps (eg updating read rule) - #skip_callback :save, :after, :after_save_hooks, :save_attached_files, - # :if => lambda { !Card.record_userstamps } - # Because of the way it chains methods, 'tracks' needs to come after # all the basic method definitions, and validations have to come after # that because they depend on some of the tracking methods. diff --git a/app/models/card/revision.rb b/app/models/card/revision.rb index f7054bc13..fcf854c77 100644 --- a/app/models/card/revision.rb +++ b/app/models/card/revision.rb @@ -4,8 +4,8 @@ class Card::Revision < ActiveRecord::Base cattr_accessor :cache - # userstamp methods - stampable :stamper_class_name => :card + belongs_to :card, :class_name => 'Card', :foreign_key => :creator_id + before_save :set_stamper def set_stamper diff --git a/lib/old_modules/notification.rb b/lib/old_modules/notification.rb index 2c526ed1d..af7f29308 100644 --- a/lib/old_modules/notification.rb +++ b/lib/old_modules/notification.rb @@ -6,7 +6,7 @@ def self.included(base) end def send_notifications - return false if Card.record_userstamp==false + return false if Card.record_timestamps==false # userstamps and timestamps are turned off in cases like updating read_rules that are automated and # generally not of enough interest to warrant notification diff --git a/lib/wagn/model/permissions.rb b/lib/wagn/model/permissions.rb index 5ebc34db6..93bfccb2e 100644 --- a/lib/wagn/model/permissions.rb +++ b/lib/wagn/model/permissions.rb @@ -198,7 +198,7 @@ def set_read_rule end def update_read_rule - Card.record_timestamps = Card.record_userstamp = false + Card.record_timestamps = false reset_patterns # why is this needed? rcard, rclass = permission_rule_card :read @@ -220,7 +220,7 @@ def update_read_rule end ensure - Card.record_timestamps = Card.record_userstamp = true + Card.record_timestamps = true end # fifo of cards that need read rules updated diff --git a/spec/lib/wagn/renderer/xml_spec.rb b/spec/lib/wagn/renderer/xml_spec.rb index 6c71e31e9..332349003 100644 --- a/spec/lib/wagn/renderer/xml_spec.rb +++ b/spec/lib/wagn/renderer/xml_spec.rb @@ -100,11 +100,8 @@ describe "css classes" do it "are correct for open view" do - pending "with html" c = Card.new :name => 'Aopen', :content => "{{A|open}}" - Wagn::Renderer::Xml.new(c)._render(:core).should be_html_with do - card( :class => "card-slot paragraph ALL TYPE-basic SELF-a") {} - end + Wagn::Renderer::Xml.new(c)._render(:core).should match /Alpha Z<\/cardlink><\/card>/ end end