{"action":"created","issue":{"url":"https://api.github.com/repos/lift/framework/issues/1730","repository_url":"https://api.github.com/repos/lift/framework","labels_url":"https://api.github.com/repos/lift/framework/issues/1730/labels{/name}","comments_url":"https://api.github.com/repos/lift/framework/issues/1730/comments","events_url":"https://api.github.com/repos/lift/framework/issues/1730/events","html_url":"https://github.com/lift/framework/pull/1730","id":114961845,"number":1730,"title":"Future with session","user":{"login":"joescii","id":882948,"avatar_url":"https://avatars.githubusercontent.com/u/882948?v=3","gravatar_id":"","url":"https://api.github.com/users/joescii","html_url":"https://github.com/joescii","followers_url":"https://api.github.com/users/joescii/followers","following_url":"https://api.github.com/users/joescii/following{/other_user}","gists_url":"https://api.github.com/users/joescii/gists{/gist_id}","starred_url":"https://api.github.com/users/joescii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joescii/subscriptions","organizations_url":"https://api.github.com/users/joescii/orgs","repos_url":"https://api.github.com/users/joescii/repos","events_url":"https://api.github.com/users/joescii/events{/privacy}","received_events_url":"https://api.github.com/users/joescii/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/lift/framework/milestones/64","html_url":"https://github.com/lift/framework/milestone/64","labels_url":"https://api.github.com/repos/lift/framework/milestones/64/labels","id":1224231,"number":64,"title":"3.1","description":null,"creator":{"login":"farmdawgnation","id":620189,"avatar_url":"https://avatars.githubusercontent.com/u/620189?v=3","gravatar_id":"","url":"https://api.github.com/users/farmdawgnation","html_url":"https://github.com/farmdawgnation","followers_url":"https://api.github.com/users/farmdawgnation/followers","following_url":"https://api.github.com/users/farmdawgnation/following{/other_user}","gists_url":"https://api.github.com/users/farmdawgnation/gists{/gist_id}","starred_url":"https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farmdawgnation/subscriptions","organizations_url":"https://api.github.com/users/farmdawgnation/orgs","repos_url":"https://api.github.com/users/farmdawgnation/repos","events_url":"https://api.github.com/users/farmdawgnation/events{/privacy}","received_events_url":"https://api.github.com/users/farmdawgnation/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":8,"state":"open","created_at":"2015-07-24T15:44:37Z","updated_at":"2016-12-22T14:32:10Z","due_on":null,"closed_at":null},"comments":31,"created_at":"2015-11-04T03:28:39Z","updated_at":"2016-12-22T14:32:10Z","closed_at":"2016-12-22T14:32:10Z","pull_request":{"url":"https://api.github.com/repos/lift/framework/pulls/1730","html_url":"https://github.com/lift/framework/pull/1730","diff_url":"https://github.com/lift/framework/pull/1730.diff","patch_url":"https://github.com/lift/framework/pull/1730.patch"},"body":"Our code base at work is getting littered with `S.session.map { session => S.initIfUninitted(session) { /** stuff */ } }` because we interleave threads from akka actors and futures.  Now that Lift supports only 2.11.x I think it would be a nice addition to have `LiftSession`-aware `scala.concurrent.Future[T]`'s that I've been working on for our project.\n\nJust to take an excerpt from the spec code, this will now work:\n\n``` scala\nobject TestVar1 extends SessionVar[String](\"test1\")\nobject TestVar2 extends SessionVar[String](\"test2\")\n\n\"A FutureWithSession\" should {\n  \"have access to session variables in map() chains\" in {\n    val session = new LiftSession(\"Test Session\", \"\", Empty)\n\n    val future:Future[String] = S.initIfUninitted(session) {\n      TestVar1(\"map1\")\n      TestVar2(\"map2\")\n      Future(\"something\").withCurrentSession\n    }\n    val actual:Future[String] = future\n      .map(_+\"-\"+TestVar1.get)\n      .map(_+\"-\"+TestVar2.get)\n    val expected:Option[Try[String]] = Some(Success(\"something-map1-map2\"))\n\n    actual.value must eventually(beEqualTo(expected))\n  }\n}\n```\n\nBecause I converted the `Future(\"something\")` into a `FutureWIthSession[T]` via the implicit `withCurrentSession` val, I am able to access the `SessionVar`s in the map lambdas.  \n\nHow do y'all feel about this addition? I've implemented everything we need at work, but I'll gladly finish this out if everyone likes it for Lift.\n"},"comment":{"url":"https://api.github.com/repos/lift/framework/issues/comments/268811015","html_url":"https://github.com/lift/framework/pull/1730#issuecomment-268811015","issue_url":"https://api.github.com/repos/lift/framework/issues/1730","id":268811015,"user":{"login":"farmdawgnation","id":620189,"avatar_url":"https://avatars.githubusercontent.com/u/620189?v=3","gravatar_id":"","url":"https://api.github.com/users/farmdawgnation","html_url":"https://github.com/farmdawgnation","followers_url":"https://api.github.com/users/farmdawgnation/followers","following_url":"https://api.github.com/users/farmdawgnation/following{/other_user}","gists_url":"https://api.github.com/users/farmdawgnation/gists{/gist_id}","starred_url":"https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farmdawgnation/subscriptions","organizations_url":"https://api.github.com/users/farmdawgnation/orgs","repos_url":"https://api.github.com/users/farmdawgnation/repos","events_url":"https://api.github.com/users/farmdawgnation/events{/privacy}","received_events_url":"https://api.github.com/users/farmdawgnation/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T14:32:10Z","updated_at":"2016-12-22T14:32:10Z","body":"Superseded by #1813."}}
{"actor":{"display_login":"farmdawgnation"}}