Skip to content
Extraits de code Groupes Projets
Valider 302cf54f rédigé par maxwell's avatar maxwell
Parcourir les fichiers

MS subscribers should now unsubscribe

parent c34f5e5e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -5,5 +5,12 @@ class AuthorsController < ApplicationController ...@@ -5,5 +5,12 @@ class AuthorsController < ApplicationController
@author= Author.where(:id => params[:id]).first @author= Author.where(:id => params[:id]).first
@author_ostatus_posts = @author.ostatus_posts.sort(:created_at.desc) @author_ostatus_posts = @author.ostatus_posts.sort(:created_at.desc)
end end
def destroy
current_user.unsubscribe_from_pubsub(params[:id])
flash[:notice] = "unsubscribed person."
redirect_to ostatus_path
end
end end
...@@ -9,7 +9,8 @@ class Author ...@@ -9,7 +9,8 @@ class Author
key :hub, String key :hub, String
many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id
before_save :set_defaults before_save :set_defaults
before_destroy :delete_posts
def self.instantiate(opts) def self.instantiate(opts)
author = Author.first(:feed_url => opts[:feed_url]) author = Author.first(:feed_url => opts[:feed_url])
...@@ -22,4 +23,8 @@ class Author ...@@ -22,4 +23,8 @@ class Author
self.avatar_thumbnail = nil if self.avatar_thumbnail == 0 self.avatar_thumbnail = nil if self.avatar_thumbnail == 0
self.service = self.url if self.service == 0 self.service = self.url if self.service == 0
end end
def delete_posts
self.ostatus_posts.delete_all
end
end end
.span-20.last .span-20.last
%h1= "#{@author.username}" %h1= "#{@author.username}"
= link_to 'unsubscribe', @author, :confirm => 'Are you sure?', :method => :delete
.span-20 .span-20
- if @author_ostatus_posts - if @author_ostatus_posts
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
%h1= title_for_page %h1= title_for_page
= render "shared/publisher" = render "shared/publisher"
%ul#stream %ul#stream
= puts @posts.inspect
- for post in @posts - for post in @posts
= render type_partial(post), :post => post = render type_partial(post), :post => post
#pagination #pagination
......
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