Skip to content
Extraits de code Groupes Projets
Valider a179bac6 rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

fixed migrations, added unread to PrivateMessageVisibilities

parent 979d9d7f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -62,7 +62,7 @@ class StatusMessagesController < ApplicationController ...@@ -62,7 +62,7 @@ class StatusMessagesController < ApplicationController
else else
respond_to do |format| respond_to do |format|
format.js { render :json =>{:errors => @status_message.errors.full_messages}, :status => 406 } format.js { render :json =>{:errors => @status_message.errors.full_messages}, :status => 406 }
format.html {redirect_to :back} format.html {redirect_to :back}
end end
end end
end end
...@@ -80,7 +80,7 @@ class StatusMessagesController < ApplicationController ...@@ -80,7 +80,7 @@ class StatusMessagesController < ApplicationController
def show def show
@status_message = current_user.find_visible_post_by_id params[:id] @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} @object_aspect_ids = @status_message.aspects.map{|a| a.id}
# mark corresponding notification as read # mark corresponding notification as read
......
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
class CreatePrivateMessageVisibilities < ActiveRecord::Migration class CreatePrivateMessagesAndVisibilities < ActiveRecord::Migration
def self.up 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| create_table :private_message_visibilities do |t|
t.integer :private_message_id t.integer :private_message_id
t.integer :person_id t.integer :person_id
t.boolean :unread, :null => false, :default => true
t.timestamps t.timestamps
end end
...@@ -10,9 +20,11 @@ class CreatePrivateMessageVisibilities < ActiveRecord::Migration ...@@ -10,9 +20,11 @@ class CreatePrivateMessageVisibilities < ActiveRecord::Migration
add_index :private_message_visibilities, :person_id add_index :private_message_visibilities, :person_id
add_index :private_message_visibilities, :private_message_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_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 end
def self.down def self.down
drop_table :private_messages
drop_table :private_message_visibilities drop_table :private_message_visibilities
end end
end end
...@@ -10,11 +10,7 @@ ...@@ -10,11 +10,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
<<<<<<< HEAD
ActiveRecord::Schema.define(:version => 20110228201109) do 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| create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id", :null => false t.integer "aspect_id", :null => false
...@@ -390,6 +386,7 @@ ActiveRecord::Schema.define(:version => 20110225193130) do ...@@ -390,6 +386,7 @@ ActiveRecord::Schema.define(:version => 20110225193130) do
create_table "private_message_visibilities", :force => true do |t| create_table "private_message_visibilities", :force => true do |t|
t.integer "private_message_id" t.integer "private_message_id"
t.integer "person_id" t.integer "person_id"
t.boolean "unread", :default => true, :null => false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
...@@ -399,10 +396,9 @@ ActiveRecord::Schema.define(:version => 20110225193130) do ...@@ -399,10 +396,9 @@ ActiveRecord::Schema.define(:version => 20110225193130) do
add_index "private_message_visibilities", ["private_message_id"], :name => "index_private_message_visibilities_on_private_message_id" add_index "private_message_visibilities", ["private_message_id"], :name => "index_private_message_visibilities_on_private_message_id"
create_table "private_messages", :force => true do |t| create_table "private_messages", :force => true do |t|
t.integer "author_id", :null => false t.integer "author_id", :null => false
t.boolean "unread", :default => true, :null => false t.string "guid", :null => false
t.string "guid", :null => false t.text "message", :null => false
t.text "message", :null => false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
......
...@@ -23,13 +23,6 @@ describe AspectMembershipsController do ...@@ -23,13 +23,6 @@ describe AspectMembershipsController do
request.env["HTTP_REFERER"] = 'http://' + request.host request.env["HTTP_REFERER"] = 'http://' + request.host
end end
describe "#new" do
it 'succeeds' do
get :new
response.should be_success
end
end
describe '#create' do describe '#create' do
it 'creates an aspect membership' do it 'creates an aspect membership' do
@user.should_receive(:add_contact_to_aspect) @user.should_receive(:add_contact_to_aspect)
......
...@@ -65,9 +65,9 @@ describe StatusMessagesController do ...@@ -65,9 +65,9 @@ describe StatusMessagesController do
end end
it "dispatches the post to the specified services" do it "dispatches the post to the specified services" do
s1 = Services::Facebook.new s1 = Services::Facebook.new
@user1.services << s1 @user1.services << s1
@user1.services << Services::Twitter.new @user1.services << Services::Twitter.new
status_message_hash[:services] = ['facebook'] status_message_hash[:services] = ['facebook']
@user1.should_receive(:dispatch_post).with(anything(), hash_including(:services => [s1])) @user1.should_receive(:dispatch_post).with(anything(), hash_including(:services => [s1]))
post :create, status_message_hash post :create, status_message_hash
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter