-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
TODOs
|
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.
Wonderfull PR! Done with first review :)
client/src/elm/App/Update.elm
Outdated
(Pusher.Model.AccessToken accessToken) | ||
|
||
msg = | ||
case webDataUser of |
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.
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.
I tried doing it with a combination of RemoteData.map and RemoteData.withDefault, but it looks way more complicated to me. Probably I didn't understand what's the proper way to handle it.
client/src/elm/App/Update.elm
Outdated
{-| Get a singal if internet connection is lost. | ||
-} | ||
port offline : (Value -> msg) -> Sub msg | ||
|
||
|
||
pusherLogin : Model -> WebData User -> String -> Cmd Msg |
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.
worth a comment on the function, and a bit more comments in the function itself.
client/src/elm/App/Model.elm
Outdated
| PageLogin Pages.Login.Model.Msg | ||
| SetActivePage Page | ||
| SetCurrentDate Date | ||
| Tick Time | ||
| ToggleSideBar | ||
| NoOp |
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.
order by alpha bet
client/src/elm/App/Update.elm
Outdated
, accessTokenPort "" | ||
) | ||
let | ||
( _, pusherLogout ) = |
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 should probably be ( pusherModelUpdated, pusherLogout ) =
so we could update it as well:
1
--
( { emptyModel
| accessToken = ""
| pusher = pusherModelUpdated
@@ -15,6 +15,7 @@ type alias ItemId = | |||
type alias Item = | |||
{ name : String | |||
, image : String | |||
, privateNote : Maybe String |
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.
👍
*/ | ||
function hedley_pusher_exit() { | ||
$queue = &drupal_static('hedley_pusher_static_queue', []); | ||
if (!empty($queue)) { |
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.
Minor, I prefer less indentation.
if (!$queue) {
// No registered pusher events.
return;
}
$this->handler->setAccount(user_load(1)); | ||
$result = $this->handler->post('', $pusher_auth_arguments); | ||
$this->assertTrue(intval($result['id']), 'Received auth token ID.'); | ||
$this->assertTrue(preg_match('/^key:[\d|\w]+$/', $result['auth']), 'Received token in the expected format.'); |
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.
Wow, even a test. Kudos!
* The pusher channel name: 'general' or 'private-general'. | ||
*/ | ||
protected function getPusherChannel($uid) { | ||
return user_access('access private pusher channel', user_load($uid)) ? 'private-general' : 'general'; |
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.
Even though it's the same, I'd still use
$account = $this->getAccount();
eturn user_access('access private pusher channel', $account) ? 'private-general' : 'general';
IMO it makes it clear we're talking about the current user.
public function publicFieldsInfo() { | ||
$public_fields = parent::publicFieldsInfo(); | ||
|
||
$public_fields['auth'] = array( |
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.
=> []
* Pusher auth plugin definition. | ||
*/ | ||
|
||
$plugin = array( |
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.
=> []
client/src/elm/App/Update.elm
Outdated
-- Create a MsgPusher for login, or NoOp in case the user or the config | ||
-- are missing. | ||
msg = | ||
case webDataUser of |
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.
Untested, but could be shorten to:
RemoteData.toMaybe webDataUser
|> Maybe.map (\user ->
RemoteData.toMaybe model.config
|> Maybe.map (\config -> pusherLoginMsg config.pusherKey user.pusherChannel)
|> Maybe.withDefault NoOp
)
|> Maybe.withDefault NoOp
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.
Perfect. Thanks!
Great, if you can add a note in the README as-well, indicating the connection of the access private fields, and the private Pusher channel. |
README.md
Outdated
`access private fields` permission, and currently exposes the item's "Private | ||
note" field, which normal users can't access. | ||
|
||
Login for example with `admin` / `admin` to see the item private field, and get |
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.
Maybe:
Login for example with admin
/ admin
to see the private field on for example /#/item/1
(-- @bitamar
is that correct? --).
Only privileged users can see this note. Also when the item will be updated (e.g. via the backend on node/1/edit
), it will be updated in real time through the private channel.
#123