:javascript
  Portal.currentUser = {
    get isAnonymous() {
      return "#{current_visitor.anonymous?}" === "true";
    },
    get isLoggedIn() {
      return !this.isAnonymous;
    },
    get isAdmin() {
      return "#{current_visitor.has_role?('admin')}" === "true";
    },
    get isManager() {
      return "#{current_visitor.has_role?('manager')}" === "true";
    },
    get isResearcher() {
      return "#{current_visitor.has_role?('researcher')}" === "true";
    },
    get isAuthor() {
      return "#{current_visitor.has_role?('author')}" === "true";
    },
    get isTeacher() {
      // portal_teacher can return nil which is interpolated to "" string.
      return "#{current_visitor.portal_teacher}" != "";
    },
    get isStudent() {
      // portal_student can return nil which is interpolated to "" string.
      return "#{current_visitor.portal_student}" != "";
    },
    get firstName() {
      return "#{current_visitor.first_name}";
    },
    get lastName() {
      return "#{current_visitor.last_name}";
    },
    get fullName() {
      return "#{current_visitor.full_name}";
    },
    get homePath() {
      return "#{current_user_home_path}";
    }
  };

:javascript
  Portal.currentUser = {
    get isAnonymous() {
      return "#{current_visitor.anonymous?}" === "true";
    },
    get isLoggedIn() {
      return !this.isAnonymous;
    },
    get isAdmin() {
      return "#{current_visitor.has_role?('admin')}" === "true";
    },
    get isManager() {
      return "#{current_visitor.has_role?('manager')}" === "true";
    },
    get isResearcher() {
      return "#{current_visitor.has_role?('researcher')}" === "true";
    },
    get isAuthor() {
      return "#{current_visitor.has_role?('author')}" === "true";
    },
    get isTeacher() {
      // portal_teacher can return nil which is interpolated to "" string.
      return "#{current_visitor.portal_teacher.present?}" === "true";
    },
    get isStudent() {
      // portal_student can return nil which is interpolated to "" string.
      return "#{current_visitor.portal_student.present?}" === "true";
    },
    get firstName() {
      return "#{current_visitor.first_name}";
    },
    get lastName() {
      return "#{current_visitor.last_name}";
    },
    get fullName() {
      return "#{current_visitor.full_name}";
    },
    get homePath() {
      return "#{current_user_home_path}";
    }
  };

Fix bug causing warning in test output
Fix bug causing warning in test output

Turns out that this is the code responsible for warnings like:

```
ignoring attempt to close portal::teacher:0x0000000c9d8558 with html
  opened at byte 6288, line 134
  closed at byte 15429, line 409
  attributes at open: {}
  text around open: "() {\n      return \"#<Portal::Teacher:0x0"
  text around close: "v>\n</div>\n\n\n</body>\n</html>\n"
```

I believe these have been seen in test output since the code was
implemented ~3 years ago.

If I understand correctly, the goal is to detect if the current_visitor
is a teacher or student based on the the value of portal_teacher or
portal_student *not* being nil. What was actually happening is that
to_s was being called on these ruby classes and the result was being
inserted into view.
