Beispiel #1
0
     const place = getters.activePlace
     if (!place) return []
     return place.subscribers.map(userId => rootGetters['users/get'](userId))
   },
   ...metaStatuses(['create', 'fetch']),
   conversationUnreadCount: (state, getters) => getters.conversation && getters.conversation.unreadMessageCount,
   conversation: (state, getters, rootState, rootGetters) => {
     if (!state.activePlaceId) return
     return rootGetters['conversations/getForPlace'](state.activePlaceId)
   },
 },
 actions: {
   ...withMeta({
     async save ({ dispatch }, place) {
       dispatch('update', [await places.save(place)])
       router.push({ name: 'place', params: { placeId: place.id } })
     },
     async create ({ dispatch, rootGetters }, place) {
       const createdPlace = await places.create({
         ...place,
         group: rootGetters['currentGroup/id'],
       })
       dispatch('update', [createdPlace])
       router.push({ name: 'place', params: { placeId: createdPlace.id } })
     },
     async fetch ({ commit }) {
       commit('set', await places.list())
     },
     async subscribe (_, id) {
       await places.subscribe(id)
     },
Beispiel #2
0
        await messageAPI.markThread(id, seenUpTo)
      },
    }, {
      findId: () => undefined,
    }),

    async fetchOrRedirect ({ dispatch, getters }, messageId) {
      await dispatch('fetch', messageId)
      if (getters.fetchStatus.hasValidationErrors) {
        dispatch('toasts/show', {
          message: 'CONVERSATION.MESSAGE_NOT_FOUND',
          config: {
            type: 'negative',
          },
        }, { root: true })
        router.push('/')
      }
    },

    async maybeSetMuted ({ state, getters, dispatch }, { threadId, value }) {
      const pending = getters.setMutedStatus.pending
      const prevent = state.thread.muted === value
      if (!pending && !prevent) {
        await dispatch('setMuted', { threadId, value })
      }
    },

    receiveMessage ({ commit, state }, message) {
      if (!state.id || message.thread !== state.id) return
      commit('update', [message])
      if (message.id === state.id) {
Beispiel #3
0
       ...(isCurrentUser
         ? { name: 'groupPreview', params: { groupPreviewId: groupId } }
         : { name: 'applications', params: { groupId } }
       ),
       query: routeTo.query,
     })
   }
   if (!isCurrentUser) dispatch('currentGroup/select', { groupId }, { root: true })
 },
 routeLeave ({ dispatch }) {
   dispatch('clear')
 },
 openForPickup ({ dispatch }, pickup) {
   if (Platform.is.mobile) {
     const { id, group, place } = pickup
     router.push({ name: 'pickupDetail', params: { groupId: group.id, placeId: place.id, pickupId: id } })
   }
   else {
     dispatch('selectPickup', pickup.id)
   }
 },
 openForUser ({ dispatch }, user) {
   if (Platform.is.mobile) {
     router.push({ name: 'userDetail', params: { userId: user.id } })
   }
   else {
     dispatch('selectUser', user.id)
   }
 },
 openForApplication ({ dispatch }, application) {
   if (Platform.is.mobile) {