highlight posts where you are mentioned, issue #18

This commit is contained in:
Morgan McMillian 2017-06-25 14:01:43 -07:00
parent aaaafa18b4
commit ee532730d6
3 changed files with 22 additions and 3 deletions

View file

@ -23,8 +23,8 @@
</ion-refresher>
<ion-list>
<ion-card *ngFor="let post of posts">
<ion-item>
<ion-card *ngFor="let post of posts" color="{{ post.you_are_mentioned ? 'mention' : '' }}">
<ion-item color="{{ post.you_are_mentioned ? 'mention' : '' }}">
<ion-avatar item-start>
<img src="{{ post.user.content.avatar_image.link }}">
</ion-avatar>

View file

@ -68,6 +68,12 @@ export class StreamPage {
if (res.data[i]['repost_of']) {
res.data[i] = res.data[i]['repost_of']
}
for (var j = 0; j < res.data[i]['content']['entities']['mentions'].length; j++) {
var men = res.data[i]['content']['entities']['mentions'][j]['text'];
if (this.myUsername === men) {
res.data[i]['you_are_mentioned'] = true;
}
}
}
this.posts.push.apply(this.posts, res.data);
this.before_id = res.meta.min_id;
@ -93,6 +99,12 @@ export class StreamPage {
if (res.data[i]['repost_of']) {
res.data[i] = res.data[i]['repost_of']
}
for (var j = 0; j < res.data[i]['content']['entities']['mentions'].length; j++) {
var men = res.data[i]['content']['entities']['mentions'][j]['text'];
if (this.myUsername === men) {
res.data[i]['you_are_mentioned'] = true;
}
}
}
Array.prototype.unshift.apply(this.posts, res.data);
this.since_id = res.meta.max_id;
@ -116,6 +128,12 @@ export class StreamPage {
}
// res.data[i]['reposted_by_string'] = "Reposted by: " + reposted_by_string;
}
for (var j = 0; j < res.data[i]['content']['entities']['mentions'].length; j++) {
var men = res.data[i]['content']['entities']['mentions'][j]['text'];
if (this.myUsername === men) {
res.data[i]['you_are_mentioned'] = true;
}
}
}
this.posts = res.data;
this.since_id = res.meta.max_id;

View file

@ -28,7 +28,8 @@ $colors: (
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
dark: #222,
mention: #f4f4f4
);