summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-27 15:07:12 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-10-27 15:07:12 +0200
commitdb3cb63810a53cbf94cc6de270b55a7675dd37de (patch)
tree49205136d84d4bc94d5904081979b4419a79006f
parentffe5f1bacbbe0acbeff7d48585933e85928e8d12 (diff)
Let's not support oci yet
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--.eslintrc.js72
-rw-r--r--.github/workflows/phpunit-oci.yml142
-rw-r--r--package-lock.json2
-rw-r--r--package.json2
-rw-r--r--src/App.vue59
-rw-r--r--src/components/ActorAvatar.vue25
-rw-r--r--src/components/Composer/Composer.vue172
-rw-r--r--src/components/Composer/PreviewGrid.vue17
-rw-r--r--src/components/Composer/PreviewGridItem.vue53
-rw-r--r--src/components/Emoji.vue12
-rw-r--r--src/components/EmptyContent.vue6
-rw-r--r--src/components/FollowButton.vue28
-rw-r--r--src/components/MessageContent.js224
-rw-r--r--src/components/PostAttachment.vue34
-rw-r--r--src/components/ProfileInfo.vue100
-rw-r--r--src/components/Search.vue84
-rw-r--r--src/components/TimelineEntry.vue23
-rw-r--r--src/components/TimelineList.vue86
-rw-r--r--src/components/TimelinePost.vue52
-rw-r--r--src/components/UserEntry.vue22
-rw-r--r--src/dashboard.js2
-rw-r--r--src/directives/focusOnCreate.js4
-rw-r--r--src/main.js12
-rw-r--r--src/mixins/accountMixins.js14
-rw-r--r--src/mixins/currentUserMixin.js8
-rw-r--r--src/mixins/follow.js6
-rw-r--r--src/mixins/popoverMenu.js10
-rw-r--r--src/mixins/serverData.js15
-rw-r--r--src/ostatus.js4
-rw-r--r--src/profile.js32
-rw-r--r--src/router.js40
-rw-r--r--src/services/logger.js37
-rw-r--r--src/store/account.js22
-rw-r--r--src/store/index.js10
-rw-r--r--src/store/settings.js6
-rw-r--r--src/store/timeline.js60
-rw-r--r--src/views/Dashboard.vue23
-rw-r--r--src/views/OStatus.vue58
-rw-r--r--src/views/Profile.vue30
-rw-r--r--src/views/ProfileFollowers.vue44
-rw-r--r--src/views/ProfilePageIntegration.vue25
-rw-r--r--src/views/ProfileTimeline.vue16
-rw-r--r--src/views/Timeline.vue144
-rw-r--r--src/views/TimelineSinglePost.vue60
44 files changed, 784 insertions, 1113 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index 641466ef..89bcc517 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,72 +1,8 @@
module.exports = {
- root: true,
- env: {
- browser: true,
- es6: true,
- node: true,
- jest: true
- },
- globals: {
- t: true,
- n: true,
- OC: true,
- OCA: true,
- Vue: true,
- VueRouter: true
- },
- parserOptions: {
- parser: 'babel-eslint',
- ecmaVersion: 6
- },
extends: [
- 'eslint:recommended',
- 'plugin:node/recommended',
- 'plugin:vue/essential',
- 'plugin:vue/recommended',
- 'standard'
+ '@nextcloud'
],
- plugins: ['vue', 'node'],
- rules: {
- // space before function ()
- 'space-before-function-paren': ['error', 'never'],
- // curly braces always space
- 'object-curly-spacing': ['error', 'always'],
- // stay consistent with array brackets
- 'array-bracket-newline': ['error', 'consistent'],
- // 1tbs brace style
- 'brace-style': 'error',
- // tabs only
- indent: ['error', 'tab'],
- 'no-tabs': 0,
- 'vue/html-indent': ['error', 'tab'],
- // only debug console
- 'no-console': ['error', { allow: ['error', 'warn', 'debug'] }],
- // classes blocks
- 'padded-blocks': ['error', { classes: 'always' }],
- // always have the operator in front
- 'operator-linebreak': ['error', 'before'],
- // ternary on multiline
- 'multiline-ternary': ['error', 'always-multiline'],
- // es6 import/export and require
- 'node/no-unpublished-require': ['off'],
- 'node/no-unsupported-features/es-syntax': ['off'],
- // space before self-closing elements
- 'vue/html-closing-bracket-spacing': 'error',
- // newline before closing bracket
- 'vue/html-closing-bracket-newline': ["error", {
- "singleline": "never",
- "multiline": "never"
- }],
- // code spacing with attributes
- 'vue/max-attributes-per-line': [
- 'error',
- {
- singleline: 3,
- multiline: {
- max: 3,
- allowFirstLine: true
- }
- }
- ]
+ globals: {
+ appName: true
}
-}
+};
diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml
deleted file mode 100644
index 3e079e5f..00000000
--- a/.github/workflows/phpunit-oci.yml
+++ /dev/null
@@ -1,142 +0,0 @@
-# This workflow is provided via the organization template repository
-#
-# https://github.com/nextcloud/.github
-# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
-
-name: PHPUnit
-
-on:
- pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
- push:
- branches:
- - main
- - master
- - stable*
-
-permissions:
- contents: read
-
-concurrency:
- group: phpunit-oci-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
-
-env:
- # Location of the phpunit.xml and phpunit.integration.xml files
- PHPUNIT_CONFIG: ./tests/phpunit.xml
- PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
-
-jobs:
- phpunit-oci:
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- php-versions: ['8.0']
- server-versions: ['master']
-
- services:
- oracle:
- image: deepdiver/docker-oracle-xe-11g # 'wnameless/oracle-xe-11g-r2'
- ports:
- - 1521:1521/tcp
-
- steps:
- - name: Set app env
- run: |
- # Split and keep last
- echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
-
- - name: Checkout server
- uses: actions/checkout@v3
- with:
- submodules: true
- repository: nextcloud/server
- ref: ${{ matrix.server-versions }}
-
- - name: Checkout app
- uses: actions/checkout@v3
- with:
- path: apps/${{ env.APP_NAME }}
-
- - name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8
- tools: phpunit
- coverage: none
-
- - name: Check composer file existence
- id: check_composer
- uses: andstor/file-existence-action@v2
- with:
- files: apps/${{ env.APP_NAME }}/composer.json
-
- - name: Set up PHPUnit
- # Only run if phpunit config file exists
- if: steps.check_composer.outputs.files_exists == 'true'
- working-directory: apps/${{ env.APP_NAME }}
- run: composer i
-
- - name: Set up Nextcloud
- env:
- DB_PORT: 1521
- run: |
- mkdir data
- ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
- ./occ app:enable --force ${{ env.APP_NAME }}
-
- - name: Check PHPUnit config file existence
- id: check_phpunit
- uses: andstor/file-existence-action@v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
-
- - name: PHPUnit
- # Only run if phpunit config file exists
- if: steps.check_phpunit.outputs.files_exists == 'true'
- working-directory: apps/${{ env.APP_NAME }}
- run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
-
- - name: Check PHPUnit integration config file existence
- id: check_integration
- uses: andstor/file-existence-action@v2
- with:
- files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
-
- - name: Run Nextcloud
- # Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
- run: php -S localhost:8080 &
-
- - name: PHPUnit integration
- # Only run if phpunit integration config file exists
- if: steps.check_integration.outputs.files_exists == 'true'
- working-directory: apps/${{ env.APP_NAME }}
- run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
-
- summary:
- permissions:
- contents: none
- runs-on: ubuntu-latest
- needs: phpunit-oci
-
- if: always()
-
- name: phpunit-oci-summary
-
- steps:
- - name: Summary status
- run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi
diff --git a/package-lock.json b/package-lock.json
index f46096f5..841f3214 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,9 @@
"dependencies": {
"@nextcloud/auth": "^2.0.0",
"@nextcloud/axios": "^2.0.0",
+ "@nextcloud/dialogs": "^3.2.0",
"@nextcloud/initial-state": "^2.0.0",
+ "@nextcloud/l10n": "^1.6.0",
"@nextcloud/logger": "^2.2.1",
"@nextcloud/moment": "^1.2.1",
"@nextcloud/router": "^1.2.0",
diff --git a/package.json b/package.json
index 6ac40018..665cc5d4 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,9 @@
"dependencies": {
"@nextcloud/auth": "^2.0.0",
"@nextcloud/axios": "^2.0.0",
+ "@nextcloud/dialogs": "^3.2.0",
"@nextcloud/initial-state": "^2.0.0",
+ "@nextcloud/l10n": "^1.6.0",
"@nextcloud/logger": "^2.2.1",
"@nextcloud/moment": "^1.2.1",
"@nextcloud/router": "^1.2.0",
diff --git a/src/App.vue b/src/App.vue
index b9c46e25..d1f70e76 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,8 +2,11 @@
<NcContent v-if="!serverData.setup" app-name="social" :class="{public: serverData.public}">
<NcAppNavigation v-if="!serverData.public">
<template #list>
- <NcAppNavigationItem v-for="item in menu.items" :key="item.key" :to="item.to"
- :title="item.title" :exact="true">
+ <NcAppNavigationItem v-for="item in menu.items"
+ :key="item.key"
+ :to="item.to"
+ :title="item.title"
+ :exact="true">
<template #icon>
<component :is="item.icon" />
</template>
@@ -94,27 +97,27 @@ export default {
Search,
},
mixins: [currentuserMixin],
- data: function() {
+ data() {
return {
infoHidden: false,
state: [],
cloudAddress: '',
- searchTerm: ''
+ searchTerm: '',
}
},
computed: {
- timeline: function() {
+ timeline() {
return this.$store.getters.getTimeline
},
- menu: function() {
+ menu() {
const defaultCategories = [
{
id: 'social-timeline',
icon: Home,
title: t('social', 'Home'),
to: {
- name: 'timeline'
- }
+ name: 'timeline',
+ },
},
{
id: 'social-direct-messages',
@@ -122,8 +125,8 @@ export default {
title: t('social', 'Direct messages'),
to: {
name: 'timeline',
- params: { type: 'direct' }
- }
+ params: { type: 'direct' },
+ },
},
{
id: 'social-notifications',
@@ -131,8 +134,8 @@ export default {
title: t('social', 'Notifications'),
to: {
name: 'timeline',
- params: { type: 'notifications' }
- }
+ params: { type: 'notifications' },
+ },
},
{
id: 'social-account',
@@ -140,8 +143,8 @@ export default {
title: t('social', 'Profile'),
to: {
name: 'profile',
- params: { account: this.currentUser.uid }
- }
+ params: { account: this.currentUser.uid },
+ },
},
{
id: 'social-liked',
@@ -149,8 +152,8 @@ export default {
title: t('social', 'Liked'),
to: {
name: 'timeline',
- params: { type: 'liked' }
- }
+ params: { type: 'liked' },
+ },
},
{
id: 'social-local',
@@ -158,8 +161,8 @@ export default {
title: t('social', 'Local timeline'),
to: {
name: 'timeline',
- params: { type: 'timeline' }
- }
+ params: { type: 'timeline' },
+ },
},
{
id: 'social-global',
@@ -167,22 +170,22 @@ export default {
title: t('social', 'Global timeline'),
to: {
name: 'timeline',
- params: { type: 'federated' }
- }
- }
+ params: { type: 'federated' },
+ },
+ },
]
return {
items: defaultCategories,
- loading: false
+ loading: false,
}
- }
+ },
},
watch: {
$route(to, from) {
this.searchTerm = ''
- }
+ },
},
- beforeMount: function() {
+ beforeMount() {
// importing server data into the store
this.$store.commit('setServerData', loadState('social', 'serverData'))
@@ -212,7 +215,7 @@ export default {
resetSearch() {
this.searchTerm = ''
},
- fromPushApp: function(data) {
+ fromPushApp(data) {
// FIXME: might be better to use Timeline.type() ?
let timeline = 'home'
if (this.$route.name === 'tags') {
@@ -227,8 +230,8 @@ export default {
if (data.source === 'timeline.direct' && timeline === 'direct') {
this.$store.dispatch('addToTimeline', [data.payload])
}
- }
- }
+ },
+ },
}
</script>
diff --git a/src/components/ActorAvatar.vue b/src/components/ActorAvatar.vue
index 153d00c3..50f026a8 100644
--- a/src/components/ActorAvatar.vue
+++ b/src/components/ActorAvatar.vue
@@ -21,9 +21,16 @@
-->
<template>
- <NcAvatar v-if="actor.local" :size="size" :user="actor.preferredUsername"
- :display-name="actor.account" :disable-tooltip="true" :showUserStatus="false" />
- <NcAvatar v-else :size="size" :url="avatarUrl" :showUserStatus="false"
+ <NcAvatar v-if="actor.local"
+ :size="size"
+ :user="actor.preferredUsername"
+ :display-name="actor.account"
+ :disable-tooltip="true"
+ :show-user-status="false" />
+ <NcAvatar v-else
+ :size="size"
+ :url="avatarUrl"
+ :show-user-status="false"
:disable-tooltip="true" />
</template>
@@ -34,21 +41,21 @@ import { generateUrl } from '@nextcloud/router'
export default {
name: 'ActorAvatar',
components: {
- NcAvatar
+ NcAvatar,
},
props: {
actor: { type: Object, default: () => {} },
- size: { type: Number, default: 32 }
+ size: { type: Number, default: 32 },
},
- data: function() {
+ data() {
return {
- followingText: t('social', 'Following')
+ followingText: t('social', 'Following'),
}
},
computed: {
avatarUrl() {
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
- }
- }
+ },
+ },
}
</script>
diff --git a/src/components/Composer/Composer.vue b/src/components/Composer/Composer.vue
index e8004851..34ff0591 100644
--- a/src/components/Composer/Composer.vue
+++ b/src/components/Composer/Composer.vue
@@ -25,14 +25,16 @@
<div class="new-post" data-id="">
<input id="file-upload"
ref="fileUploadInput"
- @change="handleFileChange($event)"
multiple
type="file"
tabindex="-1"
aria-hidden="true"
- class="hidden-visually">
+ class="hidden-visually"
+ @change="handleFileChange($event)">
<div class="new-post-author">
- <NcAvatar :user="currentUser.uid" :display-name="currentUser.displayName" :disable-tooltip="true"
+ <NcAvatar :user="currentUser.uid"
+ :display-name="currentUser.displayName"
+ :disable-tooltip="true"
:size="32" />
<div class="post-author">
<span class="post-author-name">
@@ -46,11 +48,12 @@
<div v-if="replyTo" class="reply-to">
<p class="reply-info">
<span>{{ t('social', 'In reply to') }}</span>
- <actor-avatar :actor="replyTo.actor_info" :size="16" />
+ <ActorAvatar :actor="replyTo.actor_info" :size="16" />
<strong>{{ replyTo.actor_info.account }}</strong>
- <NcButton type="tertiary" class="close-button"
- @click="closeReply"
- :aria-label="t('social', 'Close reply')">
+ <NcButton type="tertiary"
+ class="close-button"
+ :aria-label="t('social', 'Close reply')"
+ @click="closeReply">
<template #icon>
<Close :size="20" />
</template>
@@ -61,33 +64,42 @@
</div>
</div>
<form class="new-post-form" @submit.prevent="createPost">
- <vue-tribute :options="tributeOptions">
+ <VueTribute :options="tributeOptions">
<!-- eslint-disable-next-line vue/valid-v-model -->
- <div ref="composerInput" v-contenteditable:post.dangerousHTML="canType && !loading" class="message"
- placeholder="What would you like to share?" :class="{'icon-loading': loading}" @keyup.prevent.enter="keyup"
+ <div ref="composerInput"
+ v-contenteditable:post.dangerousHTML="canType && !loading"
+ class="message"
+ placeholder="What would you like to share?"
+ :class="{'icon-loading': loading}"
+ @keyup.prevent.enter="keyup"
@tribute-replaced="updatePostFromTribute" />
- </vue-tribute>
+ </VueTribute>
- <PreviewGrid :uploading="false" :uploadProgress="0.4" :miniatures="previewUrls" />
+ <PreviewGrid :uploading="false"
+ :upload-progress="0.4"
+ :miniatures="previewUrls"
+ @deleted="deletePreview" />
<div class="options">
- <NcButton type="tertiary"
- @click.prevent="clickImportInput"
+ <NcButton v-tooltip="t('social', 'Add attachment')"
+ type="tertiary"
:aria-label="t('social', 'Add attachment')"
- v-tooltip="t('social', 'Add attachment')">
+ @click.prevent="clickImportInput">
<template #icon>
<FileUpload :size="22" decorative title="" />
</template>
</NcButton>
<div class="new-post-form__emoji-picker">
- <NcEmojiPicker ref="emojiPicker" :search="search" :close-on-select="false"
+ <NcEmojiPicker ref="emojiPicker"
+ :search="search"
+ :close-on-select="false"
:container="container"
@select="insert">
- <NcButton type="tertiary"
+ <NcButton v-tooltip="t('social', 'Add emoji')"
+ type="tertiary"
:aria-haspopup="true"
- :aria-label="t('social', 'Add emoji')"
- v-tooltip="t('social', 'Add emoji')">
+ :aria-label="t('social', 'Add emoji')">
<template #icon>
<EmoticonOutline :size="22" decorative title="" />
</template>
@@ -96,17 +108,19 @@
</div>
<div v-click-outside="hidePopoverMenu" class="popovermenu-parent">
- <NcButton type="tertiary"
- :class="currentVisibilityIconClass"
- @click.prevent="togglePopoverMenu"
- v-tooltip="t('social', 'Visibility')" />
+ <NcButton v-tooltip="t('social', 'Visibility')"
+ type="tertiary"
+ :class="currentVisibilityIconClass"
+ @click.prevent="togglePopoverMenu" />
<div :class="{open: menuOpened}" class="popovermenu">
<NcPopoverMenu :menu="visibilityPopover" />
</div>
</div>
<div class="emptySpace" />
- <NcButton :value="currentVisibilityPostLabel" :disabled="!canPost" type="primary"
+ <NcButton :value="currentVisibilityPostLabel"
+ :disabled="!canPost"
+ type="primary"
@click.prevent="createPost">
<template #icon>
<Send title="" :size="22" decorative />
@@ -162,8 +176,8 @@ export default {
type: localStorage.getItem('social.lastPostType') || 'followers',
loading: false,
post: '',
- miniatures: [], // miniatures of images stored in postAttachments
- postAttachments: [], // The toot's attachments
+ miniatures: [], // miniatures of images stored in postAttachments
+ postAttachments: [], // The toot's attachments
previewUrls: [],
canType: true,
search: '',
@@ -173,45 +187,45 @@ export default {
collection: [
{
trigger: '@',
- lookup: function(item) {
+ lookup(item) {
return item.key + item.value
},
- menuItemTemplate: function(item) {
+ menuItemTemplate(item) {
return '<img src="' + item.original.avatar + '" /><div>'
+ '<span class="displayName">' + item.original.key + '</span>'
+ '<span class="account">' + item.original.value + '</span>'
+ '</div>'
},
- selectTemplate: function(item) {
+ selectTemplate(item) {
return '<span class="mention" contenteditable="false">'
+ '<a href="' + item.original.url + '" target="_blank"><img src="' + item.original.avatar + '" />@' + item.original.value + '</a></span>'
},
values: (text, cb) => {
- let users = []
+ const users = []
if (text.length < 1) {
cb(users)
}
this.remoteSearchAccounts(text).then((result) => {
- for (var i in result.data.result.accounts) {
- let user = result.data.result.accounts[i]
+ for (const i in result.data.result.accounts) {
+ const user = result.data.result.accounts[i]
users.push({
key: user.preferredUsername,
value: user.account,
url: user.url,
- avatar: user.local ? generateUrl(`/avatar/${user.preferredUsername}/32`) : generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`)
+ avatar: user.local ? generateUrl(`/avatar/${user.preferredUsername}/32`) : generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`),
})
}
cb(users)
})
- }
+ },
},
{
trigger: '#',
- menuItemTemplate: function(item) {
+ menuItemTemplate(item) {
return item.original.value
},
- selectTemplate: function(item) {
+ selectTemplate(item) {
let tag = ''
// item is undefined if selectTemplate is called from a noMatchTemplate menu