-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Federation Data Exchange for FE2 #1943
Changes from 1 commit
8d576ec
e80f557
1677c00
bbc7b5e
71e63ad
05c3de9
62f22bb
05c5dcb
7bf43cb
65dc966
ac25784
4a32b59
4b52dbf
07913e0
147f0be
20998ca
9550e1e
5008da9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import com.github.dedis.popstellar.repository.LinkedOrganizationsRepository | |
import com.github.dedis.popstellar.repository.RollCallRepository | ||
import com.github.dedis.popstellar.utility.error.UnknownLaoException | ||
import com.github.dedis.popstellar.utility.error.keys.NoRollCallException | ||
import io.reactivex.disposables.CompositeDisposable | ||
import javax.inject.Inject | ||
import timber.log.Timber | ||
|
||
|
@@ -45,7 +46,7 @@ constructor( | |
linkedOrgRepo.otherLaoId != null) { | ||
val laoId = context.channel.extractLaoId() | ||
linkedOrgRepo.addLinkedLao(laoId, linkedOrgRepo.otherLaoId!!, arrayOf()) | ||
laoRepo.addDisposable( | ||
disposables.add( | ||
context.messageSender | ||
.subscribe(Channel.getLaoChannel(linkedOrgRepo.otherLaoId!!)) | ||
.subscribe( | ||
|
@@ -76,15 +77,15 @@ constructor( | |
// LAO. This might be changed in the future (making a pop-up asking the user if he/she wants | ||
// to subscribe to that) | ||
tokenExchange.tokens.forEach { t -> | ||
laoRepo.addDisposable( | ||
disposables.add( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the disposable from the handler doesn't give you the opportunity to clear the added disposables when closing a lao or the application. Take a look at the usage of disposables in the RollCallRepository or any other repository. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh ok, then should I create the disposables in LinkedOrganizationsRepository (as done in RollCallRepository) and then call it from the LinkedOrganizationsHandler ? Or should I do it directly in the handler ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep you can do it from the repository as for roll calls and keep it consistent |
||
context.messageSender | ||
.subscribe( | ||
Channel.getLaoChannel(tokenExchange.laoId).subChannel(SOCIAL).subChannel(t)) | ||
.subscribe( | ||
{ Timber.tag(TAG).d(SUCCESS) }, | ||
{ error: Throwable -> Timber.tag(TAG).e(error, ERROR) })) | ||
} | ||
laoRepo.addDisposable( | ||
disposables.add( | ||
context.messageSender | ||
.subscribe( | ||
Channel.getLaoChannel(tokenExchange.laoId).subChannel(SOCIAL).subChannel(REACTIONS)) | ||
|
@@ -106,6 +107,7 @@ constructor( | |
|
||
companion object { | ||
private val TAG = LinkedOrganizationsHandler::class.java.simpleName | ||
private val disposables = CompositeDisposable() | ||
private const val SOCIAL = "social" | ||
private const val REACTIONS = "reactions" | ||
private const val SUCCESS = "subscription is a success" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test when also there are some organizations (so not just the empty case)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like input validation, maybe you should complete MessageValidator class to check a federation status? Validation would then just be a clear oneliner 👍
You also probably want to check the public key to be non empty B64