tag subscriptions
This commit is contained in:
@@ -3,7 +3,7 @@ class ArtistVersionsController < ApplicationController
|
||||
|
||||
def index
|
||||
@search = ArtistVersion.search(params[:search])
|
||||
@artist_versions = @search.paginate :order => "id desc", :per_page => 25, :page => params[:page]
|
||||
@artist_versions = @search.paginate :page => params[:page]
|
||||
respond_with(@artist_versions)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,10 +38,10 @@ class DmailsController < ApplicationController
|
||||
redirect_to dmails_path, :notice => "Message destroyed"
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(dmail)
|
||||
if !dmail.visible_to?(CurrentUser.user)
|
||||
raise User::PrivilegeError
|
||||
end
|
||||
private
|
||||
def check_privilege(dmail)
|
||||
if !dmail.visible_to?(CurrentUser.user)
|
||||
raise User::PrivilegeError
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,22 +1,46 @@
|
||||
class TagSubscriptionsController < ApplicationController
|
||||
before_filter :member_only, :only => [:new, :edit, :create, :update, :destroy]
|
||||
respond_to :html, :xml, :json
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@tag_subscription = TagSubscription.new
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
@search = TagSubscription.search(params[:search]).visible
|
||||
@tag_subscriptions = @search.paginate(:page => params[:page])
|
||||
respond_with(@tag_subscriptions)
|
||||
end
|
||||
|
||||
def create
|
||||
@tag_subscription = TagSubscription.create(params[:tag_subscription])
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
def update
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
@tag_subscription.update_attributes(params[:tag_subscription])
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
@tag_subscription.destroy
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(tag_subscription)
|
||||
raise User::PrivilegeError unless (tag_subscription.owner_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user