gitcontacts 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/cookies +5 -0
- data/lib/gitcontacts/Contacts.rb +17 -16
- data/lib/gitcontacts/Invitation.rb +3 -3
- data/lib/gitcontacts/Request.rb +30 -29
- data/lib/gitcontacts/User.rb +21 -20
- data/lib/gitcontacts/util.rb +1 -1
- data/lib/gitcontacts/version.rb +1 -1
- data/lib/gitcontacts.rb +61 -99
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e670865cd65a65f5128db25e4e2ebac318ff0043
|
4
|
+
data.tar.gz: 2969653a59f1061f778cc0957e06593604325690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac51a3ab2dc1d9ed77fa8ce960708a6d3f8f323f5b794f34a02380079a71ee48d5ea413b0eeaba18f57ed2a20297fcb86cf150c40b3c79b9a85e74f50d4b381
|
7
|
+
data.tar.gz: bcb9b4fa02ab51417dcd30299ee0a715e788fcf81d248f4976d83ae751bb71d9149503ba21844b293dd1884930632236037c5fc333b0cee33475b6b941c3e634
|
data/.gitignore
CHANGED
data/cookies
ADDED
data/lib/gitcontacts/Contacts.rb
CHANGED
@@ -10,10 +10,11 @@ module GitContacts
|
|
10
10
|
# some keys are optional
|
11
11
|
if hash.keys.include?(:name)
|
12
12
|
obj = ContactsObject.new
|
13
|
+
obj.set_gid gid
|
13
14
|
obj.name = hash[:name]
|
14
15
|
obj.note = hash[:note] if hash.has_key?(:note)
|
15
|
-
obj.users << gid
|
16
|
-
obj.admins << gid
|
16
|
+
#obj.users << gid
|
17
|
+
#obj.admins << gid
|
17
18
|
obj.gid
|
18
19
|
end
|
19
20
|
end
|
@@ -66,39 +67,39 @@ module GitContacts
|
|
66
67
|
"contacts_object:"
|
67
68
|
end
|
68
69
|
|
69
|
-
def self::exist?
|
70
|
-
true if redis.keys(key_prefix+
|
70
|
+
def self::exist? gid
|
71
|
+
true if redis.keys(key_prefix+gid+':*').count > 0
|
71
72
|
end
|
72
73
|
|
73
74
|
def self::access id
|
74
75
|
if exist? id
|
75
76
|
obj = allocate
|
76
|
-
obj.
|
77
|
-
obj.set_name Redis::Value.new(key_prefix+id+':name')
|
78
|
-
obj.set_note Redis::Value.new(key_prefix+id+':note')
|
79
|
-
obj.set_users Redis::Set.new(key_prefix+id+':users')
|
80
|
-
obj.set_admins Redis::Set.new(key_prefix+id+':admins')
|
81
|
-
obj.set_requests Redis::Set.new(key_prefix+id+':requests')
|
82
|
-
obj.set_owner Redis::Value.new(key_prefix+id+':owner')
|
77
|
+
obj.set_gid id
|
78
|
+
obj.set_name Redis::Value.new(key_prefix+obj.id+':name')
|
79
|
+
obj.set_note Redis::Value.new(key_prefix+obj.id+':note')
|
80
|
+
obj.set_users Redis::Set.new(key_prefix+obj.id+':users')
|
81
|
+
obj.set_admins Redis::Set.new(key_prefix+obj.id+':admins')
|
82
|
+
obj.set_requests Redis::Set.new(key_prefix+obj.id+':requests')
|
83
|
+
obj.set_owner Redis::Value.new(key_prefix+obj.id+':owner')
|
83
84
|
obj
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
87
88
|
|
88
89
|
def initialize
|
89
|
-
|
90
|
+
#@id = Digest::SHA1.hexdigest Time.now.to_s
|
90
91
|
end
|
91
92
|
|
92
93
|
def id
|
93
|
-
@
|
94
|
+
@gid
|
94
95
|
end
|
95
96
|
|
96
97
|
def gid
|
97
|
-
@
|
98
|
+
@gid
|
98
99
|
end
|
99
100
|
|
100
|
-
def
|
101
|
-
@
|
101
|
+
def set_gid gid
|
102
|
+
@gid = gid
|
102
103
|
end
|
103
104
|
|
104
105
|
def set_name name
|
@@ -67,9 +67,9 @@ module GitContacts
|
|
67
67
|
if exist? id
|
68
68
|
obj = allocate
|
69
69
|
obj.set_id id
|
70
|
-
obj.set_uid Redis::Value.new(key_prefix+id+':uid')
|
71
|
-
obj.set_gid Redis::Value.new(key_prefix+id+':gid')
|
72
|
-
obj.set_inviter_id Redis::Value.new(key_prefix+id+':inviter_id')
|
70
|
+
obj.set_uid Redis::Value.new(key_prefix+obj.id+':uid')
|
71
|
+
obj.set_gid Redis::Value.new(key_prefix+obj.id+':gid')
|
72
|
+
obj.set_inviter_id Redis::Value.new(key_prefix+obj.id+':inviter_id')
|
73
73
|
obj
|
74
74
|
end
|
75
75
|
end
|
data/lib/gitcontacts/Request.rb
CHANGED
@@ -9,15 +9,14 @@ module GitContacts
|
|
9
9
|
|
10
10
|
def create hash
|
11
11
|
# all keys are required
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
12
|
+
obj = RequestObject.new
|
13
|
+
obj.uid = hash[:uid]
|
14
|
+
obj.gid = hash[:gid]
|
15
|
+
obj.time = Time.now.to_i
|
16
|
+
obj.card_id = hash[:card_id] if hash.member? :card_id
|
17
|
+
obj.action = hash[:action]
|
18
|
+
obj.content = hash[:content] if hash.member? :content
|
19
|
+
obj.request_id
|
21
20
|
end
|
22
21
|
|
23
22
|
def delete request_id
|
@@ -26,56 +25,58 @@ module GitContacts
|
|
26
25
|
|
27
26
|
end
|
28
27
|
|
29
|
-
def
|
28
|
+
def initialize request_id
|
30
29
|
@obj = RequestObject::access request_id
|
31
30
|
end
|
32
31
|
|
33
32
|
def getuid
|
34
|
-
@obj.uid if @obj
|
33
|
+
@obj.uid.value if @obj
|
35
34
|
end
|
36
35
|
|
37
36
|
def getgid
|
38
|
-
@obj.gid if @obj
|
37
|
+
@obj.gid.value if @obj
|
39
38
|
end
|
40
39
|
|
41
40
|
def getaction
|
42
|
-
@obj.action if @obj
|
41
|
+
@obj.action.value if @obj
|
43
42
|
end
|
44
43
|
|
45
44
|
def getcard_id
|
46
|
-
@obj.card_id if @obj
|
45
|
+
@obj.card_id.value if @obj
|
47
46
|
end
|
48
47
|
|
49
48
|
def get_req_time
|
50
|
-
@obj.time if @obj
|
49
|
+
@obj.time.value if @obj
|
51
50
|
end
|
52
51
|
|
53
52
|
def getcontent
|
54
|
-
@obj.content if @obj
|
53
|
+
@obj.content.value if @obj
|
55
54
|
end
|
56
55
|
|
56
|
+
# code review: @AustinChou
|
57
57
|
def auto_merge? uid
|
58
|
-
|
58
|
+
true
|
59
59
|
end
|
60
60
|
|
61
61
|
def allow operator
|
62
62
|
author = User.new getuid
|
63
|
-
|
63
|
+
operator = User.new operator
|
64
|
+
contacts = Gitdb::Contacts.new(getuid).access getgid
|
64
65
|
card = Gitdb::Card.new contacts.repo
|
65
66
|
|
66
67
|
case getaction
|
67
68
|
when 'create'
|
68
|
-
card.create
|
69
|
+
card.create getuid
|
69
70
|
when 'setmeta'
|
70
|
-
card.access(getcard_id).setmeta getcontent
|
71
|
+
card.access(getcard_id).setmeta JSON.parse(getcontent, { symbolize_names: true })
|
71
72
|
when 'setdata'
|
72
|
-
card.access(getcard_id).setdata getcontent
|
73
|
+
card.access(getcard_id).setdata JSON.parse(getcontent, { symbolize_names: true })
|
73
74
|
when 'delete'
|
74
75
|
card.access(getcard_id).delete
|
75
76
|
end
|
76
77
|
|
77
78
|
commit_obj = {
|
78
|
-
:author => { :name => author.getuid, :email => author.getemail, :time => get_req_time },
|
79
|
+
:author => { :name => author.getuid, :email => author.getemail, :time => Time.at(get_req_time.to_i) },
|
79
80
|
:committer => { :name => operator.getuid, :email => operator.getemail, :time => Time.now }
|
80
81
|
}
|
81
82
|
|
@@ -98,7 +99,7 @@ module GitContacts
|
|
98
99
|
value :time
|
99
100
|
value :card_id
|
100
101
|
value :action
|
101
|
-
|
102
|
+
value :content
|
102
103
|
|
103
104
|
def self::key_prefix
|
104
105
|
"request_object:"
|
@@ -116,12 +117,12 @@ module GitContacts
|
|
116
117
|
if exist? id
|
117
118
|
obj = allocate
|
118
119
|
obj.set_id id
|
119
|
-
obj.set_uid Redis::Value.new(key_prefix+id+':uid')
|
120
|
-
obj.set_gid Redis::Value.new(key_prefix+id+':gid')
|
121
|
-
obj.set_card_id Redis::Value.new(key_prefix+id+':card_id')
|
122
|
-
obj.set_action Redis::Value.new(key_prefix+id+':action')
|
123
|
-
obj.set_time Redis::Value.new "#{key_prefix}#{id}:time"
|
124
|
-
obj.set_content Redis::
|
120
|
+
obj.set_uid Redis::Value.new(key_prefix+obj.id+':uid')
|
121
|
+
obj.set_gid Redis::Value.new(key_prefix+obj.id+':gid')
|
122
|
+
obj.set_card_id Redis::Value.new(key_prefix+obj.id+':card_id')
|
123
|
+
obj.set_action Redis::Value.new(key_prefix+obj.id+':action')
|
124
|
+
obj.set_time Redis::Value.new "#{key_prefix}#{obj.id}:time"
|
125
|
+
obj.set_content Redis::Value.new(key_prefix+obj.id+':content')
|
125
126
|
obj
|
126
127
|
end
|
127
128
|
end
|
data/lib/gitcontacts/User.rb
CHANGED
@@ -10,34 +10,35 @@ module GitContacts
|
|
10
10
|
# some keys are optional
|
11
11
|
if hash.keys.include?(:email) && hash.keys.include?(:password) && !User::exist?(hash[:email])
|
12
12
|
obj = UserObject.new
|
13
|
-
obj.
|
14
|
-
obj.password = hash[:password]
|
15
|
-
obj.uid
|
13
|
+
obj.set_email hash[:email]
|
14
|
+
obj.password = Digest::MD5.hexdigest(hash[:password])
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
18
|
def initialize email
|
19
|
+
@email = email
|
20
20
|
@obj = UserObject::access email
|
21
21
|
end
|
22
22
|
|
23
23
|
def getuid
|
24
|
-
|
24
|
+
getemail
|
25
25
|
end
|
26
26
|
|
27
|
-
def getname
|
28
|
-
|
29
|
-
end
|
27
|
+
# def getname
|
28
|
+
# @obj.name.value if @obj
|
29
|
+
# end
|
30
30
|
|
31
31
|
def getemail
|
32
|
-
|
32
|
+
#@obj.email if @obj
|
33
|
+
@email
|
33
34
|
end
|
34
35
|
|
35
36
|
def getpassword
|
36
|
-
@obj.password if @obj
|
37
|
+
@obj.password.value if @obj
|
37
38
|
end
|
38
39
|
|
39
40
|
def getcontacts
|
40
|
-
@obj.contacts if @obj
|
41
|
+
@obj.contacts.members if @obj
|
41
42
|
end
|
42
43
|
|
43
44
|
def getrequests
|
@@ -73,8 +74,8 @@ module GitContacts
|
|
73
74
|
class UserObject
|
74
75
|
include Redis::Objects
|
75
76
|
|
76
|
-
value :uid
|
77
|
-
value :email
|
77
|
+
#value :uid
|
78
|
+
# value :email
|
78
79
|
value :password
|
79
80
|
set :contacts
|
80
81
|
set :requests
|
@@ -90,24 +91,24 @@ module GitContacts
|
|
90
91
|
def self::access email
|
91
92
|
obj = allocate
|
92
93
|
obj.set_email email
|
93
|
-
obj.set_uid Redis::Value.new(key_prefix+id+':uid')
|
94
|
-
obj.set_password Redis::Value.new(key_prefix+id+':password')
|
95
|
-
obj.set_contacts Redis::Set.new(key_prefix+id+':contacts')
|
96
|
-
obj.set_requests Redis::Set.new(key_prefix+id+':requests')
|
94
|
+
#obj.set_uid Redis::Value.new(key_prefix+obj.id+':uid')
|
95
|
+
obj.set_password Redis::Value.new(key_prefix+obj.id+':password')
|
96
|
+
obj.set_contacts Redis::Set.new(key_prefix+obj.id+':contacts')
|
97
|
+
obj.set_requests Redis::Set.new(key_prefix+obj.id+':requests')
|
97
98
|
obj
|
98
99
|
end
|
99
100
|
|
100
101
|
def initialize
|
101
|
-
|
102
|
+
#@uid = Digest::SHA1.hexdigest(Time.now.to_s + rand(10000).to_s)
|
102
103
|
end
|
103
104
|
|
104
105
|
def id
|
105
106
|
@email
|
106
107
|
end
|
107
108
|
|
108
|
-
def set_uid uid
|
109
|
-
|
110
|
-
end
|
109
|
+
#def set_uid uid
|
110
|
+
# @uid = uid
|
111
|
+
#end
|
111
112
|
|
112
113
|
def set_email email
|
113
114
|
@email = email
|
data/lib/gitcontacts/util.rb
CHANGED
data/lib/gitcontacts/version.rb
CHANGED
data/lib/gitcontacts.rb
CHANGED
@@ -7,7 +7,7 @@ require 'gitcontacts/Request'
|
|
7
7
|
require 'gitcontacts/Contacts'
|
8
8
|
require 'gitcontacts/Invitation'
|
9
9
|
require "gitcontacts/version"
|
10
|
-
require 'digest
|
10
|
+
require 'digest'
|
11
11
|
require "gitdb"
|
12
12
|
|
13
13
|
module GitContacts
|
@@ -16,128 +16,84 @@ module GitContacts
|
|
16
16
|
def user_exist? uid
|
17
17
|
User::exist? uid
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def create_user hash
|
21
21
|
User::create hash
|
22
22
|
end
|
23
|
-
|
23
|
+
# code review: @abbshr
|
24
24
|
def password_valid? email, password
|
25
25
|
if user = User.new(email)
|
26
|
-
user if user.password_correct? Digest::
|
26
|
+
user if user.password_correct? Digest::MD5.hexdigest(password)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
# code review: @AustinChou
|
30
30
|
def relation_valid? operator, gid
|
31
|
-
|
31
|
+
if User::exist?(operator) && Contacts::exist?(gid)
|
32
32
|
user = User.new operator
|
33
|
-
contacts =
|
34
|
-
[user, contacts]
|
35
|
-
|
33
|
+
contacts = Contacts.new gid
|
34
|
+
[user, contacts] if user.getcontacts.include?(gid) && contacts.getusers.include?(operator)
|
35
|
+
end
|
36
36
|
end
|
37
|
-
|
37
|
+
# code review: @abbshr
|
38
38
|
# meta => :owner, :gid, :count, :name
|
39
39
|
def get_all_contacts operator
|
40
40
|
contacts_arr = []
|
41
41
|
user = User.new operator
|
42
|
-
contacts = Gitdb::Contacts.new
|
42
|
+
contacts = Gitdb::Contacts.new operator
|
43
43
|
user.getcontacts.each do |gid|
|
44
|
-
|
44
|
+
break unless GitContacts::relation_valid? operator, gid
|
45
45
|
contacts.access gid
|
46
46
|
contacts_arr << contacts.getmeta
|
47
47
|
end
|
48
48
|
contacts_arr
|
49
49
|
end
|
50
|
-
|
50
|
+
# code review: @abbshr
|
51
51
|
# e.g.: 获取联系人数量大于200的uid群组
|
52
52
|
# get_contacts_if { |contacts| contacts.count > 200 }
|
53
|
-
def get_contacts_if &condition
|
53
|
+
def get_contacts_if uid, &condition
|
54
54
|
GitContacts::get_all_contacts(uid).select &condition
|
55
55
|
end
|
56
|
-
|
56
|
+
# code review: @abbshr
|
57
57
|
def add_contacts operator, name
|
58
58
|
#return unless GitContacts::relation_valid? operator gid
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
git_contacts = Gitdb::Contacts.new operator
|
60
|
+
git_contacts.create name
|
61
|
+
gid = git_contacts.getmeta[:gid]
|
62
|
+
Contacts.create gid, { :name => name }
|
63
|
+
contacts = Contacts.new gid
|
64
|
+
contacts.add_user operator
|
65
|
+
contacts.add_admin operator
|
66
|
+
user = User.new operator
|
67
|
+
user.add_contacts gid
|
68
|
+
gid
|
62
69
|
end
|
63
|
-
|
70
|
+
# code review: @abbshr
|
64
71
|
def edit_contacts_meta operator, gid, new_meta
|
65
|
-
return unless GitContacts::relation_valid? operator gid
|
72
|
+
return unless GitContacts::relation_valid? operator, gid
|
73
|
+
puts operator, gid, new_meta
|
66
74
|
contacts = Gitdb::Contacts.new operator
|
67
75
|
contacts.access gid
|
68
76
|
contacts.setmeta new_meta
|
77
|
+
true
|
69
78
|
end
|
70
|
-
|
79
|
+
# code review: @abbshr
|
71
80
|
def get_contacts_card operator, gid, card_id
|
72
|
-
return unless GitContacts::relation_valid? operator gid
|
81
|
+
return unless GitContacts::relation_valid? operator, gid
|
73
82
|
contacts = Gitdb::Contacts.new operator
|
74
83
|
contacts.access gid
|
75
|
-
contacts.get_card_by_id
|
76
|
-
end
|
77
|
-
=begin
|
78
|
-
def get_contacts_cards_by_owner operator, owner
|
79
|
-
return unless GitContacts::relation_valid? operator gid
|
80
|
-
contacts = Gitdb::Contacts.new operator
|
81
|
-
contacts.access gid
|
82
|
-
contacts.get_cards do |card|
|
83
|
-
card.getdata if card.getmeta[:owner].include? owner
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def get_contacts_cards_by_name operator, name
|
88
|
-
return unless GitContacts::relation_valid? operator gid
|
89
|
-
contacts = Gitdb::Contacts.new operator
|
90
|
-
contacts.access gid
|
91
|
-
contacts.get_cards do |card|
|
92
|
-
card.getdata if card.getdata[:firstname].include? name || card.getdata[:firstname].include? name
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def get_contacts_cards_by_number operator, number
|
97
|
-
return unless GitContacts::relation_valid? operator gid
|
98
|
-
contacts = Gitdb::Contacts.new operator
|
99
|
-
contacts.access gid
|
100
|
-
contacts.get_cards do |card|
|
101
|
-
info = card.getdata
|
102
|
-
cond = info[:mobile].include? number || info[:phone].include? number || info[:im].include? number
|
103
|
-
info if cond
|
104
|
-
end
|
84
|
+
contacts.get_card_by_id(card_id).getdata
|
105
85
|
end
|
106
|
-
|
107
|
-
def get_contacts_cards_by_birthday date
|
108
|
-
contacts = Gitdb::Contacts.new uid
|
109
|
-
contacts.access gid
|
110
|
-
contacts.get_cards do |card|
|
111
|
-
card.getdata if card.getdata[:birthday].include? date
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def get_contacts_cards_by_email email
|
116
|
-
contacts = Gitdb::Contacts.new uid
|
117
|
-
contacts.access gid
|
118
|
-
contacts.get_cards do |card|
|
119
|
-
card.getdata if card.getdata[:email].include? email
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def get_contacts_cards_by_etc info
|
124
|
-
contacts = Gitdb::Contacts.new uid
|
125
|
-
contacts.access gid
|
126
|
-
contacts.get_cards do |card|
|
127
|
-
card.getdata if card.getdata[:address].include? info || card.getdata[:note].include? info
|
128
|
-
end
|
129
|
-
end
|
130
|
-
=end
|
86
|
+
# code review: @abbshr
|
131
87
|
def get_contacts_cards_by_related operator, gid, keyword
|
132
|
-
return unless GitContacts::relation_valid? operator gid
|
88
|
+
return unless GitContacts::relation_valid? operator, gid
|
133
89
|
contacts = Gitdb::Contacts.new operator
|
134
90
|
contacts.access gid
|
135
91
|
contacts.get_cards do |card|
|
136
92
|
info = card.getdata
|
137
|
-
info if card.getmeta[:owner].include? keyword || info.find { |k| true if
|
93
|
+
info if (card.getmeta[:owner].include? keyword) || info.find { |k,v| true if v.include? keyword }
|
138
94
|
end
|
139
95
|
end
|
140
|
-
|
96
|
+
# code review: @abbshr
|
141
97
|
def get_contacts_history operator, gid
|
142
98
|
contacts = Gitdb::Contacts.new operator
|
143
99
|
contacts.access gid
|
@@ -151,8 +107,9 @@ module GitContacts
|
|
151
107
|
commit_obj
|
152
108
|
end
|
153
109
|
end
|
154
|
-
|
155
|
-
def revert_to operator, gid
|
110
|
+
# code review: @abbshr
|
111
|
+
def revert_to operator, gid, oid
|
112
|
+
puts operator, gid, oid
|
156
113
|
contacts = Gitdb::Contacts.new operator
|
157
114
|
contacts.access gid
|
158
115
|
operator = {
|
@@ -162,49 +119,50 @@ module GitContacts
|
|
162
119
|
}
|
163
120
|
contacts.revert_to oid, { :author => operator, :committer => operator, :message => "revert to revision #{oid}" }
|
164
121
|
end
|
165
|
-
|
122
|
+
# code review: @abbshr
|
166
123
|
def add_contacts_card operator, gid, payload
|
167
|
-
return unless GitContacts::relation_valid? operator gid
|
124
|
+
return unless GitContacts::relation_valid? operator, gid
|
168
125
|
# request id
|
169
|
-
qid = Request::create :uid => operator, :gid => gid, :action => "create"
|
126
|
+
qid = Request::create :uid => operator, :gid => gid, :action => "create"
|
170
127
|
# create a rqeuest
|
171
128
|
req = Request.new qid
|
172
129
|
if req.auto_merge? operator
|
173
|
-
Request::delete qid
|
174
130
|
# here should return card_id if success
|
175
|
-
|
131
|
+
cid = req.allow operator
|
132
|
+
Request::delete qid
|
133
|
+
return cid
|
176
134
|
end
|
177
135
|
true
|
178
136
|
end
|
179
|
-
|
137
|
+
# code review: @abbshr
|
180
138
|
def edit_contacts_card operator, gid, card_id, payload
|
181
|
-
return unless GitContacts::relation_valid? operator gid
|
182
|
-
qid =
|
183
|
-
req =
|
139
|
+
return unless GitContacts::relation_valid? operator, gid
|
140
|
+
qid = Request::create :uid => operator, :gid => gid, :action => "setdata", :card_id => card_id, :content => JSON.generate(payload)
|
141
|
+
req = Request.new qid
|
184
142
|
if req.auto_merge? operator
|
185
143
|
req.allow operator
|
186
144
|
Request::delete qid
|
187
145
|
end
|
188
146
|
true
|
189
147
|
end
|
190
|
-
|
148
|
+
# code review: @abbshr
|
191
149
|
def delete_contacts_card operator, gid, card_id
|
192
|
-
return unless GitContacts::relation_valid? operator gid
|
193
|
-
qid =
|
194
|
-
req =
|
150
|
+
return unless GitContacts::relation_valid? operator, gid
|
151
|
+
qid = Request::create :uid => operator, :gid => gid, :action => "delete", :card_id => card_id
|
152
|
+
req = Request.new qid
|
195
153
|
if req.auto_merge? operator
|
196
154
|
req.allow operator
|
197
155
|
Request::delete qid
|
198
156
|
end
|
199
157
|
true
|
200
158
|
end
|
201
|
-
|
159
|
+
# code review: @abbshr
|
202
160
|
def get_contacts_users operator, gid
|
203
161
|
return unless result = GitContacts::relation_valid?(operator, gid)
|
204
162
|
contacts = result.last
|
205
163
|
contacts.getusers
|
206
164
|
end
|
207
|
-
|
165
|
+
# code review: @abbshr
|
208
166
|
def add_contacts_user operator, gid, uid
|
209
167
|
return unless result = GitContacts::relation_valid?(operator, gid)
|
210
168
|
user = result.first
|
@@ -215,6 +173,7 @@ module GitContacts
|
|
215
173
|
end
|
216
174
|
end
|
217
175
|
|
176
|
+
# code review: @AustinChou
|
218
177
|
def edit_contacts_user_privileges operator, gid, uid, payload
|
219
178
|
return unless result = GitContacts::relation_valid?(operator, gid)
|
220
179
|
user = result.first
|
@@ -230,7 +189,7 @@ module GitContacts
|
|
230
189
|
end
|
231
190
|
end
|
232
191
|
end
|
233
|
-
|
192
|
+
=begin
|
234
193
|
def invite_contacts_user operator, gid, payload
|
235
194
|
return unless result = GitContacts::relation_valid?(operator, gid)
|
236
195
|
user = result.first
|
@@ -252,10 +211,13 @@ module GitContacts
|
|
252
211
|
true
|
253
212
|
end
|
254
213
|
end
|
255
|
-
|
214
|
+
=end
|
215
|
+
|
216
|
+
# code review: @AustinChou
|
256
217
|
def get_all_requests operator
|
257
218
|
end
|
258
219
|
|
220
|
+
# code review: @AustinChou
|
259
221
|
def edit_request_status operator
|
260
222
|
end
|
261
223
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitcontacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AustinChou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- LICENSE.txt
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
|
+
- cookies
|
96
97
|
- gitcontacts.gemspec
|
97
98
|
- lib/gitcontacts.rb
|
98
99
|
- lib/gitcontacts/Contacts.rb
|