Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 473
- Log:
Add simple topic title blacklist.
- Author:
- rool
- Date:
- Thu Jan 31 09:48:46 +0000 2019
- Size:
- 1874 Bytes
1 | # 2019-01-26 (ADH): |
2 | # |
3 | # Very simplistic quick-and-dirty implementation; Blacklist has just one |
4 | # row, which contains a text field of newline separated items processed |
5 | # by Ruby when checking a post. Not efficient but sufficient for now. |
6 | # |
7 | class BlacklistController < ApplicationController |
8 | @@hubssolib_permissions = HubSsoLib::Permissions.new({ |
9 | :show => [ :admin, :webmaster ], |
10 | :new => [ :admin, :webmaster ], |
11 | :create => [ :admin, :webmaster ], |
12 | :edit => [ :admin, :webmaster ], |
13 | :update => [ :admin, :webmaster ], |
14 | :destroy => [ :admin, :webmaster ], |
15 | }) |
16 | |
17 | public |
18 | |
19 | def BlacklistController.hubssolib_permissions |
20 | @@hubssolib_permissions |
21 | end |
22 | |
23 | def show |
24 | @blacklist = Blacklist.find( :first ) |
25 | end |
26 | |
27 | def new |
28 | @blacklist = Blacklist.new |
29 | end |
30 | |
31 | def create |
32 | set_list_to( params[ :blacklist ] ) |
33 | flash[ :notice ] = 'Blacklist created' |
34 | redirect_to( blacklist_path() ) |
35 | end |
36 | |
37 | def edit |
38 | @blacklist = Blacklist.find( :first ) |
39 | end |
40 | |
41 | def update |
42 | set_list_to( params[ :blacklist ] ) |
43 | flash[ :notice ] = 'Blacklist updated' |
44 | redirect_to( blacklist_path() ) |
45 | end |
46 | |
47 | def destroy |
48 | set_list_to( { :list => '', :title_list => '' } ) |
49 | flash[ :notice ] = 'Blacklist emptied' |
50 | redirect_to( blacklist_path() ) |
51 | end |
52 | |
53 | private |
54 | |
55 | def set_list_to( options ) |
56 | list = options[ :list ] |
57 | title_list = options[ :title_list ] |
58 | |
59 | blacklist = if Blacklist.count > 0 |
60 | Blacklist.find(:first) |
61 | else |
62 | Blacklist.new |
63 | end |
64 | |
65 | blacklist.list = list |
66 | blacklist.title_list = title_list |
67 | |
68 | blacklist.save! |
69 | end |
70 | |
71 | end |