diff options
| -rw-r--r-- | src/components/attachment/attachment.vue | 2 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 1 | ||||
| -rw-r--r-- | src/components/user_card_content/user_card_content.vue | 4 | ||||
| -rw-r--r-- | src/components/user_finder/user_finder.js | 12 | ||||
| -rw-r--r-- | src/components/user_finder/user_finder.vue | 20 | ||||
| -rw-r--r-- | static/font/css/animation.css | 7 | ||||
| -rw-r--r-- | static/timeago.json | 2 | ||||
| -rw-r--r-- | test/unit/specs/modules/statuses.spec.js | 36 |
8 files changed, 77 insertions, 7 deletions
diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index d45a6825..870ee233 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -55,6 +55,7 @@ background: rgba(230,230,230,0.6); border-radius: 5px; font-weight: bold; + z-index: 4; } video { @@ -62,6 +63,7 @@ border: 1px solid; border-radius: 5px; width: 100%; + z-index: 0; } audio { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index ec479215..b46fbf3a 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -143,6 +143,7 @@ .icon-cancel { cursor: pointer; + z-index: 4; } .autocomplete-panel { diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index e4e3394e..baa71cd0 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -2,7 +2,7 @@ <div id="heading" class="profile-panel-background" :style="headingStyle"> <div class="panel-heading text-center"> <div class='user-info'> - <router-link to='/user-settings' style="float: right;" v-if="!isOtherUser"> + <router-link to='/user-settings' style="float: right; margin-top:16px;" v-if="!isOtherUser"> <i class="icon-cog usersettings"></i> </router-link> <div class='container'> @@ -47,7 +47,7 @@ </div> <div class="panel-body profile-panel-body" :style="bodyStyle"> <div class="user-counts"> - <div class="user-count base04"> + <div class="user-count"> <a href="#" v-on:click.prevent="setProfileView('statuses')" v-if="switcher"><h5 class="base05">Statuses</h5></a> <h5 v-else>Statuses</h5> <span class="base05">{{user.statuses_count}} <br><span class="dailyAvg">{{dailyAvg}} per day</span></span> diff --git a/src/components/user_finder/user_finder.js b/src/components/user_finder/user_finder.js index 03205382..abd40d51 100644 --- a/src/components/user_finder/user_finder.js +++ b/src/components/user_finder/user_finder.js @@ -1,20 +1,30 @@ const UserFinder = { data: () => ({ username: undefined, - hidden: true + hidden: true, + error: false, + loading: false }), methods: { findUser (username) { + this.loading = true this.$store.state.api.backendInteractor.externalProfile(username) .then((user) => { + this.loading = false + this.hidden = true if (!user.error) { this.$store.commit('addNewUsers', [user]) this.$router.push({name: 'user-profile', params: {id: user.id}}) + } else { + this.error = true } }) }, toggleHidden () { this.hidden = !this.hidden + }, + dismissError () { + this.error = false } } } diff --git a/src/components/user_finder/user_finder.vue b/src/components/user_finder/user_finder.vue index c23d8ee0..2ca476fa 100644 --- a/src/components/user_finder/user_finder.vue +++ b/src/components/user_finder/user_finder.vue @@ -1,8 +1,15 @@ <template> - <a href="#" v-if="hidden"><i class="icon-user-plus user-finder-icon" @click.prevent="toggleHidden"/></a> - <span v-else> - <input class="user-finder-input base03-border" @keyup.enter="findUser(username)" v-model="username" placeholder="Find user" id="user-finder-input" type="text"/> + <span> + <span class="finder-error base05" v-if="error"> + <i class="icon-cancel user-finder-icon" @click="dismissError"/> + Error fetching user + </span> + <i class="icon-spin4 user-finder-icon animate-spin-slow" v-if="loading" /> + <a href="#" v-if="hidden"><i class="icon-user-plus user-finder-icon" @click.prevent="toggleHidden"/></a> + <span v-else> + <input class="user-finder-input base03-border" @keyup.enter="findUser(username)" v-model="username" placeholder="Find user" id="user-finder-input" type="text"/> <i class="icon-cancel user-finder-icon" @click="toggleHidden"/> + </span> </span> </template> @@ -20,4 +27,11 @@ border-radius: 5px; padding: 0.1em 0.2em 0.2em 0.2em; } + + .finder-error { + background-color: rgba(255, 48, 16, 0.65); + margin: 0.35em; + border-radius: 5px; + padding: 0.25em; + } </style> diff --git a/static/font/css/animation.css b/static/font/css/animation.css index ac5a9562..c8cfc252 100644 --- a/static/font/css/animation.css +++ b/static/font/css/animation.css @@ -8,6 +8,13 @@ animation: spin 2s infinite linear; display: inline-block; } +.animate-spin-slow { + -moz-animation: spin 4s infinite linear; + -o-animation: spin 4s infinite linear; + -webkit-animation: spin 4s infinite linear; + animation: spin 4s infinite linear; + display: inline-block; +} @-moz-keyframes spin { 0% { -moz-transform: rotate(0deg); diff --git a/static/timeago.json b/static/timeago.json index b6f669c2..073ece16 100644 --- a/static/timeago.json +++ b/static/timeago.json @@ -5,6 +5,6 @@ ["%sh", "%sh"], ["%sd", "%sd"], ["%sw", "%sw"], - ["%sm", "%sm"], + ["%smo", "%smo"], ["%sy", "%sy"] ] diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js index d25cc108..372d1aaa 100644 --- a/test/unit/specs/modules/statuses.spec.js +++ b/test/unit/specs/modules/statuses.spec.js @@ -386,5 +386,41 @@ describe('The Statuses module', () => { expect(state.notifications).to.have.length(1) }) + + it('adds a notification when the user is followed', () => { + const state = cloneDeep(defaultState) + const user = {id: 1, screen_name: 'b'} + const follower = {id: 2, screen_name: 'a'} + + const follow = { + id: 3, + is_post_verb: false, + activity_type: 'follow', + text: 'a started following b', + user: follower + } + + mutations.addNewStatuses(state, { statuses: [follow], showImmediately: true, timeline: 'public', user }) + + expect(state.notifications).to.have.length(1) + }) + + it('does not add a notification when an other user is followed', () => { + const state = cloneDeep(defaultState) + const user = {id: 1, screen_name: 'b'} + const follower = {id: 2, screen_name: 'a'} + + const follow = { + id: 3, + is_post_verb: false, + activity_type: 'follow', + text: 'a started following b@shitposter.club', + user: follower + } + + mutations.addNewStatuses(state, { statuses: [follow], showImmediately: true, timeline: 'public', user }) + + expect(state.notifications).to.have.length(0) + }) }) }) |
