Archived
1
0
Fork 0

Add attribute Actions::AddFriend#text

This commit is contained in:
Braiden Vasco 2017-08-12 02:26:11 +00:00
parent eb1f0c8542
commit 34d569f2a4
2 changed files with 10 additions and 4 deletions

View file

@ -2,11 +2,12 @@
module Actions
class AddFriend < Obredux::Thunk::Action
attr_reader :tox_client, :public_key
attr_reader :tox_client, :public_key, :text
def initialize(tox_client, public_key)
def initialize(tox_client, public_key, text)
self.tox_client = tox_client
self.public_key = public_key
self.text = text
end
def call(dispatch)
@ -25,6 +26,11 @@ module Actions
@public_key = value
end
def text=(value)
raise TypeError, "expected #text to be a #{String}" unless value.is_a? String
@text = value
end
class Done < Obredux::Action
attr_reader :friend

View file

@ -87,8 +87,8 @@ private
store.dispatch Actions::LoadFriends.new friends
end
def on_friend_request(public_key, _text)
store.dispatch Actions::AddFriend.new @tox_client, public_key
def on_friend_request(public_key, text)
store.dispatch Actions::AddFriend.new @tox_client, public_key, text
end
def on_friend_message(friend, text)