Do not expose activity on every autosave

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-12-04 14:44:31 +01:00
parent 43a11327a6
commit dd104466d6
8 changed files with 144 additions and 17 deletions

View File

@@ -29,9 +29,11 @@ class Card extends RelationalEntity {
protected $title;
protected $description;
protected $descriptionPrev;
protected $stackId;
protected $type;
protected $lastModified;
protected $lastEditor;
protected $createdAt;
protected $labels;
protected $assignedUsers;
@@ -113,6 +115,7 @@ class Card extends RelationalEntity {
}
$json['duedate'] = $this->getDuedate(true);
unset($json['notified']);
unset($json['descriptionPrev']);
return $json;
}

View File

@@ -147,6 +147,11 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($sql);
}
public function findUnexposedDescriptionChances() {
$sql = 'SELECT id,title,duedate,notified,description_prev,last_editor,description from `*PREFIX*deck_cards` WHERE last_editor IS NOT NULL AND description_prev IS NOT NULL';
return $this->findEntities($sql);
}
public function delete(Entity $entity) {
// delete assigned labels
$this->labelMapper->deleteLabelAssignmentsForCard($entity->getId());

View File

@@ -41,11 +41,13 @@ class ChangeHelper {
public function __construct(
IDBConnection $db,
ICacheFactory $cacheFactory,
IRequest $request
IRequest $request,
$userId
) {
$this->db = $db;
$this->cache = $cacheFactory->createDistributed('deck_changes');
$this->request = $request;
$this->userId = $userId;
}
public function boardChanged($boardId) {
@@ -61,8 +63,8 @@ class ChangeHelper {
$etag = md5($time . microtime());
$this->cache->set(self::TYPE_CARD . '-' .$cardId, $etag);
if ($updateCard) {
$sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ? WHERE `id` = ?';
$this->db->executeUpdate($sql, [time(), $cardId]);
$sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ?, `last_editor` = ? WHERE `id` = ?';
$this->db->executeUpdate($sql, [time(), $this->userId, $cardId]);
}
$sql = 'SELECT s.board_id as id, c.stack_id as stack_id FROM `*PREFIX*deck_stacks` as s inner join `*PREFIX*deck_cards` as c ON c.stack_id = s.id WHERE c.id = ?';