<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -50,10 +50,11 @@ class Person &lt; ActiveRecord::Base
   NUM_WALL_COMMENTS = 10
   NUM_RECENT = 8
   FEED_SIZE = 10
-  ACCEPTED_AND_ACTIVE =  [%(status = #{Connection::ACCEPTED} AND
+  TIME_AGO_FOR_MOSTLY_ACTIVE = 1.month.ago
+  ACCEPTED_AND_ACTIVE =  [%(status = ? AND
                             deactivated = ? AND
                             (email_verified IS NULL OR email_verified = ?)),
-                          false, true] 
+                          Connection::ACCEPTED, false, true]
 
   has_one :blog
   has_many :email_verifications
@@ -68,7 +69,7 @@ class Person &lt; ActiveRecord::Base
   has_many :photos, :dependent =&gt; :destroy, :order =&gt; 'created_at'
   has_many :requested_contacts, :through =&gt; :connections,
            :source =&gt; :contact,
-           :conditions =&gt; &quot;status = #{Connection::REQUESTED}&quot;
+           :conditions =&gt; [&quot;status = ?&quot;, Connection::REQUESTED]
   with_options :class_name =&gt; &quot;Message&quot;, :dependent =&gt; :destroy,
                :order =&gt; 'created_at DESC' do |person|
     person.has_many :_sent_messages, :foreign_key =&gt; &quot;sender_id&quot;,
@@ -110,6 +111,14 @@ class Person &lt; ActiveRecord::Base
                      :conditions =&gt; conditions_for_active)
     end
     
+    # Return the people who are 'mostly' active.
+    # People are mostly active if they have logged in recently enough.
+    def mostly_active(page = 1)
+      paginate(:all, :page =&gt; page,
+                     :per_page =&gt; RASTER_PER_PAGE,
+                     :conditions =&gt; conditions_for_mostly_active)
+    end
+    
     # Return *all* the active users.
     def all_active
       find(:all, :conditions =&gt; conditions_for_active)
@@ -376,7 +385,7 @@ class Person &lt; ActiveRecord::Base
     end
 
     def log_activity_description_changed
-      unless @old_description == description
+      unless @old_description == description or description.blank?
         add_activities(:item =&gt; self, :person =&gt; self)
       end
     end
@@ -397,10 +406,22 @@ class Person &lt; ActiveRecord::Base
       crypted_password.blank? || !password.blank? || !verify_password.nil?
     end
     
-    # Return the conditions for a user to be active.
-    def self.conditions_for_active
-      [%(deactivated = ? AND 
-        (email_verified IS NULL OR email_verified = ?)),
-       false, true]
+    class &lt;&lt; self
+    
+      # Return the conditions for a user to be active.
+      def conditions_for_active
+        [%(deactivated = ? AND 
+          (email_verified IS NULL OR email_verified = ?)),
+         false, true]
+      end
+      
+      # Return the conditions for a user to be 'mostly' active.
+      def conditions_for_mostly_active
+        [%(deactivated = ? AND 
+          (email_verified IS NULL OR email_verified = ?) AND
+          (last_logged_in_at IS NOT NULL AND
+           last_logged_in_at &gt;= ?)),
+         false, true, TIME_AGO_FOR_MOSTLY_ACTIVE]
+      end
     end
 end</diff>
      <filename>app/models/person.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,14 @@
 &lt;%- unless @person.recent_activity.empty? -%&gt;
   &lt;h2&gt;Recent Activity&lt;/h2&gt;
+  
+
+  &lt;%- unless @person.last_logged_in_at.nil? or current_person?(@person) -%&gt;
+    &lt;p class=&quot;meta&quot;&gt;
+    &lt;%= @person.name %&gt; last logged in 
+    &lt;%= time_ago_in_words(@person.last_logged_in_at) %&gt; ago
+    &lt;/p&gt;    
+  &lt;%- end -%&gt;
+  
   &lt;ul class=&quot;list activity full&quot;&gt;
      &lt;%= render :partial =&gt; 'shared/activity',
                 :collection =&gt; @person.recent_activity,</diff>
      <filename>app/views/people/_recent_activity.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,9 @@
 &lt;%- column_div :type =&gt; :primary do -%&gt;
+  &lt;%- if global_prefs.app_name.blank? -%&gt;
   &lt;h2&gt;Sign up&lt;/h2&gt;
+  &lt;%- else -%&gt;
+  &lt;h2&gt;Sign up for &lt;%= global_prefs.app_name %&gt;&lt;/h2&gt;
+  &lt;%- end -%&gt;
 
   &lt;%= error_messages_for :person %&gt;
 </diff>
      <filename>app/views/people/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 &lt;%- column_div :type =&gt; :primary do -%&gt;
   &lt;div class=&quot;profile vcard&quot;&gt;
     &lt;h2&gt;Profile: &lt;span class=&quot;fn n&quot;&gt;&lt;%= h @person.name %&gt;&lt;/span&gt;&lt;/h2&gt;
+    &lt;%- if admin? and not @person.active? -%&gt;
+      &lt;p class=&quot;error&quot;&gt;This person is not active&lt;/p&gt;
+    &lt;%- end -%&gt;
     &lt;%- if current_person?(@person) -%&gt;
       &lt;%- if current_person.description.blank? -%&gt;
         &lt;div class=&quot;error&quot;&gt;</diff>
      <filename>app/views/people/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -337,6 +337,34 @@ describe Person do
       @person.should be_active
     end
   end
+  
+  describe &quot;mostly active&quot; do
+    it &quot;should include a recently logged-in person&quot; do
+      Person.mostly_active.should contain(@person)
+    end
+    
+    it &quot;should not include a deactivated person&quot; do
+      @person.toggle!(:deactivated)
+      Person.mostly_active.should_not contain(@person)
+    end
+    
+    it &quot;should not include an email unverified person&quot; do
+      enable_email_notifications
+      @person.email_verified = false; @person.save!
+      Person.mostly_active.should_not contain(@person)      
+    end
+    
+    it &quot;should not include a person who has never logged in&quot; do
+      @person.last_logged_in_at = nil; @person.save
+      Person.mostly_active.should_not contain(@person)
+    end
+    
+    it &quot;should not include a person who logged in too long ago&quot; do
+      @person.last_logged_in_at = Person::TIME_AGO_FOR_MOSTLY_ACTIVE - 1
+      @person.save
+      Person.mostly_active.should_not contain(@person)
+    end
+  end
 
   describe &quot;admin&quot; do
 </diff>
      <filename>spec/models/person_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0e29f505c4c978efa533d91fb16c79c96cb1f74f</id>
    </parent>
    <parent>
      <id>f4b426917037f93bdf9b93e6a0b84c436fa90865</id>
    </parent>
  </parents>
  <author>
    <name>Pavel Valodzka</name>
    <email>pavel@valodzka.name</email>
  </author>
  <url>http://github.com/valodzka/insoshi/commit/251c0b16712342f4c95cbb2bd9be21d9fa993042</url>
  <id>251c0b16712342f4c95cbb2bd9be21d9fa993042</id>
  <committed-date>2008-05-23T15:34:09-07:00</committed-date>
  <authored-date>2008-05-23T15:34:09-07:00</authored-date>
  <message>Merge branch 'master' into valodzka</message>
  <tree>9d1226c5ce88e7f46e5f8261d559621afa067d7a</tree>
  <committer>
    <name>Pavel Valodzka</name>
    <email>pavel@valodzka.name</email>
  </committer>
</commit>
