Clicking on an external post or announce opens the corresponding

post in another window

Also, implements nextcloud-logger in TimelineEntry.vue

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
feature/noid/sql-rewrite-0929
Cyrille Bollu 2019-09-15 10:19:05 +02:00 zatwierdzone przez Maxence Lange
rodzic 83d045e5fa
commit 9920fb13fe
2 zmienionych plików z 48 dodań i 2 usunięć

Wyświetl plik

@ -30,6 +30,7 @@
</template>
<script>
import Logger from '../logger'
import TimelinePost from './TimelinePost.vue'
export default {
@ -95,12 +96,29 @@ export default {
},
methods: {
getSinglePostTimeline(e) {
// Do not call the single-post view when clicking on a link, a post attachment miniature or the post's author
Logger.debug('Clicked on post', { post: this.item })
// Do not call the single-post view when clicking on a link, a post attachment miniature or the post's author
if (e.target.tagName === 'A' || e.target.tagName === 'IMG' || e.target.className.startsWith('post-author')) {
Logger.debug('will not call single-post', { event: e })
return
}
// Display external posts
if (!this.item.local) {
if (this.item.type === 'Note') {
window.open(this.item.id)
} else if (this.item.type === 'Announce') {
window.open(this.item.object)
} else {
Logger.warn("Don't know what to do with posts of type " + this.item.type, { post: this.item })
}
return
}
// Display internal posts
this.$router.push({ name: 'single-post',
params: {
id: this.item.id,

28
src/logger.js 100644
Wyświetl plik

@ -0,0 +1,28 @@
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { getLoggerBuilder } from 'nextcloud-logger'
import { getCurrentUser } from 'nextcloud-auth'
export default getLoggerBuilder()
.setApp('social')
.setUid(getCurrentUser().uid)
.build()