...
 
Commits (2)
......@@ -4,6 +4,9 @@ import { Router } from '@angular/router';
import { GroupsService } from './groups-service';
import { Session } from '../../services/session';
import { LoginReferrerService } from '../../services/login-referrer.service';
import { PermissionsService } from '../../common/services/permissions/permissions.service';
import { FeaturesService } from '../../services/features.service';
import { Flags } from '../../common/services/permissions/flags';
@Component({
selector: 'minds-groups-join-button',
......@@ -79,7 +82,9 @@ export class GroupsJoinButton {
public session: Session,
public service: GroupsService,
private router: Router,
private loginReferrer: LoginReferrerService
private loginReferrer: LoginReferrerService,
private featuresService: FeaturesService,
private permissionsService: PermissionsService
) {
this.minds = window.Minds;
}
......@@ -116,6 +121,14 @@ export class GroupsJoinButton {
this.router.navigate(['/login']);
return;
}
if (
this.featuresService.has('permissions') &&
!this.permissionsService.canInteract(this.group, Flags.JOIN)
) {
return;
}
this.inProgress = true;
this.service
.join(this.group)
......
......@@ -6,6 +6,8 @@ import {
Renderer,
ViewChild,
Injector,
OnInit,
OnDestroy,
} from '@angular/core';
import { Client } from '../../../services/api';
......@@ -18,6 +20,9 @@ import { MessengerEncryptionService } from '../encryption/encryption.service';
import { MessengerConversationDockpanesService } from '../dockpanes/dockpanes.service';
import { MessengerSounds } from '../sounds/service';
import { BlockListService } from '../../../common/services/block-list.service';
import { FeaturesService } from '../../../services/features.service';
import { PermissionsService } from '../../../common/services/permissions/permissions.service';
import { Flags } from '../../../common/services/permissions/flags';
@Component({
moduleId: module.id,
......@@ -29,7 +34,7 @@ import { BlockListService } from '../../../common/services/block-list.service';
inputs: ['conversation'],
templateUrl: 'conversation.component.html',
})
export class MessengerConversation {
export class MessengerConversation implements OnInit, OnDestroy {
minds: Minds = window.Minds;
sounds = new MessengerSounds();
......@@ -81,7 +86,9 @@ export class MessengerConversation {
private renderer: Renderer,
public encryption: MessengerEncryptionService,
public dockpanes: MessengerConversationDockpanesService,
protected blockListService: BlockListService
protected blockListService: BlockListService,
protected featuresService: FeaturesService,
protected permissionsService: PermissionsService
) {
this.buildTabId();
}
......@@ -130,8 +137,8 @@ export class MessengerConversation {
this.messages = this.messages.concat(response.messages);
this.scrollEmitter.next(true);
} else if (opts.offset) {
let scrollTop = scrollView.scrollTop;
let scrollHeight = scrollView.scrollHeight;
const scrollTop = scrollView.scrollTop;
const scrollHeight = scrollView.scrollHeight;
if (this.messages.length) {
response.messages.pop();
}
......@@ -249,6 +256,13 @@ export class MessengerConversation {
send(e) {
e.preventDefault();
if (
this.featuresService.has('permissions') &&
!this.permissionsService.canInteract(this.conversation, Flags.MESSAGE)
) {
return;
}
if (
this.blocked ||
!this.message ||
......@@ -258,7 +272,7 @@ export class MessengerConversation {
return;
}
let newLength = this.messages.push({
const newLength = this.messages.push({
// Optimistic
optimisticGuess: true,
owner: this.session.getLoggedInUser(),
......@@ -332,7 +346,7 @@ export class MessengerConversation {
this.blockingActionInProgress = true;
let blocks = [],
const blocks = [],
newState = !this.blocked;
this.conversation.participants.forEach((participant: any) => {
......