mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
Tag document view activity with source/referrer
This commit is contained in:
parent
663ec23c75
commit
c9e429ea1a
3 changed files with 35 additions and 4 deletions
|
@ -20,9 +20,13 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
|||
folderService: service('folder'),
|
||||
userService: service('user'),
|
||||
|
||||
beforeModel() {
|
||||
beforeModel(transition) {
|
||||
// Note the source that sent user to this document.
|
||||
let source = transition.queryParams.source;
|
||||
if (is.null(source) || is.undefined(source)) source = "";
|
||||
|
||||
return new EmberPromise((resolve) => {
|
||||
this.get('documentService').fetchPages(this.paramsFor('document').document_id, this.get('session.user.id')).then((data) => {
|
||||
this.get('documentService').fetchPages(this.paramsFor('document').document_id, this.get('session.user.id'), source).then((data) => {
|
||||
this.set('pages', data);
|
||||
resolve();
|
||||
});
|
||||
|
|
|
@ -375,7 +375,9 @@ export default Service.extend({
|
|||
// This method bulk fetches data to reduce network chatter.
|
||||
// We produce a bunch of calculated boolean's for UI display purposes
|
||||
// that can tell us quickly about pending changes for UI display.
|
||||
fetchPages(documentId, currentUserId) {
|
||||
|
||||
// Source - optional identifier of (document) referrer.
|
||||
fetchPages(documentId, currentUserId, source) {
|
||||
let constants = this.get('constants');
|
||||
let changePending = false;
|
||||
let changeAwaitingReview = false;
|
||||
|
@ -384,7 +386,7 @@ export default Service.extend({
|
|||
let userHasChangeAwaitingReview = false;
|
||||
let userHasChangeRejected = false;
|
||||
|
||||
return this.get('ajax').request(`fetch/page/${documentId}`, {
|
||||
return this.get('ajax').request(`fetch/page/${documentId}?source=${source}`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
let data = A([]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue