Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-15652 Render header plugin correctly in mobile view #3059

Merged
merged 1 commit into from
Jul 8, 2019
Merged

Conversation

hmhealey
Copy link
Member

@hmhealey hmhealey commented Jul 4, 2019

This seems to be a regression caused by #2933. Originally, it rendered the button in both the header and dropdown, then it rendered the text item in both places. Now, it'll render the button in the header and the text in the dropdown.

Screen Shot 2019-07-04 at 1 06 24 PM

Ticket Link

https://mattermost.atlassian.net/browse/MM-15652

@hmhealey hmhealey added 2: Dev Review Requires review by a core commiter CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Jul 4, 2019
@hmhealey hmhealey added this to the v5.13.0 milestone Jul 4, 2019
Copy link
Member

@jespino jespino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lieut-data
Copy link
Member

@hmhealey, this basically looks like a revert of the original PR, but maybe with some differences? Is there a way to highlight the net changes?

@hmhealey
Copy link
Member Author

hmhealey commented Jul 4, 2019

Here's the diff from before Jesús's changes. Basically, the original version rendered a single item as a button and multiple items as a list. It now renders multiple items the same, but a single item is a button if it's in the header or a list if it's in the dropdown.

harrison-mm2:mattermost-webapp harrison$ git diff 2e6c8150f17d23f7d3fe19121170de70a777b432^ -- plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
diff --git a/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx b/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
index 410facf28..038195572 100644
--- a/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
+++ b/plugins/mobile_channel_header_plug/mobile_channel_header_plug.jsx
@@ -26,38 +26,43 @@ export default class MobileChannelHeaderPlug extends React.PureComponent {
         theme: PropTypes.object.isRequired,
     }
 
-    createButton(plug) {
-        return (
-            <li className='flex-parent--center'>
-                <button
-                    className='navbar-toggle navbar-right__icon'
-                    onClick={() => this.fireAction(plug)}
-                >
-                    <span className='icon navbar-plugin-button'>
-                        {plug.icon}
-                    </span>
-                </button>
-            </li>
-        );
-    }
+    createButton = (plug) => {
+        const onClick = () => this.fireAction(plug);
 
-    createList(plugs) {
-        return plugs.map((plug) => {
+        if (this.props.isDropdown) {
             return (
                 <li
                     key={'mobileChannelHeaderItem' + plug.id}
                     role='presentation'
+                    className='MenuItem'
                 >
                     <a
                         role='menuitem'
                         href='#'
-                        onClick={() => this.fireAction(plug)}
+                        onClick={onClick}
                     >
                         {plug.dropdownText}
                     </a>
                 </li>
             );
-        });
+        }
+
+        return (
+            <li className='flex-parent--center'>
+                <button
+                    className='navbar-toggle navbar-right__icon'
+                    onClick={onClick}
+                >
+                    <span className='icon navbar-plugin-button'>
+                        {plug.icon}
+                    </span>
+                </button>
+            </li>
+        );
+    }
+
+    createList(plugs) {
+        return plugs.map(this.createButton);
     }
 
     fireAction(plug) {

This reverts Jesús's changes when you have a single item outside of the dropdown, but it keeps them for a single item inside of the dropdown

Copy link
Member

@lieut-data lieut-data left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @hmhealey!

@amyblais amyblais added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Jul 5, 2019
@hmhealey hmhealey merged commit f110635 into master Jul 8, 2019
@hmhealey hmhealey deleted the mm15652 branch July 8, 2019 13:14
@hmhealey hmhealey added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Jul 8, 2019
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Jul 8, 2019
devinbinnie pushed a commit to devinbinnie/mattermost-webapp that referenced this pull request Jul 9, 2019
devinbinnie added a commit that referenced this pull request Jul 10, 2019
* [MM-16723] Added aria-label to post components

* [MM-16723] Removed hard to read ternary statements

* Increasing test coverage for MM-15012 (#3060)

* Increasing test coverage for MM-15012

* combine checkEmojiSize functions and updating documentation

* using emojis.join function in order to remove commas

* MM-15652 Render header plugin correctly in mobile view (#3059)

* MM-16695 Update mattermost-redux to add additional null check (#3052)

* MM-16695 Update mattermost-redux to add additional null check

* Update mattermost-redux

* MM-16477 Check for modified users on reconnect  (#3028)

* MM-16477 Move websocket status to redux

* MM-16477 Check for modified users on reconnect

* Update mattermost-redux

* Fix unit tests

* Update mattermost-redux

* Fix incorrect merge

* [MM-15887] E2E: add test for interactive menus - basic options (#3063)

* E2E: add test for interactive menus - basic options

* check status after initiating Cypress task both for postIncomingWebhook and postMessageAs

* fix messaging and team flaky specs (#3070)

* [MM-14720] Add bot post counts per day to System Analytics  (#3018)

* Add Bot Posts per day analytics

* Remove botPostCountsDay from team analytics. This is causing an
linting error and not currently requested for teams

* Add Total Posts from Bots

* Correctly place alphabetically in sorted fields

* [MM-16723] Removed hard to read ternary statements

* [MM-16723] PR feedback
@lindalumitchell lindalumitchell added the Tests/Done Release tests have been written label Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone Docs/Not Needed Does not require documentation Tests/Done Release tests have been written
Projects
None yet
5 participants