Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #400 from filipedelimabrito/iss321
Browse files Browse the repository at this point in the history
Spotlight changes.
  • Loading branch information
rafaelks authored Aug 18, 2017
2 parents b9d3665 + 5c8721d commit bb01f6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ public Task<Void> createPrivateGroup(final String name, final boolean readOnly)
.onSuccessTask(task -> Task.forResult(null));
}

public Task<Void> createDirectMessage(final String username) {
public Task<String> createDirectMessage(final String username) {
return call("createDirectMessage", TIMEOUT_MS, () -> new JSONArray().put(username))
.onSuccessTask(task -> Task.forResult(null));
.onSuccessTask(CONVERT_TO_JSON_OBJECT)
.onSuccessTask(task -> Task.forResult(task.getResult().getString("rid")));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void onSpotlightSelected(Spotlight spotlight) {
methodCallHelper.createDirectMessage(username)
.continueWithTask(task -> {
if (task.isCompleted()) {
rocketChatCache.setSelectedRoomId(spotlight.getId() + userId);
rocketChatCache.setSelectedRoomId(task.getResult());
}
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private void setupView(Optional<RocketChatAbsoluteUrl> rocketChatAbsoluteUrlOpti
protected Task<Void> getMethodCallForSubmitAction() {
String username =
((TextView) getDialog().findViewById(R.id.editor_username)).getText().toString();
return methodCall.createDirectMessage(username);
return methodCall.createDirectMessage(username)
.onSuccess(task -> null);
}
}

0 comments on commit bb01f6a

Please sign in to comment.