Beacon24 / v0

4 stars 2 forks source link

`if` statement to show and hide Join and Leave buttons on `/views/groups/show` not working #18

Open Beacon24 opened 2 years ago

Beacon24 commented 2 years ago

The Join button is always showing, regardless of whether or not the group has already been joined. This makes me think the first includes function is not finding the currentUser in the group members array. Code is pasted below:

<% if( group.members.includes('currentUser.name') ) { %>
                <form class="d-inline" action="/groups/<%= group._id%>/leave?_method=DELETE" method="POST">
                  <button class="btn btn-danger">
                      Leave
                  </button>
                </form>
              <% } else { %>
                <form class="d-inline" action="/groups/<%= group._id%>/join" method="POST">
                  <button class="btn btn-danger">
                      Join
                  </button>
                </form>
 <% } %>
Beacon24 commented 2 years ago

This functionality has been temporarily hidden but it is still a problem worth working on, we will re-introduce this feature hopefully very soon.