molten-trunk/molten5_withgrid/lib/watcher_classes.rb
# Unsubscribes the +contact+ from this CaseWatcher.
# Also destroys this CaseWatcher if the subscriber list is now empty.
Unsubscribes the +contact+ from this CaseWatcher.
Also destroys this CaseWatcher if the subscriber list is now empty.
Unsubscribes the + contact + from this CaseWatcher . Also destroys this CaseWatcher if the subscriber list is now empty .
def unsubscribe!(contact)
    subscriber = Case_Watcher_List.find(:first, :conditions => ["case_watcher_id__c = ? AND contact_id__c = ?",id,contact.id])
    if subscriber
      subscriber.class.establish_connection :salesforce
      subscriber.destroy 
      subscriber.clone.destroy if subscriber.clone
    elsif local_watcher = SfcaseWatcherList.find(:first, :conditions => ["case_watcher_id__c = ? AND contact_id__c = ?",id,contact.id])
      local_watcher.destroy
    end
    if case_watcher_lists.empty?
      Case_Watcher_List.destroy(id)
      clone.destroy if clone
    end
  end
def unsubscribe! ( contact ) subscriber = Case_Watcher_List . find ( :first , :conditions => [ "case_watcher_id__c = ? AND contact_id__c = ?" , id , contact . id ] ) if subscriber subscriber . class . establish_connection :salesforce subscriber . destroy subscriber . clone . destroy if subscriber . clone elsif local_watcher = SfcaseWatcherList . find ( :first , :conditions => [ "case_watcher_id__c = ? AND contact_id__c = ?" , id , contact . id ] ) local_watcher . destroy end if case_watcher_lists . empty? Case_Watcher_List . destroy ( id ) clone . destroy if clone end end
Unsubscribes the +contact+ from this CaseWatcher.
Unsubscribes the + contact + from this CaseWatcher .
# try to find the contact in the case watcher list # if the contact is in the subscriber list, delete the SF record and the local copy # couldn't find the SF record...delete the local one # if the subscriber list is empty, delete the case watcher as well
contact