MS subscribers should now unsubscribe
This commit is contained in:
parent
c34f5e5ee0
commit
302cf54fab
4 changed files with 15 additions and 2 deletions
|
|
@ -6,4 +6,11 @@ class AuthorsController < ApplicationController
|
|||
@author_ostatus_posts = @author.ostatus_posts.sort(:created_at.desc)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
current_user.unsubscribe_from_pubsub(params[:id])
|
||||
flash[:notice] = "unsubscribed person."
|
||||
redirect_to ostatus_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class Author
|
|||
|
||||
many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id
|
||||
before_save :set_defaults
|
||||
before_destroy :delete_posts
|
||||
|
||||
def self.instantiate(opts)
|
||||
author = Author.first(:feed_url => opts[:feed_url])
|
||||
|
|
@ -22,4 +23,8 @@ class Author
|
|||
self.avatar_thumbnail = nil if self.avatar_thumbnail == 0
|
||||
self.service = self.url if self.service == 0
|
||||
end
|
||||
|
||||
def delete_posts
|
||||
self.ostatus_posts.delete_all
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.span-20.last
|
||||
%h1= "#{@author.username}"
|
||||
|
||||
= link_to 'unsubscribe', @author, :confirm => 'Are you sure?', :method => :delete
|
||||
.span-20
|
||||
- if @author_ostatus_posts
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
%h1= title_for_page
|
||||
= render "shared/publisher"
|
||||
%ul#stream
|
||||
= puts @posts.inspect
|
||||
- for post in @posts
|
||||
= render type_partial(post), :post => post
|
||||
#pagination
|
||||
|
|
|
|||
Loading…
Reference in a new issue