mirror of
https://github.com/wekan/wekan.git
synced 2026-02-02 22:51:47 +01:00
Attachment upload from card done, need to fix download link
This commit is contained in:
parent
05c53ca01d
commit
4dcdec0084
9 changed files with 49 additions and 27 deletions
|
|
@ -4,7 +4,7 @@ Attachments = new FilesCollection({
|
|||
storagePath: storagePath(),
|
||||
debug: true, // FIXME: Remove debug mode
|
||||
collectionName: 'attachments2',
|
||||
allowClientCode: false, // Disallow remove files from Client
|
||||
allowClientCode: true, // FIXME: Permissions
|
||||
});
|
||||
|
||||
if (Meteor.isServer) {
|
||||
|
|
@ -15,11 +15,11 @@ if (Meteor.isServer) {
|
|||
// TODO: Permission related
|
||||
// TODO: Add Activity update
|
||||
// TODO: publish and subscribe
|
||||
// Meteor.publish('files.attachments.all', function () {
|
||||
// return Attachments.find().cursor;
|
||||
// });
|
||||
Meteor.publish('attachments', function() {
|
||||
return Attachments.find().cursor;
|
||||
});
|
||||
} else {
|
||||
// Meteor.subscribe('files.attachments.all');
|
||||
Meteor.subscribe('attachments');
|
||||
}
|
||||
|
||||
// ---------- Deprecated fallback ---------- //
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ Cards.helpers({
|
|||
|
||||
// Copy attachments
|
||||
oldCard.attachments().forEach(att => {
|
||||
att.cardId = _id;
|
||||
att.meta.cardId = _id;
|
||||
delete att._id;
|
||||
return Attachments.insert(att);
|
||||
});
|
||||
|
|
@ -456,14 +456,16 @@ Cards.helpers({
|
|||
attachments() {
|
||||
if (this.isLinkedCard()) {
|
||||
return Attachments.find(
|
||||
{ cardId: this.linkedId },
|
||||
{ 'meta.cardId': this.linkedId },
|
||||
{ sort: { uploadedAt: -1 } },
|
||||
);
|
||||
} else {
|
||||
return Attachments.find(
|
||||
{ cardId: this._id },
|
||||
const ret = Attachments.find(
|
||||
{ 'meta.cardId': this._id },
|
||||
{ sort: { uploadedAt: -1 } },
|
||||
);
|
||||
if (ret.first()) console.log('link', Attachments.link(ret.first()));
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -471,7 +473,7 @@ Cards.helpers({
|
|||
const cover = Attachments.findOne(this.coverId);
|
||||
// if we return a cover before it is fully stored, we will get errors when we try to display it
|
||||
// todo XXX we could return a default "upload pending" image in the meantime?
|
||||
return cover && cover.url() && cover;
|
||||
return cover && cover.link();
|
||||
},
|
||||
|
||||
checklists() {
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ export class Exporter {
|
|||
readStream.pipe(tmpWriteable);
|
||||
};
|
||||
const getBase64DataSync = Meteor.wrapAsync(getBase64Data);
|
||||
result.attachments = Attachments.find(byBoard)
|
||||
result.attachments = Attachments.find({ 'meta.boardId': byBoard.boardId })
|
||||
.fetch()
|
||||
.map(attachment => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ export class TrelloCreator {
|
|||
// so we make it server only, and let UI catch up once it is done, forget about latency comp.
|
||||
const self = this;
|
||||
if (Meteor.isServer) {
|
||||
// FIXME: Change to new model
|
||||
file.attachData(att.url, function(error) {
|
||||
file.boardId = boardId;
|
||||
file.cardId = cardId;
|
||||
|
|
|
|||
|
|
@ -415,6 +415,7 @@ export class WekanCreator {
|
|||
const self = this;
|
||||
if (Meteor.isServer) {
|
||||
if (att.url) {
|
||||
// FIXME: Change to new file library
|
||||
file.attachData(att.url, function(error) {
|
||||
file.boardId = boardId;
|
||||
file.cardId = cardId;
|
||||
|
|
@ -440,6 +441,7 @@ export class WekanCreator {
|
|||
}
|
||||
});
|
||||
} else if (att.file) {
|
||||
// FIXME: Change to new file library
|
||||
file.attachData(
|
||||
new Buffer(att.file, 'base64'),
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue