rip out default filtered tags
This commit is contained in:
parent
d959977ca1
commit
1452e1c34d
5 changed files with 12 additions and 23 deletions
|
|
@ -159,9 +159,7 @@ private
|
|||
if user
|
||||
filtered_tag_ids = @user.tag_filters.map{|tf| tf.tag_id }
|
||||
else
|
||||
# for logged-out users, filter defaults
|
||||
filtered_tag_ids = Tag.where(:filtered_by_default => true).
|
||||
map{|t| t.id } + tags_filtered_by_cookie.map{|t| t.id }
|
||||
filtered_tag_ids = tags_filtered_by_cookie.map{|t| t.id }
|
||||
end
|
||||
|
||||
if tag
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ class User < ActiveRecord::Base
|
|||
self.create_rss_token
|
||||
self.create_mailing_list_token
|
||||
end
|
||||
after_create :create_default_tag_filters
|
||||
|
||||
BANNED_USERNAMES = [ "admin", "administrator", "hostmaster", "mailer-daemon",
|
||||
"postmaster", "root", "security", "support", "webmaster", ]
|
||||
|
|
@ -75,15 +74,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def create_default_tag_filters
|
||||
Tag.where(:filtered_by_default => true).each do |t|
|
||||
tf = TagFilter.new
|
||||
tf.tag_id = t.id
|
||||
tf.user_id = self.id
|
||||
tf.save
|
||||
end
|
||||
end
|
||||
|
||||
def create_mailing_list_token
|
||||
if self.mailing_list_token.blank?
|
||||
self.mailing_list_token = Utils.random_str(10)
|
||||
|
|
|
|||
|
|
@ -30,10 +30,7 @@
|
|||
"checked" : "" %>></td>
|
||||
<td><a href="/t/<%= tag.tag %>" class="<%= tag.css_class %>"><%=
|
||||
tag.tag %></a></td>
|
||||
<td><%= tag.description %>
|
||||
<% if tag.filtered_by_default? %>
|
||||
<em>(Filtered by default)</em>
|
||||
<% end %></td>
|
||||
<td><%= tag.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveTagFilteredByDefault < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :tags, :filtered_by_default
|
||||
end
|
||||
end
|
||||
11
db/schema.rb
11
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140101202252) do
|
||||
ActiveRecord::Schema.define(version: 20140106205200) do
|
||||
|
||||
create_table "comments", force: true do |t|
|
||||
t.datetime "created_at", null: false
|
||||
|
|
@ -125,11 +125,10 @@ ActiveRecord::Schema.define(version: 20140101202252) do
|
|||
add_index "taggings", ["story_id", "tag_id"], name: "story_id_tag_id", unique: true, using: :btree
|
||||
|
||||
create_table "tags", force: true do |t|
|
||||
t.string "tag", limit: 25, default: "", null: false
|
||||
t.string "description", limit: 100
|
||||
t.boolean "filtered_by_default", default: false
|
||||
t.boolean "privileged", default: false
|
||||
t.boolean "is_media", default: false
|
||||
t.string "tag", limit: 25, default: "", null: false
|
||||
t.string "description", limit: 100
|
||||
t.boolean "privileged", default: false
|
||||
t.boolean "is_media", default: false
|
||||
end
|
||||
|
||||
add_index "tags", ["tag"], name: "tag", unique: true, using: :btree
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue