Commit ff63f69d authored by Mark Harding's avatar Mark Harding Committed by Mark Harding
Browse files

Merge branch 'fix/modal-pager-sync' into 'production'

Modal pager fixes

See merge request !749
parent 225dc6f3
Loading
Loading
Loading
Loading
+18 −9
Original line number Original line Diff line number Diff line
@@ -173,7 +173,7 @@ export class HorizontalFeedService {


    return {
    return {
      index: index,
      index: index,
      entity: this.entities.setCastToActivities(true).single(entity.urn),
      entity: this.entities.single(entity.urn),
    };
    };
  }
  }


@@ -289,14 +289,15 @@ export class HorizontalFeedService {
   */
   */
  protected async _fetchContainer() {
  protected async _fetchContainer() {
    const baseEntity = this.baseEntity;
    const baseEntity = this.baseEntity;
    const baseEntityTimestamp = baseEntity.time_created * 1000;
    const guid = baseEntity.container_guid || baseEntity.owner_guid;
    const guid = baseEntity.container_guid || baseEntity.owner_guid;
    const endpoint = `api/v2/feeds/container/${guid}/all`;
    const endpoint = `api/v2/feeds/container/${guid}/all`;


    const params = {
    const params = {
      sync: 1,
      sync: 1,
      as_activities: 1,
      force_public: 1,
      force_public: 1,
      limit: this.limit,
      limit: this.limit,
      from_timestamp: baseEntityTimestamp,
    };
    };


    // TODO: Make this less convoluted
    // TODO: Make this less convoluted
@@ -305,22 +306,28 @@ export class HorizontalFeedService {
        ? this._fetchFromServer(endpoint, {
        ? this._fetchFromServer(endpoint, {
            ...params,
            ...params,
            reverse_sort: 1,
            reverse_sort: 1,
            from_timestamp: baseEntity.time_created * 1000 + 1,
          })
          })
        : Promise.resolve(null),
        : Promise.resolve(null),
      this.pools.next.moreData
      this.pools.next.moreData
        ? this._fetchFromServer(endpoint, {
        ? this._fetchFromServer(endpoint, params)
            ...params,
            from_timestamp: baseEntity.time_created * 1000 - 1,
          })
        : Promise.resolve(null),
        : Promise.resolve(null),
    ]);
    ]);


    const baseGuids = [
      this.baseEntity.guid,
      this.baseEntity.entity_guid,
      this.baseEntity.remind_object && this.baseEntity.remind_object.guid,
      this.baseEntity.remind_object &&
        this.baseEntity.remind_object.entity_guid,
    ].filter(Boolean);

    let changed = false;
    let changed = false;


    if (prev !== null) {
    if (prev !== null) {
      this.pools.prev = {
      this.pools.prev = {
        entities: prev,
        entities: prev.filter(
          entity => entity.guid && !baseGuids.includes(entity.guid)
        ),
        moreData: false,
        moreData: false,
      };
      };


@@ -329,7 +336,9 @@ export class HorizontalFeedService {


    if (next !== null) {
    if (next !== null) {
      this.pools.next = {
      this.pools.next = {
        entities: next,
        entities: next.filter(
          entity => entity.guid && !baseGuids.includes(entity.guid)
        ),
        moreData: false,
        moreData: false,
      };
      };


+4 −0
Original line number Original line Diff line number Diff line
@@ -175,6 +175,10 @@ m-overlay-modal {
    vertical-align: top;
    vertical-align: top;
  }
  }


  .m-mediaModal__media--image {
    object-fit: contain;
  }

  &.m-mediaModal__mediaWrapper--blog {
  &.m-mediaModal__mediaWrapper--blog {
    overflow-x: hidden;
    overflow-x: hidden;
    overflow-y: scroll;
    overflow-y: scroll;
+4 −2
Original line number Original line Diff line number Diff line
@@ -713,8 +713,10 @@ export class MediaModalComponent implements OnInit, OnDestroy {
  // Dismiss modal when backdrop is clicked and modal is open
  // Dismiss modal when backdrop is clicked and modal is open
  @HostListener('document:click', ['$event'])
  @HostListener('document:click', ['$event'])
  clickedBackdrop($event) {
  clickedBackdrop($event) {
    if ($event) {
      $event.preventDefault();
      $event.preventDefault();
      $event.stopPropagation();
      $event.stopPropagation();
    }
    if (this.isOpen) {
    if (this.isOpen) {
      this.overlayModal.dismiss();
      this.overlayModal.dismiss();
    }
    }