Skip to content

Commit

Permalink
Merge branch 'app' into app-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jun 28, 2023
2 parents 13b2316 + 0af601d commit b63c110
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 19 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
applicationId "org.ilovefreegle.direct"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1204
versionCode 1205
versionName "3.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
Expand Down
7 changes: 7 additions & 0 deletions components/ChatHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ export default {
return ret
},
},
watch: {
unseen() {
// Make sure the chat is up to date. This helps in the case where pollForChatUpdates picks up a new
// message and so we show that the chat has unread messages, but we haven't yet
this.chatStore.fetchMessages(this.id)
},
},
methods: {
async hide() {
console.log('Hide chat')
Expand Down
2 changes: 2 additions & 0 deletions components/ChatMessageDateRead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<b-badge
v-if="chatmessage?.replyexpected && !chatmessage?.replyreceived"
variant="danger"
class="ml-1"
>
RSVP - reply expected
</b-badge>
Expand Down Expand Up @@ -96,6 +97,7 @@
<b-badge
v-if="chatmessage?.replyexpected && !chatmessage?.replyreceived"
variant="info"
class="ml-1"
>
RSVP - reply requested
</b-badge>
Expand Down
3 changes: 3 additions & 0 deletions components/LayoutCommon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,14 @@ export default {
},
monitorTabVisibility() {
if (process.client) {
// console.log('---monitorTabVisibility')
document.addEventListener('visibilitychange', () => {
console.log('---visibilitychange')
const miscStore = useMiscStore()
miscStore.visible = !document.hidden
if (this.me && !document.hidden) {
// console.log('---visibilitychange CHANGED')
// We have become visible. Refetch our notification count and chat count, which are the two key things which
// produce red badges people should click on.
const notificationStore = useNotificationStore()
Expand Down
4 changes: 1 addition & 3 deletions components/OutcomeBy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
/>
</div>
<p class="mt-1 text-muted small">
We'll let anyone else who replied know, and it helps us identify reliable
freeglers.
This helps us identify reliable freeglers.
</p>
</div>
</template>
Expand Down Expand Up @@ -222,7 +221,6 @@ export default {
})
} else if (userid > 0) {
const user = this.availableUsers.find((u) => u.userid === userid)
console.log('Found', user)
user.count = 1
this.currentlySelectedUsers.push(user)
}
Expand Down
68 changes: 65 additions & 3 deletions components/OutcomeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@
/>
</div>
<div v-if="showCompletion">
<div
v-if="
type === 'Taken' && tookUsers?.length && otherRepliers?.length
"
>
<label class="strong">
Message for other people who replied (optional):
</label>
<b-form-textarea
v-model="completionMessage"
:rows="3"
:max-rows="6"
class="mt-1"
placeholder="e.g. Thanks for the interest. Sorry, this went to someone else."
/>
<p class="mt-1 text-muted small">
<v-icon icon="lock" /> We'll send this privately in Chat to each
other freegler who replied to your post.
</p>
</div>
<hr class="mb-0" />
<div>
<label class="mt-3 strong">
How do you feel about freegling just now?
Expand Down Expand Up @@ -185,6 +206,7 @@
</template>
<script>
import { useMessageStore } from '../stores/message'
import { useChatStore } from '../stores/chat'
import OutcomeBy from './OutcomeBy'
import SpinButton from './SpinButton'
import modal from '@/mixins/modal'
Expand All @@ -206,7 +228,9 @@ export default {
},
setup() {
const messageStore = useMessageStore()
return { messageStore }
const chatStore = useChatStore()
return { messageStore, chatStore }
},
data() {
return {
Expand All @@ -216,6 +240,7 @@ export default {
tookUsers: [],
selectedUser: null,
chooseError: false,
completionMessage: null,
}
},
computed: {
Expand All @@ -241,6 +266,33 @@ export default {
this.left === 0
)
},
otherRepliers() {
const ret = []
if (this.message?.replies) {
this.message.replies.forEach((u) => {
if (u.userid > 0) {
let found = false
for (const t of this.tookUsers) {
if (t.userid === u.userid) {
found = true
break
}
}
if (!found) {
ret.push({
userid: u.userid,
displayname: u.displayname,
})
}
}
})
}
return ret
},
submitDisabled() {
const ret =
this.type === 'Taken' &&
Expand Down Expand Up @@ -311,6 +363,18 @@ export default {
comment: this.comments,
})
if (this.type === 'Taken' && this.completionMessage) {
// Send a message to the other repliers.
this.otherRepliers.forEach(async (u) => {
const chatid = await this.chatStore.openChatToUser({
userid: u.userid,
chattype: 'User2User',
})
await this.chatStore.send(chatid, this.completionMessage)
})
}
this.hide()
} else {
// We are recording some partial results for the post.
Expand All @@ -319,12 +383,10 @@ export default {
}
}
},
show(type) {
this.showModal = true
this.type = type
},
hide() {
// We're having trouble capturing events from this modal, so use root as a bus.
this.$bus.$emit('outcome', {
Expand Down
12 changes: 12 additions & 0 deletions pages/unsubscribe/unsubscribed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@
</b-row>
</client-only>
</template>
<script>
export default {
mounted() {
try {
console.log('Disable Google autoselect')
window?.google?.accounts?.id?.disableAutoSelect()
} catch (e) {
console.log('Ignore Google autoselect error', e)
}
},
}
</script>
8 changes: 0 additions & 8 deletions stores/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,6 @@ export const useAuthStore = defineStore({
await this.fetchUser()
return this.user
},
async addRelatedUserUser(params) {
this.addRelatedUser(params.id)

if (this.userlist.length > 1) {
// Logged in as multiple users. Let the server know.
await this.$api.session.related(this.userlist)
}
},
async savePushId(){
const mobileStore = useMobileStore()
// Tell server our push notification id if logged in
Expand Down
14 changes: 10 additions & 4 deletions stores/volunteering.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ export const useVolunteeringStore = defineStore({
}
}

for (const date of params.newdates) {
promises.push(
api(this.config).volunteering.addDate(params.id, date.start, date.end)
)
if (params.newdates) {
for (const date of params.newdates) {
promises.push(
api(this.config).volunteering.addDate(
params.id,
date.start,
date.end
)
)
}
}

await Promise.all(promises)
Expand Down

0 comments on commit b63c110

Please sign in to comment.