From ee532730d609325d88a36ffaf9340ee4efbe0874 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 25 Jun 2017 14:01:43 -0700 Subject: [PATCH] highlight posts where you are mentioned, issue #18 --- src/pages/stream/stream.html | 4 ++-- src/pages/stream/stream.ts | 18 ++++++++++++++++++ src/theme/variables.scss | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/pages/stream/stream.html b/src/pages/stream/stream.html index b128d94..c1dcdde 100644 --- a/src/pages/stream/stream.html +++ b/src/pages/stream/stream.html @@ -23,8 +23,8 @@ - - + + diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index 078cbe3..63f1c74 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -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; diff --git a/src/theme/variables.scss b/src/theme/variables.scss index b95dd52..86df848 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -28,7 +28,8 @@ $colors: ( secondary: #32db64, danger: #f53d3d, light: #f4f4f4, - dark: #222 + dark: #222, + mention: #f4f4f4 );