diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2019-09-15 10:19:05 +0200 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-09-25 14:07:24 +0200 |
commit | 9920fb13fe7aa9d439c8656c1b909845bd906be7 (patch) | |
tree | 678e8a9ed8c0ee7d0f03dec6fd65e06924f586a0 /src | |
parent | 83d045e5fa081114a9b234b46de9a5fd76a136e1 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/TimelineEntry.vue | 22 | ||||
-rw-r--r-- | src/logger.js | 28 |
2 files changed, 48 insertions, 2 deletions
diff --git a/src/components/TimelineEntry.vue b/src/components/TimelineEntry.vue index fc0c57c5..ca50189d 100644 --- a/src/components/TimelineEntry.vue +++ b/src/components/TimelineEntry.vue @@ -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, diff --git a/src/logger.js b/src/logger.js new file mode 100644 index 00000000..3b159426 --- /dev/null +++ b/src/logger.js @@ -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() |