fixed migrations, added unread to PrivateMessageVisibilities
This commit is contained in:
parent
979d9d7fb4
commit
a179bac689
6 changed files with 21 additions and 38 deletions
|
|
@ -80,7 +80,7 @@ class StatusMessagesController < ApplicationController
|
|||
|
||||
def show
|
||||
@status_message = current_user.find_visible_post_by_id params[:id]
|
||||
if @status_messag
|
||||
if @status_message
|
||||
@object_aspect_ids = @status_message.aspects.map{|a| a.id}
|
||||
|
||||
# mark corresponding notification as read
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
class CreatePrivateMessages < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :private_messages do |t|
|
||||
t.integer :author_id, :null => false
|
||||
t.boolean :unread, :null => false, :default => true
|
||||
t.string :guid, :null => false
|
||||
t.text :message, :null => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :private_messages, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :private_messages
|
||||
end
|
||||
end
|
||||
|
|
@ -1,8 +1,18 @@
|
|||
class CreatePrivateMessageVisibilities < ActiveRecord::Migration
|
||||
class CreatePrivateMessagesAndVisibilities < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :private_messages do |t|
|
||||
t.integer :author_id, :null => false
|
||||
t.string :guid, :null => false
|
||||
t.text :message, :null => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
|
||||
create_table :private_message_visibilities do |t|
|
||||
t.integer :private_message_id
|
||||
t.integer :person_id
|
||||
t.boolean :unread, :null => false, :default => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
@ -10,9 +20,11 @@ class CreatePrivateMessageVisibilities < ActiveRecord::Migration
|
|||
add_index :private_message_visibilities, :person_id
|
||||
add_index :private_message_visibilities, :private_message_id
|
||||
add_index :private_message_visibilities, [:private_message_id, :person_id], :name => 'pm_visibilities_on_pm_id_and_person_id', :unique => true
|
||||
add_index :private_messages, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :private_messages
|
||||
drop_table :private_message_visibilities
|
||||
end
|
||||
end
|
||||
|
|
@ -10,11 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
<<<<<<< HEAD
|
||||
ActiveRecord::Schema.define(:version => 20110228201109) do
|
||||
=======
|
||||
ActiveRecord::Schema.define(:version => 20110225193130) do
|
||||
>>>>>>> added PrivateMessage and PrivateMessageVisibility models and migrations
|
||||
|
||||
create_table "aspect_memberships", :force => true do |t|
|
||||
t.integer "aspect_id", :null => false
|
||||
|
|
@ -390,6 +386,7 @@ ActiveRecord::Schema.define(:version => 20110225193130) do
|
|||
create_table "private_message_visibilities", :force => true do |t|
|
||||
t.integer "private_message_id"
|
||||
t.integer "person_id"
|
||||
t.boolean "unread", :default => true, :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
|
@ -400,7 +397,6 @@ ActiveRecord::Schema.define(:version => 20110225193130) do
|
|||
|
||||
create_table "private_messages", :force => true do |t|
|
||||
t.integer "author_id", :null => false
|
||||
t.boolean "unread", :default => true, :null => false
|
||||
t.string "guid", :null => false
|
||||
t.text "message", :null => false
|
||||
t.datetime "created_at"
|
||||
|
|
|
|||
|
|
@ -23,13 +23,6 @@ describe AspectMembershipsController do
|
|||
request.env["HTTP_REFERER"] = 'http://' + request.host
|
||||
end
|
||||
|
||||
describe "#new" do
|
||||
it 'succeeds' do
|
||||
get :new
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe '#create' do
|
||||
it 'creates an aspect membership' do
|
||||
@user.should_receive(:add_contact_to_aspect)
|
||||
|
|
|
|||
Loading…
Reference in a new issue