Skip to content

Commit

Permalink
Fixed #422 - My Task File Download Issue (#424)
Browse files Browse the repository at this point in the history
* Fixed #422 - My Task File Download Issue

* Fixed downloading issue for co-workers

* New file_project_id support for pm-file component

* Fixed file download issue for comments

* Fixed file download issues for other tasks

* Remove some unused lines and formatted code
  • Loading branch information
ManiruzzamanAkash authored Oct 6, 2021
1 parent 659b6bd commit 1dca272
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 40 deletions.
24 changes: 8 additions & 16 deletions views/assets/src/components/common/comments.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div class="pm-task-comment-wrap">

<!-- <div class="discuss-text pm-h2">{{ __( 'Discussion', 'wedevs-project-manager') }}</div> -->

<div class="comment-content">
Expand All @@ -12,14 +11,14 @@
<a :href="myTaskRedirect( comment.creator.data.id )" :title="comment.creator.data.display_name">
<img :alt="comment.creator.data.display_name" :src="comment.creator.data.avatar_url" class="avatar avatar-96 photo" height="96" width="96"></a>
</div>

<div v-if="!comment.edit_mode" class="author-date">
<span class="pm-author">
<a :href="myTaskRedirect( comment.creator.data.id )" :title="comment.creator.data.display_name">
{{ ucfirst(comment.creator.data.display_name) }}
</a>
</span>

<span class="pm-date">
<time :datetime="dateISO8601Format( comment.created_at.datetime )" :title="getFullDate( comment.created_at.date+' '+comment.created_at.time )">{{ relativeDate(comment.created_at.datetime) }}</time>
</span>
Expand All @@ -42,19 +41,16 @@
</ul>
</div>
</div>

</div>


<div v-if="!comment.edit_mode" class="pm-comment-content">

<div v-html="comment.content"></div>
<ul class="pm-attachments" v-if="comment.files.data.length">
<li v-for="file in comment.files.data" :key="file.id">
<pm-file :file="file" />
<pm-file :file="file" :file_project_id="comment.project_id" />
</li>
</ul>

</div>

<transition name="slide" v-if="can_edit_comment(comment)" >
Expand All @@ -73,10 +69,10 @@
</div>
<div class="comment-field">
<div @click.prevent="showHideNewCommentField()" v-if="!commentFormMeta.activeNewCommentField" class="comment-field-text pm-light-font">{{ __( 'Add a comment', 'wedevs-project-manager' ) }}</div>
<task-comment-form
v-if="commentFormMeta.activeNewCommentField"
:task="commentable"
:comment="{}"
<task-comment-form
v-if="commentFormMeta.activeNewCommentField"
:task="commentable"
:comment="{}"
:comments="comments"
:commentFormMeta="commentFormMeta">
</task-comment-form>
Expand Down Expand Up @@ -339,7 +335,7 @@

<script>
import comment_form from './comment-form.vue';
export default {
// Get passing data for this component.
props: {
Expand Down Expand Up @@ -369,10 +365,6 @@
},
created () {
// this.comments.forEach(function(comment) {
// pm.Vue.set(comment, 'actionMode', false);
// });
window.addEventListener('click', this.windowActivity);
},
Expand Down
33 changes: 11 additions & 22 deletions views/assets/src/components/common/pm-file.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<template>

<div class="pm-file">
<a v-if="isVideo" v-pm-pretty-photo class="pm-colorbox-img pm-video" :href="file.url + '?iframe=true'" :title="file.name" target="_blank" rel="prettyPhoto">
<img class="pm-content-img-size" :src="file.thumb" :alt="file.name" :title="file.name">
Expand All @@ -19,23 +18,24 @@
<img v-if="!file.absoluteUrl" class="pm-content-img-size" :src="file.thumb" :alt="file.name" :title="file.name">
</a>
</div>

</template>


<script>
export default {
props: {
file: {
required: true,
type: Object,
}
},
data() {
return {
required : true,
type : Object,
},
file_project_id: {
required : false,
type : Number
}
},
computed: {
isPrettyPhoto () {
var photo = [];
Expand All @@ -51,7 +51,7 @@ export default {
return false;
}
},
isVideo () {
if (typeof this.file.mime_type !== 'undefined' ) {
return this.file.mime_type.split("/").indexOf('video') !== -1;
Expand All @@ -75,23 +75,12 @@ export default {
},
projectId () {
if ( this.file.fileable ) {
if ( typeof this.file.fileable !== 'undefined' && this.file.fileable.project_id !== null ) {
return this.file.fileable.project_id;
}
return this.project_id;
}
},
methods: {
check(){
//console.log(this.file.mime_type);
return this.project_id > 0 ? this.project_id : this.file_project_id;
}
}
}
</script>


<style lang="css">
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div v-html="comment.content"></div>
<ul class="pm-attachments" v-if="comment.files.data.length">
<li v-for="file in comment.files.data" :key="file.id">
<pm-file :file="file" />
<pm-file :file="file" :file_project_id="comment.project_id" />
</li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div v-html="comment.content"></div>
<ul class="pm-attachments" v-if="comment.files.data.length">
<li v-for="file in comment.files.data" :key="file.id">
<pm-file :file="file" />
<pm-file :file="file" :file_project_id="comment.project_id" />
</li>
</ul>

Expand Down

0 comments on commit 1dca272

Please sign in to comment.