Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Feb 18, 2020
2 parents b98485e + 51b83ce commit 56eb2cb
Show file tree
Hide file tree
Showing 47 changed files with 1,941 additions and 359 deletions.
8 changes: 4 additions & 4 deletions api/BanditAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export default class ChatAPI extends BaseAPI {
return ret.variant
}

shown({ uid, variant, score }) {
return this.$post('/abtest', { uid, variant, score, shown: true })
shown({ uid, variant }) {
return this.$post('/abtest', { uid, variant, shown: true })
}

chosen({ uid, variant }) {
return this.$post('/abtest', { uid, variant, action: true })
chosen({ uid, variant, score }) {
return this.$post('/abtest', { uid, variant, action: true, score })
}
}
35 changes: 30 additions & 5 deletions api/ChatAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import BaseAPI from '@/api/BaseAPI'

export default class ChatAPI extends BaseAPI {
fetch(chatid, { limit, context }) {
return this.$get(`/chat/rooms/${chatid}/messages`, { limit, context })
return chatid
? this.$get(`/chat/rooms/${chatid}/messages`, { limit, context })
: this.$get(`/chatmessages`, { limit, context })
}

async listChats(params) {
Expand Down Expand Up @@ -33,9 +35,9 @@ export default class ChatAPI extends BaseAPI {
})
}

nudge(roomid) {
nudge(chatid) {
return this.$post('/chatrooms', {
id: roomid,
id: chatid,
action: 'Nudge'
})
}
Expand All @@ -52,9 +54,32 @@ export default class ChatAPI extends BaseAPI {
return this.$get('/chatrooms', { count: true })
}

rsvp(roomid, id, value) {
hold(msgid) {
return this.$post('/chatmessages', { id: msgid, action: 'Hold' })
}

release(msgid) {
return this.$post('/chatmessages', { id: msgid, action: 'Release' })
}

reject(msgid) {
return this.$post('/chatmessages', { id: msgid, action: 'Reject' })
}

approve(msgid) {
return this.$post('/chatmessages', { id: msgid, action: 'Approve' })
}

whitelist(msgid) {
return this.$post('/chatmessages', {
id: msgid,
action: 'ApproveAllFuture'
})
}

rsvp(chatid, id, value) {
return this.$patch('/chatmessages', {
roomid: roomid,
roomid: chatid,
id: id,
replyexpected: value
})
Expand Down
68 changes: 68 additions & 0 deletions api/MembershipsAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,72 @@ export default class MembershipsAPI extends BaseAPI {
leaveGroup(data) {
return this.$del('/memberships', data)
}

fetch(params, logError = true) {
return this.$get('/memberships', params, logError)
}

fetchMembers(params) {
return this.$get('/memberships', params)
}

del(id) {
return this.$del('/memberships', { id })
}

put(data) {
return this.$put('/memberships', data)
}

approve(id, groupid, subject = null, stdmsgid = null, body = null) {
return this.$post('/memberships', {
action: 'Approve',
id: id,
groupid: groupid,
subject: subject,
stdmsgid: stdmsgid,
body: body
})
}

reply(id, groupid, subject = null, stdmsgid = null, body = null) {
return this.$post('/memberships', {
action: 'Reply',
id: id,
groupid: groupid,
subject: subject,
stdmsgid: stdmsgid,
body: body
})
}

reject(id, groupid, subject = null, stdmsgid = null, body = null) {
return this.$post('/memberships', {
action: 'Reject',
id: id,
groupid: groupid,
subject: subject,
stdmsgid: stdmsgid,
body: body
})
}

delete(id, groupid, subject = null, stdmsgid = null, body = null) {
return this.$post('/memberships', {
action: 'Delete',
id: id,
groupid: groupid,
subject: subject,
stdmsgid: stdmsgid,
body: body
})
}

spam(id, groupid) {
return this.$post('/memberships', {
action: 'Spam',
id: id,
groupid: groupid
})
}
}
22 changes: 22 additions & 0 deletions api/MessageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,26 @@ export default class MessageAPI extends BaseAPI {
groupid: groupid
})
}

notspam(id, groupid) {
return this.$post('/message', {
action: 'NotSpam',
id: id,
groupid: groupid
})
}

hold(id) {
return this.$post('/message', {
action: 'Hold',
id: id
})
}

release(id) {
return this.$post('/message', {
action: 'Release',
id: id
})
}
}
36 changes: 24 additions & 12 deletions components/ChatPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<v-icon name="bell" />&nbsp;Nudge
</b-btn>
</span>
<span v-if="chat && chat.chattype === 'User2Mod'">
<b-btn v-b-tooltip.hover.top variant="white" title="Info about this freegler" @click="showInfo">
<v-icon name="info-circle" />&nbsp;Info
</b-btn>
</span>
<b-btn variant="primary" class="float-right ml-1" @click="send">
Send&nbsp;
<v-icon v-if="sending" name="sync" class="fa-spin" title="Sending..." />
Expand Down Expand Up @@ -209,6 +214,7 @@ import ChatBlockModal from './ChatBlockModal'
import ChatHideModal from './ChatHideModal'
import twem from '~/assets/js/twem'
import chatCollate from '@/mixins/chatCollate.js'
import WaitForRef from '@/mixins/waitForRef'
// Don't use dynamic imports because it stops us being able to scroll to the bottom after render.
import ChatMessage from '~/components/ChatMessage.vue'
Expand Down Expand Up @@ -239,7 +245,7 @@ export default {
ChatReportModal,
ChatRSVPModal
},
mixins: [chatCollate],
mixins: [chatCollate, WaitForRef],
props: {
id: {
type: Number,
Expand Down Expand Up @@ -320,18 +326,22 @@ export default {
otheruser() {
// The user who isn't us.
let ret = null
const me = this.$store.getters['auth/user']
if (
this.chat &&
this.chat.chattype === 'User2User' &&
this.chat.user1 &&
this.$store.getters['auth/user']
) {
ret =
if (this.chat && me) {
if (this.chat.chattype === 'User2User' && this.chat.user1 && me) {
ret =
this.chat.user1 && this.chat.user1.id === me.id
? this.chat.user2
: this.chat.user1
} else if (
this.chat.chattype === 'User2Mod' &&
this.chat.user1 &&
this.chat.user1.id === this.$store.getters['auth/user'].id
? this.chat.user2
: this.chat.user1
me.id !== this.chat.user1.id
) {
// We are a mod.
ret = this.chat.user1
}
}
return ret
Expand Down Expand Up @@ -419,7 +429,9 @@ export default {
methods: {
showInfo() {
this.$refs.profile.show()
this.waitForRef('profile', () => {
this.$refs.profile.show()
})
},
availability() {
this.$refs.availabilitymodal.show()
Expand Down
Loading

0 comments on commit 56eb2cb

Please sign in to comment.