Secured deletion/moderation of screenshots
Only logged in users can do that.
This commit is contained in:
parent
51c6c99d61
commit
48ca75cb64
1 changed files with 3 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
class PackagesController < ApplicationController
|
class PackagesController < ApplicationController
|
||||||
|
before_action :authenticate_user!, only: [:delete_screenshot, :moderate]
|
||||||
|
|
||||||
def list
|
def list
|
||||||
@packages = query_packages
|
@packages = query_packages
|
||||||
@packages = @packages.paginate(page: params[:page], per_page: 6)
|
@packages = @packages.paginate(page: params[:page], per_page: 6)
|
||||||
|
|
@ -55,9 +57,8 @@ class PackagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_screenshot
|
def delete_screenshot
|
||||||
@screenshot = Screenshot.find_by(id: params[:id])
|
@screenshot = Screenshot.find(params[:id])
|
||||||
@screenshot.destroy
|
@screenshot.destroy
|
||||||
|
|
||||||
redirect_to package_path
|
redirect_to package_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue