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;
|
||||
before_id: string;
|
||||
fetcher: any;
|
||||
myUsername: string;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController) {
|
||||
// console.log(JSON.stringify(navParams));
|
||||
|
@ -36,6 +37,13 @@ export class StreamPage {
|
|||
this.fetchPosts();
|
||||
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) {
|
||||
|
@ -142,13 +150,13 @@ export class StreamPage {
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
showQuotedPost(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();
|
||||
}
|
||||
|
||||
|
@ -194,9 +202,11 @@ export class NewPostModal {
|
|||
replyid: string;
|
||||
ptext: string;
|
||||
options: Object;
|
||||
myUsername: string;
|
||||
|
||||
constructor(public navParams: NavParams, public viewCtrl: ViewController) {
|
||||
console.log(this.navParams);
|
||||
this.myUsername = navParams.data.me;
|
||||
if (navParams.data.type === 'reply') {
|
||||
this.replyid = navParams.data.post.id;
|
||||
this.options = {replyTo: this.replyid};
|
||||
|
@ -233,7 +243,9 @@ export class NewPostModal {
|
|||
let mtext = ""
|
||||
for(var i = 0; i < mentions.length; i++) {
|
||||
let mu = mentions[i].text;
|
||||
mtext += "@" + mu + " ";
|
||||
if (mu !== this.myUsername) {
|
||||
mtext += "@" + mu + " ";
|
||||
}
|
||||
}
|
||||
if (mtext.length > 0) {
|
||||
return mtext;
|
||||
|
|
Reference in a new issue