highlight posts where you are mentioned, issue #18
This commit is contained in:
parent
aaaafa18b4
commit
ee532730d6
3 changed files with 22 additions and 3 deletions
|
@ -23,8 +23,8 @@
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<ion-card *ngFor="let post of posts">
|
<ion-card *ngFor="let post of posts" color="{{ post.you_are_mentioned ? 'mention' : '' }}">
|
||||||
<ion-item>
|
<ion-item color="{{ post.you_are_mentioned ? 'mention' : '' }}">
|
||||||
<ion-avatar item-start>
|
<ion-avatar item-start>
|
||||||
<img src="{{ post.user.content.avatar_image.link }}">
|
<img src="{{ post.user.content.avatar_image.link }}">
|
||||||
</ion-avatar>
|
</ion-avatar>
|
||||||
|
|
|
@ -68,6 +68,12 @@ export class StreamPage {
|
||||||
if (res.data[i]['repost_of']) {
|
if (res.data[i]['repost_of']) {
|
||||||
res.data[i] = 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.posts.push.apply(this.posts, res.data);
|
||||||
this.before_id = res.meta.min_id;
|
this.before_id = res.meta.min_id;
|
||||||
|
@ -93,6 +99,12 @@ export class StreamPage {
|
||||||
if (res.data[i]['repost_of']) {
|
if (res.data[i]['repost_of']) {
|
||||||
res.data[i] = 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);
|
Array.prototype.unshift.apply(this.posts, res.data);
|
||||||
this.since_id = res.meta.max_id;
|
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;
|
// 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.posts = res.data;
|
||||||
this.since_id = res.meta.max_id;
|
this.since_id = res.meta.max_id;
|
||||||
|
|
|
@ -28,7 +28,8 @@ $colors: (
|
||||||
secondary: #32db64,
|
secondary: #32db64,
|
||||||
danger: #f53d3d,
|
danger: #f53d3d,
|
||||||
light: #f4f4f4,
|
light: #f4f4f4,
|
||||||
dark: #222
|
dark: #222,
|
||||||
|
mention: #f4f4f4
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue