summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Rename mattermost_command to mattermost_slash_commandszj-slash-commands-mattermostKamil Trzcinski2016-11-187-15/+15
|
* Fix typosZ.J. van de Weg2016-11-184-23/+13
|
* Return a consistent not found messageZ.J. van de Weg2016-11-186-12/+26
| | | | | This prevents leakage of project names on an endpoint which is unauthenticated and thus open to the world.
* Improve style, add more testsZ.J. van de Weg2016-11-1810-29/+38
|
* Projects have chat servicesZ.J. van de Weg2016-11-182-0/+2
|
* More coverage on service levelZ.J. van de Weg2016-11-188-9/+177
|
* Merge remote-tracking branch 'origin/master' into zj-slash-commands-mattermostZ.J. van de Weg2016-11-17311-892/+3128
|\
| * Merge branch 'google-singletons-are' into 'master' Jacob Schatz2016-11-171-0/+51
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decide on and document a convention for singletons > The singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The simplest implementation uses an object literal to contain the logic. ```javascript gl.MyThing = { prop1: 'hello', method1: () => {} }; ``` A live example of this is [GfmAutoComplete](https://gitlab.com/gitlab-org/gitlab-ce/blob/172aab108b875e8dc9a5f1d3c2d53018eff76ea1/app/assets/javascripts/gfm_auto_complete.js.es6) Another approach makes use of ES6 `class` syntax. ```javascript let singleton; class MyThing { constructor() { if (!singleton) { singleton = this; singleton.init(); } return singleton; } init() { this.prop1 = 'hello'; } method1() {} } gl.MyThing = MyThing; ``` A live example of this is [Sidebar](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/sidebar.js.es6) Another functional approach to define Singleton using `Javascript Revealing Module Pattern` is like below ```javascript /** * 1. It instantiates only a single object * 2. It is safe – it keeps the reference to the singleton inside a variable, which lives inside a lexical closure, so it is not accessible by the outside world * 3. It allows privacy – you can define all private methods of your singleton inside the lexical closure of the first module pattern * 4. No this keyword trap (no wrong context referring) * 5. No use of new keyword * 6. Easy to write test code */ // const Singleton = (function () { // Instance stores a reference to the Singleton var instance; function init() { // Singleton // Private methods and variables function privateMethod(){ console.log( "I am private" ); } var privateVariable = "Im also private"; var privateRandomNumber = Math.random(); return { // Public methods and variables publicMethod: function () { console.log( "The public can see me!" ); }, publicProperty: "I am also public", getRandomNumber: function() { return privateRandomNumber; } }; }; return { // Get the Singleton instance if one exists // or create one if it doesn't getInstance: function () { if ( !instance ) { instance = init(); } return instance; } }; })(); const singletonObj = Singleton.getInstance() ``` ## Are there points in the code the reviewer needs to double check? ## What does this MR do? Creates a space for discussion and contribution for interested devs. ## Why was this MR needed? ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] All builds are passing (http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? See merge request !6620
| | * Fix spacing in code sample.google-singletons-areBryce Johnson2016-11-011-3/+5
| | |
| | * Document convention for singleton use in front-end code.Bryce Johnson2016-10-311-0/+49
| | |
| * | Merge branch 'fix-singin-redirect-for-fork-new' into 'master' Sean McGivern2016-11-173-0/+64
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Fixing the issue of visiting a project fork url giving 500 error when not signed… Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/24302 See merge request !7392
| | * | Remove newlines between context and it in addition to testing redirection ↵Cagdas Gerede2016-11-151-6/+1
| | | | | | | | | | | | | | | | for create action to import path
| | * | Add authentication for for create action. Add more tests for for new and ↵Cagdas Gerede2016-11-152-8/+56
| | | | | | | | | | | | | | | | create actions
| | * | Move sign_out out of it into beforeCagdas Gerede2016-11-131-2/+1
| | | |
| | * | Replace tabs with spacesEarth2016-11-131-1/+1
| | | |
| | * | Add a unit test for redirecting to sign-in page when user is not logged in ↵Earth2016-11-131-0/+15
| | | | | | | | | | | | | | | | and user visits the new fork page
| | * | Add a new line after the guard statement to be compatible with the style guide.Cagdas Gerede2016-11-121-0/+1
| | | |
| | * | Replaces conditional with guard statement.Cagdas Gerede2016-11-121-0/+1
| | | |
| | * | Temporary changeCagdas Gerede2016-11-121-1/+0
| | | |
| | * | Replace conditional with a guard statement.Cagdas Gerede2016-11-121-6/+3
| | | |
| | * | Fixing the issue of visiting a project fork url giving 500 error when not ↵Cagdas Gerede2016-11-102-2/+11
| | | | | | | | | | | | | | | | signed in instead of being redirected to the sign in page. The main reason is ApplicationController skips authentication if the project exists. To fix the issue, forced the authentication in ForksController when current_user is nil.
| * | | Merge branch 'feature/subscribe-to-group-level-labels' into 'master' Sean McGivern2016-11-1746-227/+754
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support subscribing to group labels https://gitlab.com/gitlab-org/gitlab-ce/issues/23586 See merge request !7215
| | * | | Remove extra subscribable_type filter on migrationDouglas Barbosa Alexandre2016-11-171-3/+3
| | | | |
| | * | | Add feature spec for labels subscriptionDouglas Barbosa Alexandre2016-11-171-0/+74
| | | | |
| | * | | Avoid code duplication for label subscription status on label partialDouglas Barbosa Alexandre2016-11-173-15/+9
| | | | |
| | * | | Rename LabelSubscription javascript to ProjectLabelSubscriptionDouglas Barbosa Alexandre2016-11-172-3/+3
| | | | |
| | * | | Fix label subscription menu on small screens resolutionDouglas Barbosa Alexandre2016-11-173-16/+42
| | | | |
| | * | | Allow users to subscribe to a group label at group or project levelDouglas Barbosa Alexandre2016-11-175-11/+122
| | | | |
| | * | | Use button instead of an icon to subscribe/unsubscribe to labelsDouglas Barbosa Alexandre2016-11-174-14/+49
| | | | |
| | * | | Add CHANGELOG entryDouglas Barbosa Alexandre2016-11-171-0/+4
| | | | |
| | * | | Add toggle_subscription action to Groups::LabelsControllerDouglas Barbosa Alexandre2016-11-173-1/+33
| | | | |
| | * | | Allow subscriptions to be created without a projectDouglas Barbosa Alexandre2016-11-175-42/+119
| | | | |
| | * | | Use subqueries instead of joins to migrate subscriptionsDouglas Barbosa Alexandre2016-11-171-39/+24
| | | | |
| | * | | Add helper method to toggle label subscription on labels controller specDouglas Barbosa Alexandre2016-11-171-2/+6
| | | | |
| | * | | Remove default value for `project` argument on subscribable concernDouglas Barbosa Alexandre2016-11-1722-98/+96
| | | | |
| | * | | Use @project as default on ToggleSubscriptionAction concernDouglas Barbosa Alexandre2016-11-174-13/+1
| | | | |
| | * | | Allow users to subscribe to group labels at project-levelDouglas Barbosa Alexandre2016-11-174-27/+34
| | | | |
| | * | | Pass project to Entities::Label to check if user is subscribedDouglas Barbosa Alexandre2016-11-172-7/+7
| | | | |
| | * | | Fix specs to pass a project when creating subscriptionsDouglas Barbosa Alexandre2016-11-173-7/+9
| | | | |
| | * | | Refactoring label subscription toggle button text to accept a projectDouglas Barbosa Alexandre2016-11-172-4/+4
| | | | |
| | * | | Refactoring label subscription status to accept a projectDouglas Barbosa Alexandre2016-11-172-4/+4
| | | | |
| | * | | Refactoring notification service to find subscriptions per projectDouglas Barbosa Alexandre2016-11-172-50/+92
| | | | |
| | * | | Add subscribable_project to ToggleSubscriptionAction concernDouglas Barbosa Alexandre2016-11-174-1/+17
| | | | |
| | * | | Refactoring Subscribable concern to accept a projectDouglas Barbosa Alexandre2016-11-173-38/+46
| | | | |
| | * | | Fix small typo on NotificationServiceDouglas Barbosa Alexandre2016-11-171-1/+1
| | | | |
| | * | | Add unique index to subscriptions on subscribable and user and projectDouglas Barbosa Alexandre2016-11-175-3/+34
| | | | |
| | * | | Migrate subscribable project id to the subscriptions tableDouglas Barbosa Alexandre2016-11-171-0/+59
| | | | |
| | * | | Add project_id to subscriptionsDouglas Barbosa Alexandre2016-11-174-0/+34
| | | | |
| * | | | Merge branch 'chat-name-authorize' into 'master' Rémy Coutable2016-11-1722-1/+522
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows to authorize chat user against GitLab. This is needed for: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7438 See merge request !7450
| | * | | | Change last_used_at to use touchchat-name-authorizeKamil Trzcinski2016-11-171-1/+1
| | | | | |