|
7 | 7 | <div class="mt-8 sm:mt-0"> |
8 | 8 | <div v-if="matches.length"> |
9 | 9 | <h1 class="text-xl md:text-base text-gray-matcha font-bold">Matches</h1> |
10 | | - <div class="overflow-scroll mt-4"> |
11 | | - <Match v-on:chat="chat" v-for="match in matches" :key="match.id" v-bind:match="match"></Match> |
| 10 | + <div class="overflow-scroll flex mt-4"> |
| 11 | + <Match v-bind:class="{'ml-2': index !== 0}" v-on:chat="chat" v-for="(match, index) in matches" :key="index" v-bind:match="match"></Match> |
12 | 12 | </div> |
13 | 13 | </div> |
14 | 14 | <div v-else class="flex items-center"> |
|
24 | 24 | <div class="mt-8"> |
25 | 25 | <div v-if="messages.length"> |
26 | 26 | <h1 class="text-xl md:text-base text-gray-matcha text-left font-bold">Messages</h1> |
27 | | - <div class="overflow-scroll mt-4"> |
| 27 | + <div class="overflow-scroll md:h-64 mt-4"> |
28 | 28 | <Message v-on:chat="chat" v-for="message in messages" :key="message.with_user.id" v-bind:message="message"></Message> |
29 | 29 | </div> |
30 | 30 | </div> |
@@ -103,11 +103,16 @@ export default { |
103 | 103 | return; |
104 | 104 | } |
105 | 105 | for (let i = 0; i < matches.length; i += 1) { |
| 106 | + let matchHasMessage = false; |
106 | 107 | for (let j = 0; j < this.messages.length; j += 1) { |
107 | | - if (this.messages[j].with_user.id !== matches[i].user_1 && this.messages[j].with_user.id !== matches[i].user_2) { |
108 | | - await this.fetchMatch(matches[i].user_1, matches[i].user_2); |
| 108 | + if (this.messages[j].with_user.id === matches[i].user_1 || this.messages[j].with_user.id === matches[i].user_2) { |
| 109 | + matchHasMessage = true; |
| 110 | + break; |
109 | 111 | } |
110 | 112 | } |
| 113 | + if (!matchHasMessage) { |
| 114 | + await this.fetchMatch(matches[i].user_1, matches[i].user_2); |
| 115 | + } |
111 | 116 | } |
112 | 117 | }, |
113 | 118 | async fetchMessages() { |
|
0 commit comments