Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc optimizations #3741

Merged
merged 7 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function getSession(): JSONResponse {
'currentUser' => $this->acl->getCurrentUser(),
'appPermissions' => $this->acl->getPermissionsArray(),
'appSettings' => $this->acl->getAppSettings(),
'share' => null,
]);
}

Expand Down
3 changes: 0 additions & 3 deletions lib/Db/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,9 @@ public function jsonSerialize(): array {
'token' => $this->getToken(),
'type' => $this->getType(),
'pollId' => $this->getPollId(),
'userId' => $this->getUserId(),
'emailAddress' => $this->getEmailAddress(),
'invitationSent' => boolval($this->getInvitationSent()),
'reminderSent' => boolval($this->getReminderSent()),
'locked' => boolval($this->getDeleted() ? 0 : $this->getLocked()),
'displayName' => $this->getDisplayName(),
'label' => $this->getLabel(),
'URL' => $this->getURL(),
'publicPollEmail' => $this->getPublicPollEmail(),
Expand Down
555 changes: 274 additions & 281 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@

<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { NcContent } from '@nextcloud/vue'
import { debounce } from 'lodash'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'

import NcContent from '@nextcloud/vue/dist/Components/NcContent.js'

import UserSettingsDlg from './components/Settings/UserSettingsDlg.vue'
import LoadingOverlay from './components/Base/modules/LoadingOverlay.vue'

import { useSessionStore } from './stores/session.ts'
import { usePollStore } from './stores/poll.ts'
import { showSuccess } from '@nextcloud/dialogs'

import '@nextcloud/dialogs/style.css'
import './assets/scss/colors.scss'
import './assets/scss/hacks.scss'
import './assets/scss/print.scss'
import './assets/scss/transitions.scss'
import './assets/scss/markdown.scss'
import UserSettingsDlg from './components/Settings/UserSettingsDlg.vue'
import LoadingOverlay from './components/Base/modules/LoadingOverlay.vue'
import { useSessionStore } from './stores/session.ts'
import { usePollStore } from './stores/poll.ts'
import { showSuccess } from '@nextcloud/dialogs'
import { debounce } from 'lodash'

const sessionStore = useSessionStore()
const pollStore = usePollStore()
Expand Down
5 changes: 1 addition & 4 deletions src/Types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export { Comment, Comments, CommentsGrouped } from '../stores/comments.ts'
export { Poll, PollType, AccessType, ShowResults, AllowProposals, PollConfiguration, PollStatus, PollPermissions, CurrentUserStatus } from '../stores/poll.ts'
export { SortType, FilterType, PollCategory, Meta, PollList } from '../stores/polls.ts'
export { Option, OptionVotes, Sequence, Shift, SimpleOption, Options } from '../stores/options.ts'
export { Share } from '../stores/share.ts'
export { Shares } from '../stores/shares.ts'
export { Share, Shares, ShareType } from '../stores/shares.ts'
export { Route, UserStatus, Session } from '../stores/session.ts'
export { UserPreferences, SessionSettings, Calendar, Preferences, ViewMode } from '../stores/preferences.ts'
export { Answer, AnswerSymbol, Vote, Votes } from '../stores/votes.ts'
Expand Down Expand Up @@ -79,7 +78,6 @@ export type AppPermissions = {
}

export type User = {
userId: string
displayName: string
emailAddress: string
subName: string
Expand All @@ -88,7 +86,6 @@ export type User = {
desc: string
type: UserType
id: string
user: string
organisation: string
languageCode: string
localeCode: string
Expand Down
8 changes: 5 additions & 3 deletions src/components/Actions/modules/ActionChangeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

<script setup lang="ts">
import { computed } from 'vue'
import { NcButton } from '@nextcloud/vue'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import ListViewIcon from 'vue-material-design-icons/ViewListOutline.vue' // view-sequential-outline
import TableViewIcon from 'vue-material-design-icons/Table.vue' // view-comfy-outline
import { t } from '@nextcloud/l10n'

import { usePollStore, PollType, } from '../../../stores/poll.ts'
import { usePreferencesStore, ViewMode } from '../../../stores/preferences.ts'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const pollStore = usePollStore()
const preferencesStore = usePreferencesStore()
Expand Down
8 changes: 5 additions & 3 deletions src/components/Actions/modules/ActionDelete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

<script setup lang="ts">
import { ref, computed } from 'vue'
import { NcButton } from '@nextcloud/vue'
import { t, n } from '@nextcloud/l10n'

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import DeleteIcon from 'vue-material-design-icons/Delete.vue'
import RestoreIcon from 'vue-material-design-icons/Recycle.vue'
import LockIcon from 'vue-material-design-icons/Lock.vue'
import UndoIcon from 'vue-material-design-icons/ArrowULeftTop.vue'
import { t, n } from '@nextcloud/l10n'

const props = defineProps({
timeout: {
Expand Down Expand Up @@ -97,7 +99,7 @@
<template>
<div class="">
<NcButton :name="computedTitle"
type="tertiary"
:type="ButtonType.Tertiary"
:aria-label="computedTitle">
<template #icon>
<RestoreIcon v-if="restore"
Expand Down
5 changes: 3 additions & 2 deletions src/components/Actions/modules/ActionDeleteOrphanedVotes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
-->

<script setup lang="ts">
import { NcButton } from '@nextcloud/vue'
import { t } from '@nextcloud/l10n'

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import { useVotesStore } from '../../../stores/votes.ts'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

const votesStore = useVotesStore()
const caption = t('polls', 'Delete orphaned')
Expand Down
4 changes: 2 additions & 2 deletions src/components/Actions/modules/ActionOpenOptionsSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
-->

<script setup lang="ts">
import { NcButton } from '@nextcloud/vue'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const caption = t('polls', 'Add some!')

Expand Down
4 changes: 2 additions & 2 deletions src/components/Actions/modules/ActionOpenSharesSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
-->

<script setup lang="ts">
import { NcButton } from '@nextcloud/vue'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const caption = t('polls', 'Edit access')

Expand Down
8 changes: 5 additions & 3 deletions src/components/Actions/modules/ActionRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

<script setup lang="ts">
import { ref } from 'vue'
import { NcModal, NcButton } from '@nextcloud/vue'
import PublicRegisterModal from '../../Public/PublicRegisterModal.vue'
import { t } from '@nextcloud/l10n'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'

import PublicRegisterModal from '../../Public/PublicRegisterModal.vue'

const caption = t('polls', 'Register')
const showRegistration = ref(false)
Expand Down
9 changes: 6 additions & 3 deletions src/components/Actions/modules/ActionSendConfirmed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
<script setup lang="ts">
import { useRoute } from 'vue-router'
import { ref } from 'vue'
import { NcButton, NcModal } from '@nextcloud/vue'
import { t, n } from '@nextcloud/l10n'

import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import EmailCheckIcon from 'vue-material-design-icons/EmailCheck.vue' // view-comfy-outline

import { PollsAPI } from '../../../Api/index.js'
import { Logger } from '../../../helpers/index.ts'
import { t, n } from '@nextcloud/l10n'
import { StatusResults } from '../../../Types/index.ts'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const route = useRoute()
const showModal = ref(false)
Expand Down
8 changes: 5 additions & 3 deletions src/components/Actions/modules/ActionSortOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

<script setup lang="ts">
import { computed } from 'vue'
import { NcButton } from '@nextcloud/vue'
import { t } from '@nextcloud/l10n'

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import SortByOriginalOrderIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue'
import SortByRankIcon from 'vue-material-design-icons/FormatListNumbered.vue'
import SortByDateOptionIcon from 'vue-material-design-icons/SortClockAscendingOutline.vue'
import { t } from '@nextcloud/l10n'

import { useOptionsStore } from '../../../stores/options.ts'
import { usePollStore, PollType } from '../../../stores/poll.ts'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const pollStore = usePollStore()
const optionsStore = useOptionsStore()
Expand Down
6 changes: 3 additions & 3 deletions src/components/Actions/modules/ActionSwitchSafeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
-->

<script setup lang="ts">
import { NcButton } from '@nextcloud/vue'
import { t } from '@nextcloud/l10n'
import { usePollStore } from '../../../stores/poll.ts'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

const pollStore = usePollStore()
const caption = t('polls', 'Reveal them')
Expand All @@ -18,7 +18,7 @@
<div class="action toggle-sidebar">
<NcButton :type="ButtonType.Primary"
:aria-label="caption"
@click="pollStore.switchSafeTable()">
@click="pollStore.revealParticipants = true">
{{ caption }}
</NcButton>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/components/Actions/modules/ActionToggleSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
-->

<script setup lang="ts">
import { NcButton } from '@nextcloud/vue'
import { emit } from '@nextcloud/event-bus'
import SidebarIcon from 'vue-material-design-icons/TextAccount.vue' // view-comfy-outline
import { t } from '@nextcloud/l10n'
import { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js';

import NcButton, { ButtonType } from '@nextcloud/vue/dist/Components/NcButton.js'

import SidebarIcon from 'vue-material-design-icons/TextAccount.vue' // view-comfy-outline

const caption = t('polls', 'Toggle Sidebar')
function clickAction() {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Activity/ActivityItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<script setup lang="ts">
import { computed } from 'vue'
import moment from '@nextcloud/moment'
import { NcUserBubble, NcRichText } from '@nextcloud/vue'

import NcUserBubble from '@nextcloud/vue/dist/Components/NcUserBubble.js'
import NcRichText from '@nextcloud/vue/dist/Components/NcRichText.js'

import { GuestBubble, SimpleLink } from '../../helpers/index.ts'

const props = defineProps({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Base/modules/CardDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<script setup lang="ts">
import { NcNoteCard } from '@nextcloud/vue'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
</script>

<template>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Base/modules/RadioGroupDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<script setup lang="ts">
import { computed, PropType } from 'vue'
import { NcCheckboxRadioSwitch } from '@nextcloud/vue'

import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'

export type CheckboxOption = {
value: string
Expand Down
9 changes: 6 additions & 3 deletions src/components/Calendar/CalendarPeek.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
<script setup lang="ts">

import { computed, onMounted, ref, PropType } from 'vue'
import { t } from '@nextcloud/l10n'
import orderBy from 'lodash/orderBy'
import { NcPopover } from '@nextcloud/vue'
import moment from '@nextcloud/moment'

import NcPopover from '@nextcloud/vue/dist/Components/NcPopover.js'

import { usePollStore } from '../../stores/poll.ts'

import CalendarInfo from './CalendarInfo.vue'
import { CalendarAPI } from '../../Api/index.js'
import { Logger } from '../../helpers/index.ts'
import { t } from '@nextcloud/l10n'
import { usePollStore } from '../../stores/poll.ts'
import { Option } from '../../Types/index.ts'

const pollStore = usePollStore()
Expand Down
8 changes: 4 additions & 4 deletions src/components/Cards/modules/CardRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import { CardDiv } from '../../Base/index.js'
import ActionRegister from '../../Actions/modules/ActionRegister.vue'
import { t } from '@nextcloud/l10n'
import { useShareStore } from '../../../stores/share.ts'
import { useSessionStore } from '../../../stores/session.ts'

const shareStore = useShareStore()
const sessionStore = useSessionStore()
const cardType = 'info'

const registrationInvitationText = computed(() => {
if (shareStore.publicPollEmail === 'mandatory') {
if (sessionStore.share.publicPollEmail === 'mandatory') {
return t('polls', 'To participate, register with your email address and a name.')
}
if (shareStore.publicPollEmail === 'optional') {
if (sessionStore.share.publicPollEmail === 'optional') {
return t('polls', 'To participate, register a name and optionally with your email address.')
}
return t('polls', 'To participate, register with a name.')
Expand Down
2 changes: 1 addition & 1 deletion src/components/Combo/ComboTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:title="poll.configuration.title"
class="poll-group">
<div v-for="(participant) in comboStore.participantsInPoll(poll.id)"
:key="`${participant.userId}_${participant.pollId}`"
:key="`${participant.user.id}_${participant.pollId}`"
class="participant">
<UserItem v-bind="participant" condensed />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Combo/VoteColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:title="poll.configuration.title"
class="poll-group">
<VoteItem v-for="(participant) in comboStore.participantsInPoll(poll.id)"
:key="`${participant.userId}_${participant.pollId}`"
:key="`${participant.user.id}_${participant.pollId}`"
:poll="poll"
:user="participant.user"
:option="option" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Combo/VoteItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
})

const answer = computed(() => comboStore.getVote({
userId: props.user.userId,
userId: props.user.id,
optionText: props.option.text,
pollId: props.poll.id,
}).answer)
Expand Down
8 changes: 4 additions & 4 deletions src/components/Comments/CommentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

const dateCommentedRelative = computed(() => moment.unix(props.comment.timestamp).fromNow())

const isCurrentUser = computed(() => sessionStore.currentUser.userId === props.comment.user.userId)
const isCurrentUser = computed(() => sessionStore.currentUser.id === props.comment.user.id)

function linkify(subComment: string) {
return linkifyStr(subComment)
Expand All @@ -57,7 +57,7 @@
</script>

<template>
<div :class="['comment-item', {currentuser: isCurrentUser}]">
<div :class="['comment-item', {'current-user': isCurrentUser}]">
<UserItem :user="comment.user" hide-names />
<div class="comment-item__content">
<span class="comment-item__user">{{ comment.user.displayName }}</span>
Expand All @@ -69,7 +69,7 @@
<span v-html="linkify(subComment.comment)" />
<!-- eslint-enable vue/no-v-html -->

<ActionDelete v-if="(comment.user.userId === sessionStore.currentUser.userId || pollStore.currentUserStatus.isOwner)"
<ActionDelete v-if="(comment.user.id === sessionStore.currentUser.id || pollStore.currentUserStatus.isOwner)"
:name="subComment.deleted ? t('polls', 'Restore comment') : t('polls', 'Delete comment')"
:restore="!!subComment.deleted"
:timeout="0"
Expand Down Expand Up @@ -146,7 +146,7 @@
.alternativestyle {
.comment-item {
flex-direction: row-reverse;
&.currentuser {
&.current-user {
flex-direction: row;
}
}
Expand Down
Loading