filter self from reply all issue #15
This commit is contained in:
parent
357776e0f3
commit
e7e2723e73
1 changed files with 15 additions and 3 deletions
|
@ -21,6 +21,7 @@ export class StreamPage {
|
||||||
since_id: string;
|
since_id: string;
|
||||||
before_id: string;
|
before_id: string;
|
||||||
fetcher: any;
|
fetcher: any;
|
||||||
|
myUsername: string;
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController) {
|
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController) {
|
||||||
// console.log(JSON.stringify(navParams));
|
// console.log(JSON.stringify(navParams));
|
||||||
|
@ -36,6 +37,13 @@ export class StreamPage {
|
||||||
this.fetchPosts();
|
this.fetchPosts();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
pnut.user('me').then(res => {
|
||||||
|
this.myUsername = res.data.username;
|
||||||
|
console.log('-- check --');
|
||||||
|
console.log(this.myUsername);
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchOlderPosts(infiniteScroll) {
|
fetchOlderPosts(infiniteScroll) {
|
||||||
|
@ -142,13 +150,13 @@ export class StreamPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
showReplyPost(postData) {
|
showReplyPost(postData) {
|
||||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'reply', post: postData});
|
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'reply', post: postData, me: this.myUsername});
|
||||||
newPostModal.present();
|
newPostModal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
showQuotedPost(postData) {
|
showQuotedPost(postData) {
|
||||||
console.log(postData);
|
console.log(postData);
|
||||||
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'quote', post: postData});
|
let newPostModal = this.modalCtrl.create(NewPostModal, {type: 'quote', post: postData, me: this.myUsername});
|
||||||
newPostModal.present();
|
newPostModal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,9 +202,11 @@ export class NewPostModal {
|
||||||
replyid: string;
|
replyid: string;
|
||||||
ptext: string;
|
ptext: string;
|
||||||
options: Object;
|
options: Object;
|
||||||
|
myUsername: string;
|
||||||
|
|
||||||
constructor(public navParams: NavParams, public viewCtrl: ViewController) {
|
constructor(public navParams: NavParams, public viewCtrl: ViewController) {
|
||||||
console.log(this.navParams);
|
console.log(this.navParams);
|
||||||
|
this.myUsername = navParams.data.me;
|
||||||
if (navParams.data.type === 'reply') {
|
if (navParams.data.type === 'reply') {
|
||||||
this.replyid = navParams.data.post.id;
|
this.replyid = navParams.data.post.id;
|
||||||
this.options = {replyTo: this.replyid};
|
this.options = {replyTo: this.replyid};
|
||||||
|
@ -233,7 +243,9 @@ export class NewPostModal {
|
||||||
let mtext = ""
|
let mtext = ""
|
||||||
for(var i = 0; i < mentions.length; i++) {
|
for(var i = 0; i < mentions.length; i++) {
|
||||||
let mu = mentions[i].text;
|
let mu = mentions[i].text;
|
||||||
mtext += "@" + mu + " ";
|
if (mu !== this.myUsername) {
|
||||||
|
mtext += "@" + mu + " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mtext.length > 0) {
|
if (mtext.length > 0) {
|
||||||
return mtext;
|
return mtext;
|
||||||
|
|
Reference in a new issue