MOBILE-2491 filter: Use instanceid 0 for system context
parent
6c219b5246
commit
b99d31ca61
|
@ -104,7 +104,7 @@ export class AddonBlogEntriesComponent implements OnInit {
|
||||||
this.contextInstanceId = this.courseId;
|
this.contextInstanceId = this.courseId;
|
||||||
} else {
|
} else {
|
||||||
this.contextLevel = 'system';
|
this.contextLevel = 'system';
|
||||||
this.contextInstanceId = this.siteHomeId;
|
this.contextInstanceId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.commentsEnabled = !this.commentsProvider.areCommentsDisabledInSite();
|
this.commentsEnabled = !this.commentsProvider.areCommentsDisabledInSite();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<a ion-item text-wrap *ngFor="let result of search.results" [title]="result.fullname" (click)="gotoDiscussion(result.userid, result.messageid)" [class.core-split-item-selected]="result.userid == discussionUserId" class="addon-message-discussion">
|
<a ion-item text-wrap *ngFor="let result of search.results" [title]="result.fullname" (click)="gotoDiscussion(result.userid, result.messageid)" [class.core-split-item-selected]="result.userid == discussionUserId" class="addon-message-discussion">
|
||||||
<ion-avatar core-user-avatar [user]="result" item-start [checkOnline]="result.showonlinestatus"></ion-avatar>
|
<ion-avatar core-user-avatar [user]="result" item-start [checkOnline]="result.showonlinestatus"></ion-avatar>
|
||||||
<h2>{{ result.fullname }}</h2>
|
<h2>{{ result.fullname }}</h2>
|
||||||
<p><core-format-text clean="true" singleLine="true" [text]="result.lastmessage" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></p>
|
<p><core-format-text clean="true" singleLine="true" [text]="result.lastmessage" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
</a>
|
</a>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<span *ngIf="discussion.unread" class="core-primary-circle"></span>
|
<span *ngIf="discussion.unread" class="core-primary-circle"></span>
|
||||||
<span *ngIf="discussion.message.timecreated > 0">{{discussion.message.timecreated / 1000 | coreDateDayOrTime}}</span>
|
<span *ngIf="discussion.message.timecreated > 0">{{discussion.message.timecreated / 1000 | coreDateDayOrTime}}</span>
|
||||||
</ion-note>
|
</ion-note>
|
||||||
<p><core-format-text clean="true" singleLine="true" [text]="discussion.message.message" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></p>
|
<p><core-format-text clean="true" singleLine="true" [text]="discussion.message.message" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
</a>
|
</a>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
|
||||||
loading: '',
|
loading: '',
|
||||||
text: ''
|
text: ''
|
||||||
};
|
};
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
||||||
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
||||||
|
@ -60,7 +59,6 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
|
||||||
this.search.loading = translate.instant('core.searching');
|
this.search.loading = translate.instant('core.searching');
|
||||||
this.loadingMessages = translate.instant('core.loading');
|
this.loadingMessages = translate.instant('core.loading');
|
||||||
this.siteId = sitesProvider.getCurrentSiteId();
|
this.siteId = sitesProvider.getCurrentSiteId();
|
||||||
this.siteHomeId = sitesProvider.getCurrentSiteHomeId();
|
|
||||||
|
|
||||||
// Update discussions when new message is received.
|
// Update discussions when new message is received.
|
||||||
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
|
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
<div class="item-avatar-center">
|
<div class="item-avatar-center">
|
||||||
<img class="avatar" [src]="conversation.imageurl" core-external-content [alt]="conversation.name" role="presentation" onError="this.src='assets/img/group-avatar.png'">
|
<img class="avatar" [src]="conversation.imageurl" core-external-content [alt]="conversation.name" role="presentation" onError="this.src='assets/img/group-avatar.png'">
|
||||||
</div>
|
</div>
|
||||||
<h2><core-format-text [text]="conversation.name" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></h2>
|
<h2><core-format-text [text]="conversation.name" contextLevel="system" [contextInstanceId]="0"></core-format-text></h2>
|
||||||
<p><core-format-text *ngIf="conversation.subname" [text]="conversation.subname" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></p>
|
<p><core-format-text *ngIf="conversation.subname" [text]="conversation.subname" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
<p>{{ 'addon.messages.numparticipants' | translate:{$a: conversation.membercount} }}</p>
|
<p>{{ 'addon.messages.numparticipants' | translate:{$a: conversation.membercount} }}</p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,12 @@ export class AddonMessagesConversationInfoPage implements OnInit {
|
||||||
members: AddonMessagesConversationMember[] = [];
|
members: AddonMessagesConversationMember[] = [];
|
||||||
canLoadMore = false;
|
canLoadMore = false;
|
||||||
loadMoreError = false;
|
loadMoreError = false;
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
protected conversationId: number;
|
protected conversationId: number;
|
||||||
|
|
||||||
constructor(private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
constructor(private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
||||||
protected viewCtrl: ViewController, sitesProvider: CoreSitesProvider) {
|
protected viewCtrl: ViewController, sitesProvider: CoreSitesProvider) {
|
||||||
this.conversationId = navParams.get('conversationId');
|
this.conversationId = navParams.get('conversationId');
|
||||||
this.siteHomeId = sitesProvider.getCurrentSiteHomeId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<ion-title>
|
<ion-title>
|
||||||
<img *ngIf="loaded && !otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" [alt]="title" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
|
<img *ngIf="loaded && !otherMember && conversationImage" class="core-bar-button-image" [src]="conversationImage" [alt]="title" onError="this.src='assets/img/group-avatar.png'" core-external-content role="presentation" [siteId]="siteId || null">
|
||||||
<ion-avatar *ngIf="loaded && otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
|
<ion-avatar *ngIf="loaded && otherMember" class="core-bar-button-image" core-user-avatar [user]="otherMember" [linkProfile]="false" [checkOnline]="otherMember.showonlinestatus" item-start (click)="showInfo && viewInfo()"></ion-avatar>
|
||||||
<core-format-text [text]="title" contextLevel="system" [contextInstanceId]="siteHomeId" (click)="showInfo && !isGroup && viewInfo()"></core-format-text>
|
<core-format-text [text]="title" contextLevel="system" [contextInstanceId]="0" (click)="showInfo && !isGroup && viewInfo()"></core-format-text>
|
||||||
<core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star" [label]="'core.favourites' | translate"></core-icon>
|
<core-icon *ngIf="conversation && conversation.isfavourite" name="fa-star" [label]="'core.favourites' | translate"></core-icon>
|
||||||
<core-icon *ngIf="conversation && conversation.ismuted" name="volume-off" [label]="'addon.messages.mutedconversation' | translate"></core-icon>
|
<core-icon *ngIf="conversation && conversation.ismuted" name="volume-off" [label]="'addon.messages.mutedconversation' | translate"></core-icon>
|
||||||
</ion-title>
|
</ion-title>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
<!-- Some messages have <p> and some others don't. Add a <p> so they all have same styles. -->
|
<!-- Some messages have <p> and some others don't. Add a <p> so they all have same styles. -->
|
||||||
<p class="addon-message-text">
|
<p class="addon-message-text">
|
||||||
<core-format-text (afterRender)="last && scrollToBottom()" [text]="message.text" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text>
|
<core-format-text (afterRender)="last && scrollToBottom()" [text]="message.text" contextLevel="system" [contextInstanceId]="0"></core-format-text>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button ion-button icon-only clear="true" *ngIf="!message.sending && showDelete" (click)="deleteMessage(message, index)" class="addon-messages-delete-button" [@coreSlideInOut]="'fromRight'" [attr.aria-label]=" 'addon.messages.deletemessage' | translate">
|
<button ion-button icon-only clear="true" *ngIf="!message.sending && showDelete" (click)="deleteMessage(message, index)" class="addon-messages-delete-button" [@coreSlideInOut]="'fromRight'" [attr.aria-label]=" 'addon.messages.deletemessage' | translate">
|
||||||
|
|
|
@ -95,7 +95,6 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
|
||||||
isSelf = false;
|
isSelf = false;
|
||||||
muteEnabled = false;
|
muteEnabled = false;
|
||||||
muteIcon = 'volume-off';
|
muteIcon = 'volume-off';
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, navParams: NavParams,
|
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, navParams: NavParams,
|
||||||
private userProvider: CoreUserProvider, private navCtrl: NavController, private messagesSync: AddonMessagesSyncProvider,
|
private userProvider: CoreUserProvider, private navCtrl: NavController, private messagesSync: AddonMessagesSyncProvider,
|
||||||
|
@ -108,7 +107,6 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
|
||||||
this.currentUserId = sitesProvider.getCurrentSiteUserId();
|
this.currentUserId = sitesProvider.getCurrentSiteUserId();
|
||||||
this.groupMessagingEnabled = this.messagesProvider.isGroupMessagingEnabled();
|
this.groupMessagingEnabled = this.messagesProvider.isGroupMessagingEnabled();
|
||||||
this.muteEnabled = this.messagesProvider.isMuteConversationEnabled();
|
this.muteEnabled = this.messagesProvider.isMuteConversationEnabled();
|
||||||
this.siteHomeId = sitesProvider.getCurrentSiteHomeId();
|
|
||||||
|
|
||||||
this.logger = logger.getInstance('AddonMessagesDiscussionPage');
|
this.logger = logger.getInstance('AddonMessagesDiscussionPage');
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
<ion-avatar *ngIf="conversation.type != typeGroup" core-user-avatar [user]="conversation.otherUser" [linkProfile]="false" [checkOnline]="conversation.showonlinestatus" item-start></ion-avatar>
|
<ion-avatar *ngIf="conversation.type != typeGroup" core-user-avatar [user]="conversation.otherUser" [linkProfile]="false" [checkOnline]="conversation.showonlinestatus" item-start></ion-avatar>
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<core-format-text [text]="conversation.name" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text>
|
<core-format-text [text]="conversation.name" contextLevel="system" [contextInstanceId]="0"></core-format-text>
|
||||||
<core-icon name="fa-ban" *ngIf="conversation.isblocked" [label]="'addon.messages.contactblocked' | translate"></core-icon>
|
<core-icon name="fa-ban" *ngIf="conversation.isblocked" [label]="'addon.messages.contactblocked' | translate"></core-icon>
|
||||||
<core-icon *ngIf="conversation.ismuted" name="volume-off" [label]="'addon.messages.mutedconversation' | translate"></core-icon>
|
<core-icon *ngIf="conversation.ismuted" name="volume-off" [label]="'addon.messages.mutedconversation' | translate"></core-icon>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -107,11 +107,11 @@
|
||||||
<ion-badge *ngIf="conversation.unreadcount > 0">{{ conversation.unreadcount }}</ion-badge>
|
<ion-badge *ngIf="conversation.unreadcount > 0">{{ conversation.unreadcount }}</ion-badge>
|
||||||
<span *ngIf="conversation.lastmessagedate > 0">{{conversation.lastmessagedate | coreDateDayOrTime}}</span>
|
<span *ngIf="conversation.lastmessagedate > 0">{{conversation.lastmessagedate | coreDateDayOrTime}}</span>
|
||||||
</ion-note>
|
</ion-note>
|
||||||
<p *ngIf="conversation.subname"><core-format-text [text]="conversation.subname" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></p>
|
<p *ngIf="conversation.subname"><core-format-text [text]="conversation.subname" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
<p class="addon-message-last-message">
|
<p class="addon-message-last-message">
|
||||||
<span *ngIf="conversation.sentfromcurrentuser" class="addon-message-last-message-user">{{ 'addon.messages.you' | translate }}</span>
|
<span *ngIf="conversation.sentfromcurrentuser" class="addon-message-last-message-user">{{ 'addon.messages.you' | translate }}</span>
|
||||||
<span *ngIf="!conversation.sentfromcurrentuser && conversation.type == typeGroup && conversation.members[0]" class="addon-message-last-message-user">{{ conversation.members[0].fullname + ':' }}</span>
|
<span *ngIf="!conversation.sentfromcurrentuser && conversation.type == typeGroup && conversation.members[0]" class="addon-message-last-message-user">{{ conversation.members[0].fullname + ':' }}</span>
|
||||||
<core-format-text clean="true" singleLine="true" [text]="conversation.lastmessage" class="addon-message-last-message-text" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text>
|
<core-format-text clean="true" singleLine="true" [text]="conversation.lastmessage" class="addon-message-last-message-text" contextLevel="system" [contextInstanceId]="0"></core-format-text>
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
|
@ -67,7 +67,6 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
|
||||||
};
|
};
|
||||||
typeGroup = AddonMessagesProvider.MESSAGE_CONVERSATION_TYPE_GROUP;
|
typeGroup = AddonMessagesProvider.MESSAGE_CONVERSATION_TYPE_GROUP;
|
||||||
currentListEl: HTMLElement;
|
currentListEl: HTMLElement;
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
protected loadingString: string;
|
protected loadingString: string;
|
||||||
protected siteId: string;
|
protected siteId: string;
|
||||||
|
@ -96,7 +95,6 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
|
||||||
// Conversation to load.
|
// Conversation to load.
|
||||||
this.conversationId = navParams.get('conversationId') || false;
|
this.conversationId = navParams.get('conversationId') || false;
|
||||||
this.discussionUserId = !this.conversationId && (navParams.get('discussionUserId') || false);
|
this.discussionUserId = !this.conversationId && (navParams.get('discussionUserId') || false);
|
||||||
this.siteHomeId = sitesProvider.getCurrentSiteHomeId();
|
|
||||||
|
|
||||||
// Update conversations when new message is received.
|
// Update conversations when new message is received.
|
||||||
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
|
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</ion-note>
|
</ion-note>
|
||||||
<p class="addon-message-last-message">
|
<p class="addon-message-last-message">
|
||||||
<span *ngIf="result.sentfromcurrentuser" class="addon-message-last-message-user">{{ 'addon.messages.you' | translate }}</span>
|
<span *ngIf="result.sentfromcurrentuser" class="addon-message-last-message-user">{{ 'addon.messages.you' | translate }}</span>
|
||||||
<core-format-text clean="true" singleLine="true" [text]="result.lastmessage" [highlight]="result.highlightMessage" contextLevel="system" [contextInstanceId]="siteHomeId" class="addon-message-last-message-text"></core-format-text>
|
<core-format-text clean="true" singleLine="true" [text]="result.lastmessage" [highlight]="result.highlightMessage" contextLevel="system" [contextInstanceId]="0" class="addon-message-last-message-text"></core-format-text>
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ export class AddonMessagesSearchPage implements OnDestroy {
|
||||||
loadMoreError: false
|
loadMoreError: false
|
||||||
};
|
};
|
||||||
selectedResult = null;
|
selectedResult = null;
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
protected memberInfoObserver;
|
protected memberInfoObserver;
|
||||||
|
|
||||||
|
@ -67,8 +66,6 @@ export class AddonMessagesSearchPage implements OnDestroy {
|
||||||
constructor(private appProvider: CoreAppProvider, private domUtils: CoreDomUtilsProvider, eventsProvider: CoreEventsProvider,
|
constructor(private appProvider: CoreAppProvider, private domUtils: CoreDomUtilsProvider, eventsProvider: CoreEventsProvider,
|
||||||
sitesProvider: CoreSitesProvider, private messagesProvider: AddonMessagesProvider) {
|
sitesProvider: CoreSitesProvider, private messagesProvider: AddonMessagesProvider) {
|
||||||
|
|
||||||
this.siteHomeId = sitesProvider.getCurrentSiteHomeId();
|
|
||||||
|
|
||||||
// Update block status of a user.
|
// Update block status of a user.
|
||||||
this.memberInfoObserver = eventsProvider.on(AddonMessagesProvider.MEMBER_INFO_CHANGED_EVENT, (data) => {
|
this.memberInfoObserver = eventsProvider.on(AddonMessagesProvider.MEMBER_INFO_CHANGED_EVENT, (data) => {
|
||||||
if (!data.userBlocked && !data.userUnblocked) {
|
if (!data.userBlocked && !data.userUnblocked) {
|
||||||
|
|
|
@ -297,8 +297,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr
|
||||||
title: message.name || message.userfromfullname,
|
title: message.name || message.userfromfullname,
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.filterHelper.getFiltersAndFormatText(message.text, 'system', this.sitesProvider.getCurrentSiteHomeId(),
|
return this.filterHelper.getFiltersAndFormatText(message.text, 'system', 0, {clean: true, singleLine: true}).catch(() => {
|
||||||
{clean: true, singleLine: true}).catch(() => {
|
|
||||||
return message.text;
|
return message.text;
|
||||||
}).then((formattedText) => {
|
}).then((formattedText) => {
|
||||||
data['text'] = formattedText;
|
data['text'] = formattedText;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<p *ngIf="notification.userfromfullname">{{ notification.userfromfullname }}</p>
|
<p *ngIf="notification.userfromfullname">{{ notification.userfromfullname }}</p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item text-wrap>
|
<ion-item text-wrap>
|
||||||
<p><core-format-text [text]="notification.mobiletext | coreCreateLinks" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></p>
|
<p><core-format-text [text]="notification.mobiletext | coreCreateLinks" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<addon-notifications-actions [contextUrl]="notification.contexturl" [courseId]="notification.courseid" [data]="notification.customdata"></addon-notifications-actions>
|
<addon-notifications-actions [contextUrl]="notification.contexturl" [courseId]="notification.courseid" [data]="notification.customdata"></addon-notifications-actions>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
|
@ -40,7 +40,6 @@ export class AddonNotificationsListPage {
|
||||||
loadMoreError = false;
|
loadMoreError = false;
|
||||||
canMarkAllNotificationsAsRead = false;
|
canMarkAllNotificationsAsRead = false;
|
||||||
loadingMarkAllNotificationsAsRead = false;
|
loadingMarkAllNotificationsAsRead = false;
|
||||||
siteHomeId: number;
|
|
||||||
|
|
||||||
protected isCurrentView: boolean;
|
protected isCurrentView: boolean;
|
||||||
protected cronObserver: CoreEventObserver;
|
protected cronObserver: CoreEventObserver;
|
||||||
|
@ -52,8 +51,6 @@ export class AddonNotificationsListPage {
|
||||||
private utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
private utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
||||||
private pushNotificationsDelegate: CorePushNotificationsDelegate,
|
private pushNotificationsDelegate: CorePushNotificationsDelegate,
|
||||||
private notificationsHelper: AddonNotificationsHelperProvider) {
|
private notificationsHelper: AddonNotificationsHelperProvider) {
|
||||||
|
|
||||||
this.siteHomeId = sitesProvider.getCurrentSite().getSiteHomeId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ export class CoreSitePickerComponent implements OnInit {
|
||||||
|
|
||||||
sites.forEach((site: any) => {
|
sites.forEach((site: any) => {
|
||||||
// Format the site name.
|
// Format the site name.
|
||||||
promises.push(this.filterHelper.getFiltersAndFormatText(site.siteName, 'system', site.siteHomeId,
|
promises.push(this.filterHelper.getFiltersAndFormatText(site.siteName, 'system', 0,
|
||||||
{clean: true, singleLine: true}, site.getId()).catch(() => {
|
{clean: true, singleLine: true}, site.getId()).catch(() => {
|
||||||
return site.siteName;
|
return site.siteName;
|
||||||
}).then((formatted) => {
|
}).then((formatted) => {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
||||||
</ion-avatar>
|
</ion-avatar>
|
||||||
<h2>{{site.fullName}}</h2>
|
<h2>{{site.fullName}}</h2>
|
||||||
<p><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id" contextLevel="system" [contextInstanceId]="site.siteHomeId"></core-format-text></p>
|
<p><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
<p>{{site.siteUrl}}</p>
|
<p>{{site.siteUrl}}</p>
|
||||||
</a>
|
</a>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-navbar core-back-button>
|
<ion-navbar core-back-button>
|
||||||
<ion-title><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></ion-title>
|
<ion-title><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0"></core-format-text></ion-title>
|
||||||
|
|
||||||
<ion-buttons end>
|
<ion-buttons end>
|
||||||
<button *ngIf="searchEnabled" ion-button icon-only (click)="openSearch()" [attr.aria-label]="'core.courses.searchcourses' | translate">
|
<button *ngIf="searchEnabled" ion-button icon-only (click)="openSearch()" [attr.aria-label]="'core.courses.searchcourses' | translate">
|
||||||
|
|
|
@ -45,7 +45,6 @@ export class CoreCoursesDashboardPage implements OnDestroy {
|
||||||
tabsReady = false;
|
tabsReady = false;
|
||||||
searchEnabled: boolean;
|
searchEnabled: boolean;
|
||||||
tabs = [];
|
tabs = [];
|
||||||
siteHomeId: number;
|
|
||||||
siteName: string;
|
siteName: string;
|
||||||
blocks: any[];
|
blocks: any[];
|
||||||
dashboardEnabled = false;
|
dashboardEnabled = false;
|
||||||
|
@ -134,7 +133,6 @@ export class CoreCoursesDashboardPage implements OnDestroy {
|
||||||
* Load the site name.
|
* Load the site name.
|
||||||
*/
|
*/
|
||||||
protected loadSiteName(): void {
|
protected loadSiteName(): void {
|
||||||
this.siteHomeId = this.sitesProvider.getCurrentSiteHomeId();
|
|
||||||
this.siteName = this.sitesProvider.getCurrentSite().getSiteName();
|
this.siteName = this.sitesProvider.getCurrentSite().getSiteName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ export class CoreFilterProvider {
|
||||||
for (let i = 0; i < contextsToSend.length; i++) {
|
for (let i = 0; i < contextsToSend.length; i++) {
|
||||||
const context = contextsToSend[i];
|
const context = contextsToSend[i];
|
||||||
|
|
||||||
if (context.contextlevel == 'system' && context.instanceid == site.getSiteHomeId()) {
|
if (context.contextlevel == 'system') {
|
||||||
hasSystemContext = true;
|
hasSystemContext = true;
|
||||||
|
|
||||||
// Use course site home instead. Check if it's already in the list.
|
// Use course site home instead. Check if it's already in the list.
|
||||||
|
@ -212,7 +212,7 @@ export class CoreFilterProvider {
|
||||||
// Site home not in list, use it instead of system.
|
// Site home not in list, use it instead of system.
|
||||||
contextsToSend[i] = {
|
contextsToSend[i] = {
|
||||||
contextlevel: 'course',
|
contextlevel: 'course',
|
||||||
instanceid: context.instanceid
|
instanceid: site.getSiteHomeId()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ export class CoreFilterProvider {
|
||||||
|
|
||||||
// Simulate the system context based on the inherited data.
|
// Simulate the system context based on the inherited data.
|
||||||
filter.contextlevel = 'system';
|
filter.contextlevel = 'system';
|
||||||
|
filter.instanceid = 0;
|
||||||
filter.contextid = -1;
|
filter.contextid = -1;
|
||||||
filter.localstate = filter.inheritedstate;
|
filter.localstate = filter.inheritedstate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ export class CoreFilterHelperProvider {
|
||||||
|
|
||||||
let promise: Promise<boolean>;
|
let promise: Promise<boolean>;
|
||||||
|
|
||||||
if (instanceId == site.getSiteHomeId() && (contextLevel == 'system' || contextLevel == 'course')) {
|
if (contextLevel == 'system' || (contextLevel == 'course' && instanceId == site.getSiteHomeId())) {
|
||||||
// No need to check the site filters because we're requesting the same context, so we'd do the same twice.
|
// No need to check the site filters because we're requesting the same context, so we'd do the same twice.
|
||||||
promise = Promise.resolve(true);
|
promise = Promise.resolve(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +223,7 @@ export class CoreFilterHelperProvider {
|
||||||
return this.sitesProvider.getSite(siteId).then((site) => {
|
return this.sitesProvider.getSite(siteId).then((site) => {
|
||||||
|
|
||||||
// Get filters at site level.
|
// Get filters at site level.
|
||||||
return this.filterProvider.getAvailableInContext('system', site.getSiteHomeId(), site.getId()).then((filters) => {
|
return this.filterProvider.getAvailableInContext('system', 0, site.getId()).then((filters) => {
|
||||||
|
|
||||||
return this.filterDelegate.shouldBeApplied(filters, options, site);
|
return this.filterDelegate.shouldBeApplied(filters, options, site);
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
||||||
</ion-avatar>
|
</ion-avatar>
|
||||||
<h2>{{site.fullName}}</h2>
|
<h2>{{site.fullName}}</h2>
|
||||||
<p><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id" contextLevel="system" [contextInstanceId]="site.siteHomeId"></core-format-text></p>
|
<p><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
<p>{{site.siteUrl}}</p>
|
<p>{{site.siteUrl}}</p>
|
||||||
<ion-badge item-end *ngIf="!showDelete && site.badge">{{site.badge}}</ion-badge>
|
<ion-badge item-end *ngIf="!showDelete && site.badge">{{site.badge}}</ion-badge>
|
||||||
<button *ngIf="showDelete" item-end ion-button icon-only clear color="danger" (click)="deleteSite($event, idx)" [attr.aria-label]="'core.delete' | translate">
|
<button *ngIf="showDelete" item-end ion-button icon-only clear color="danger" (click)="deleteSite($event, idx)" [attr.aria-label]="'core.delete' | translate">
|
||||||
|
|
|
@ -86,7 +86,7 @@ export class CoreLoginSitesPage {
|
||||||
const site = this.sites[index],
|
const site = this.sites[index],
|
||||||
siteName = site.siteName;
|
siteName = site.siteName;
|
||||||
|
|
||||||
this.filterHelper.getFiltersAndFormatText(siteName, 'system', site.siteHomeId, {clean: true, singleLine: true}, site.id)
|
this.filterHelper.getFiltersAndFormatText(siteName, 'system', 0, {clean: true, singleLine: true}, site.id)
|
||||||
.then((siteName) => {
|
.then((siteName) => {
|
||||||
|
|
||||||
this.domUtils.showConfirm(this.translate.instant('core.login.confirmdeletesite', { sitename: siteName })).then(() => {
|
this.domUtils.showConfirm(this.translate.instant('core.login.confirmdeletesite', { sitename: siteName })).then(() => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-navbar core-back-button>
|
<ion-navbar core-back-button>
|
||||||
<ion-title><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="siteHomeId"></core-format-text></ion-title>
|
<ion-title><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0"></core-format-text></ion-title>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
|
@ -33,7 +33,6 @@ export class CoreMainMenuMorePage implements OnDestroy {
|
||||||
handlersLoaded: boolean;
|
handlersLoaded: boolean;
|
||||||
siteInfo: any;
|
siteInfo: any;
|
||||||
siteName: string;
|
siteName: string;
|
||||||
siteHomeId: number;
|
|
||||||
logoutLabel: string;
|
logoutLabel: string;
|
||||||
showWeb: boolean;
|
showWeb: boolean;
|
||||||
showHelp: boolean;
|
showHelp: boolean;
|
||||||
|
@ -111,7 +110,6 @@ export class CoreMainMenuMorePage implements OnDestroy {
|
||||||
this.siteInfo = currentSite.getInfo();
|
this.siteInfo = currentSite.getInfo();
|
||||||
this.siteName = currentSite.getSiteName();
|
this.siteName = currentSite.getSiteName();
|
||||||
this.siteUrl = currentSite.getURL();
|
this.siteUrl = currentSite.getURL();
|
||||||
this.siteHomeId = currentSite.getSiteHomeId();
|
|
||||||
this.logoutLabel = 'core.mainmenu.' + (config && config.tool_mobile_forcelogout == '1' ? 'logout' : 'changesite');
|
this.logoutLabel = 'core.mainmenu.' + (config && config.tool_mobile_forcelogout == '1' ? 'logout' : 'changesite');
|
||||||
this.showWeb = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_website');
|
this.showWeb = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_website');
|
||||||
this.showHelp = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_help');
|
this.showHelp = !currentSite.isFeatureDisabled('CoreMainMenuDelegate_help');
|
||||||
|
|
|
@ -453,7 +453,7 @@ export class CorePushNotificationsProvider {
|
||||||
clean: true,
|
clean: true,
|
||||||
singleLine: true,
|
singleLine: true,
|
||||||
contextLevel: 'system',
|
contextLevel: 'system',
|
||||||
instanceId: site.getSiteHomeId(),
|
instanceId: 0,
|
||||||
filter: true
|
filter: true
|
||||||
},
|
},
|
||||||
isAndroid = this.platform.is('android'),
|
isAndroid = this.platform.is('android'),
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<core-loading [hideUntil]="usageLoaded">
|
<core-loading [hideUntil]="usageLoaded">
|
||||||
<ion-item *ngFor="let site of sites" [class.core-primary-selected-item]="site.id == currentSiteId">
|
<ion-item *ngFor="let site of sites" [class.core-primary-selected-item]="site.id == currentSiteId">
|
||||||
<h2 text-wrap><core-format-text [text]="site.siteName" contextLevel="system" [contextInstanceId]="site.siteHomeId"></core-format-text></h2>
|
<h2 text-wrap><core-format-text [text]="site.siteName" contextLevel="system" [contextInstanceId]="0"></core-format-text></h2>
|
||||||
<p text-wrap>{{ site.fullName }}</p>
|
<p text-wrap>{{ site.fullName }}</p>
|
||||||
<div item-end>
|
<div item-end>
|
||||||
<p>{{ site.spaceUsage | coreBytesToSize }}</p>
|
<p>{{ site.spaceUsage | coreBytesToSize }}</p>
|
||||||
|
|
|
@ -167,7 +167,7 @@ export class CoreSettingsSpaceUsagePage {
|
||||||
* @param siteData Site object with space usage.
|
* @param siteData Site object with space usage.
|
||||||
*/
|
*/
|
||||||
deleteSiteStorage(siteData: any): void {
|
deleteSiteStorage(siteData: any): void {
|
||||||
this.filterHelper.getFiltersAndFormatText(siteData.siteName, 'system', siteData.siteHomeId,
|
this.filterHelper.getFiltersAndFormatText(siteData.siteName, 'system', 0,
|
||||||
{clean: true, singleLine: true}, siteData.id).then((siteName) => {
|
{clean: true, singleLine: true}, siteData.id).then((siteName) => {
|
||||||
|
|
||||||
const title = this.translate.instant('core.settings.deletesitefilestitle');
|
const title = this.translate.instant('core.settings.deletesitefilestitle');
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<p>{{ 'core.settings.sites' | translate }}</p>
|
<p>{{ 'core.settings.sites' | translate }}</p>
|
||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
<ion-item *ngFor="let site of sites" [class.core-primary-selected-item]="site.id == currentSiteId" text-wrap>
|
<ion-item *ngFor="let site of sites" [class.core-primary-selected-item]="site.id == currentSiteId" text-wrap>
|
||||||
<h2><core-format-text [text]="site.siteName" contextLevel="system" [contextInstanceId]="site.siteHomeId"></core-format-text></h2>
|
<h2><core-format-text [text]="site.siteName" contextLevel="system" [contextInstanceId]="0"></core-format-text></h2>
|
||||||
<p>{{ site.fullName }}</p>
|
<p>{{ site.fullName }}</p>
|
||||||
<p>{{ site.siteUrl }}</p>
|
<p>{{ site.siteUrl }}</p>
|
||||||
<button ion-button icon-only clear item-end *ngIf="!isSynchronizing(site.id)" (click)="synchronize(site.id)" [title]="site.siteName" [attr.aria-label]="'core.settings.synchronizenow' | translate">
|
<button ion-button icon-only clear item-end *ngIf="!isSynchronizing(site.id)" (click)="synchronize(site.id)" [title]="site.siteName" [attr.aria-label]="'core.settings.synchronizenow' | translate">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
<img [src]="site.avatar" core-external-content [siteId]="site.id" alt="{{ 'core.pictureof' | translate:{$a: site.fullname} }}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
|
||||||
</ion-avatar>
|
</ion-avatar>
|
||||||
<h2>{{site.fullName}}</h2>
|
<h2>{{site.fullName}}</h2>
|
||||||
<p><core-format-text clean="true" [text]="site.siteName" [siteId]="site.id" contextLevel="system" [contextInstanceId]="site.siteHomeId"></core-format-text></p>
|
<p><core-format-text clean="true" [text]="site.siteName" [siteId]="site.id" contextLevel="system" [contextInstanceId]="0"></core-format-text></p>
|
||||||
<p>{{site.siteUrl}}</p>
|
<p>{{site.siteUrl}}</p>
|
||||||
</a>
|
</a>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
Loading…
Reference in New Issue