Merge pull request #31 from nextcloud-gmbh/timeline

Use actor info to render timeline entries
pull/33/head
Julius Härtl 2018-11-15 17:24:08 +01:00 zatwierdzone przez GitHub
commit 25f61ef08d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 15 dodań i 12 usunięć

Wyświetl plik

@ -28,6 +28,7 @@
}, },
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.0.0", "@babel/polyfill": "^7.0.0",
"linkifyjs": "^2.1.7",
"nextcloud-axios": "^0.1.2", "nextcloud-axios": "^0.1.2",
"nextcloud-vue": "^0.4.2", "nextcloud-vue": "^0.4.2",
"uuid": "^3.3.2", "uuid": "^3.3.2",

Wyświetl plik

@ -2,24 +2,30 @@
<div class="timeline-entry"> <div class="timeline-entry">
<div class="entry-content"> <div class="entry-content">
<div class="post-avatar"> <div class="post-avatar">
<avatar :size="32" :url="item.authorAvatar" /> <avatar :size="32" :user="item.actor_info.preferredUsername" />
</div> </div>
<div class="post-content"> <div class="post-content">
<div class="post-author-wrapper"> <div class="post-author-wrapper">
<router-link :to="{ name: 'profile', params: { account: item.authorId }}"> <router-link v-if="item.actor_info.local" :to="{ name: 'profile', params: { account: item.actor_info.preferredUsername }}">
<span class="post-author">{{ item.author }}</span> <span class="post-author">{{ item.actor_info.preferredUsername }}</span>
<span class="post-author-id">{{ item.authorId }}</span> <span class="post-author-id">{{ item.actor_info.account }}</span>
</router-link> </router-link>
<a :href="item.actor_info.url" v-else>
<span class="post-author">{{ item.actor_info.preferredUsername }}</span>
<span class="post-author-id">{{ item.actor_info.account }}</span>
</a>
</div> </div>
<div class="post-message" v-html="formatedMessage" /> <div class="post-message" v-html="formatedMessage" />
<!--<pre style="height: 200px; overflow:scroll;">{{item}}</pre> //-->
</div> </div>
<div class="post-timestamp">{{ item.timestamp }}</div> <div class="post-timestamp">{{ item.published }}</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { Avatar } from 'nextcloud-vue' import { Avatar } from 'nextcloud-vue'
import linkifyStr from 'linkifyjs/string';
export default { export default {
name: 'TimelineEntry', name: 'TimelineEntry',
@ -36,9 +42,9 @@ export default {
}, },
computed: { computed: {
formatedMessage: function() { formatedMessage: function() {
let message = this.item.message let message = this.item.content
message = message.replace(/(?:\r\n|\r|\n)/g, '<br />') message = message.replace(/(?:\r\n|\r|\n)/g, '<br />')
return message return message.linkify()
} }
} }
} }

Wyświetl plik

@ -27,11 +27,7 @@
<div class="submitLoading icon-loading-small hidden" /> <div class="submitLoading icon-loading-small hidden" />
</form> </form>
</div> </div>
<!--<timeline-entry v-for="entry in timeline" :item="entry" :key="entry.id" /> //--> <timeline-entry v-for="entry in timeline" :item="entry" :key="entry.id" />
<div v-for="entry in timeline">
{{entry.content}}
<pre style="height: 200px; overflow:scroll;">{{entry}}</pre>
</div>
<infinite-loading @infinite="infiniteHandler" ref="infiniteLoading"> <infinite-loading @infinite="infiniteHandler" ref="infiniteLoading">
<div slot="spinner"><div class="icon-loading"></div></div> <div slot="spinner"><div class="icon-loading"></div></div>
<div slot="no-more"><div class="list-end"></div></div> <div slot="no-more"><div class="list-end"></div></div>