Add attribute Actions::AddFriend#text
This commit is contained in:
parent
eb1f0c8542
commit
34d569f2a4
2 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue