+ Use the long description to introduce new members to the community, or distribute + some important links +
++ You can even use 'img' tags +
+`); + const RoomSummaryType = PropTypes.shape({ room_id: PropTypes.string.isRequired, profile: PropTypes.shape({ @@ -392,6 +403,8 @@ export default React.createClass({ propTypes: { groupId: PropTypes.string.isRequired, + // Whether this is the first time the group admin is viewing the group + groupIsNew: PropTypes.bool, }, childContextTypes: { @@ -407,24 +420,30 @@ export default React.createClass({ getInitialState: function() { return { summary: null, + isGroupPublicised: null, + isUserPrivileged: null, + groupRooms: null, + groupRoomsLoading: null, error: null, editing: false, saving: false, uploadingAvatar: false, membershipBusy: false, publicityBusy: false, + inviterProfile: null, }; }, componentWillMount: function() { - this._changeAvatarComponent = null; - this._initGroupStore(this.props.groupId); + this._matrixClient = MatrixClientPeg.get(); + this._matrixClient.on("Group.myMembership", this._onGroupMyMembership); - MatrixClientPeg.get().on("Group.myMembership", this._onGroupMyMembership); + this._changeAvatarComponent = null; + this._initGroupStore(this.props.groupId, true); }, componentWillUnmount: function() { - MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership); + this._matrixClient.removeListener("Group.myMembership", this._onGroupMyMembership); this._groupStore.removeAllListeners(); }, @@ -445,8 +464,12 @@ export default React.createClass({ this.setState({membershipBusy: false}); }, - _initGroupStore: function(groupId) { - this._groupStore = GroupStoreCache.getGroupStore(MatrixClientPeg.get(), groupId); + _initGroupStore: function(groupId, firstInit) { + const group = this._matrixClient.getGroup(groupId); + if (group && group.inviter && group.inviter.userId) { + this._fetchInviterProfile(group.inviter.userId); + } + this._groupStore = GroupStoreCache.getGroupStore(this._matrixClient, groupId); this._groupStore.registerListener(() => { const summary = this._groupStore.getSummary(); if (summary.profile) { @@ -458,10 +481,19 @@ export default React.createClass({ } this.setState({ summary, + summaryLoading: !this._groupStore.isStateReady(GroupStore.STATE_KEY.Summary), isGroupPublicised: this._groupStore.getGroupPublicity(), isUserPrivileged: this._groupStore.isUserPrivileged(), + groupRooms: this._groupStore.getGroupRooms(), + groupRoomsLoading: !this._groupStore.isStateReady(GroupStore.STATE_KEY.GroupRooms), + isUserMember: this._groupStore.getGroupMembers().some( + (m) => m.userId === this._matrixClient.credentials.userId, + ), error: null, }); + if (this.props.groupIsNew && firstInit) { + this._onEditClick(); + } }); this._groupStore.on('error', (err) => { this.setState({ @@ -471,6 +503,26 @@ export default React.createClass({ }); }, + _fetchInviterProfile(userId) { + this.setState({ + inviterProfileBusy: true, + }); + this._matrixClient.getProfileInfo(userId).then((resp) => { + this.setState({ + inviterProfile: { + avatarUrl: resp.avatar_url, + displayName: resp.displayname, + }, + }); + }).catch((e) => { + console.error('Error getting group inviter profile', e); + }).finally(() => { + this.setState({ + inviterProfileBusy: false, + }); + }); + }, + _onShowRhsClick: function(ev) { dis.dispatch({ action: 'show_right_panel' }); }, @@ -520,7 +572,7 @@ export default React.createClass({ if (!file) return; this.setState({uploadingAvatar: true}); - MatrixClientPeg.get().uploadContent(file).then((url) => { + this._matrixClient.uploadContent(file).then((url) => { const newProfileForm = Object.assign(this.state.profileForm, { avatar_url: url }); this.setState({ uploadingAvatar: false, @@ -540,7 +592,7 @@ export default React.createClass({ _onSaveClick: function() { this.setState({saving: true}); const savePromise = this.state.isUserPrivileged ? - MatrixClientPeg.get().setGroupProfile(this.props.groupId, this.state.profileForm) : + this._matrixClient.setGroupProfile(this.props.groupId, this.state.profileForm) : Promise.resolve(); savePromise.then((result) => { this.setState({ @@ -565,7 +617,7 @@ export default React.createClass({ _onAcceptInviteClick: function() { this.setState({membershipBusy: true}); - MatrixClientPeg.get().acceptGroupInvite(this.props.groupId).then(() => { + this._groupStore.acceptGroupInvite().then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -579,7 +631,7 @@ export default React.createClass({ _onRejectInviteClick: function() { this.setState({membershipBusy: true}); - MatrixClientPeg.get().leaveGroup(this.props.groupId).then(() => { + this._matrixClient.leaveGroup(this.props.groupId).then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -602,7 +654,7 @@ export default React.createClass({ if (!confirmed) return; this.setState({membershipBusy: true}); - MatrixClientPeg.get().leaveGroup(this.props.groupId).then(() => { + this._matrixClient.leaveGroup(this.props.groupId).then(() => { // don't reset membershipBusy here: wait for the membership change to come down the sync }).catch((e) => { this.setState({membershipBusy: false}); @@ -650,6 +702,15 @@ export default React.createClass({ const RoomDetailList = sdk.getComponent('rooms.RoomDetailList'); const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); const TintableSvg = sdk.getComponent('elements.TintableSvg'); + const Spinner = sdk.getComponent('elements.Spinner'); + const ToolTipButton = sdk.getComponent('elements.ToolTipButton'); + + const roomsHelpNode = this.state.editing ?@@ -743,69 +664,31 @@ module.exports = React.createClass({ ); }, - _renderUrlPreviewSelector: function() { - return |
\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n": "\n Nutze die lange Beschreibung um neuen Mitgliedern diese Community zu beschreiben\n oder um einige wichtige Informationen oder Links festzuhalten.\n
\n\n Du kannst auch 'img'-Tags (HTML) verwenden\n
\n", + "Your community hasn't got a Long Description, a HTML page to show to community members.\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n": "\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n", "Add rooms to the community summary": "Add rooms to the community summary", "Which rooms would you like to add to this summary?": "Which rooms would you like to add to this summary?", "Add to summary": "Add to summary", @@ -683,6 +697,7 @@ "Leave": "Leave", "Unable to leave room": "Unable to leave room", "Community Settings": "Community Settings", + "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.", "Add rooms to this community": "Add rooms to this community", "Featured Rooms:": "Featured Rooms:", "Featured Users:": "Featured Users:", @@ -691,6 +706,7 @@ "You are a member of this community": "You are a member of this community", "Community Member Settings": "Community Member Settings", "Publish this community on your profile": "Publish this community on your profile", + "Your community hasn't got a Long Description, a HTML page to show to community members.\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n": "\n Utilisez la description longue pour présenter la communauté aux nouveaux membres\n ou pour diffuser des liens importants\n
\n\n Vous pouvez même utiliser des balises \"img\"\n
\n", + "Your community hasn't got a Long Description, a HTML page to show to community members.\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n": "\n Használj hosszú leírást az tagok közösségbe való bemutatásához vagy terjessz\n hasznos linkeket\n
\n\n Még 'img' tagokat is használhatsz\n
\n", + "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "Ezek a szobák megjelennek a közösség tagjainak a közösségi oldalon. A közösség tagjai kattintással csatlakozhatnak a szobákhoz.", + "Your community hasn't got a Long Description, a HTML page to show to community members.\n Use the long description to introduce new members to the community, or distribute\n some important links\n
\n\n You can even use 'img' tags\n
\n": "\n Dlhý popis môžete použiť na predstavenie komunity novým členom, alebo uvedenie \n dôležitých odkazov\n
\n\n Môžete tiež používať HTML značku 'img'\n
\n", + "Add rooms to the community summary": "Pridať miestnosti do prehľadu komunity", + "Which rooms would you like to add to this summary?": "Ktoré miestnosti si želáte pridať do tohoto prehľadu?", + "Add to summary": "Pridať do prehľadu", + "Failed to add the following rooms to the summary of %(groupId)s:": "Do prehľadu komunity %(groupId)s sa nepodarilo pridať nasledujúce miestnosti:", + "Add a Room": "Pridať miestnosť", + "Failed to remove the room from the summary of %(groupId)s": "Z prehľadu komunity %(groupId)s sa nepodarilo odstrániť miestnosť", + "The room '%(roomName)s' could not be removed from the summary.": "Nie je možné odstrániť miestnosť '%(roomName)s' z prehľadu.", + "Add users to the community summary": "Pridať používateľov do prehľadu komunity", + "Who would you like to add to this summary?": "Koho si želáte pridať do tohoto prehľadu?", + "Failed to add the following users to the summary of %(groupId)s:": "Do prehľadu komunity %(groupId)s sa nepodarilo pridať nasledujúcich používateľov:", + "Add a User": "Pridať používateľa", + "Failed to remove a user from the summary of %(groupId)s": "Z prehľadu komunity %(groupId)s sa nepodarilo odstrániť používateľa", + "The user '%(displayName)s' could not be removed from the summary.": "Nie je možné odstrániť používateľa '%(displayName)s' z prehľadu.", + "Failed to upload image": "Nepodarilo sa nahrať obrázok", + "Failed to update community": "Nepodarilo sa aktualizovať komunitu", + "Unable to accept invite": "Nie je možné prijať pozvanie", + "Unable to reject invite": "Nie je možné odmietnuť pozvanie", + "Leave Community": "Opustiť komunitu", + "Leave %(groupName)s?": "Opustiť komunitu %(groupName)s?", + "Leave": "Opustiť", + "Unable to leave room": "Nie je možné opustiť miestnosť", + "Community Settings": "Nastavenia komunity", + "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "Tieto miestnosti sú zobrazené všetkým členom na stránke komunity. Členovia komunity môžu vstúpiť do miestnosti kliknutím.", + "Add rooms to this community": "Pridať miestnosti do tejto komunity", + "Featured Rooms:": "Hlavné miestnosti:", + "Featured Users:": "Významní používatelia:", + "%(inviter)s has invited you to join this community": "%(inviter)s vás pozval vstúpiť do tejto komunity", + "You are an administrator of this community": "Ste správcom tejto komunity", + "You are a member of this community": "Ste členom tejto komunity", + "Community Member Settings": "Nastavenia členstva v komunite", + "Publish this community on your profile": "Uverejniť túto komunitu vo vašom profile", + "Your community hasn't got a Long Description, a HTML page to show to community members.