Skip to content

Commit

Permalink
(chore): change conversation descriptor to tabId
Browse files Browse the repository at this point in the history
Conflicts:

	plugins/Messenger/app/conversation/conversation.ts
  • Loading branch information
edgebal authored and markharding committed Aug 22, 2016
1 parent 59e363d commit 59e096a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugins/Messenger/Controllers/api/v1/conversations.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function post($pages)
$emit = $response['message'];
unset($emit['message']);

$emit['localClientId'] = isset($_POST['localClientId']) ? $_POST['localClientId'] : null;
$emit['tabId'] = isset($_POST['tabId']) ? $_POST['tabId'] : null;

try {
(new Sockets\Events())
Expand Down
2 changes: 1 addition & 1 deletion plugins/Messenger/Controllers/api/v2/conversations.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function post($pages)
$emit = $response['message'];
unset($emit['message']);

$emit['localClientId'] = isset($_POST['localClientId']) ? $_POST['localClientId'] : null;
$emit['tabId'] = isset($_POST['tabId']) ? $_POST['tabId'] : null;

try {
(new Sockets\Events())
Expand Down
16 changes: 8 additions & 8 deletions plugins/Messenger/app/conversation/conversation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ElementRef, ChangeDetectorRef, EventEmitter } from '@angular/core';
import { Component, ElementRef, ChangeDetectorRef, EventEmitter, Renderer, ViewChild } from '@angular/core';
import { Router, RouteParams, RouterLink } from "@angular/router-deprecated";

import { Client } from '../../../services/api';
Expand Down Expand Up @@ -43,7 +43,7 @@ export class MessengerConversation {
dockpanes = MessengerConversationDockpanesFactory.build();
sounds = new MessengerSounds();

localClientId: string;
tabId: string;

guid : string;
conversation;
Expand Down Expand Up @@ -76,8 +76,8 @@ export class MessengerConversation {
blocked: boolean = false;
unavailable: boolean = false;

constructor(public client: Client, public sockets: SocketsService, public cd: ChangeDetectorRef) {
this.buildLocalClientId();
constructor(public client: Client, public sockets: SocketsService, public cd: ChangeDetectorRef, private renderer: Renderer) {
this.buildTabId();
}

ngOnInit(){
Expand Down Expand Up @@ -163,7 +163,7 @@ export class MessengerConversation {
let fromSelf = false;

if (this.session.getLoggedInUser().guid == message.ownerObj.guid) {
if (this.localClientId == message.localClientId) {
if (this.tabId == message.tabId) {
return;
}

Expand Down Expand Up @@ -243,7 +243,7 @@ export class MessengerConversation {
this.client.post('api/v2/conversations/' + this.conversation.guid, {
message: this.message,
encrypt: true,
localClientId: this.localClientId
tabId: this.tabId
})
.then((response: any) => {
if (response.message) {
Expand Down Expand Up @@ -344,7 +344,7 @@ export class MessengerConversation {
this.focused = false;
}

buildLocalClientId() {
this.localClientId = (Math.random() + 1).toString(36).substring(7);
buildTabId() {
this.tabId = (Math.random() + 1).toString(36).substring(7);
}
}

0 comments on commit 59e096a

Please sign in to comment.