<p>This follows on from <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1583" class="issue-link js-issue-link" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/1583" data-id="242423704" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#1583</a> and refactors the remaining controller code, and all of the views, to use the <code>current_user</code> approach for accessing the currently logged in user.</p>
<p>The <code>self.current_user =</code> feels a bit clumsy, but it's necessary to avoid creating local variables with the same name as the controller method. I'm sure those will disappear when we eventually migrate to a devise or similar.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/1595'>https://github.com/openstreetmap/openstreetmap-website/pull/1595</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Convert remaining controller code to use current_user</li>
  <li>Use a current_user helper for accessing the logged in user in all views.</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-0">app/controllers/application_controller.rb</a>
    (68)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-1">app/controllers/user_controller.rb</a>
    (184)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-2">app/views/browse/changeset.html.erb</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-3">app/views/changeset/history.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-4">app/views/changeset/list.atom.builder</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-5">app/views/diary_entry/view.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-6">app/views/layouts/_header.html.erb</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-7">app/views/layouts/_inbox.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-8">app/views/layouts/map.html.erb</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-9">app/views/message/_message_count.html.erb</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-10">app/views/message/inbox.html.erb</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-11">app/views/message/new.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-12">app/views/message/outbox.html.erb</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-13">app/views/message/read.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-14">app/views/oauth/authorize.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-15">app/views/redactions/show.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-16">app/views/site/_potlatch.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-17">app/views/site/_potlatch2.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-18">app/views/site/edit.html.erb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-19">app/views/site/help.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-20">app/views/site/id.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-21">app/views/user/_contact.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-22">app/views/user/account.html.erb</a>
    (28)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-23">app/views/user/api_read.builder</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-24">app/views/user/reset_password.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-25">app/views/user/save.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-26">app/views/user/view.html.erb</a>
    (48)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-27">app/views/user_blocks/_block.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-28">app/views/user_blocks/blocks_by.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-29">app/views/user_blocks/blocks_on.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-30">app/views/user_blocks/index.html.erb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-31">app/views/user_blocks/show.html.erb</a>
    (4)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595/files#diff-32">routes.txt</a>
    (270)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/1595.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/1595.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/1595.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/1595.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1595">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLW8wRsG1t-axQiG82yciZKlVWD9dks5sR15ngaJpZM4OkHEq">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLSmdynYft4cvv0yFnVA-xoms6WiXks5sR15ngaJpZM4OkHEq.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/pull/1595"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Further refactoring to avoid @user (#1595)"}],"action":{"name":"View Pull Request","url":"https://github.com/openstreetmap/openstreetmap-website/pull/1595"}}}</script>