Fix path to detect when group is the tavern or the user's party and set paths appropriately (#10570)

* Fix path to detect when group is the tavern or the user's party and set path's appropriately

* Fix lint issues
This commit is contained in:
FergusonSean
2018-08-03 02:54:32 -07:00
committed by Matteo Pagliazzi
parent fcbc2acda7
commit 4493e1d98c
4 changed files with 19 additions and 5 deletions

View File

@@ -2,9 +2,13 @@ version: "3"
services: services:
client: client:
environment:
- NODE_ENV=development
volumes: volumes:
- '.:/usr/src/habitrpg' - '.:/usr/src/habitrpg'
server: server:
environment:
- NODE_ENV=development
volumes: volumes:
- '.:/usr/src/habitrpg' - '.:/usr/src/habitrpg'

View File

@@ -2,7 +2,7 @@
.container .container
.row .row
.col-12 .col-12
copy-as-todo-modal(:group-name='groupName', :group-id='groupId') copy-as-todo-modal(:group-type='groupType', :group-name='groupName', :group-id='groupId')
report-flag-modal report-flag-modal
div(v-for="(msg, index) in messages", v-if='chat && canViewFlag(msg)') div(v-for="(msg, index) in messages", v-if='chat && canViewFlag(msg)')
// @TODO: is there a different way to do these conditionals? This creates an infinite loop // @TODO: is there a different way to do these conditionals? This creates an infinite loop
@@ -87,7 +87,7 @@ import reportFlagModal from './reportFlagModal';
import chatCard from './chatCard'; import chatCard from './chatCard';
export default { export default {
props: ['chat', 'groupId', 'groupName', 'inbox'], props: ['chat', 'groupType', 'groupId', 'groupName', 'inbox'],
components: { components: {
copyAsTodoModal, copyAsTodoModal,
reportFlagModal, reportFlagModal,

View File

@@ -18,6 +18,7 @@ import notificationsMixin from 'client/mixins/notifications';
import Task from 'client/components/tasks/task'; import Task from 'client/components/tasks/task';
import taskDefaults from 'common/script/libs/taskDefaults'; import taskDefaults from 'common/script/libs/taskDefaults';
import { TAVERN_ID } from '../../../common/script/constants';
const baseUrl = 'https://habitica.com'; const baseUrl = 'https://habitica.com';
@@ -29,7 +30,7 @@ export default {
Task, Task,
}, },
mixins: [notificationsMixin], mixins: [notificationsMixin],
props: ['copyingMessage', 'groupName', 'groupId'], props: ['copyingMessage', 'groupType', 'groupName', 'groupId'],
data () { data () {
return { return {
isUser: true, isUser: true,
@@ -38,7 +39,7 @@ export default {
}, },
mounted () { mounted () {
this.$root.$on('habitica::copy-as-todo', message => { this.$root.$on('habitica::copy-as-todo', message => {
const notes = `${message.user || 'system message'}${message.user ? ' wrote' : ''} in [${this.groupName}](${baseUrl}/groups/guild/${this.groupId})`; const notes = `${message.user || 'system message'}${message.user ? ' wrote' : ''} in [${this.groupName}](${this.groupPath()})`;
const newTask = { const newTask = {
text: message.text, text: message.text,
type: 'todo', type: 'todo',
@@ -55,6 +56,15 @@ export default {
...mapActions({ ...mapActions({
createTask: 'tasks:create', createTask: 'tasks:create',
}), }),
groupPath () {
if (this.groupId === TAVERN_ID) {
return `${baseUrl}/groups/tavern`;
} else if (this.groupType === 'party') {
return `${baseUrl}/party`;
} else {
return `${baseUrl}/groups/guild/${this.groupId}`;
}
},
close () { close () {
this.$root.$emit('bv::hide::modal', 'copyAsTodo'); this.$root.$emit('bv::hide::modal', 'copyAsTodo');
}, },

View File

@@ -34,7 +34,7 @@
.row .row
.hr.col-12 .hr.col-12
chat-message(:chat.sync='group.chat', :group-id='group._id', :group-name='group.name') chat-message(:chat.sync='group.chat', :group-type='group.type', :group-id='group._id', :group-name='group.name')
</template> </template>
<script> <script>