Skip to content

Commit

Permalink
Merge pull request #2502 from RestyaPlatform/issue/2485
Browse files Browse the repository at this point in the history
Fixes #2485: Card count duplicate, modal card share and more option text issue fixed
  • Loading branch information
S. Sivachidambaram authored Mar 20, 2019
2 parents ee57080 + 5454fdb commit 2e5e659
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion client/js/templates/modal_card_view.jst.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,10 @@
</li>
<li class="col-xs-12 divider"></li>
<li class="col-xs-12">
<p class="text-muted"> <span class="show"><%- i18next.t('Card # %s', { postProcess: 'sprintf', sprintf: [card.attributes.id] }) %></span> <span class="show"><%- i18next.t('Link to this card') %></span> </p>
<p><span class="show"><%- i18next.t('Card # %s', { postProcess: 'sprintf', sprintf: [card.attributes.id] }) %></span></p>
<form role="form">
<div class="form-group">
<span class="show"><%- i18next.t('Link to this card') %></span>
<input type="text" value="<%= window.location.origin %><%= window.location.pathname %>#/board/<%- card.attributes.board_id %>/card/<%- card.attributes.id %>" class="form-control input-sm js-select-card-url" readonly="readonly">
</div>
<% if(!_.isEmpty(IMAP_EMAIL)){ %>
Expand Down
6 changes: 3 additions & 3 deletions client/js/views/footer_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1382,10 +1382,10 @@ App.FooterView = Backbone.View.extend({
new_attachment.set('board_id', parseInt(activity.attributes.attachment.board_id));
new_attachment.set('list_id', parseInt(activity.attributes.attachment.list_id));
new_attachment.set('card_id', parseInt(activity.attributes.attachment.card_id));
self.board.attachments.add(new_attachment, {
self.board.attachments.unshift(new_attachment, {
silent: true
});
card.attachments.add(new_attachment);
card.attachments.unshift(new_attachment);
} else if (activity.attributes.type === 'move_card') {
// Getting the old list of the card
var card_old_list = self.board.lists.findWhere({
Expand Down Expand Up @@ -1758,7 +1758,7 @@ App.FooterView = Backbone.View.extend({
}
}
Auth = JSON.parse($.cookie('auth'));
if (parseInt(activity.attributes.card_id) !== 0 && activity.attributes.token !== authuser.access_token && (parseInt(Auth.user.unread_activity_id) < parseInt(activity.attributes.id))) {
if (parseInt(activity.attributes.card_id) !== 0 && activity.attributes.token !== authuser.access_token && (parseInt(Auth.user.unread_activity_id) < parseInt(activity.attributes.id) || _.isUndefined(Auth.user.unread_activity_id))) {
$('#js-card-' + activity.attributes.card_id).parent().addClass('animation');
$('#js-card-' + activity.attributes.card_id).addClass('tada-animation');
$('#js-card-' + activity.attributes.card_id).stop().animate({
Expand Down
2 changes: 0 additions & 2 deletions client/js/views/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1654,8 +1654,6 @@ App.ListView = Backbone.View.extend({
global_uuid[data.uuid] = options.temp_id;
card.set('id', data.uuid);
}
var cards_count = isNaN(self.model.attributes.card_count) ? 0 : self.model.attributes.card_count;
self.model.set('card_count', parseInt(cards_count) + 1);
if (parseInt(self.model.attributes.card_count) === 1) {
// Removing the &nbsp; in the card listing after adding card
$('#js-card-listing-' + self.model.id).html(function(i, h) {
Expand Down
5 changes: 3 additions & 2 deletions client/js/views/modal_card_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ App.ModalCardView = Backbone.View.extend({
} else if (filter === 'activity') {
filter = 'activity';
}
$('#js-card-modal-' + this.model.id).find('#js-loader-img').removeClass('hide');
self.model.activities.url = api_url + 'boards/' + self.model.attributes.board_id + '/lists/' + self.model.attributes.list_id + '/cards/' + self.model.id + '/activities.json?mode=' + filter + '&page=1';
self.model.activities.fetch({
cache: false,
Expand Down Expand Up @@ -1088,6 +1089,7 @@ App.ModalCardView = Backbone.View.extend({
} else if (filter === 'activity') {
filter = 'activity';
}
$('#js-card-modal-' + self.model.id).find('#js-loader-img').removeClass('hide');
this.model.activities.url = api_url + 'boards/' + self.model.attributes.board_id + '/lists/' + self.model.attributes.list_id + '/cards/' + self.model.id + '/activities.json?mode=' + filter + '&page=1';
this.model.activities.fetch({
cache: false,
Expand Down Expand Up @@ -2378,10 +2380,10 @@ App.ModalCardView = Backbone.View.extend({
}
var view_activity = this.$('#js-card-activities-' + self.model.id);
//view_activity.html('');
$('#js-card-modal-' + self.model.id).find('#js-loader-img').addClass('hide');
if (!_.isEmpty(this.model.activities)) {
var i = 1;
this.model.activities.each(function(activity) {
$('#js-loader-img').removeClass('hide');
if (!_.isEmpty(self.model.collection)) {
activity.cards.add(self.model.collection.models);
}
Expand All @@ -2392,7 +2394,6 @@ App.ModalCardView = Backbone.View.extend({
flag: '1'
});
view_activity.append(view.render().el);
$('#js-loader-img').addClass('hide');
i++;
});
var page_count = $('.js-load-more-block').length + 1;
Expand Down
5 changes: 4 additions & 1 deletion server/php/R/r.php
Original file line number Diff line number Diff line change
Expand Up @@ -4907,15 +4907,18 @@ function r_post($r_resource_cmd, $r_resource_vars, $r_resource_filters, $r_post)
$response['cards_labels'] = $cards_labels;
if (count($newlabel) && !count(array_diff($previous_cards_labels, $oldlabel))) {
$names = implode(",", $newlabel);
$names = preg_replace('/[ ,]+/', ', ', $names);
$comment = '##USER_NAME## added label(s) to this card ##CARD_LINK## - ' . $names;
$type = 'add_card_label';
} else if (!count($newlabel) && count(array_diff($previous_cards_labels, $oldlabel))) {
$names = implode(",", array_diff($previous_cards_labels, $oldlabel));
$names = preg_replace('/[ ,]+/', ', ', $names);
$comment = '##USER_NAME## removed label(s) to this card ##CARD_LINK## - ' . $names;
$type = 'update_card_label';
} else if (count($newlabel) && count(array_diff($previous_cards_labels, $oldlabel))) {
$deletenames = implode(",", array_diff($previous_cards_labels, $oldlabel));
$names = implode(",", $newlabel);
$names = preg_replace('/[ ,]+/', ', ', $names);
$comment = '##USER_NAME## removed the label(s) ' . ' - ' . $deletenames . ' and added the lables ' . '-' . $names . ' to this card ##CARD_LINK##';
$type = 'update_card_label';
}
Expand Down Expand Up @@ -5361,7 +5364,7 @@ function r_post($r_resource_cmd, $r_resource_vars, $r_resource_filters, $r_post)
$qry_val_arr = array(
$response['id']
);
$attachments = pg_query_params($db_lnk, 'SELECT * FROM card_attachments WHERE card_id = $1', $qry_val_arr);
$attachments = pg_query_params($db_lnk, 'SELECT * FROM card_attachments WHERE card_id = $1 ORDER BY id ASC', $qry_val_arr);
while ($attachment = pg_fetch_assoc($attachments)) {
$response['cards']['attachments'][] = $attachment;
}
Expand Down
5 changes: 4 additions & 1 deletion server/php/libs/ActivityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ public static function getActivitiesObj($obj)
$obj['foreign_id']
);
$obj['card'] = executeQuery('SELECT * FROM cards_listing WHERE id = $1', $obj_val_arr);
$obj['card']['card_attachments'] = executeQuery('SELECT * FROM card_attachments WHERE card_id = $1', $obj_val_arr);
$card_attachments = pg_query_params($db_lnk, 'SELECT * FROM card_attachments WHERE card_id = $1 ORDER BY id DESC', $obj_val_arr);
while ($card_attachment = pg_fetch_assoc($card_attachments)) {
$obj['card']['card_attachments'][] = $card_attachment;
}
if (is_plugin_enabled('r_custom_fields')) {
$obj['custom_fields'] = array();
$conditions = array(
Expand Down

0 comments on commit 2e5e659

Please sign in to comment.