From a2e8b706b861a6232cc7c81644110492b7d9bf06 Mon Sep 17 00:00:00 2001 From: githubjeka Date: Fri, 5 May 2017 09:55:44 +0300 Subject: [PATCH] Enh: Remove pin/unpin success flash message --- .../stream/resources/js/humhub.stream.js | 22 +++++----- .../codeception/acceptance/StreamCest.php | 44 +++++++++---------- protected/humhub/widgets/CoreJsConfig.php | 2 - 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/protected/humhub/modules/stream/resources/js/humhub.stream.js b/protected/humhub/modules/stream/resources/js/humhub.stream.js index 46667414dc..12ffbee810 100644 --- a/protected/humhub/modules/stream/resources/js/humhub.stream.js +++ b/protected/humhub/modules/stream/resources/js/humhub.stream.js @@ -99,7 +99,7 @@ humhub.module('stream', function (module, require, $) { var that = this; var stream = this.stream(); - + promise.then(function ($confirm) { if ($confirm) { that.remove(); // Make sure to remove the wallentry node. @@ -263,7 +263,6 @@ humhub.module('stream', function (module, require, $) { that.remove().then(function () { stream.loadEntry(that.getKey(), {'prepend': true}); }); - module.log.success('success.pin'); } else if (data.info) { module.log.info(data.info, true); } else { @@ -299,9 +298,8 @@ humhub.module('stream', function (module, require, $) { StreamEntry.prototype.unpin = function (evt) { var that = this; this.loader(); - client.post(evt.url).then(function (data) { + client.post(evt.url).then(function () { that.stream().init(); - module.log.success('success.unpin'); }).catch(function (e) { module.log.error(e, true); that.loader(false); @@ -898,7 +896,7 @@ humhub.module('stream', function (module, require, $) { /** * Simple stream component can be used for static streams without load logic (only reload single content). - * + * * @param {type} container * @param {type} cfg * @returns {humhub.streamL#5.SimpleStream} @@ -908,14 +906,14 @@ humhub.module('stream', function (module, require, $) { }; object.inherits(SimpleStream, WallStream); - + SimpleStream.prototype.reloadEntry = function (entry) { entry.loader(); var contentId = entry.getKey(); return client.get(contentModule.config.reloadUrl, {data: {id: contentId}}).then(function (response) { if (response.output) { entry.replace(response.output); - } + } return response; }).catch(function (err) { module.log.error(err, true); @@ -978,11 +976,11 @@ humhub.module('stream', function (module, require, $) { /* This can be used to trace the currently visible entries - + var lastKey; // Defines our base y position for changing the current entry var yLimit = scrollTop + (windowHeight / 2); - + // Get id of current scroll item //TODO: chache the entry nodes ! var matchingNodes = stream.$entryCache.map(function () { @@ -991,11 +989,11 @@ humhub.module('stream', function (module, require, $) { return $this; } }); - + // Get the id of the current element var $current = matchingNodes[matchingNodes.length - 1]; var currentKey = $current && $current.length ? $current.data('content-key') : ""; - + if (lastKey !== currentKey) { lastKey = currentKey; // Set/remove active class @@ -1065,4 +1063,4 @@ humhub.module('stream', function (module, require, $) { getStream: getStream, getEntry: getEntry }); -}); \ No newline at end of file +}); diff --git a/protected/humhub/modules/stream/tests/codeception/acceptance/StreamCest.php b/protected/humhub/modules/stream/tests/codeception/acceptance/StreamCest.php index a0acb432c3..57526b798a 100644 --- a/protected/humhub/modules/stream/tests/codeception/acceptance/StreamCest.php +++ b/protected/humhub/modules/stream/tests/codeception/acceptance/StreamCest.php @@ -113,7 +113,6 @@ class StreamCest $I->click('.preferences .dropdown-toggle', $newEntrySelector); $I->waitForText('Pin', 10); $I->click('Pin', $newEntrySelector); - $I->seeSuccess('The content has been pinned.'); $I->see('This is my first stream test post!', '.s2_streamContent div:nth-child(1)'); $I->see('Pinned', $newEntrySelector); @@ -122,7 +121,6 @@ class StreamCest $I->click('.preferences .dropdown-toggle', $newEntrySelector); $I->waitForText('Unpin', 10); $I->click('Unpin', $newEntrySelector); - $I->seeSuccess('The content has been unpinned.'); $I->see('This is my second stream test post!', '.s2_streamContent div:nth-child(1)'); $I->dontSee('Pinned', $newEntrySelector); } @@ -145,7 +143,7 @@ class StreamCest $I->click('.preferences .dropdown-toggle', $newEntrySelector); $I->waitForText('Edit', 10); $I->click('Edit', $newEntrySelector); - + $I->waitForElementVisible($newEntrySelector . ' .content_edit', 20); $I->amGoingTo('cancel my edit'); $I->click('.preferences .dropdown-toggle', $newEntrySelector); @@ -154,43 +152,43 @@ class StreamCest $I->waitForElementNotVisible($newEntrySelector . ' .content_edit', 20); $I->waitForElementVisible($newEntrySelector . ' .content', 20); $I->see('This is my first stream test post!', $newEntrySelector); - + $I->amGoingTo('edit my new post'); $I->click('.preferences .dropdown-toggle', $newEntrySelector); $I->waitForText('Edit', 10); $I->click('Edit', $newEntrySelector); - + $I->waitForElementVisible($newEntrySelector . ' .content_edit', 20); $I->fillField($newEntrySelector . ' [contenteditable]', 'This is my edited post!'); $I->click('Save', $newEntrySelector); - + $I->seeSuccess('Saved'); $I->seeElement($newEntrySelector); $I->see('This is my edited post!', $newEntrySelector); } - + public function testEmptyStream(AcceptanceTester $I) { $I->amUser(); $I->amOnSpace3(); $I->wantToTest('the empty stream message and filter'); - + $I->waitForText('This space is still empty!'); $I->dontSeeElement('#filter'); - + $I->amGoingTo('create a new post and delete it afterwards'); - + $I->createPost('This is my first stream test post!'); - $I->wait(1); - + $I->wait(1); + $I->amGoingTo('Delete my new post again.'); $I->dontSee('This space is still empty!'); $I->seeElement('#filter'); $I->click('.preferences .dropdown-toggle', '[data-stream-entry]:nth-of-type(1)'); $I->wait(1); $I->click('Delete'); - + $I->waitForElementVisible('#globalModalConfirm', 5); $I->see('Confirm post deletion'); $I->click('Delete', '#globalModalConfirm'); @@ -199,7 +197,7 @@ class StreamCest $I->see('This space is still empty!'); $I->dontSeeElement('#filter'); } - + public function testFilterInvolved(AcceptanceTester $I) { $I->amUser(); @@ -209,25 +207,25 @@ class StreamCest $I->waitForElementVisible('#filter_entry_userinvolved'); $I->click('#filter_entry_userinvolved'); $I->waitForText('No matches with your selected filters!'); - + $I->createPost('Involved Post.'); $I->dontSee('No matches with your selected filters!'); - + $I->amGoingTo('Reset filter'); $I->click('.stream-filter', '#filter'); $I->waitForElementVisible('#filter_entry_userinvolved'); $I->click('#filter_entry_userinvolved'); - + $I->waitForElementVisible('[data-content-key="10"]'); - + $I->click('Comment', '[data-content-key="10"]'); $I->waitForElementVisible('#newCommentForm_humhubmodulespostmodelsPost_10'); $I->fillField('#newCommentForm_humhubmodulespostmodelsPost_10', 'My Comment'); $I->click('Send', '#comment_create_form_humhubmodulespostmodelsPost_10'); $I->waitForText('My Comment', 30, '#comment_humhubmodulespostmodelsPost_10 .comment'); - + $I->click('Like', '[data-content-key="11"]'); - + $I->click('.stream-filter', '#filter'); $I->waitForElementVisible('#filter_entry_userinvolved'); $I->click('#filter_entry_userinvolved'); @@ -267,15 +265,15 @@ class StreamCest $I->click('Comment', $post4Selector); $I->fillField($post4Selector . ' [contenteditable]', 'My Comment!'); $I->click('Send', $post4Selector . ' .comment-buttons'); - + $I->scrollTop(); - + $I->click('.stream-sorting', '#filter'); $I->waitForElementVisible('#sorting_u'); $I->click('#sorting_u'); $I->wait(2); $I->waitForElementVisible($post4Selector); - + $I->see('POST4', '.s2_streamContent > [data-stream-entry]:nth-of-type(1)'); $I->see('POST5', '.s2_streamContent > [data-stream-entry]:nth-of-type(2)'); $I->see('POST3', '.s2_streamContent > [data-stream-entry]:nth-of-type(3)'); diff --git a/protected/humhub/widgets/CoreJsConfig.php b/protected/humhub/widgets/CoreJsConfig.php index 4a9eed8e20..3cf7e9988b 100644 --- a/protected/humhub/widgets/CoreJsConfig.php +++ b/protected/humhub/widgets/CoreJsConfig.php @@ -142,8 +142,6 @@ class CoreJsConfig extends Widget 'text' => [ 'success.archive' => Yii::t('ContentModule.widgets_views_stream', 'The content has been archived.'), 'success.unarchive' => Yii::t('ContentModule.widgets_views_stream', 'The content has been unarchived.'), - 'success.pin' => Yii::t('ContentModule.widgets_views_stream', 'The content has been pinned.'), - 'success.unpin' => Yii::t('ContentModule.widgets_views_stream', 'The content has been unpinned.'), 'success.delete' => Yii::t('ContentModule.widgets_views_stream', 'The content has been deleted.'), 'info.editCancel' => Yii::t('ContentModule.widgets_views_stream', 'Your last edit state has been saved!'), ]