inkwell 1.5.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +7 -0
- data/app/models/inkwell/blog_item.rb +0 -2
- data/app/models/inkwell/blog_item_category.rb +0 -1
- data/app/models/inkwell/comment.rb +1 -2
- data/app/models/inkwell/community_user.rb +0 -2
- data/app/models/inkwell/favorite_item.rb +0 -1
- data/app/models/inkwell/following.rb +0 -2
- data/app/models/inkwell/timeline_item.rb +0 -1
- data/lib/acts_as_inkwell_category/base.rb +0 -1
- data/lib/acts_as_inkwell_community/base.rb +8 -9
- data/lib/acts_as_inkwell_post/base.rb +2 -2
- data/lib/acts_as_inkwell_user/base.rb +1 -1
- data/lib/inkwell/version.rb +1 -1
- data/test/dummy/app/models/category.rb +0 -1
- data/test/dummy/app/models/community.rb +0 -1
- data/test/dummy/app/models/post.rb +0 -1
- data/test/dummy/app/models/user.rb +0 -1
- data/test/dummy/config/application.rb +0 -6
- data/test/dummy/config/environments/development.rb +2 -3
- data/test/dummy/config/environments/test.rb +2 -6
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +64 -64
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy_without_community/app/models/post.rb +0 -1
- data/test/dummy_without_community/app/models/user.rb +0 -1
- data/test/dummy_without_community/config/application.rb +0 -6
- data/test/dummy_without_community/config/environments/development.rb +2 -3
- data/test/dummy_without_community/config/environments/test.rb +2 -6
- metadata +260 -273
- data/README-1.2.0.md +0 -454
- data/test/dummy_without_community/log/test.hello +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d09c2db1108f151f5cebcc41289020419772556a
|
4
|
+
data.tar.gz: 8004af10ee8c2e86409e5159c412a805eab56702
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4a635cd7392c201f49a2d69ce8e8954cbb1455184242b898430da3a7f51fd993f3f9807cfa086c3389ca03e97af9eec5780bb75b94f99a443afade06ed28508
|
7
|
+
data.tar.gz: 5cf09925279513e5084a4c036337e6fe974bab862b20131da9519e31bacee5a80aeb7aeb794c5f7a9fe1a4fe78104bd2df1d2953cddcc12c7399bd0d34cf0d85
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@ Ruby on Rails application.
|
|
6
6
|
|
7
7
|
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NYTZGSJD3H3BC)
|
8
8
|
|
9
|
+
References that may be useful:
|
10
|
+
|
11
|
+
[Building Social Apps with Rails: inkwell](http://www.matthewpbyrne.com/blog/2014/01/09/building-social-apps-with-rails-inkwell/)
|
12
|
+
|
9
13
|
Russian translation of README file available
|
10
14
|
[here](https://github.com/salkar/inkwell/blob/master/README_RU.rdoc).
|
11
15
|
|
@@ -49,6 +53,9 @@ class Category < ActiveRecord::Base
|
|
49
53
|
end
|
50
54
|
```
|
51
55
|
|
56
|
+
*MySQL* can't set default value for BLOB/TEXT fields so currently only *sqlite3* and *PostgreSQL* are supported.
|
57
|
+
|
58
|
+
|
52
59
|
## Installation
|
53
60
|
|
54
61
|
To get Inkwell from RubyGems, put the following line in the `Gemfile`.
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Inkwell
|
2
2
|
class BlogItem < ActiveRecord::Base
|
3
|
-
attr_accessible :item_id, :owner_id, :is_reblog, :item_type, :created_at, :updated_at, :owner_type
|
4
|
-
|
5
3
|
if ::Inkwell::Engine::config.respond_to?('community_table')
|
6
4
|
belongs_to ::Inkwell::Engine::config.community_table.to_s.singularize.to_sym, :foreign_key => :owner_id
|
7
5
|
end
|
@@ -4,7 +4,6 @@ module Inkwell
|
|
4
4
|
include ::Inkwell::Constants
|
5
5
|
include ::Inkwell::Common
|
6
6
|
|
7
|
-
attr_accessible :body, :parent_comment_id, :topmost_obj_id, :topmost_obj_type
|
8
7
|
attr_accessor :is_reblogged
|
9
8
|
attr_accessor :is_favorited
|
10
9
|
attr_accessor :item_id_in_line
|
@@ -17,7 +16,7 @@ module Inkwell
|
|
17
16
|
after_create :processing_a_comment
|
18
17
|
before_destroy :destroy_comment_processing
|
19
18
|
|
20
|
-
belongs_to ::Inkwell::Engine::config.user_table.to_s.singularize
|
19
|
+
belongs_to ::Inkwell::Engine::config.user_table.to_s.singularize.to_sym
|
21
20
|
|
22
21
|
def commentline(options = {})
|
23
22
|
options.symbolize_keys!
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Inkwell
|
2
2
|
if ::Inkwell::Engine::config.respond_to?('community_table')
|
3
3
|
class CommunityUser < ActiveRecord::Base
|
4
|
-
attr_accessible "#{::Inkwell::Engine::config.user_table.to_s.singularize}_id", "#{::Inkwell::Engine::config.community_table.to_s.singularize}_id",
|
5
|
-
:is_writer, :is_admin, :admin_level, :muted, :user_access, :active, :banned, :asked_invitation
|
6
4
|
belongs_to ::Inkwell::Engine::config.community_table.to_s.singularize.to_sym
|
7
5
|
belongs_to ::Inkwell::Engine::config.user_table.to_s.singularize.to_sym
|
8
6
|
belongs_to :admins, :foreign_key => "#{::Inkwell::Engine::config.user_table.to_s.singularize}_id"
|
@@ -10,19 +10,18 @@ module Inkwell
|
|
10
10
|
|
11
11
|
module Config
|
12
12
|
def acts_as_inkwell_community
|
13
|
-
attr_accessible :owner_id, :public
|
14
13
|
validates :owner_id, :presence => true
|
15
14
|
|
16
15
|
if ::Inkwell::Engine::config.respond_to?('community_table')
|
17
16
|
has_many :communities_users, :class_name => 'Inkwell::CommunityUser'
|
18
|
-
has_many :users, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
19
|
-
has_many :admins, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
20
|
-
has_many :writers,
|
21
|
-
has_many :muted_users, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
22
|
-
has_many :banned_users, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
23
|
-
has_many :asked_invitation_users, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
24
|
-
has_many :blog_items, :class_name => 'Inkwell::BlogItem', :foreign_key => :owner_id
|
25
|
-
has_many ::Inkwell::Engine::config.post_table, :class_name => ::Inkwell::Engine::config.post_table.to_s.singularize.capitalize, :through => :blog_items
|
17
|
+
has_many :users, -> { where "inkwell_community_users.active" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
18
|
+
has_many :admins, -> { where "inkwell_community_users.is_admin" => true, "inkwell_community_users.active" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
19
|
+
has_many :writers, -> { where "inkwell_community_users.user_access" => ::Inkwell::Constants::CommunityAccessLevels::WRITE, "inkwell_community_users.active" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
20
|
+
has_many :muted_users, -> { where "inkwell_community_users.muted" => true, "inkwell_community_users.active" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
21
|
+
has_many :banned_users, -> { where "inkwell_community_users.banned" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
22
|
+
has_many :asked_invitation_users, -> { where "inkwell_community_users.asked_invitation" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
23
|
+
has_many :blog_items, -> { where :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY}, :class_name => 'Inkwell::BlogItem', :foreign_key => :owner_id
|
24
|
+
has_many ::Inkwell::Engine::config.post_table, -> { where "inkwell_blog_items.item_type" => ::Inkwell::Constants::ItemTypes::POST}, :class_name => ::Inkwell::Engine::config.post_table.to_s.singularize.capitalize, :through => :blog_items
|
26
25
|
end
|
27
26
|
|
28
27
|
after_create :processing_a_community
|
@@ -16,9 +16,9 @@ module Inkwell
|
|
16
16
|
attr_accessor :is_reblog_in_blogline
|
17
17
|
attr_accessor :from_sources_in_timeline
|
18
18
|
|
19
|
-
has_many :blog_items, :class_name => 'Inkwell::BlogItem', :foreign_key => :item_id
|
19
|
+
has_many :blog_items, -> { where item_type: ::Inkwell::Constants::ItemTypes::POST}, :class_name => 'Inkwell::BlogItem', :foreign_key => :item_id
|
20
20
|
if ::Inkwell::Engine::config.respond_to?('community_table')
|
21
|
-
has_many ::Inkwell::Engine::config.community_table, :class_name => ::Inkwell::Engine::config.community_table.to_s.singularize.capitalize, :through => :blog_items
|
21
|
+
has_many ::Inkwell::Engine::config.community_table, -> {where "inkwell_blog_items.owner_type" => ::Inkwell::Constants::OwnerTypes::COMMUNITY}, :class_name => ::Inkwell::Engine::config.community_table.to_s.singularize.capitalize, :through => :blog_items
|
22
22
|
end
|
23
23
|
|
24
24
|
after_create :processing_a_post
|
@@ -17,7 +17,7 @@ module Inkwell
|
|
17
17
|
has_many :followers, :through => :follower_relations, :class_name => ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize
|
18
18
|
if ::Inkwell::Engine::config.respond_to?('community_table')
|
19
19
|
has_many :communities_users, :class_name => 'Inkwell::CommunityUser'
|
20
|
-
has_many :communities, :through => :communities_users, :class_name => ::Inkwell::Engine::config.community_table.to_s.singularize.capitalize
|
20
|
+
has_many :communities, -> {where "inkwell_community_users.active" => true}, :through => :communities_users, :class_name => ::Inkwell::Engine::config.community_table.to_s.singularize.capitalize
|
21
21
|
end
|
22
22
|
before_destroy :destroy_processing
|
23
23
|
include ::Inkwell::ActsAsInkwellUser::InstanceMethods
|
data/lib/inkwell/version.rb
CHANGED
@@ -40,12 +40,6 @@ module Dummy
|
|
40
40
|
|
41
41
|
# Version of your assets, change this if you want to expire all your assets
|
42
42
|
config.assets.version = '1.0'
|
43
|
-
|
44
|
-
# Enforce whitelist mode for mass assignment.
|
45
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
46
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
47
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
48
|
-
config.active_record.whitelist_attributes = true
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
@@ -6,9 +6,6 @@ Dummy::Application.configure do
|
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
9
|
# Show full error reports and disable caching
|
13
10
|
config.consider_all_requests_local = true
|
14
11
|
config.action_controller.perform_caching = false
|
@@ -27,4 +24,6 @@ Dummy::Application.configure do
|
|
27
24
|
|
28
25
|
# Expands the lines which load the assets
|
29
26
|
config.assets.debug = true
|
27
|
+
|
28
|
+
config.eager_load = false
|
30
29
|
end
|
@@ -11,9 +11,6 @@ Dummy::Application.configure do
|
|
11
11
|
config.serve_static_assets = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
13
|
|
14
|
-
# Log error messages when you accidentally call methods on nil
|
15
|
-
config.whiny_nils = true
|
16
|
-
|
17
14
|
# Show full error reports and disable caching
|
18
15
|
config.consider_all_requests_local = true
|
19
16
|
config.action_controller.perform_caching = false
|
@@ -28,9 +25,6 @@ Dummy::Application.configure do
|
|
28
25
|
# The :test delivery method accumulates sent emails in the
|
29
26
|
# ActionMailer::Base.deliveries array.
|
30
27
|
config.action_mailer.delivery_method = :test
|
31
|
-
|
32
|
-
# Raise exception on mass assignment protection for Active Record models
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
28
|
|
35
29
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
36
30
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
@@ -39,4 +33,6 @@ Dummy::Application.configure do
|
|
39
33
|
|
40
34
|
# Print deprecation notices to the stderr
|
41
35
|
config.active_support.deprecation = :stderr
|
36
|
+
|
37
|
+
config.eager_load = false
|
42
38
|
end
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -9,130 +9,130 @@
|
|
9
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
11
|
#
|
12
|
-
# It's strongly recommended
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:
|
14
|
+
ActiveRecord::Schema.define(version: 20130330184136) do
|
15
15
|
|
16
|
-
create_table "categories", :
|
16
|
+
create_table "categories", force: true do |t|
|
17
17
|
t.string "name"
|
18
|
-
t.datetime "created_at"
|
19
|
-
t.datetime "updated_at"
|
20
|
-
t.text "parent_ids", :
|
21
|
-
t.text "child_ids", :
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
t.text "parent_ids", default: "[]"
|
21
|
+
t.text "child_ids", default: "[]"
|
22
22
|
t.integer "owner_id"
|
23
23
|
t.string "owner_type"
|
24
24
|
end
|
25
25
|
|
26
|
-
create_table "communities", :
|
26
|
+
create_table "communities", force: true do |t|
|
27
27
|
t.string "name"
|
28
|
-
t.datetime "created_at"
|
29
|
-
t.datetime "updated_at"
|
28
|
+
t.datetime "created_at"
|
29
|
+
t.datetime "updated_at"
|
30
30
|
t.integer "owner_id"
|
31
|
-
t.string "default_user_access", :
|
32
|
-
t.boolean "public", :
|
33
|
-
t.integer "user_count", :
|
34
|
-
t.integer "writer_count", :
|
35
|
-
t.integer "admin_count", :
|
36
|
-
t.integer "muted_count", :
|
37
|
-
t.integer "banned_count", :
|
38
|
-
t.integer "invitation_count", :
|
31
|
+
t.string "default_user_access", default: "w"
|
32
|
+
t.boolean "public", default: true
|
33
|
+
t.integer "user_count", default: 1
|
34
|
+
t.integer "writer_count", default: 1
|
35
|
+
t.integer "admin_count", default: 1
|
36
|
+
t.integer "muted_count", default: 0
|
37
|
+
t.integer "banned_count", default: 0
|
38
|
+
t.integer "invitation_count", default: 0
|
39
39
|
end
|
40
40
|
|
41
|
-
create_table "inkwell_blog_item_categories", :
|
41
|
+
create_table "inkwell_blog_item_categories", force: true do |t|
|
42
42
|
t.integer "blog_item_id"
|
43
43
|
t.integer "category_id"
|
44
44
|
t.integer "item_id"
|
45
45
|
t.string "item_type"
|
46
46
|
t.datetime "blog_item_created_at"
|
47
|
-
t.datetime "created_at"
|
48
|
-
t.datetime "updated_at"
|
47
|
+
t.datetime "created_at"
|
48
|
+
t.datetime "updated_at"
|
49
49
|
end
|
50
50
|
|
51
|
-
create_table "inkwell_blog_items", :
|
51
|
+
create_table "inkwell_blog_items", force: true do |t|
|
52
52
|
t.integer "item_id"
|
53
53
|
t.boolean "is_reblog"
|
54
|
-
t.datetime "created_at"
|
55
|
-
t.datetime "updated_at"
|
54
|
+
t.datetime "created_at"
|
55
|
+
t.datetime "updated_at"
|
56
56
|
t.integer "owner_id"
|
57
57
|
t.string "item_type"
|
58
58
|
t.string "owner_type"
|
59
|
-
t.text "category_ids", :
|
59
|
+
t.text "category_ids", default: "[]"
|
60
60
|
end
|
61
61
|
|
62
|
-
create_table "inkwell_comments", :
|
62
|
+
create_table "inkwell_comments", force: true do |t|
|
63
63
|
t.integer "user_id"
|
64
64
|
t.text "body"
|
65
65
|
t.integer "parent_comment_id"
|
66
66
|
t.integer "topmost_obj_id"
|
67
67
|
t.text "upper_comments_tree"
|
68
|
-
t.text "users_ids_who_favorite_it", :
|
69
|
-
t.text "users_ids_who_comment_it", :
|
70
|
-
t.text "users_ids_who_reblog_it", :
|
71
|
-
t.datetime "created_at"
|
72
|
-
t.datetime "updated_at"
|
68
|
+
t.text "users_ids_who_favorite_it", default: "[]"
|
69
|
+
t.text "users_ids_who_comment_it", default: "[]"
|
70
|
+
t.text "users_ids_who_reblog_it", default: "[]"
|
71
|
+
t.datetime "created_at"
|
72
|
+
t.datetime "updated_at"
|
73
73
|
t.string "topmost_obj_type"
|
74
74
|
end
|
75
75
|
|
76
|
-
create_table "inkwell_community_users", :
|
76
|
+
create_table "inkwell_community_users", force: true do |t|
|
77
77
|
t.integer "user_id"
|
78
78
|
t.integer "community_id"
|
79
|
-
t.string "user_access", :
|
80
|
-
t.boolean "is_admin", :
|
79
|
+
t.string "user_access", default: "r"
|
80
|
+
t.boolean "is_admin", default: false
|
81
81
|
t.integer "admin_level"
|
82
|
-
t.boolean "muted", :
|
83
|
-
t.datetime "created_at"
|
84
|
-
t.datetime "updated_at"
|
85
|
-
t.boolean "active", :
|
86
|
-
t.boolean "banned", :
|
87
|
-
t.boolean "asked_invitation", :
|
82
|
+
t.boolean "muted", default: false
|
83
|
+
t.datetime "created_at"
|
84
|
+
t.datetime "updated_at"
|
85
|
+
t.boolean "active", default: false
|
86
|
+
t.boolean "banned", default: false
|
87
|
+
t.boolean "asked_invitation", default: false
|
88
88
|
end
|
89
89
|
|
90
|
-
create_table "inkwell_favorite_items", :
|
90
|
+
create_table "inkwell_favorite_items", force: true do |t|
|
91
91
|
t.integer "item_id"
|
92
92
|
t.integer "owner_id"
|
93
|
-
t.datetime "created_at"
|
94
|
-
t.datetime "updated_at"
|
93
|
+
t.datetime "created_at"
|
94
|
+
t.datetime "updated_at"
|
95
95
|
t.string "item_type"
|
96
96
|
t.string "owner_type"
|
97
97
|
end
|
98
98
|
|
99
|
-
create_table "inkwell_followings", :
|
99
|
+
create_table "inkwell_followings", force: true do |t|
|
100
100
|
t.integer "follower_id"
|
101
101
|
t.integer "followed_id"
|
102
|
-
t.datetime "created_at"
|
103
|
-
t.datetime "updated_at"
|
102
|
+
t.datetime "created_at"
|
103
|
+
t.datetime "updated_at"
|
104
104
|
end
|
105
105
|
|
106
|
-
create_table "inkwell_timeline_items", :
|
106
|
+
create_table "inkwell_timeline_items", force: true do |t|
|
107
107
|
t.integer "item_id"
|
108
108
|
t.integer "owner_id"
|
109
|
-
t.text "from_source", :
|
110
|
-
t.boolean "has_many_sources", :
|
111
|
-
t.datetime "created_at"
|
112
|
-
t.datetime "updated_at"
|
109
|
+
t.text "from_source", default: "[]"
|
110
|
+
t.boolean "has_many_sources", default: false
|
111
|
+
t.datetime "created_at"
|
112
|
+
t.datetime "updated_at"
|
113
113
|
t.string "item_type"
|
114
114
|
t.string "owner_type"
|
115
115
|
end
|
116
116
|
|
117
|
-
create_table "posts", :
|
117
|
+
create_table "posts", force: true do |t|
|
118
118
|
t.string "title"
|
119
119
|
t.text "body"
|
120
120
|
t.integer "user_id"
|
121
|
-
t.datetime "created_at"
|
122
|
-
t.datetime "updated_at"
|
123
|
-
t.text "users_ids_who_favorite_it", :
|
124
|
-
t.text "users_ids_who_comment_it", :
|
125
|
-
t.text "users_ids_who_reblog_it", :
|
126
|
-
t.text "communities_ids", :
|
121
|
+
t.datetime "created_at"
|
122
|
+
t.datetime "updated_at"
|
123
|
+
t.text "users_ids_who_favorite_it", default: "[]"
|
124
|
+
t.text "users_ids_who_comment_it", default: "[]"
|
125
|
+
t.text "users_ids_who_reblog_it", default: "[]"
|
126
|
+
t.text "communities_ids", default: "[]"
|
127
127
|
end
|
128
128
|
|
129
|
-
create_table "users", :
|
129
|
+
create_table "users", force: true do |t|
|
130
130
|
t.string "nick"
|
131
|
-
t.datetime "created_at"
|
132
|
-
t.datetime "updated_at"
|
133
|
-
t.integer "follower_count", :
|
134
|
-
t.integer "following_count", :
|
135
|
-
t.integer "community_count", :
|
131
|
+
t.datetime "created_at"
|
132
|
+
t.datetime "updated_at"
|
133
|
+
t.integer "follower_count", default: 0
|
134
|
+
t.integer "following_count", default: 0
|
135
|
+
t.integer "community_count", default: 0
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
Binary file
|